vendor: 6,913 bytes, lines 1-17
1(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();function _M(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var LA={exports:{}},M_={};/** 2 * @license React 3 * react-jsx-runtime.production.js 4 * 5 * Copyright (c) Meta Platforms, Inc. and affiliates. 6 * 7 * This source code is licensed under the MIT license found in the 8 * LICENSE file in the root directory of this source tree. 9 */var J2;function LG(){if(J2)return M_;J2=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,r){var a=null;if(r!==void 0&&(a=""+r),i.key!==void 0&&(a=""+i.key),"key"in i){r={};for(var l in i)l!=="key"&&(r[l]=i[l])}else r=i;return i=r.ref,{$$typeof:s,type:n,key:a,ref:i!==void 0?i:null,props:r}}return M_.Fragment=e,M_.jsx=t,M_.jsxs=t,M_}var eD;function BG(){return eD||(eD=1,LA.exports=LG()),LA.exports}var Xe=BG(),BA={exports:{}},Rn={};/** 10 * @license React 11 * react.production.js 12 * 13 * Copyright (c) Meta Platforms, Inc. and affiliates. 14 * 15 * This source code is licensed under the MIT license found in the 16 * LICENSE file in the root directory of this source tree. 17 */var tD;function PG(){if(tD)return Rn;tD=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function y(K){return K===null||typeof K!="object"?null:(K=g&&K[g]||K["@@iterator"],typeof K=="function"?K:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,A={};function E(K,oe,we){this.props=K,this.context=oe,this.refs=A,this.updater=we||_}E.prototype.isReactComponent={},E.prototype.setState=function(K,oe){if(typeof K!="object"&&typeof K!="function"&&K!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,K,oe,"setState")},E.prototype.forceUpdate=function(K){this.updater.enqueueForceUpdate(this,K,"forceUpdate")};function b(){}b.prototype=E.prototype;function C(K,oe,we){this.props=K,this.context=oe,this.refs=A,this.updater=we||_}var w=C.prototype=new b;w.constructor=C,S(w,E.prototype),w.isPureReactComponent=!0;var D=Array.isArray,P={H:null,A:null,T:null,S:null,V:null},I=Object.prototype.hasOwnProperty;function F(K,oe,we,Ie,Ze,mt){return we=mt.ref,{$$typeof:s,type:K,key:oe,ref:we!==void 0?we:null,props:mt}}function z(K,oe){return F(K.type,oe,void 0,void 0,void 0,K.props)}function B(K){return typeof K=="object"&&K!==null&&K.$$typeof===s}function O(K){var oe={"=":"=0",":":"=2"};return"$"+K.replace(/[=:]/g,function(we){return oe[we]})}var W=/\/+/g;function ee(K,oe){return typeof K=="object"&&K!==null&&K.key!=null?O(""+K.key):oe.toString(36)}function se(){}function fe(K){switch(K.status){case"fulfilled":return K.value;case"rejected":throw K.reason;default:switch(typeof K.status=="string"?K.then(se,se):(K.status="pending",K.then(function(oe){K.status==="pending"&&(K.status="fulfilled",K.value=oe)},function(oe){K.status==="pending"&&(K.status="rejected",K.reason=oe)})),K.status){case"fulfilled":return K.value;case"rejected":throw K.reason}}throw K}function pe(K,oe,we,Ie,Ze){var mt=typeof K;(mt==="undefined"||mt==="boolean")&&(K=null);var xe=!1;if(K===null)xe=!0;else switch(mt){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(K.$$typeof){case s:case e:xe=!0;break;case p:return xe=K._init,pe(xe(K._payload),oe,we,Ie,Ze)}}if(xe)return Ze=Ze(K),xe=Ie===""?"."+ee(K,0):Ie,D(Ze)?(we="",xe!=null&&(we=xe.replace(W,"$&/")+"/"),pe(Ze,oe,we,"",function(Mt){return Mt})):Ze!=null&&(B(Ze)&&(Ze=z(Ze,we+(Ze.key==null||K&&K.key===Ze.key?"":(""+Ze.key).replace(W,"$&/")+"/")+xe)),oe.push(Ze)),1;xe=0;var Ve=Ie===""?".":Ie+":";if(D(K))for(var tt=0;tt<K.length;tt++)Ie=K[tt],mt=Ve+ee(Ie,tt),xe+=pe(Ie,oe,we,mt,Ze);else if(tt=y(K),typeof tt=="function")for(K=tt.call(K),tt=0;!(Ie=K.next()).done;)Ie=Ie.value,mt=Ve+ee(Ie,tt++),xe+=pe(Ie,oe,we,mt,Ze);else if(mt==="object"){if(typeof K.then=="function")return pe(fe(K),oe,we,Ie,Ze);throw oe=String(K),Error("Objects are not valid as a React child (found: "+(oe==="[object Object]"?"object with keys {"+Object.keys(K).join(", ")+"}":oe)+"). If you meant to render a collection of children, use an array instead.")}return xe}function k(K,oe,we){if(K==null)return K;var Ie=[],Ze=0;return pe(K,Ie,"","",function(mt){return oe.call(we,mt,Ze++)}),Ie}function Q(K){if(K._status===-1){var oe=K._result;oe=oe(),oe.then(function(we){(K._status===0||K._status===-1)&&(K._status=1,K._result=we)},function(we){(K._status===0||K._status===-1)&&(K._status=2,K._result=we)}),K._status===-1&&(K._status=0,K._result=oe)}if(K._status===1)return K._result.default;throw K._result}var J=typeof reportError=="function"?reportError:function(K){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var oe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof K=="object"&&K!==null&&typeof K.message=="string"?String(K.message):String(K),error:K});if(!window.dispatchEvent(oe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",K);return}console.error(K)};function Se(){}return Rn.Children={map:k,forEach:function(K,oe,we){k(K,function(){oe.apply(this,arguments)},we)},count:function(K){var oe=0;return k(K,function(){oe++}),oe},toArray:function(K){return k(K,function(oe){return oe})||[]},only:function(K){if(!B(K))throw Error("React.Children.only expected to receive a single React element child.");return K}},Rn.Component=E,Rn.Fragment=t,Rn.Profiler=i,Rn.PureComponent=C,Rn.StrictMode=n,Rn.Suspense=u,Rn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Rn.__COMPILER_RUNTIME={__proto__:null,c:function(K){return P.H.useMemoCache(K)}},Rn.cache=function(K){return function(){return K.apply(null,arguments)}},Rn.cloneElement=function(K,oe,we){if(K==null)throw Error("The argument must be a React element, but you passed "+K+".");var Ie=S({}
vendor: 4,325 bytes, lines 17-25
17,K.props),Ze=K.key,mt=void 0;if(oe!=null)for(xe in oe.ref!==void 0&&(mt=void 0),oe.key!==void 0&&(Ze=""+oe.key),oe)!I.call(oe,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&oe.ref===void 0||(Ie[xe]=oe[xe]);var xe=arguments.length-2;if(xe===1)Ie.children=we;else if(1<xe){for(var Ve=Array(xe),tt=0;tt<xe;tt++)Ve[tt]=arguments[tt+2];Ie.children=Ve}return F(K.type,Ze,void 0,void 0,mt,Ie)},Rn.createContext=function(K){return K={$$typeof:a,_currentValue:K,_currentValue2:K,_threadCount:0,Provider:null,Consumer:null},K.Provider=K,K.Consumer={$$typeof:r,_context:K},K},Rn.createElement=function(K,oe,we){var Ie,Ze={},mt=null;if(oe!=null)for(Ie in oe.key!==void 0&&(mt=""+oe.key),oe)I.call(oe,Ie)&&Ie!=="key"&&Ie!=="__self"&&Ie!=="__source"&&(Ze[Ie]=oe[Ie]);var xe=arguments.length-2;if(xe===1)Ze.children=we;else if(1<xe){for(var Ve=Array(xe),tt=0;tt<xe;tt++)Ve[tt]=arguments[tt+2];Ze.children=Ve}if(K&&K.defaultProps)for(Ie in xe=K.defaultProps,xe)Ze[Ie]===void 0&&(Ze[Ie]=xe[Ie]);return F(K,mt,void 0,void 0,null,Ze)},Rn.createRef=function(){return{current:null}},Rn.forwardRef=function(K){return{$$typeof:l,render:K}},Rn.isValidElement=B,Rn.lazy=function(K){return{$$typeof:p,_payload:{_status:-1,_result:K},_init:Q}},Rn.memo=function(K,oe){return{$$typeof:h,type:K,compare:oe===void 0?null:oe}},Rn.startTransition=function(K){var oe=P.T,we={};P.T=we;try{var Ie=K(),Ze=P.S;Ze!==null&&Ze(we,Ie),typeof Ie=="object"&&Ie!==null&&typeof Ie.then=="function"&&Ie.then(Se,J)}catch(mt){J(mt)}finally{P.T=oe}},Rn.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Rn.use=function(K){return P.H.use(K)},Rn.useActionState=function(K,oe,we){return P.H.useActionState(K,oe,we)},Rn.useCallback=function(K,oe){return P.H.useCallback(K,oe)},Rn.useContext=function(K){return P.H.useContext(K)},Rn.useDebugValue=function(){},Rn.useDeferredValue=function(K,oe){return P.H.useDeferredValue(K,oe)},Rn.useEffect=function(K,oe,we){var Ie=P.H;if(typeof we=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return Ie.useEffect(K,oe)},Rn.useId=function(){return P.H.useId()},Rn.useImperativeHandle=function(K,oe,we){return P.H.useImperativeHandle(K,oe,we)},Rn.useInsertionEffect=function(K,oe){return P.H.useInsertionEffect(K,oe)},Rn.useLayoutEffect=function(K,oe){return P.H.useLayoutEffect(K,oe)},Rn.useMemo=function(K,oe){return P.H.useMemo(K,oe)},Rn.useOptimistic=function(K,oe){return P.H.useOptimistic(K,oe)},Rn.useReducer=function(K,oe,we){return P.H.useReducer(K,oe,we)},Rn.useRef=function(K){return P.H.useRef(K)},Rn.useState=function(K){return P.H.useState(K)},Rn.useSyncExternalStore=function(K,oe,we){return P.H.useSyncExternalStore(K,oe,we)},Rn.useTransition=function(){return P.H.useTransition()},Rn.version="19.1.1",Rn}var nD;function jy(){return nD||(nD=1,BA.exports=PG()),BA.exports}var ze=jy();const yy=_M(ze);var PA={exports:{}},E_={},OA={exports:{}},IA={};/** 18 * @license React 19 * scheduler.production.js 20 * 21 * Copyright (c) Meta Platforms, Inc. and affiliates. 22 * 23 * This source code is licensed under the MIT license found in the 24 * LICENSE file in the root directory of this source tree. 25 */var iD;function OG(){return iD||(iD=1,(function(s){function e(k,Q){var J=k.length;k.push(Q);e:for(;0<J;){var Se=J-1>>>1,K=k[Se];if(0<i(K,Q))k[Se]=Q,k[J]=K,J=Se;else break e}}function t(k){return k.length===0?null:k[0]}function n(k){if(k.length===0)return null;var Q=k[0],J=k.pop();if(J!==Q){k[0]=J;e:for(var Se=0,K=k.length,oe=K>>>1;Se<oe;){var we=2*(Se+1)-1,Ie=k[we],Ze=we+1,mt=k[Ze];if(0>i(Ie,J))Ze<K&&0>i(mt,Ie)?(k[Se]=mt,k[Ze]=J,Se=Ze):(k[Se]=Ie,k[we]=J,Se=we);else if(Ze<K&&0>i(mt,J))k[Se]=mt,k[Ze]=J,Se=Ze;else break e}}return Q}function i(k,Q){var J=k.sortIndex-Q.sortIndex;return J!==0?J:k.id-Q.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;s.unstable_now=function(){return r.now()}}else{var a=Date,l=a.now();s.unstable_now=function(){return a.now()-l}}var u=[],h=[],p=1,g=null,y=3,_=!1,S=!1,A=!1,E=!1,b=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function D(k){for(var Q=t(h);Q!==null;){if(Q.callback===null)n(h);else if(Q.startTime<=k)n(h),Q.sortIndex=Q.expirationTime,e(u,Q);else break;Q=t(h)}}
vendor: 9,133 bytes, lines 25-41
25function P(k){if(A=!1,D(k),!S)if(t(u)!==null)S=!0,I||(I=!0,ee());else{var Q=t(h);Q!==null&&pe(P,Q.startTime-k)}}var I=!1,F=-1,z=5,B=-1;function O(){return E?!0:!(s.unstable_now()-B<z)}function W(){if(E=!1,I){var k=s.unstable_now();B=k;var Q=!0;try{e:{S=!1,A&&(A=!1,C(F),F=-1),_=!0;var J=y;try{t:{for(D(k),g=t(u);g!==null&&!(g.expirationTime>k&&O());){var Se=g.callback;if(typeof Se=="function"){g.callback=null,y=g.priorityLevel;var K=Se(g.expirationTime<=k);if(k=s.unstable_now(),typeof K=="function"){g.callback=K,D(k),Q=!0;break t}g===t(u)&&n(u),D(k)}else n(u);g=t(u)}if(g!==null)Q=!0;else{var oe=t(h);oe!==null&&pe(P,oe.startTime-k),Q=!1}}break e}finally{g=null,y=J,_=!1}Q=void 0}}finally{Q?ee():I=!1}}}var ee;if(typeof w=="function")ee=function(){w(W)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,fe=se.port2;se.port1.onmessage=W,ee=function(){fe.postMessage(null)}}else ee=function(){b(W,0)};function pe(k,Q){F=b(function(){k(s.unstable_now())},Q)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(k){k.callback=null},s.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<k?Math.floor(1e3/k):5},s.unstable_getCurrentPriorityLevel=function(){return y},s.unstable_next=function(k){switch(y){case 1:case 2:case 3:var Q=3;break;default:Q=y}var J=y;y=Q;try{return k()}finally{y=J}},s.unstable_requestPaint=function(){E=!0},s.unstable_runWithPriority=function(k,Q){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var J=y;y=k;try{return Q()}finally{y=J}},s.unstable_scheduleCallback=function(k,Q,J){var Se=s.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?Se+J:Se):J=Se,k){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=J+K,k={id:p++,callback:Q,priorityLevel:k,startTime:J,expirationTime:K,sortIndex:-1},J>Se?(k.sortIndex=J,e(h,k),t(u)===null&&k===t(h)&&(A?(C(F),F=-1):A=!0,pe(P,J-Se))):(k.sortIndex=K,e(u,k),S||_||(S=!0,I||(I=!0,ee()))),k},s.unstable_shouldYield=O,s.unstable_wrapCallback=function(k){var Q=y;return function(){var J=y;y=Q;try{return k.apply(this,arguments)}finally{y=J}}}})(IA)),IA}var sD;function IG(){return sD||(sD=1,OA.exports=OG()),OA.exports}var FA={exports:{}},Ir={};/** 26 * @license React 27 * react-dom.production.js 28 * 29 * Copyright (c) Meta Platforms, Inc. and affiliates. 30 * 31 * This source code is licensed under the MIT license found in the 32 * LICENSE file in the root directory of this source tree. 33 */var rD;function FG(){if(rD)return Ir;rD=1;var s=jy();function e(u){var h="https://react.dev/errors/"+u;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+u+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var n={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},i=Symbol.for("react.portal");function r(u,h,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:u,containerInfo:h,implementation:p}}var a=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,h){if(u==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Ir.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Ir.createPortal=function(u,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return r(u,h,null,p)},Ir.flushSync=function(u){var h=a.T,p=n.p;try{if(a.T=null,n.p=2,u)return u()}finally{a.T=h,n.p=p,n.d.f()}},Ir.preconnect=function(u,h){typeof u=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,n.d.C(u,h))},Ir.prefetchDNS=function(u){typeof u=="string"&&n.d.D(u)},Ir.preinit=function(u,h){if(typeof u=="string"&&h&&typeof h.as=="string"){var p=h.as,g=l(p,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,_=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?n.d.S(u,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:_}):p==="script"&&n.d.X(u,{crossOrigin:g,integrity:y,fetchPriority:_,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Ir.preinitModule=function(u,h){if(typeof u=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=l(h.as,h.crossOrigin);n.d.M(u,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&n.d.M(u)},Ir.preload=function(u,h){if(typeof u=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,g=l(p,h.crossOrigin);n.d.L(u,p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Ir.preloadModule=function(u,h){if(typeof u=="string")if(h){var p=l(h.as,h.crossOrigin);n.d.m(u,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else n.d.m(u)},Ir.requestFormReset=function(u){n.d.r(u)},Ir.unstable_batchedUpdates=function(u,h){return u(h)},Ir.useFormState=function(u,h,p){return a.H.useFormState(u,h,p)},Ir.useFormStatus=function(){return a.H.useHostTransitionStatus()},Ir.version="19.1.1",Ir}var aD;function kB(){if(aD)return FA.exports;aD=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),FA.exports=FG(),FA.exports}/** 34 * @license React 35 * react-dom-client.production.js 36 * 37 * Copyright (c) Meta Platforms, Inc. and affiliates. 38 * 39 * This source code is licensed under the MIT license found in the 40 * LICENSE file in the root directory of this source tree. 41 */var oD;function VG(){if(oD)return E_;oD=1;var s=IG(),e=jy(),t=kB();function n(o){var c="https://react.dev/errors/"+o;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function r(o){var c=o,m=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(m=c.return),o=c.return;while(o)}return c.tag===3?m:null}function a(o){if(o.tag===13){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function l(o){if(r(o)!==o)throw Error(n(188))}function u(o){var c=o.alternate;if(!c){if(c=r(o),c===null)throw Error(n(188));return c!==o?null:o}for(var m=o,v=c;;){var T=m.return;if(T===null)break;var R=T.alternate;if(R===null){if(v=T.return,v!==null){m=v;continue}break}if(T.child===R.child){for(R=T.child;R;){if(R===m)return l(T),o;if(R===v)return l(T),c;R=R.sibling}throw Error(n(188))}if(m.return!==v.return)m=T,v=R;else{for(var V=!1,H=T.child;H;){if(H===m){V=!0,m=T,v=R;break}if(H===v){V=!0,v=T,m=R;break}H=H.sibling}if(!V){for(H=R.child;H;){if(H===m){V=!0,m=R,v=T;break}if(H===v){V=!0,v=R,m=T;break}H=H.sibling}if(!V)throw Error(n(189))}}if(m.alternate!==v)throw Error(n(190))}if(m.tag!==3)throw Error(n(188));return m.stateNode.current===m?o:c}function h(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o;for(o=o.child;o!==null;){if(c=h(o),c!==null)return c;o=o.sibling}return null}var p=Object.assign,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),C=Symbol.for("react.consumer"),w=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function ee(o){return o===null||typeof o!="object"?null:(o=W&&o[W]||o["@@iterator"],typeof o=="function"?o:null)}var se=Symbol.for("react.client.reference");function fe(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===se?null:o.displayName||o.name||null;
vendor: 6,446 bytes, line 41
41if(typeof o=="string")return o;switch(o){case S:return"Fragment";case E:return"Profiler";case A:return"StrictMode";case P:return"Suspense";case I:return"SuspenseList";case B:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case _:return"Portal";case w:return(o.displayName||"Context")+".Provider";case C:return(o._context.displayName||"Context")+".Consumer";case D:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case F:return c=o.displayName||null,c!==null?c:fe(o.type)||"Memo";case z:c=o._payload,o=o._init;try{return fe(o(c))}catch{}}return null}var pe=Array.isArray,k=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},Se=[],K=-1;function oe(o){return{current:o}}function we(o){0>K||(o.current=Se[K],Se[K]=null,K--)}function Ie(o,c){K++,Se[K]=o.current,o.current=c}var Ze=oe(null),mt=oe(null),xe=oe(null),Ve=oe(null);function tt(o,c){switch(Ie(xe,c),Ie(mt,o),Ie(Ze,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?R2(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=R2(c),o=N2(c,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}we(Ze),Ie(Ze,o)}function Mt(){we(Ze),we(mt),we(xe)}function Ct(o){o.memoizedState!==null&&Ie(Ve,o);var c=Ze.current,m=N2(c,o.type);c!==m&&(Ie(mt,o),Ie(Ze,m))}function rn(o){mt.current===o&&(we(Ze),we(mt)),Ve.current===o&&(we(Ve),__._currentValue=J)}var vn=Object.prototype.hasOwnProperty,te=s.unstable_scheduleCallback,$e=s.unstable_cancelCallback,Ye=s.unstable_shouldYield,qe=s.unstable_requestPaint,Be=s.unstable_now,ft=s.unstable_getCurrentPriorityLevel,Je=s.unstable_ImmediatePriority,nt=s.unstable_UserBlockingPriority,qt=s.unstable_NormalPriority,tn=s.unstable_LowPriority,Z=s.unstable_IdlePriority,G=s.log,ge=s.unstable_setDisableYieldValue,De=null,We=null;function Ue(o){if(typeof G=="function"&&ge(o),We&&typeof We.setStrictMode=="function")try{We.setStrictMode(De,o)}catch{}}var St=Math.clz32?Math.clz32:Ut,ht=Math.log,Dt=Math.LN2;function Ut(o){return o>>>=0,o===0?32:31-(ht(o)/Dt|0)|0}var et=256,gt=4194304;function Ht(o){var c=o&42;if(c!==0)return c;switch(o&-o){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:return 64;case 128:return 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 o&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Lt(o,c,m){var v=o.pendingLanes;if(v===0)return 0;var T=0,R=o.suspendedLanes,V=o.pingedLanes;o=o.warmLanes;var H=v&134217727;return H!==0?(v=H&~R,v!==0?T=Ht(v):(V&=H,V!==0?T=Ht(V):m||(m=H&~o,m!==0&&(T=Ht(m))))):(H=v&~R,H!==0?T=Ht(H):V!==0?T=Ht(V):m||(m=v&~o,m!==0&&(T=Ht(m)))),T===0?0:c!==0&&c!==T&&(c&R)===0&&(R=T&-T,m=c&-c,R>=m||R===32&&(m&4194048)!==0)?c:T}function yt(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function un(o,c){switch(o){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32: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 c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function he(){var o=et;return et<<=1,(et&4194048)===0&&(et=256),o}function at(){var o=gt;return gt<<=1,(gt&62914560)===0&&(gt=4194304),o}function dt(o){for(var c=[],m=0;31>m;m++)c.push(o);return c}function Nt(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function it(o,c,m,v,T,R){var V=o.pendingLanes;o.pendingLanes=m,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=m,o.entangledLanes&=m,o.errorRecoveryDisabledLanes&=m,o.shellSuspendCounter=0;var H=o.entanglements,ne=o.expirationTimes,Me=o.hiddenUpdates;for(m=V&~m;0<m;){var ke=31-St(m),Qe=1<<ke;H[ke]=0,ne[ke]=-1;var Ae=Me[ke];if(Ae!==null)for(Me[ke]=null,ke=0;ke<Ae.length;ke++){var Re=Ae[ke];Re!==null&&(Re.lane&=-536870913)}m&=~Qe}v!==0&&Ke(o,v,0),R!==0&&T===0&&o.tag!==0&&(o.suspendedLanes|=R&~(V&~c))}function Ke(o,c,m){o.pendingLanes|=c,o.suspendedLanes&=~c;var v=31-St(c);o.entangledLanes|=c,o.entanglements[v]=o.entanglements[v]|1073741824|m&4194090}function Bt(o,c){var m=o.entangledLanes|=c;for(o=o.entanglements;m;){var v=31-St(m),T=1<<v;T&c|o[v]&c&&(o[v]|=c),m&=~T}}function nn(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function zn(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Bn(){var o=Q.p;return o!==0?o:(o=window.event,o===void 0?32:Y2(o.type))}function Ea(o,c){var m=Q.p;try{return Q.p=o,c()}finally{Q.p=m}}var as=Math.random().toString(36).slice(2),os="__reactFiber$"+as,Oi="__reactProps$"+as,Aa="__reactContainer$"+as,Kr="__reactEvents$"+as,Xd="__reactListeners$"+as,Zr="__reactHandles$"+as,Qr="__reactResources$"+as,$r="__reactMarker$"+as;function _i(o){delete o[os],delete o[Oi],delete o[Kr],delete o[Xd],delete o[Zr]}function ro(o){var c=o[os];if(c)return c;for(var m=o.parentNode;m;){if(c=m[Aa]||m[os]){if(m=c.alternate,c.child!==null||m!==null&&m.child!==null)for(o=U2(o);o!==null;){if(m=o[os])return m;o=U2(o)}return c}o=m,m=o.parentNode}return null}function No(o){if(o=o[os]||o[Aa]){var c=o.tag;if(c===5||c===6||c===13||c===26||c===27||c===3)return o}return null}function Jl(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o.stateNode;throw Error(n(33))}function fl(o){var c=o[Qr];return c||(c=o[Qr]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function ls(o){o[$r]=!0}var dh=new Set,fh={};function q(o,c){de(o,c),de(o+"Capture",c)}function de(o,c){for(fh[o]=c,o=0;o<c.length;o++)dh.add(c[o])}var Te=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u
41037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ne={},ye={};function st(o){return vn.call(ye,o)?!0:vn.call(Ne,o)?!1:Te.test(o)?ye[o]=!0:(Ne[o]=!0,!1)}function pt(o,c,m){if(st(c))if(m===null)o.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":o.removeAttribute(c);return;case"boolean":var v=c.toLowerCase().slice(0,5);if(v!=="data-"&&v!=="aria-"){o.removeAttribute(c);return}}o.setAttribute(c,""+m)}}function wt(o,c,m){if(m===null)o.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(c);return}o.setAttribute(c,""+m)}}function _t(o,c,m,v){if(v===null)o.removeAttribute(m);else{switch(typeof v){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(m);return}o.setAttributeNS(c,m,""+v)}}var Xt,$t;function zt(o){if(Xt===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);Xt=c&&c[1]||"",$t=-1<m.stack.indexOf(` 42 at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return` 43`+Xt+o+$t}var Tn=!1;function Hn(o,c){if(!o||Tn)return"";Tn=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var v={DetermineComponentFrameRoot:function(){try{if(c){var Qe=function(){throw Error()};if(Object.defineProperty(Qe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Qe,[])}catch(Re){var Ae=Re}Reflect.construct(o,[],Qe)}else{try{Qe.call()}catch(Re){Ae=Re}o.call(Qe.prototype)}}else{try{throw Error()}catch(Re){Ae=Re}(Qe=o())&&typeof Qe.catch=="function"&&Qe.catch(function(){})}}catch(Re){if(Re&&Ae&&typeof Re.stack=="string")return[Re.stack,Ae.stack]}return[null,null]}};v.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var T=Object.getOwnPropertyDescriptor(v.DetermineComponentFrameRoot,"name");T&&T.configurable&&Object.defineProperty(v.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var R=v.DetermineComponentFrameRoot(),V=R[0],H=R[1];if(V&&H){var ne=V.split(` 44`),Me=H.split(` 45`);for(T=v=0;v<ne.length&&!ne[v].includes("DetermineComponentFrameRoot");)v++;for(;T<Me.length&&!Me[T].includes("DetermineComponentFrameRoot");)T++;if(v===ne.length||T===Me.length)for(v=ne.length-1,T=Me.length-1;1<=v&&0<=T&&ne[v]!==Me[T];)T--;for(;1<=v&&0<=T;v--,T--)if(ne[v]!==Me[T]){if(v!==1||T!==1)do if(v--,T--,0>T||ne[v]!==Me[T]){var ke=` 46`+ne[v].replace(" at new "," at ");return o.displayName&&ke.includes("<anonymous>")&&(ke=ke.replace("<anonymous>",o.displayName)),ke}while(1<=v&&0<=T);break}}}finally{Tn=!1,Error.prepareStackTrace=m}return(m=o?o.displayName||o.name:"")?zt(m):""}function Ni(o){switch(o.tag){case 26:case 27:case 5:return zt(o.type);case 16:return zt("Lazy");case 13:return zt("Suspense");case 19:return zt("SuspenseList");case 0:case 15:return Hn(o.type,!1);case 11:return Hn(o.type.render,!1);case 1:return Hn(o.type,!0);case 31:return zt("Activity");default:return""}}function ni(o){try{var c="";do c+=Ni(o),o=o.return;while(o);return c}catch(m){return` 47Error generating stack: `+m.message+` 48`+m.stack}}function _n(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Yt(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function Ci(o){var c=Yt(o)?"checked":"value",m=Object.getOwnPropertyDescriptor(o.constructor.prototype,c),v=""+o[c];if(!o.hasOwnProperty(c)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var T=m.get,R=m.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return T.call(this)},set:function(V){v=""+V,R.call(this,V)}}),Object.defineProperty(o,c,{enumerable:m.enumerable}),{getValue:function(){return v},setValue:function(V){v=""+V},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function Cn(o){o._valueTracker||(o._valueTracker=Ci(o))}function Is(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var m=c.getValue(),v="";return o&&(v=Yt(o)?o.checked?"true":"false":o.value),o=v,o!==m?(c.setValue(o),!0):!1}function Ra(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}
vendor: 4,504 bytes, line 48
48catch{return o.body}}var Fs=/[\n"\\]/g;function _s(o){return o.replace(Fs,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function ai(o,c,m,v,T,R,V,H){o.name="",V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?o.type=V:o.removeAttribute("type"),c!=null?V==="number"?(c===0&&o.value===""||o.value!=c)&&(o.value=""+_n(c)):o.value!==""+_n(c)&&(o.value=""+_n(c)):V!=="submit"&&V!=="reset"||o.removeAttribute("value"),c!=null?Vs(o,V,_n(c)):m!=null?Vs(o,V,_n(m)):v!=null&&o.removeAttribute("value"),T==null&&R!=null&&(o.defaultChecked=!!R),T!=null&&(o.checked=T&&typeof T!="function"&&typeof T!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?o.name=""+_n(H):o.removeAttribute("name")}function er(o,c,m,v,T,R,V,H){if(R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(o.type=R),c!=null||m!=null){if(!(R!=="submit"&&R!=="reset"||c!=null))return;m=m!=null?""+_n(m):"",c=c!=null?""+_n(c):m,H||c===o.value||(o.value=c),o.defaultValue=c}v=v??T,v=typeof v!="function"&&typeof v!="symbol"&&!!v,o.checked=H?o.checked:!!v,o.defaultChecked=!!v,V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"&&(o.name=V)}function Vs(o,c,m){c==="number"&&Ra(o.ownerDocument)===o||o.defaultValue===""+m||(o.defaultValue=""+m)}function Fi(o,c,m,v){if(o=o.options,c){c={};for(var T=0;T<m.length;T++)c["$"+m[T]]=!0;for(m=0;m<o.length;m++)T=c.hasOwnProperty("$"+o[m].value),o[m].selected!==T&&(o[m].selected=T),T&&v&&(o[m].defaultSelected=!0)}else{for(m=""+_n(m),c=null,T=0;T<o.length;T++){if(o[T].value===m){o[T].selected=!0,v&&(o[T].defaultSelected=!0);return}c!==null||o[T].disabled||(c=o[T])}c!==null&&(c.selected=!0)}}function zs(o,c,m){if(c!=null&&(c=""+_n(c),c!==o.value&&(o.value=c),m==null)){o.defaultValue!==c&&(o.defaultValue=c);return}o.defaultValue=m!=null?""+_n(m):""}function lc(o,c,m,v){if(c==null){if(v!=null){if(m!=null)throw Error(n(92));if(pe(v)){if(1<v.length)throw Error(n(93));v=v[0]}m=v}m==null&&(m=""),c=m}m=_n(c),o.defaultValue=m,v=o.textContent,v===m&&v!==""&&v!==null&&(o.value=v)}function xs(o,c){if(c){var m=o.firstChild;if(m&&m===o.lastChild&&m.nodeType===3){m.nodeValue=c;return}}o.textContent=c}var Nx=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Yd(o,c,m){var v=c.indexOf("--")===0;m==null||typeof m=="boolean"||m===""?v?o.setProperty(c,""):c==="float"?o.cssFloat="":o[c]="":v?o.setProperty(c,m):typeof m!="number"||m===0||Nx.has(c)?c==="float"?o.cssFloat=m:o[c]=(""+m).trim():o[c]=m+"px"}function jd(o,c,m){if(c!=null&&typeof c!="object")throw Error(n(62));if(o=o.style,m!=null){for(var v in m)!m.hasOwnProperty(v)||c!=null&&c.hasOwnProperty(v)||(v.indexOf("--")===0?o.setProperty(v,""):v==="float"?o.cssFloat="":o[v]="");for(var T in c)v=c[T],c.hasOwnProperty(T)&&m[T]!==v&&Yd(o,T,v)}else for(var R in c)c.hasOwnProperty(R)&&Yd(o,R,c[R])}function Sm(o){if(o.indexOf("-")===-1)return!1;switch(o){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 hv=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
48dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Cx=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Kd(o){return Cx.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}var bm=null;function Tm(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var eu=null,uc=null;function dv(o){var c=No(o);if(c&&(o=c.stateNode)){var m=o[Oi]||null;e:switch(o=c.stateNode,c.type){case"input":if(ai(o,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name),c=m.name,m.type==="radio"&&c!=null){for(m=o;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll('input[name="'+_s(""+c)+'"][type="radio"]'),c=0;c<m.length;c++){var v=m[c];if(v!==o&&v.form===o.form){var T=v[Oi]||null;if(!T)throw Error(n(90));ai(v,T.value,T.defaultValue,T.defaultValue,T.checked,T.defaultChecked,T.type,T.name)}}for(c=0;c<m.length;c++)v=m[c],v.form===o.form&&Is(v)}break e;case"textarea":zs(o,m.value,m.defaultValue);break e;case"select":c=m.value,c!=null&&Fi(o,!!m.multiple,c,!1)}}}var Zd=!1;function fv(o,c,m){if(Zd)return o(c,m);Zd=!0;try{var v=o(c);return v}finally{if(Zd=!1,(eu!==null||uc!==null)&&(qo(),eu&&(c=eu,o=uc,uc=eu=null,dv(c),o)))for(c=0;c<o.length;c++)dv(o[c])}}function ph(o,c){var m=o.stateNode;if(m===null)return null;var v=m[Oi]||null;if(v===null)return null;m=v[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(o=o.type,v=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!v;break e;default:o=!1}if(o)return null;if(m&&typeof m!="function")throw Error(n(231,c,typeof m));return m}var Co=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qd=!1;if(Co)try{var mh={};Object.defineProperty(mh,"passive",{get:function(){Qd=!0}}),window.addEventListener("test",mh,mh),window.removeEventListener("test",mh,mh)}catch{Qd=!1}var pl=null,pv=null,Mm=null;function mv(){if(Mm)return Mm;var o,c=pv,m=c.length,v,T="value"in pl?pl.value:pl.textContent,R=T.length;for(o=0;o<m&&c[o]===T[o];o++);var V=m-o;for(v=1;v<=V&&c[m-v]===T[R-v];v++);return Mm=T.slice(o,1<v?1-v:void 0)}function tu(o){var c=o.keyCode;
vendor: 2,821 bytes, line 48
48return"charCode"in o?(o=o.charCode,o===0&&c===13&&(o=13)):o=c,o===10&&(o=13),32<=o||o===13?o:0}function gh(){return!0}function $d(){return!1}function dr(o){function c(m,v,T,R,V){this._reactName=m,this._targetInst=T,this.type=v,this.nativeEvent=R,this.target=V,this.currentTarget=null;for(var H in o)o.hasOwnProperty(H)&&(m=o[H],this[H]=m?m(R):R[H]);return this.isDefaultPrevented=(R.defaultPrevented!=null?R.defaultPrevented:R.returnValue===!1)?gh:$d,this.isPropagationStopped=$d,this}return p(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=gh)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=gh)},persist:function(){},isPersistent:gh}),c}var nu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yh=dr(nu),vh=p({},nu,{view:0,detail:0}),wx=dr(vh),ml,_h,xh,Sh=p({},vh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ef,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==xh&&(xh&&o.type==="mousemove"?(ml=o.screenX-xh.screenX,_h=o.screenY-xh.screenY):_h=ml=0,xh=o),ml)},movementY:function(o){return"movementY"in o?o.movementY:_h}}),gv=dr(Sh),Dx=p({},Sh,{dataTransfer:0}),QE=dr(Dx),Gs=p({},vh,{relatedTarget:0}),Em=dr(Gs),Ux=p({},nu,{animationName:0,elapsedTime:0,pseudoElement:0}),Lx=dr(Ux),Bx=p({},nu,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),Px=dr(Bx),Jd=p({},nu,{data:0}),Am=dr(Jd),Ox={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ix={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Fx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yv(o){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(o):(o=Fx[o])?!!c[o]:!1}function ef(){return yv}var Vx=p({},vh,{key:function(o){if(o.key){var c=Ox[o.key]||o.key;if(c!=="Unidentified")return c}
vendor: 5,186 bytes, line 48
48return o.type==="keypress"?(o=tu(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?Ix[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ef,charCode:function(o){return o.type==="keypress"?tu(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?tu(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),vv=dr(Vx),_v=p({},Sh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rm=dr(_v),zx=p({},vh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ef}),xv=dr(zx),Gx=p({},nu,{propertyName:0,elapsedTime:0,pseudoElement:0}),gl=dr(Gx),Sv=p({},Sh,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),$E=dr(Sv),Hx=p({},nu,{newState:0,oldState:0}),iu=dr(Hx),yl=[9,13,27,32],tf=Co&&"CompositionEvent"in window,cc=null;Co&&"documentMode"in document&&(cc=document.documentMode);var nf=Co&&"TextEvent"in window&&!cc,sf=Co&&(!tf||cc&&8<cc&&11>=cc),su=" ",Hs=!1;function rf(o,c){switch(o){case"keyup":return yl.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bv(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ru=!1;function af(o,c){switch(o){case"compositionend":return bv(c);case"keypress":return c.which!==32?null:(Hs=!0,su);case"textInput":return o=c.data,o===su&&Hs?null:o;default:return null}}function Tv(o,c){if(ru)return o==="compositionend"||!tf&&rf(o,c)?(o=mv(),Mm=pv=pl=null,ru=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return sf&&c.locale!=="ko"?null:c.data;default:return null}}var Nm={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Mv(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c==="input"?!!Nm[o.type]:c==="textarea"}function Cr(o,c,m,v){eu?uc?uc.push(v):uc=[v]:eu=v,c=GS(c,"onChange"),0<c.length&&(m=new yh("onChange","change",null,m,v),o.push({event:m,listeners:c}))}var bh=null,hc=null;function kx(o){b2(o,0)}function of(o){var c=Jl(o);if(Is(c))return o}function Cm(o,c){if(o==="change")return c}var wm=!1;if(Co){var Dm;if(Co){var Th="oninput"in document;if(!Th){var Mh=document.createElement("div");Mh.setAttribute("oninput","return;"),Th=typeof Mh.oninput=="function"}Dm=Th}else Dm=!1;wm=Dm&&(!document.documentMode||9<document.documentMode)}function Ii(){bh&&(bh.detachEvent("onpropertychange",qx),hc=bh=null)}function qx(o){if(o.propertyName==="value"&&of(hc)){var c=[];Cr(c,hc,o,Tm(o)),fv(kx,c)}}function JE(o,c,m){o==="focusin"?(Ii(),bh=c,hc=m,bh.attachEvent("onpropertychange",qx)):o==="focusout"&&Ii()}function Wx(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return of(hc)}function lf(o,c){if(o==="click")return of(c)}function au(o,c){if(o==="input"||o==="change")return of(c)}function Xx(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var wr=typeof Object.is=="function"?Object.is:Xx;function ao(o,c){if(wr(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var m=Object.keys(o),v=Object.keys(c);if(m.length!==v.length)return!1;for(v=0;v<m.length;v++){var T=m[v];if(!vn.call(c,T)||!wr(o[T],c[T]))return!1}return!0}function Dr(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Ev(o,c){var m=Dr(o);o=0;for(var v;m;){if(m.nodeType===3){if(v=o+m.textContent.length,o<=c&&v>=c)return{node:m,offset:c-o};o=v}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=Dr(m)}}function Av(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?Av(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function Rv(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var c=Ra(o.document);c instanceof o.HTMLIFrameElement;){try{var m=typeof c.contentWindow.location.href=="string"}catch{m=!1}if(m)o=c.contentWindow;else break;c=Ra(o.document)}return c}function uf(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}var Nv=Co&&"documentMode"in document&&11>=document.documentMode,vl=null,Um=null,cf=null,Lm=!1;function Cv(o,c,m){var v=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;Lm||vl==null||vl!==Ra(v)||(v=vl,"selectionStart"in v&&uf(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focu
vendor: 73,714 bytes, line 48
48sNode:v.focusNode,focusOffset:v.focusOffset}),cf&&ao(cf,v)||(cf=v,v=GS(Um,"onSelect"),0<v.length&&(c=new yh("onSelect","select",null,c,m),o.push({event:c,listeners:v}),c.target=vl)))}function ks(o,c){var m={};return m[o.toLowerCase()]=c.toLowerCase(),m["Webkit"+o]="webkit"+c,m["Moz"+o]="moz"+c,m}var ou={animationend:ks("Animation","AnimationEnd"),animationiteration:ks("Animation","AnimationIteration"),animationstart:ks("Animation","AnimationStart"),transitionrun:ks("Transition","TransitionRun"),transitionstart:ks("Transition","TransitionStart"),transitioncancel:ks("Transition","TransitionCancel"),transitionend:ks("Transition","TransitionEnd")},Bm={},Yx={};Co&&(Yx=document.createElement("div").style,"AnimationEvent"in window||(delete ou.animationend.animation,delete ou.animationiteration.animation,delete ou.animationstart.animation),"TransitionEvent"in window||delete ou.transitionend.transition);function _l(o){if(Bm[o])return Bm[o];if(!ou[o])return o;var c=ou[o],m;for(m in c)if(c.hasOwnProperty(m)&&m in Yx)return Bm[o]=c[m];return o}var fr=_l("animationend"),wv=_l("animationiteration"),Ur=_l("animationstart"),jx=_l("transitionrun"),xl=_l("transitionstart"),Eh=_l("transitioncancel"),Sl=_l("transitionend"),Pm=new Map,hf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");hf.push("scrollEnd");function Cs(o,c){Pm.set(o,c),q(c,[o])}var Dv=new WeakMap;function qs(o,c){if(typeof o=="object"&&o!==null){var m=Dv.get(o);return m!==void 0?m:(c={value:o,source:c,stack:ni(c)},Dv.set(o,c),c)}return{value:o,source:c,stack:ni(c)}}var tr=[],Na=0,Om=0;function df(){for(var o=Na,c=Om=Na=0;c<o;){var m=tr[c];tr[c++]=null;var v=tr[c];tr[c++]=null;var T=tr[c];tr[c++]=null;var R=tr[c];if(tr[c++]=null,v!==null&&T!==null){var V=v.pending;V===null?T.next=T:(T.next=V.next,V.next=T),v.pending=T}R!==0&&Uv(m,T,R)}}function lu(o,c,m,v){tr[Na++]=o,tr[Na++]=c,tr[Na++]=m,tr[Na++]=v,Om|=v,o.lanes|=v,o=o.alternate,o!==null&&(o.lanes|=v)}function Im(o,c,m,v){return lu(o,c,m,v),Ah(o)}function bl(o,c){return lu(o,null,null,c),Ah(o)}function Uv(o,c,m){o.lanes|=m;var v=o.alternate;v!==null&&(v.lanes|=m);for(var T=!1,R=o.return;R!==null;)R.childLanes|=m,v=R.alternate,v!==null&&(v.childLanes|=m),R.tag===22&&(o=R.stateNode,o===null||o._visibility&1||(T=!0)),o=R,R=R.return;return o.tag===3?(R=o.stateNode,T&&c!==null&&(T=31-St(m),o=R.hiddenUpdates,v=o[T],v===null?o[T]=[c]:v.push(c),c.lane=m|536870912),R):null}function Ah(o){if(50<ko)throw ko=0,Cc=null,Error(n(185));for(var c=o.return;c!==null;)o=c,c=o.return;return o.tag===3?o.stateNode:null}var uu={};function Lv(o,c,m,v){this.tag=o,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Lr(o,c,m,v){return new Lv(o,c,m,v)}function ff(o){return o=o.prototype,!(!o||!o.isReactComponent)}function $i(o,c){var m=o.alternate;return m===null?(m=Lr(o.tag,c,o.key,o.mode),m.elementType=o.elementType,m.type=o.type,m.stateNode=o.stateNode,m.alternate=o,o.alternate=m):(m.pendingProps=c,m.type=o.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=o.flags&65011712,m.childLanes=o.childLanes,m.lanes=o.lanes,m.child=o.child,m.memoizedProps=o.memoizedProps,m.memoizedState=o.memoizedState,m.updateQueue=o.updateQueue,c=o.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=o.sibling,m.index=o.index,m.ref=o.ref,m.refCleanup=o.refCleanup,m}function Bv(o,c){o.flags&=65011714;var m=o.alternate;return m===null?(o.childLanes=0,o.lanes=c,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=m.childLanes,o.lanes=m.lanes,o.child=m.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=m.memoizedProps,o.memoizedState=m.memoizedState,o.updateQueue=m.updateQueue,o.type=m.type,c=m.dependencies,o.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),o}function ws(o,c,m,v,T,R){var V=0;if(v=o,typeof o=="function")ff(o)&&(V=1);else if(typeof o=="string")V=xG(o,m,Ze.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case B:return o=Lr(31,m,c,T),o.elementType=B,o.lanes=R,o;case S:return cu(m.children,T,R,c);case A:V=8,T|=24;break;case E:return o=Lr(12,m,c,T|2),o.elementType=E,o.lanes=R,o;case P:return o=Lr(13,m,c,T),o.elementType=P,o.lanes=R,o;case I:return o=Lr(19,m,c,T),o.elementType=I,o.lanes=R,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case b:case w:V=10;break e;case C:V=9;break e;case D:V=11;break e;case F:V=14;break e;case z:V=16,v=null;break e}V=29,m=Error(n(130,o===null?"null":typeof o,"")),v=null}return c=Lr(V,m,c,T),c.elementType=o,c.type=v,c.lanes=R,c}function cu(o,c,m,v){return o=Lr(7,o,v,c),o.lanes=m,o}function pf(o,c,m){return o=Lr(6,o,null,c),o.lanes=m,o}function Fm(o,c,m){return c=Lr(4,o.children!==null?o.children:[],o.key,c),c.lanes=m,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}var Rh=[],Br=0,mf=null,Nh=0,Ws=[],Jr=0,hu=null,wo=1,Do="";function Tl(o,c){Rh[Br++]=Nh,Rh[Br++]=mf,mf=o,Nh=c}function Vm(o,c,m){Ws[Jr++]=wo,Ws[Jr++]=Do,Ws[Jr++]=hu,hu=o;var v=wo;o=Do;var T=32-St(v)-1;v&=~(1<<T),m+=1;var R=32-St(c)+T;if(30<R){var V=T-T%5;R=(v&(1<<V)-1).toString(32),v>>=V,T-=V,wo=1<<32-St(c)+T|m<<T|v,Do=R+o}else wo=1<<R|m<<T|v,Do=o}function Pv(o){o.return!==null&&(Tl(o,1),Vm(o,1,0))}function Ov(o){for(;o===mf;)mf=Rh[--Br],Rh[Br]=null,Nh=Rh[--Br],Rh[Br]=null;for(;o===hu;)hu=Ws[--Jr],Ws[Jr]=null,Do=Ws[--Jr],Ws[Jr]=null,wo=Ws[--Jr],Ws[Jr]=null}var pr=null,Vi=null,Wn=!1,Ca=null,ea=!1,zm=Error(n(519));function du(o){var c=Error(n(418,""));throw dc(qs(c,o)),zm}function Kx(o){var c=o.stateNode,m=o.type,v=o.memoizedProps;switch(c[os]=o,c[Oi]=v,m){case"dialog":Fn("cancel",c),Fn("close",c);break;case"iframe":case"object":case"embed":Fn("load",c);break;case"video":case"audio":for(m=0;m<f_.length;m++)Fn(f_[m],c);break;case"source":Fn("error",c);break;case"img":case"image":case"link":Fn("error",c),Fn("load",c);break;case"details":Fn("toggle",c);break;case"input":Fn("invalid",c),er(c,v.value,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name,!0),Cn(c);break;case"select":Fn("invalid",c);break;case"textarea":Fn("invalid",c),lc(c,v.value,v.defaultValue,v.children),Cn(c)}m=v.children,typeof m!="string"&&typeof m!="number"&&typeof m!="bigint"||c.textContent===""+m||v.suppressHydrationWarning===!0||A2(c.textContent,m)?(v.popover!=null&&(Fn("beforetoggle",c),Fn("toggle",c)),v.onScroll!=null&&Fn("scroll",c),v.onScrollEnd!=null&&Fn("scrollend",c),v.onClick!=null&&(c.onclick=HS),c=!0):c=!1,c||du(o)}function Iv(o){for(pr=o.return;pr;)switch(pr.tag){case 5:case 13:ea=!1;return;case 27:case 3:ea=!0;return;default:pr=pr.return}}function oo(o){if(o!==pr)return!1;if(!Wn)return Iv(o),Wn=!0,!1;var c=o.tag,m;if((m=c!==3&&c!==27)&&((m=c===5)&&(m=o.type,m=!(m!=="form"&&m!=="button")||_A(o.type,o.memoizedProps)),m=!m),m&&Vi&&du(o),Iv(o),c===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));e:{for(o=o.nextSibling,c=0;o;){if(o.nodeType===8)if(m=o.data,m==="/$"){if(c===0){Vi=Il(o.nextSibling);break e}c--}else m!=="$"&&m!=="$!"&&m!=="$?"||c++;o=o.nextSibling}Vi=null}}else c===27?(c=Vi,Jh(o.type)?(o=TA,TA=null,Vi=o):Vi=c):Vi=pr?Il(o.stateNode.nextSibling):null;return!0}function Ch(){Vi=pr=null,Wn=!1}function Qn(){var o=Ca;return o!==null&&(sn===null?sn=o:sn.push.apply(sn,o),Ca=null),o}function dc(o){Ca===null?Ca=[o]:Ca.push(o)}var Fv=oe(null),fu=null,Ml=null;function pu(o,c,m){Ie(Fv,c._currentValue),c._currentValue=m}function El(o){o._currentValue=Fv.current,we(Fv)}function Vv(o,c,m){for(;o!==null;){var v=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,v!==null&&(v.childLanes|=c)):v!==null&&(v.childLanes&c)!==c&&(v.childLanes|=c),o===m)break;o=o.return}}function gf(o,c,m,v){var T=o.child;for(T!==null&&(T.return=o);T!==null;){var R=T.dependencies;if(R!==null){var V=T.child;R=R.firstContext;e:for(;R!==null;){var H=R;R=T;for(var ne=0;ne<c.length;ne++)if(H.context===c[ne]){R.lanes|=m,H=R.alternate,H!==null&&(H.lanes|=m),Vv(R.return,m,o),v||(V=null);break e}R=H.next}}else if(T.tag===18){if(V=T.return,V===null)throw Error(n(341));V.lanes|=m,R=V.alternate,R!==null&&(R.lanes|=m),Vv(V,m,o),V=null}else V=T.child;if(V!==null)V.return=T;else for(V=T;V!==null;){if(V===o){V=null;break}if(T=V.sibling,T!==null){T.return=V.return,V=T;break}V=V.return}T=V}}function wa(o,c,m,v){o=null;for(var T=c,R=!1;T!==null;){if(!R){if((T.flags&524288)!==0)R=!0;else if((T.flags&262144)!==0)break}if(T.tag===10){var V=T.alternate;if(V===null)throw Error(n(387));if(V=V.memoizedProps,V!==null){var H=T.type;wr(T.pendingProps.value,V.value)||(o!==null?o.push(H):o=[H])}}else if(T===Ve.current){if(V=T.alternate,V===null)throw Error(n(387));V.memoizedState.memoizedState!==T.memoizedState.memoizedState&&(o!==null?o.push(__):o=[__])}T=T.return}o!==null&&gf(c,o,m,v),c.flags|=262144}function yf(o){for(o=o.firstContext;o!==null;){if(!wr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Uo(o){fu=o,Ml=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Xi(o){return Gm(fu,o)}function vf(o,c){return fu===null&&Uo(o),Gm(o,c)}function Gm(o,c){var m=c._currentValue;if(c={context:c,memoizedValue:m,next:null},Ml===null){if(o===null)throw Error(n(308));Ml=c,o.dependencies={lanes:0,firstContext:c},o.flags|=524288}else Ml=Ml.next=c;return m}var zv=typeof AbortController<"u"?AbortController:function(){var o=[],c=this.signal={aborted:!1,addEventListener:function(m,v){o.push(v)}};this.abort=function(){c.aborted=!0,o.forEach(function(m){return m()})}},eA=s.unstable_scheduleCallback,Zx=s.unstable_NormalPriority,us={$$typeof:w,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hm(){return{controller:new zv,data:new Map,refCount:0}}function wh(o){o.refCount--,o.refCount===0&&eA(Zx,function(){o.controller.abort()})}var Dh=null,_f=0,xn=0,Uh=null;function ta(o,c){if(Dh===null){var m=Dh=[];_f=0,xn=cA(),Uh={status:"pending",value:void 0,then:function(v){m.push(v)}}}return _f++,c.then(km,km),c}function km(){if(--_f===0&&Dh!==null){Uh!==null&&(Uh.status="fulfilled");var o=Dh;Dh=null,xn=0,Uh=null;for(var c=0;c<o.length;c++)(0,o[c])()}}function tA(o,c){var m=[],v={status:"pending",value:null,reason:null,then:function(T){m.push(T)}};return o.then(function(){v.status="fulfilled",v.value=c;for(var T=0;T<m.length;T++)(0,m[T])(c)},function(T){for(v.status="rejected",v.reason=T,T=0;T<m.length;T++)(0,m[T])(void 0)}),v}var xf=k.S;k.S=function(o,c){typeof c=="object"&&c!==null&&typeof c.then=="function"&&ta(o,c),xf!==null&&xf(o,c)};var Da=oe(null);function mu(){var o=Da.current;return o!==null?o:gn.pooledCache}function Sf(o,c){c===null?Ie(Da,Da.current):Ie(Da,c.pool)}function qm(){var o=mu();return o===null?null:{parent:us._currentValue,pool:o}}var bf=Error(n(460)),Gv=Error(n(474)),lo=Error(n(542)),Tf={then:function(){}};function Wm(o){return o=o.status,o==="fulfilled"||o==="rejected"}function Lh(){}function Xm(o,c,m){switch(m=o[m],m===void 0?o.push(c):m!==c&&(c.then(Lh,Lh),c=m),c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,Qx(o),o;default:if(typeof c.status=="string")c.then(Lh,Lh);else{if(o=gn,o!==null&&100<o.shellSuspendCounter)throw Error(n(482));o=c,o.status="pending",o.then(function(v){if(c.status==="pending"){var T=c;T.status="fulfilled",T.value=v}},function(v){if(c.status==="pending"){var T=c;T.status="rejected",T.reason=v}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,Qx(o),o}throw Ua=c,bf}}var Ua=null;function Hv(){if(Ua===null)throw Error(n(459));var o=Ua;return Ua=null,o}function Qx(o){if(o===bf||o===lo)throw Error(n(483))}var Al=!1;function kv(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function cn(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Lo(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Rl(o,c,m){var v=o.updateQueue;if(v===null)return null;if(v=v.shared,($n&2)!==0){var T=v.pending;return T===null?c.next=c:(c.next=T.next,T.next=c),v.pending=c,c=Ah(o),Uv(o,null,m),c}return lu(o,v,c,m),Ah(o)}function fc(o,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194048)!==0)){var v=c.lanes;v&=o.pendingLanes,m|=v,c.lanes=m,Bt(o,m)}}function Bh(o,c){var m=o.updateQueue,v=o.alternate;if(v!==null&&(v=v.updateQueue,m===v)){var T=null,R=null;if(m=m.firstBaseUpdate,m!==null){do{var V={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};R===null?T=R=V:R=R.next=V,m=m.next}while(m!==null);R===null?T=R=c:R=R.next=c}else T=R=c;m={baseState:v.baseState,firstBaseUpdate:T,lastBaseUpdate:R,shared:v.shared,callbacks:v.callbacks},o.updateQueue=m;return}o=m.lastBaseUpdate,o===null?m.firstBaseUpdate=c:o.next=c,m.lastBaseUpdate=c}var qv=!1;function Mf(){if(qv){var o=Uh;if(o!==null)throw o}}function Ph(o,c,m,v){qv=!1;var T=o.updateQueue;Al=!1;var R=T.firstBaseUpdate,V=T.lastBaseUpdate,H=T.shared.pending;if(H!==null){T.shared.pending=null;var ne=H,Me=ne.next;ne.next=null,V===null?R=Me:V.next=Me,V=ne;var ke=o.alternate;ke!==null&&(ke=ke.updateQueue,H=ke.lastBaseUpdate,H!==V&&(H===null?ke.firstBaseUpdate=Me:H.next=Me,ke.lastBaseUpdate=ne))}if(R!==null){var Qe=T.baseState;V=0,ke=Me=ne=null,H=R;do{var Ae=H.lane&-536870913,Re=Ae!==H.lane;if(Re?(Qt&Ae)===Ae:(v&Ae)===Ae){Ae!==0&&Ae===xn&&(qv=!0),ke!==null&&(ke=ke.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var fn=o,an=H;Ae=c;var Mi=m;switch(an.tag){case 1:if(fn=an.payload,typeof fn=="function"){Qe=fn.call(Mi,Qe,Ae);break e}Qe=fn;break e;case 3:fn.flags=fn.flags&-65537|128;case 0:if(fn=an.payload,Ae=typeof fn=="function"?fn.call(Mi,Qe,Ae):fn,Ae==null)break e;Qe=p({},Qe,Ae);break e;case 2:Al=!0}}Ae=H.callback,Ae!==null&&(o.flags|=64,Re&&(o.flags|=8192),Re=T.callbacks,Re===null?T.callbacks=[Ae]:Re.push(Ae))}else Re={lane:Ae,tag:H.tag,payload:H.payload,callback:H.callback,next:null},ke===null?(Me=ke=Re,ne=Qe):ke=ke.next=Re,V|=Ae;if(H=H.next,H===null){if(H=T.shared.pending,H===null)break;Re=H,H=Re.next,Re.next=null,T.lastBaseUpdate=Re,T.shared.pending=null}}while(!0);ke===null&&(ne=Qe),T.baseState=ne,T.firstBaseUpdate=Me,T.lastBaseUpdate=ke,R===null&&(T.shared.lanes=0),yo|=V,o.lanes=V,o.memoizedState=Qe}}function Oh(o,c){if(typeof o!="function")throw Error(n(191,o));o.call(c)}function $x(o,c){var m=o.callbacks;if(m!==null)for(o.callbacks=null,o=0;o<m.length;o++)Oh(m[o],c)}var Ih=oe(null),Ym=oe(0);function Jx(o,c){o=Fa,Ie(Ym,o),Ie(Ih,c),Fa=o|c.baseLanes}function Wv(){Ie(Ym,Fa),Ie(Ih,Ih.current)}function Ef(){Fa=Ym.current,we(Ih),we(Ym)}var Nl=0,Sn=null,ii=null,cs=null,jm=!1,gu=!1,mr=!1,Ss=0,La=0,Xs=null,eS=0;function Ji(){throw Error(n(321))}function nr(o,c){if(c===null)return!1;for(var m=0;m<c.length&&m<o.length;m++)if(!wr(o[m],c[m]))return!1;return!0}function Cl(o,c,m,v,T,R){return Nl=R,Sn=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,k.H=o===null||o.memoizedState===null?ig:o_,mr=!1,R=m(v,T),mr=!1,gu&&(R=nS(c,m,v,T)),tS(o),R}function tS(o){k.H=Nf;var c=ii!==null&&ii.next!==null;if(Nl=0,cs=ii=Sn=null,jm=!1,La=0,Xs=null,c)throw Error(n(300));o===null||Ds||(o=o.dependencies,o!==null&&yf(o)&&(Ds=!0))}function nS(o,c,m,v){Sn=o;var T=0;do{if(gu&&(Xs=null),La=0,gu=!1,25<=T)throw Error(n(301));if(T+=1,cs=ii=null,o.updateQueue!=null){var R=o.updateQueue;R.lastEffect=null,R.events=null,R.stores=null,R.memoCache!=null&&(R.memoCache.index=0)}k.H=NS,R=c(m,v)}while(gu);return R}function nA(){var o=k.H,c=o.useState()[0];return c=typeof c.then=="function"?uo(c):c,o=o.useState()[0],(ii!==null?ii.memoizedState:null)!==o&&(Sn.flags|=1024),c}function Xv(){var o=Ss!==0;return Ss=0,o}function Km(o,c,m){c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~m}function Yv(o){if(jm){for(o=o.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}jm=!1}Nl=0,cs=ii=Sn=null,gu=!1,La=Ss=0,Xs=null}function gr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cs===null?Sn.memoizedState=cs=o:cs=cs.next=o,cs}function hs(){if(ii===null){var o=Sn.alternate;o=o!==null?o.memoizedState:null}else o=ii.next;var c=cs===null?Sn.memoizedState:cs.next;if(c!==null)cs=c,ii=o;else{if(o===null)throw Sn.alternate===null?Error(n(467)):Error(n(310));ii=o,o={memoizedState:ii.memoizedState,baseState:ii.baseState,baseQueue:ii.baseQueue,queue:ii.queue,next:null},cs===null?Sn.memoizedState=cs=o:cs=cs.next=o}return cs}function yu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function uo(o){var c=La;return La+=1,Xs===null&&(Xs=[]),o=Xm(Xs,o,c),c=Sn,(cs===null?c.memoizedState:cs.next)===null&&(c=c.alternate,k.H=c===null||c.memoizedState===null?ig:o_),o}function Zm(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return uo(o);if(o.$$typeof===w)return Xi(o)}throw Error(n(438,String(o)))}function jv(o){var c=null,m=Sn.updateQueue;if(m!==null&&(c=m.memoCache),c==null){var v=Sn.alternate;v!==null&&(v=v.updateQueue,v!==null&&(v=v.memoCache,v!=null&&(c={data:v.data.map(function(T){return T.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),m===null&&(m=yu(),Sn.updateQueue=m),m.memoCache=c,m=c.data[c.index],m===void 0)for(m=c.data[c.index]=Array(o),v=0;v<o;v++)m[v]=O;return c.index++,m}function wl(o,c){return typeof c=="function"?c(o):c}function vu(o){var c=hs();return Kv(c,ii,o)}function Kv(o,c,m){var v=o.queue;if(v===null)throw Error(n(311));v.lastRenderedReducer=m;var T=o.baseQueue,R=v.pending;if(R!==null){if(T!==null){var V=T.next;T.next=R.next,R.next=V}c.baseQueue=T=R,v.pending=null}if(R=o.baseState,T===null)o.memoizedState=R;else{c=T.next;var H=V=null,ne=null,Me=c,ke=!1;do{var Qe=Me.lane&-536870913;if(Qe!==Me.lane?(Qt&Qe)===Qe:(Nl&Qe)===Qe){var Ae=Me.revertLane;if(Ae===0)ne!==null&&(ne=ne.next={lane:0,revertLane:0,action:Me.action,hasEagerState:Me.hasEagerState,eagerState:Me.eagerState,next:null}),Qe===xn&&(ke=!0);else if((Nl&Ae)===Ae){Me=Me.next,Ae===xn&&(ke=!0);continue}else Qe={lane:0,revertLane:Me.revertLane,action:Me.action,hasEagerState:Me.hasEagerState,eagerState:Me.eagerState,next:null},ne===null?(H=ne=Qe,V=R):ne=ne.next=Qe,Sn.lanes|=Ae,yo|=Ae;Qe=Me.action,mr&&m(R,Qe),R=Me.hasEagerState?Me.eagerState:m(R,Qe)}else Ae={lane:Qe,revertLane:Me.revertLane,action:Me.action,hasEagerState:Me.hasEagerState,eagerState:Me.eagerState,next:null},ne===null?(H=ne=Ae,V=R):ne=ne.next=Ae,Sn.lanes|=Qe,yo|=Qe;Me=Me.next}while(Me!==null&&Me!==c);if(ne===null?V=R:ne.next=H,!wr(R,o.memoizedState)&&(Ds=!0,ke&&(m=Uh,m!==null)))throw m;o.memoizedState=R,o.baseState=V,o.baseQueue=ne,v.lastRenderedState=R}return T===null&&(v.lanes=0),[o.memoizedState,v.dispatch]}function Zv(o){var c=hs(),m=c.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=o;var v=m.dispatch,T=m.pending,R=c.memoizedState;if(T!==null){m.pending=null;var V=T=T.next;do R=o(R,V.action),V=V.next;while(V!==T);wr(R,c.memoizedState)||(Ds=!0),c.memoizedState=R,c.baseQueue===null&&(c.baseState=R),m.lastRenderedState=R}return[R,v]}function iS(o,c,m){var v=Sn,T=hs(),R=Wn;if(R){if(m===void 0)throw Error(n(407));m=m()}else m=c();var V=!wr((ii||T).memoizedState,m);V&&(T.memoizedState=m,Ds=!0),T=T.queue;var H=rS.bind(null,v,T,o);if(zh(2048,8,H,[o]),T.getSnapshot!==c||V||cs!==null&&cs.memoizedState.tag&1){if(v.flags|=2048,Vh(9,Af(),sS.bind(null,v,T,m,c),null),gn===null)throw Error(n(349));R||(Nl&124)!==0||Fh(v,c,m)}return m}function Fh(o,c,m){o.flags|=16384,o={getSnapshot:c,value:m},c=Sn.updateQueue,c===null?(c=yu(),Sn.updateQueue=c,c.stores=[o]):(m=c.stores,m===null?c.stores=[o]:m.push(o))}function sS(o,c,m,v){c.value=m,c.getSnapshot=v,aS(c)&&oS(o)}function rS(o,c,m){return m(function(){aS(c)&&oS(o)})}function aS(o){var c=o.getSnapshot;o=o.value;try{var m=c();return!wr(o,m)}catch{return!0}}function oS(o){var c=bl(o,2);c!==null&&_r(c,o,2)}function Qv(o){var c=gr();if(typeof o=="function"){var m=o;if(o=m(),mr){Ue(!0);try{m()}finally{Ue(!1)}}}return c.memoizedState=c.baseState=o,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wl,lastRenderedState:o},c}function lS(o,c,m,v){return o.baseState=m,Kv(o,ii,typeof v=="function"?v:wl)}function iA(o,c,m,v,T){if(ng(o))throw Error(n(485));if(o=c.action,o!==null){var R={payload:T,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(V){R.listeners.push(V)}};k.T!==null?m(!0):R.isTransition=!1,v(R),m=c.pending,m===null?(R.next=c.pending=R,uS(c,R)):(R.next=m.next,c.pending=m.next=R)}}function uS(o,c){var m=c.action,v=c.payload,T=o.state;if(c.isTransition){var R=k.T,V={};k.T=V;try{var H=m(T,v),ne=k.S;ne!==null&&ne(V,H),cS(o,c,H)}catch(Me){$v(o,c,Me)}finally{k.T=R}}else try{R=m(T,v),cS(o,c,R)}catch(Me){$v(o,c,Me)}}function cS(o,c,m){m!==null&&typeof m=="object"&&typeof m.then=="function"?m.then(function(v){hS(o,c,v)},function(v){return $v(o,c,v)}):hS(o,c,m)}function hS(o,c,m){c.status="fulfilled",c.value=m,dS(c),o.state=m,c=o.pending,c!==null&&(m=c.next,m===c?o.pending=null:(m=m.next,c.next=m,uS(o,m)))}function $v(o,c,m){var v=o.pending;if(o.pending=null,v!==null){v=v.next;do c.status="rejected",c.reason=m,dS(c),c=c.next;while(c!==v)}o.action=null}function dS(o){o=o.listeners;for(var c=0;c<o.length;c++)(0,o[c])()}function Jv(o,c){return c}function fS(o,c){if(Wn){var m=gn.formState;if(m!==null){e:{var v=Sn;if(Wn){if(Vi){t:{for(var T=Vi,R=ea;T.nodeType!==8;){if(!R){T=null;break t}if(T=Il(T.nextSibling),T===null){T=null;break t}}R=T.data,T=R==="F!"||R==="F"?T:null}if(T){Vi=Il(T.nextSibling),v=T.data==="F!";break e}}du(v)}v=!1}v&&(c=m[0])}}return m=gr(),m.memoizedState=m.baseState=c,v={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jv,lastRenderedState:c},m.queue=v,m=AS.bind(null,Sn,v),v.dispatch=m,v=Qv(!1),R=tg.bind(null,Sn,!1,v.queue),v=gr(),T={state:c,dispatch:null,action:o,pending:null},v.queue=T,m=iA.bind(null,Sn,T,R,m),T.dispatch=m,v.memoizedState=o,[c,m,!1]}function pS(o){var c=hs();return mS(c,ii,o)}function mS(o,c,m){if(c=Kv(o,c,Jv)[0],o=vu(wl)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var v=uo(c)}catch(V){throw V===bf?lo:V}else v=c;c=hs();var T=c.queue,R=T.dispatch;return m!==c.memoizedState&&(Sn.flags|=2048,Vh(9,Af(),sA.bind(null,T,m),null)),[v,R,o]}function sA(o,c){o.action=c}function gS(o){var c=hs(),m=ii;if(m!==null)return mS(c,m,o);hs(),c=c.memoizedState,m=hs();var v=m.queue.dispatch;return m.memoizedState=o,[c,v,!1]}function Vh(o,c,m,v){return o={tag:o,create:m,deps:v,inst:c,next:null},c=Sn.updateQueue,c===null&&(c=yu(),Sn.updateQueue=c),m=c.lastEffect,m===null?c.lastEffect=o.next=o:(v=m.next,m.next=o,o.next=v,c.lastEffect=o),o}function Af(){return{destroy:void 0,resource:void 0}}function e_(){return hs().memoizedState}function Qm(o,c,m,v){var T=gr();v=v===void 0?null:v,Sn.flags|=o,T.memoizedState=Vh(1|c,Af(),m,v)}function zh(o,c,m,v){var T=hs();v=v===void 0?null:v;var R=T.memoizedState.inst;ii!==null&&v!==null&&nr(v,ii.memoizedState.deps)?T.memoizedState=Vh(c,R,m,v):(Sn.flags|=o,T.memoizedState=Vh(1|c,R,m,v))}function t_(o,c){Qm(8390656,8,o,c)}function n_(o,c){zh(2048,8,o,c)}function $m(o,c){return zh(4,2,o,c)}function Jm(o,c){return zh(4,4,o,c)}function yS(o,c){if(typeof c=="function"){o=o();var m=c(o);return function(){typeof m=="function"?m():c(null)}}if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function vS(o,c,m){m=m!=null?m.concat([o]):null,zh(4,4,yS.bind(null,c,o),m)}function i_(){}function _S(o,c){var m=hs();c=c===void 0?null:c;var v=m.memoizedState;return c!==null&&nr(c,v[1])?v[0]:(m.memoizedState=[o,c],o)}function s_(o,c){var m=hs();c=c===void 0?null:c;var v=m.memoizedState;if(c!==null&&nr(c,v[1]))return v[0];if(v=o(),mr){Ue(!0);try{o()}finally{Ue(!1)}}return m.memoizedState=[v,c],v}function eg(o,c,m){return m===void 0||(Nl&1073741824)!==0?o.memoizedState=c:(o.memoizedState=m,o=pg(),Sn.lanes|=o,yo|=o,m)}function xS(o,c,m,v){return wr(m,c)?m:Ih.current!==null?(o=eg(o,m,v),wr(o,c)||(Ds=!0),o):(Nl&42)===0?(Ds=!0,o.memoizedState=m):(o=pg(),Sn.lanes|=o,yo|=o,c)}function SS(o,c,m,v,T){var R=Q.p;Q.p=R!==0&&8>R?R:8;var V=k.T,H={};k.T=H,tg(o,!1,c,m);try{var ne=T(),Me=k.S;if(Me!==null&&Me(H,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var ke=tA(ne,v);Rf(o,c,ke,Ki(o))}else Rf(o,c,v,Ki(o))}catch(Qe){Rf(o,c,{then:function(){},status:"rejected",reason:Qe},Ki())}finally{Q.p=R,k.T=V}}function rA(){}function r_(o,c,m,v){if(o.tag!==5)throw Error(n(476));var T=bS(o).queue;SS(o,T,c,J,m===null?rA:function(){return TS(o),m(v)})}function bS(o){var c=o.memoizedState;if(c!==null)return c;c={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wl,lastRenderedState:J},next:null};var m={};return c.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wl,lastRenderedState:m},next:null},o.memoizedState=c,o=o.alternate,o!==null&&(o.memoizedState=c),c}function TS(o){var c=bS(o).next.queue;Rf(o,c,{},Ki())}function a_(){return Xi(__)}function MS(){return hs().memoizedState}function ES(){return hs().memoizedState}function aA(o){for(var c=o.return;c!==null;){switch(c.tag){case 24:case 3:var m=Ki();o=Lo(m);var v=Rl(c,o,m);v!==null&&(_r(v,c,m),fc(v,c,m)),c={cache:Hm()},o.payload=c;return}c=c.return}}function oA(o,c,m){var v=Ki();m={lane:v,revertLane:0,action:m,hasEagerState:!1,eagerState:null,next:null},ng(o)?RS(c,m):(m=Im(o,c,m,v),m!==null&&(_r(m,o,v),na(m,c,v)))}function AS(o,c,m){var v=Ki();Rf(o,c,m,v)}function Rf(o,c,m,v){var T={lane:v,revertLane:0,action:m,hasEagerState:!1,eagerState:null,next:null};if(ng(o))RS(c,T);else{var R=o.alternate;if(o.lanes===0&&(R===null||R.lanes===0)&&(R=c.lastRenderedReducer,R!==null))try{var V=c.lastRenderedState,H=R(V,m);if(T.hasEagerState=!0,T.eagerState=H,wr(H,V))return lu(o,c,T,0),gn===null&&df(),!1}catch{}finally{}if(m=Im(o,c,T,v),m!==null)return _r(m,o,v),na(m,c,v),!0}return!1}function tg(o,c,m,v){if(v={lane:2,revertLane:cA(),action:v,hasEagerState:!1,eagerState:null,next:null},ng(o)){if(c)throw Error(n(479))}else c=Im(o,m,v,2),c!==null&&_r(c,o,2)}function ng(o){var c=o.alternate;return o===Sn||c!==null&&c===Sn}function RS(o,c){gu=jm=!0;var m=o.pending;m===null?c.next=c:(c.next=m.next,m.next=c),o.pending=c}function na(o,c,m){if((m&4194048)!==0){var v=c.lanes;v&=o.pendingLanes,m|=v,c.lanes=m,Bt(o,m)}}var Nf={readContext:Xi,use:Zm,useCallback:Ji,useContext:Ji,useEffect:Ji,useImperativeHandle:Ji,useLayoutEffect:Ji,useInsertionEffect:Ji,useMemo:Ji,useReducer:Ji,useRef:Ji,useState:Ji,useDebugValue:Ji,useDeferredValue:Ji,useTransition:Ji,useSyncExternalStore:Ji,useId:Ji,useHostTransitionStatus:Ji,useFormState:Ji,useActionState:Ji,useOptimistic:Ji,useMemoCache:Ji,useCacheRefresh:Ji},ig={readContext:Xi,use:Zm,useCallback:function(o,c){return gr().memoizedState=[o,c===void 0?null:c],o},useContext:Xi,useEffect:t_,useImperativeHandle:function(o,c,m){m=m!=null?m.concat([o]):null,Qm(4194308,4,yS.bind(null,c,o),m)},useLayoutEffect:function(o,c){return Qm(4194308,4,o,c)},useInsertionEffect:function(o,c){Qm(4,2,o,c)},useMemo:function(o,c){var m=gr();c=c===void 0?null:c;var v=o();if(mr){Ue(!0);try{o()}finally{Ue(!1)}}return m.memoizedState=[v,c],v},useReducer:function(o,c,m){var v=gr();if(m!==void 0){var T=m(c);if(mr){Ue(!0);try{m(c)}finally{Ue(!1)}}}else T=c;return v.memoizedState=v.baseState=T,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:T},v.queue=o,o=o.dispatch=oA.bind(null,Sn,o),[v.memoizedState,o]},useRef:function(o){var c=gr();return o={current:o},c.memoizedState=o},useState:function(o){o=Qv(o);var c=o.queue,m=AS.bind(null,Sn,c);return c.dispatch=m,[o.memoizedState,m]},useDebugValue:i_,useDeferredValue:function(o,c){var m=gr();return eg(m,o,c)},useTransition:function(){var o=Qv(!1);return o=SS.bind(null,Sn,o.queue,!0,!1),gr().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,c,m){var v=Sn,T=gr();if(Wn){if(m===void 0)throw Error(n(407));m=m()}else{if(m=c(),gn===null)throw Error(n(349));(Qt&124)!==0||Fh(v,c,m)}T.memoizedState=m;var R={value:m,getSnapshot:c};return T.queue=R,t_(rS.bind(null,v,R,o),[o]),v.flags|=2048,Vh(9,Af(),sS.bind(null,v,R,m,c),null),m},useId:function(){var o=gr(),c=gn.identifierPrefix;if(Wn){var m=Do,v=wo;m=(v&~(1<<32-St(v)-1)).toString(32)+m,c="«"+c+"R"+m,m=Ss++,0<m&&(c+="H"+m.toString(32)),c+="»"}else m=eS++,c="«"+c+"r"+m.toString(32)+"»";return o.memoizedState=c},useHostTransitionStatus:a_,useFormState:fS,useActionState:fS,useOptimistic:function(o){var c=gr();c.memoizedState=c.baseState=o;var m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=m,c=tg.bind(null,Sn,!0,m),m.dispatch=c,[o,c]},useMemoCache:jv,useCacheRefresh:function(){return gr().memoizedState=aA.bind(null,Sn)}},o_={readContext:Xi,use:Zm,useCallback:_S,useContext:Xi,useEffect:n_,useImperativeHandle:vS,useInsertionEffect:$m,useLayoutEffect:Jm,useMemo:s_,useReducer:vu,useRef:e_,useState:function(){return vu(wl)},useDebugValue:i_,useDeferredValue:function(o,c){var m=hs();return xS(m,ii.memoizedState,o,c)},useTransition:function(){var o=vu(wl)[0],c=hs().memoizedState;return[typeof o=="boolean"?o:uo(o),c]},useSyncExternalStore:iS,useId:MS,useHostTransitionStatus:a_,useFormState:pS,useActionState:pS,useOptimistic:function(o,c){var m=hs();return lS(m,ii,o,c)},useMemoCache:jv,useCacheRefresh:ES},NS={readContext:Xi,use:Zm,useCallback:_S,useContext:Xi,useEffect:n_,useImperativeHandle:vS,useInsertionEffect:$m,useLayoutEffect:Jm,useMemo:s_,useReducer:Zv,useRef:e_,useState:function(){return Zv(wl)},useDebugValue:i_,useDeferredValue:function(o,c){var m=hs();return ii===null?eg(m,o,c):xS(m,ii.memoizedState,o,c)},useTransition:function(){var o=Zv(wl)[0],c=hs().memoizedState;return[typeof o=="boolean"?o:uo(o),c]},useSyncExternalStore:iS,useId:MS,useHostTransitionStatus:a_,useFormState:gS,useActionState:gS,useOptimistic:function(o,c){var m=hs();return ii!==null?lS(m,ii,o,c):(m.baseState=o,[o,m.queue.dispatch])},useMemoCache:jv,useCacheRefresh:ES},pc=null,Cf=0;function wf(o){var c=Cf;return Cf+=1,pc===null&&(pc=[]),Xm(pc,o,c)}function Gh(o,c){c=c.props.ref,o.ref=c!==void 0?c:null}function sg(o,c){throw c.$$typeof===g?Error(n(525)):(o=Object.prototype.toString.call(c),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o)))}function CS(o){var c=o._init;return c(o._payload)}function wS(o){function c(me,ce){if(o){var be=me.deletions;be===null?(me.deletions=[ce],me.flags|=16):be.push(ce)}}function m(me,ce){if(!o)return null;for(;ce!==null;)c(me,ce),ce=ce.sibling;return null}function v(me){for(var ce=new Map;me!==null;)me.key!==null?ce.set(me.key,me):ce.set(me.index,me),me=me.sibling;return ce}function T(me,ce){return me=$i(me,ce),me.index=0,me.sibling=null,me}function R(me,ce,be){return me.index=be,o?(be=me.alternate,be!==null?(be=be.index,be<ce?(me.flags|=67108866,ce):be):(me.flags|=67108866,ce)):(me.flags|=1048576,ce)}function V(me){return o&&me.alternate===null&&(me.flags|=67108866),me}function H(me,ce,be,je){return ce===null||ce.tag!==6?(ce=pf(be,me.mode,je),ce.return=me,ce):(ce=T(ce,be),ce.return=me,ce)}function ne(me,ce,be,je){var Ft=be.type;return Ft===S?ke(me,ce,be.props.children,je,be.key):ce!==null&&(ce.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===z&&CS(Ft)===ce.type)?(ce=T(ce,be.props),Gh(ce,be),ce.return=me,ce):(ce=ws(be.type,be.key,be.props,null,me.mode,je),Gh(ce,be),ce.return=me,ce)}function Me(me,ce,be,je){return ce===null||ce.tag!==4||ce.stateNode.containerInfo!==be.containerInfo||ce.stateNode.implementation!==be.implementation?(ce=Fm(be,me.mode,je),ce.return=me,ce):(ce=T(ce,be.children||[]),ce.return=me,ce)}function ke(me,ce,be,je,Ft){return ce===null||ce.tag!==7?(ce=cu(be,me.mode,je,Ft),ce.return=me,ce):(ce=T(ce,be),ce.return=me,ce)}function Qe(me,ce,be){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return ce=pf(""+ce,me.mode,be),ce.return=me,ce;if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:return be=ws(ce.type,ce.key,ce.props,null,me.mode,be),Gh(be,ce),be.return=me,be;case _:return ce=Fm(ce,me.mode,be),ce.return=me,ce;case z:var je=ce._init;return ce=je(ce._payload),Qe(me,ce,be)}if(pe(ce)||ee(ce))return ce=cu(ce,me.mode,be,null),ce.return=me,ce;if(typeof ce.then=="function")return Qe(me,wf(ce),be);if(ce.$$typeof===w)return Qe(me,vf(me,ce),be);sg(me,ce)}return null}function Ae(me,ce,be,je){var Ft=ce!==null?ce.key:null;if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return Ft!==null?null:H(me,ce,""+be,je);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case y:return be.key===Ft?ne(me,ce,be,je):null;case _:return be.key===Ft?Me(me,ce,be,je):null;case z:return Ft=be._init,be=Ft(be._payload),Ae(me,ce,be,je)}if(pe(be)||ee(be))return Ft!==null?null:ke(me,ce,be,je,null);if(typeof be.then=="function")return Ae(me,ce,wf(be),je);if(be.$$typeof===w)return Ae(me,ce,vf(me,be),je);sg(me,be)}return null}function Re(me,ce,be,je,Ft){if(typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint")return me=me.get(be)||null,H(ce,me,""+je,Ft);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case y:return me=me.get(je.key===null?be:je.key)||null,ne(ce,me,je,Ft);case _:return me=me.get(je.key===null?be:je.key)||null,Me(ce,me,je,Ft);case z:var On=je._init;return je=On(je._payload),Re(me,ce,be,je,Ft)}if(pe(je)||ee(je))return me=me.get(be)||null,ke(ce,me,je,Ft,null);if(typeof je.then=="function")return Re(me,ce,be,wf(je),Ft);if(je.$$typeof===w)return Re(me,ce,be,vf(ce,je),Ft);sg(ce,je)}return null}function fn(me,ce,be,je){for(var Ft=null,On=null,jt=ce,on=ce=0,rr=null;jt!==null&&on<be.length;on++){jt.index>on?(rr=jt,jt=null):rr=jt.sibling;var ei=Ae(me,jt,be[on],je);if(ei===null){jt===null&&(jt=rr);break}o&&jt&&ei.alternate===null&&c(me,jt),ce=R(ei,ce,on),On===null?Ft=ei:On.sibling=ei,On=ei,jt=rr}if(on===be.length)return m(me,jt),Wn&&Tl(me,on),Ft;if(jt===null){for(;on<be.length;on++)jt=Qe(me,be[on],je),jt!==null&&(ce=R(jt,ce,on),On===null?Ft=jt:On.sibling=jt,On=jt);return Wn&&Tl(me,on),Ft}for(jt=v(jt);on<be.length;on++)rr=Re(jt,me,on,be[on],je),rr!==null&&(o&&rr.alternate!==null&&jt.delete(rr.key===null?on:rr.key),ce=R(rr,ce,on),On===null?Ft=rr:On.sibling=rr,On=rr);return o&&jt.forEach(function(sd){return c(me,sd)}),Wn&&Tl(me,on),Ft}function an(me,ce,be,je){if(be==null)throw Error(n(151));for(var Ft=null,On=null,jt=ce,on=ce=0,rr=null,ei=be.next();jt!==null&&!ei.done;on++,ei=be.next()){jt.index>on?(rr=jt,jt=null):rr=jt.sibling;var sd=Ae(me,jt,ei.value,je);if(sd===null){jt===null&&(jt=rr);break}o&&jt&&sd.alternate===null&&c(me,jt),ce=R(sd,ce,on),On===null?Ft=sd:On.sibling=sd,On=sd,jt=rr}if(ei.done)return m(me,jt),Wn&&Tl(me,on),Ft;if(jt===null){for(;!ei.done;on++,ei=be.next())ei=Qe(me,ei.value,je),ei!==null&&(ce=R(ei,ce,on),On===null?Ft=ei:On.sibling=ei,On=ei);return Wn&&Tl(me,on),Ft}for(jt=v(jt);!ei.done;on++,ei=be.next())ei=Re(jt,me,on,ei.value,je),ei!==null&&(o&&ei.alternate!==null&&jt.delete(ei.key===null?on:ei.key),ce=R(ei,ce,on),On===null?Ft=ei:On.sibling=ei,On=ei);return o&&jt.forEach(function(UG){return c(me,UG)}),Wn&&Tl(me,on),Ft}function Mi(me,ce,be,je){if(typeof be=="object"&&be!==null&&be.type===S&&be.key===null&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case y:e:{for(var Ft=be.key;ce!==null;){if(ce.key===Ft){if(Ft=be.type,Ft===S){if(ce.tag===7){m(me,ce.sibling),je=T(ce,be.props.children),je.return=me,me=je;break e}}else if(ce.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===z&&CS(Ft)===ce.type){m(me,ce.sibling),je=T(ce,be.props),Gh(je,be),je.return=me,me=je;break e}m(me,ce);break}else c(me,ce);ce=ce.sibling}be.type===S?(je=cu(be.props.children,me.mode,je,be.key),je.return=me,me=je):(je=ws(be.type,be.key,be.props,null,me.mode,je),Gh(je,be),je.return=me,me=je)}return V(me);case _:e:{for(Ft=be.key;ce!==null;){if(ce.key===Ft)if(ce.tag===4&&ce.stateNode.containerInfo===be.containerInfo&&ce.stateNode.implementation===be.implementation){m(me,ce.sibling),je=T(ce,be.children||[]),je.return=me,me=je;break e}else{m(me,ce);break}else c(me,ce);ce=ce.sibling}je=Fm(be,me.mode,je),je.return=me,me=je}return V(me);case z:return Ft=be._init,be=Ft(be._payload),Mi(me,ce,be,je)}if(pe(be))return fn(me,ce,be,je);if(ee(be)){if(Ft=ee(be),typeof Ft!="function")throw Error(n(150));return be=Ft.call(be),an(me,ce,be,je)}if(typeof be.then=="function")return Mi(me,ce,wf(be),je);if(be.$$typeof===w)return Mi(me,ce,vf(me,be),je);sg(me,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,ce!==null&&ce.tag===6?(m(me,ce.sibling),je=T(ce,be),je.return=me,me=je):(m(me,ce),je=pf(be,me.mode,je),je.return=me,me=je),V(me)):m(me,ce)}return function(me,ce,be,je){try{Cf=0;var Ft=Mi(me,ce,be,je);return pc=null,Ft}catch(jt){if(jt===bf||jt===lo)throw jt;var On=Lr(29,jt,null,me.mode);return On.lanes=je,On.return=me,On}finally{}}}var mc=wS(!0),DS=wS(!1),di=oe(null),co=null;function _u(o){var c=o.alternate;Ie(es,es.current&1),Ie(di,o),co===null&&(c===null||Ih.current!==null||c.memoizedState!==null)&&(co=o)}function US(o){if(o.tag===22){if(Ie(es,es.current),Ie(di,o),co===null){var c=o.alternate;c!==null&&c.memoizedState!==null&&(co=o)}}else xu()}function xu(){Ie(es,es.current),Ie(di,di.current)}function Bo(o){we(di),co===o&&(co=null),we(es)}var es=oe(0);function Dl(o){for(var c=o;c!==null;){if(c.tag===13){var m=c.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||m.data==="$?"||bA(m)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}function Su(o,c,m,v){c=o.memoizedState,m=m(v,c),m=m==null?c:p({},c,m),o.memoizedState=m,o.lanes===0&&(o.updateQueue.baseState=m)}var yr={enqueueSetState:function(o,c,m){o=o._reactInternals;var v=Ki(),T=Lo(v);T.payload=c,m!=null&&(T.callback=m),c=Rl(o,T,v),c!==null&&(_r(c,o,v),fc(c,o,v))},enqueueReplaceState:function(o,c,m){o=o._reactInternals;var v=Ki(),T=Lo(v);T.tag=1,T.payload=c,m!=null&&(T.callback=m),c=Rl(o,T,v),c!==null&&(_r(c,o,v),fc(c,o,v))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var m=Ki(),v=Lo(m);v.tag=2,c!=null&&(v.callback=c),c=Rl(o,v,m),c!==null&&(_r(c,o,m),fc(c,o,m))}};function LS(o,c,m,v,T,R,V){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(v,R,V):c.prototype&&c.prototype.isPureReactComponent?!ao(m,v)||!ao(T,R):!0}function BS(o,c,m,v){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,v),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,v),c.state!==o&&yr.enqueueReplaceState(c,c.state,null)}function Po(o,c){var m=c;if("ref"in c){m={};for(var v in c)v!=="ref"&&(m[v]=c[v])}if(o=o.defaultProps){m===c&&(m=p({},m));for(var T in o)m[T]===void 0&&(m[T]=o[T])}return m}var gc=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)};function Df(o){gc(o)}function rg(o){console.error(o)}function PS(o){gc(o)}function ag(o,c){try{var m=o.onUncaughtError;m(c.value,{componentStack:c.stack})}catch(v){setTimeout(function(){throw v})}}function Ba(o,c,m){try{var v=o.onCaughtError;v(m.value,{componentStack:m.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(T){setTimeout(function(){throw T})}}function og(o,c,m){return m=Lo(m),m.tag=3,m.payload={element:null},m.callback=function(){ag(o,c)},m}function OS(o){return o=Lo(o),o.tag=3,o}function lg(o,c,m,v){var T=m.type.getDerivedStateFromError;if(typeof T=="function"){var R=v.value;o.payload=function(){return T(R)},o.callback=function(){Ba(c,m,v)}}var V=m.stateNode;V!==null&&typeof V.componentDidCatch=="function"&&(o.callback=function(){Ba(c,m,v),typeof T!="function"&&(ca===null?ca=new Set([this]):ca.add(this));var H=v.stack;this.componentDidCatch(v.value,{componentStack:H!==null?H:""})})}function lA(o,c,m,v,T){if(m.flags|=32768,v!==null&&typeof v=="object"&&typeof v.then=="function"){if(c=m.alternate,c!==null&&wa(c,m,T,!0),m=di.current,m!==null){switch(m.tag){case 13:return co===null?d():m.alternate===null&&wi===0&&(wi=3),m.flags&=-257,m.flags|=65536,m.lanes=T,v===Tf?m.flags|=16384:(c=m.updateQueue,c===null?m.updateQueue=new Set([v]):c.add(v),Ce(o,v,T)),!1;case 22:return m.flags|=65536,v===Tf?m.flags|=16384:(c=m.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([v])},m.updateQueue=c):(m=c.retryQueue,m===null?c.retryQueue=new Set([v]):m.add(v)),Ce(o,v,T)),!1}throw Error(n(435,m.tag))}return Ce(o,v,T),d(),!1}if(Wn)return c=di.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=T,v!==zm&&(o=Error(n(422),{cause:v}),dc(qs(o,m)))):(v!==zm&&(c=Error(n(423),{cause:v}),dc(qs(c,m))),o=o.current.alternate,o.flags|=65536,T&=-T,o.lanes|=T,v=qs(v,m),T=og(o.stateNode,v,T),Bh(o,T),wi!==4&&(wi=2)),!1;var R=Error(n(520),{cause:v});if(R=qs(R,m),Jn===null?Jn=[R]:Jn.push(R),wi!==4&&(wi=2),c===null)return!0;v=qs(v,m),m=c;do{switch(m.tag){case 3:return m.flags|=65536,o=T&-T,m.lanes|=o,o=og(m.stateNode,v,o),Bh(m,o),!1;case 1:if(c=m.type,R=m.stateNode,(m.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||R!==null&&typeof R.componentDidCatch=="function"&&(ca===null||!ca.has(R))))return m.flags|=65536,T&=-T,m.lanes|=T,T=OS(T),lg(T,o,m,v),Bh(m,T),!1}m=m.return}while(m!==null);return!1}var IS=Error(n(461)),Ds=!1;function ts(o,c,m,v){c.child=o===null?DS(c,null,m,v):mc(c,o.child,m,v)}function Pr(o,c,m,v,T){m=m.render;var R=c.ref;if("ref"in v){var V={};for(var H in v)H!=="ref"&&(V[H]=v[H])}else V=v;return Uo(c),v=Cl(o,c,m,V,R,T),H=Xv(),o!==null&&!Ds?(Km(o,c,T),Us(o,c,T)):(Wn&&H&&Pv(c),c.flags|=1,ts(o,c,v,T),c.child)}function Or(o,c,m,v,T){if(o===null){var R=m.type;return typeof R=="function"&&!ff(R)&&R.defaultProps===void 0&&m.compare===null?(c.tag=15,c.type=R,l_(o,c,R,v,T)):(o=ws(m.type,null,v,c,c.mode,T),o.ref=c.ref,o.return=c,c.child=o)}if(R=o.child,!Uf(o,T)){var V=R.memoizedProps;if(m=m.compare,m=m!==null?m:ao,m(V,v)&&o.ref===c.ref)return Us(o,c,T)}return c.flags|=1,o=$i(R,v),o.ref=c.ref,o.return=c,c.child=o}function l_(o,c,m,v,T){if(o!==null){var R=o.memoizedProps;if(ao(R,v)&&o.ref===c.ref)if(Ds=!1,c.pendingProps=v=R,Uf(o,T))(o.flags&131072)!==0&&(Ds=!0);else return c.lanes=o.lanes,Us(o,c,T)}return Hh(o,c,m,v,T)}function yc(o,c,m){var v=c.pendingProps,T=v.children,R=o!==null?o.memoizedState:null;if(v.mode==="hidden"){if((c.flags&128)!==0){if(v=R!==null?R.baseLanes|m:m,o!==null){for(T=c.child=o.child,R=0;T!==null;)R=R|T.lanes|T.childLanes,T=T.sibling;c.childLanes=R&~v}else c.childLanes=0,c.child=null;return vc(o,c,v,m)}if((m&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},o!==null&&Sf(c,R!==null?R.cachePool:null),R!==null?Jx(c,R):Wv(),US(c);else return c.lanes=c.childLanes=536870912,vc(o,c,R!==null?R.baseLanes|m:m,m)}else R!==null?(Sf(c,R.cachePool),Jx(c,R),xu(),c.memoizedState=null):(o!==null&&Sf(c,null),Wv(),xu());return ts(o,c,T,m),c.child}function vc(o,c,m,v){var T=mu();return T=T===null?null:{parent:us._currentValue,pool:T},c.memoizedState={baseLanes:m,cachePool:T},o!==null&&Sf(c,null),Wv(),US(c),o!==null&&wa(o,c,v,!0),null}function _c(o,c){var m=c.ref;if(m===null)o!==null&&o.ref!==null&&(c.flags|=4194816);else{if(typeof m!="function"&&typeof m!="object")throw Error(n(284));(o===null||o.ref!==m)&&(c.flags|=4194816)}}function Hh(o,c,m,v,T){return Uo(c),m=Cl(o,c,m,v,void 0,T),v=Xv(),o!==null&&!Ds?(Km(o,c,T),Us(o,c,T)):(Wn&&v&&Pv(c),c.flags|=1,ts(o,c,m,T),c.child)}function ia(o,c,m,v,T,R){return Uo(c),c.updateQueue=null,m=nS(c,v,m,T),tS(o),v=Xv(),o!==null&&!Ds?(Km(o,c,R),Us(o,c,R)):(Wn&&v&&Pv(c),c.flags|=1,ts(o,c,m,R),c.child)}function sa(o,c,m,v,T){if(Uo(c),c.stateNode===null){var R=uu,V=m.contextType;typeof V=="object"&&V!==null&&(R=Xi(V)),R=new m(v,R),c.memoizedState=R.state!==null&&R.state!==void 0?R.state:null,R.updater=yr,c.stateNode=R,R._reactInternals=c,R=c.stateNode,R.props=v,R.state=c.memoizedState,R.refs={},kv(c),V=m.contextType,R.context=typeof V=="object"&&V!==null?Xi(V):uu,R.state=c.memoizedState,V=m.getDerivedStateFromProps,typeof V=="function"&&(Su(c,m,V,v),R.state=c.memoizedState),typeof m.getDerivedStateFromProps=="function"||typeof R.getSnapshotBeforeUpdate=="function"||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(V=R.state,typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount(),V!==R.state&&yr.enqueueReplaceState(R,R.state,null),Ph(c,v,R,T),Mf(),R.state=c.memoizedState),typeof R.componentDidMount=="function"&&(c.flags|=4194308),v=!0}else if(o===null){R=c.stateNode;var H=c.memoizedProps,ne=Po(m,H);R.props=ne;var Me=R.context,ke=m.contextType;V=uu,typeof ke=="object"&&ke!==null&&(V=Xi(ke));var Qe=m.getDerivedStateFromProps;ke=typeof Qe=="function"||typeof R.getSnapshotBeforeUpdate=="function",H=c.pendingProps!==H,ke||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(H||Me!==V)&&BS(c,R,v,V),Al=!1;var Ae=c.memoizedState;R.state=Ae,Ph(c,v,R,T),Mf(),Me=c.memoizedState,H||Ae!==Me||Al?(typeof Qe=="function"&&(Su(c,m,Qe,v),Me=c.memoizedState),(ne=Al||LS(c,m,ne,v,Ae,Me,V))?(ke||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(c.flags|=4194308)):(typeof R.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=v,c.memoizedState=Me),R.props=v,R.state=Me,R.context=V,v=ne):(typeof R.componentDidMount=="function"&&(c.flags|=4194308),v=!1)}else{R=c.stateNode,cn(o,c),V=c.memoizedProps,ke=Po(m,V),R.props=ke,Qe=c.pendingProps,Ae=R.context,Me=m.contextType,ne=uu,typeof Me=="object"&&Me!==null&&(ne=Xi(Me)),H=m.getDerivedStateFromProps,(Me=typeof H=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(V!==Qe||Ae!==ne)&&BS(c,R,v,ne),Al=!1,Ae=c.memoizedState,R.state=Ae,Ph(c,v,R,T),Mf();var Re=c.memoizedState;V!==Qe||Ae!==Re||Al||o!==null&&o.dependencies!==null&&yf(o.dependencies)?(typeof H=="function"&&(Su(c,m,H,v),Re=c.memoizedState),(ke=Al||LS(c,m,ke,v,Ae,Re,ne)||o!==null&&o.dependencies!==null&&yf(o.dependencies))?(Me||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(v,Re,ne),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(v,Re,ne)),typeof R.componentDidUpdate=="function"&&(c.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof R.componentDidUpdate!="function"||V===o.memoizedProps&&Ae===o.memoizedState||(c.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||V===o.memoizedProps&&Ae===o.memoizedState||(c.flags|=1024),c.memoizedProps=v,c.memoizedState=Re),R.props=v,R.state=Re,R.context=ne,v=ke):(typeof R.componentDidUpdate!="function"||V===o.memoizedProps&&Ae===o.memoizedState||(c.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||V===o.memoizedProps&&Ae===o.memoizedState||(c.flags|=1024),v=!1)}return R=v,_c(o,c),v=(c.flags&128)!==0,R||v?(R=c.stateNode,m=v&&typeof m.getDerivedStateFromError!="function"?null:R.render(),c.flags|=1,o!==null&&v?(c.child=mc(c,o.child,null,T),c.child=mc(c,null,m,T)):ts(o,c,m,T),c.memoizedState=R.state,o=c.child):o=Us(o,c,T),o}function bu(o,c,m,v){return Ch(),c.flags|=256,ts(o,c,m,v),c.child}var ho={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fo(o){return{baseLanes:o,cachePool:qm()}}function bs(o,c,m){return o=o!==null?o.childLanes&~m:0,c&&(o|=Va),o}function kh(o,c,m){var v=c.pendingProps,T=!1,R=(c.flags&128)!==0,V;if((V=R)||(V=o!==null&&o.memoizedState===null?!1:(es.current&2)!==0),V&&(T=!0,c.flags&=-129),V=(c.flags&32)!==0,c.flags&=-33,o===null){if(Wn){if(T?_u(c):xu(),Wn){var H=Vi,ne;if(ne=H){e:{for(ne=H,H=ea;ne.nodeType!==8;){if(!H){H=null;break e}if(ne=Il(ne.nextSibling),ne===null){H=null;break e}}H=ne}H!==null?(c.memoizedState={dehydrated:H,treeContext:hu!==null?{id:wo,overflow:Do}:null,retryLane:536870912,hydrationErrors:null},ne=Lr(18,null,null,0),ne.stateNode=H,ne.return=c,c.child=ne,pr=c,Vi=null,ne=!0):ne=!1}ne||du(c)}if(H=c.memoizedState,H!==null&&(H=H.dehydrated,H!==null))return bA(H)?c.lanes=32:c.lanes=536870912,null;Bo(c)}return H=v.children,v=v.fallback,T?(xu(),T=c.mode,H=xc({mode:"hidden",children:H},T),v=cu(v,T,m,null),H.return=c,v.return=c,H.sibling=v,c.child=H,T=c.child,T.memoizedState=fo(m),T.childLanes=bs(o,V,m),c.memoizedState=ho,v):(_u(c),Oo(c,H))}if(ne=o.memoizedState,ne!==null&&(H=ne.dehydrated,H!==null)){if(R)c.flags&256?(_u(c),c.flags&=-257,c=Ys(o,c,m)):c.memoizedState!==null?(xu(),c.child=o.child,c.flags|=128,c=null):(xu(),T=v.fallback,H=c.mode,v=xc({mode:"visible",children:v.children},H),T=cu(T,H,m,null),T.flags|=2,v.return=c,T.return=c,v.sibling=T,c.child=v,mc(c,o.child,null,m),v=c.child,v.memoizedState=fo(m),v.childLanes=bs(o,V,m),c.memoizedState=ho,c=T);else if(_u(c),bA(H)){if(V=H.nextSibling&&H.nextSibling.dataset,V)var Me=V.dgst;V=Me,v=Error(n(419)),v.stack="",v.digest=V,dc({value:v,source:null,stack:null}),c=Ys(o,c,m)}else if(Ds||wa(o,c,m,!1),V=(m&o.childLanes)!==0,Ds||V){if(V=gn,V!==null&&(v=m&-m,v=(v&42)!==0?1:nn(v),v=(v&(V.suspendedLanes|m))!==0?0:v,v!==0&&v!==ne.retryLane))throw ne.retryLane=v,bl(o,v),_r(V,o,v),IS;H.data==="$?"||d(),c=Ys(o,c,m)}else H.data==="$?"?(c.flags|=192,c.child=o.child,c=null):(o=ne.treeContext,Vi=Il(H.nextSibling),pr=c,Wn=!0,Ca=null,ea=!1,o!==null&&(Ws[Jr++]=wo,Ws[Jr++]=Do,Ws[Jr++]=hu,wo=o.id,Do=o.overflow,hu=c),c=Oo(c,v.children),c.flags|=4096);return c}return T?(xu(),T=v.fallback,H=c.mode,ne=o.child,Me=ne.sibling,v=$i(ne,{mode:"hidden",children:v.children}),v.subtreeFlags=ne.subtreeFlags&65011712,Me!==null?T=$i(Me,T):(T=cu(T,H,m,null),T.flags|=2),T.return=c,v.return=c,v.sibling=T,c.child=v,v=T,T=c.child,H=o.child.memoizedState,H===null?H=fo(m):(ne=H.cachePool,ne!==null?(Me=us._currentValue,ne=ne.parent!==Me?{parent:Me,pool:Me}:ne):ne=qm(),H={baseLanes:H.baseLanes|m,cachePool:ne}),T.memoizedState=H,T.childLanes=bs(o,V,m),c.memoizedState=ho,v):(_u(c),m=o.child,o=m.sibling,m=$i(m,{mode:"visible",children:v.children}),m.return=c,m.sibling=null,o!==null&&(V=c.deletions,V===null?(c.deletions=[o],c.flags|=16):V.push(o)),c.child=m,c.memoizedState=null,m)}function Oo(o,c){return c=xc({mode:"visible",children:c},o.mode),c.return=o,o.child=c}function xc(o,c){return o=Lr(22,o,null,c),o.lanes=0,o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},o}function Ys(o,c,m){return mc(c,o.child,null,m),o=Oo(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function js(o,c,m){o.lanes|=c;var v=o.alternate;v!==null&&(v.lanes|=c),Vv(o.return,c,m)}function Gn(o,c,m,v,T){var R=o.memoizedState;R===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:v,tail:m,tailMode:T}:(R.isBackwards=c,R.rendering=null,R.renderingStartTime=0,R.last=v,R.tail=m,R.tailMode=T)}function Pa(o,c,m){var v=c.pendingProps,T=v.revealOrder,R=v.tail;if(ts(o,c,v.children,m),v=es.current,(v&2)!==0)v=v&1|2,c.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&js(o,m,c);else if(o.tag===19)js(o,m,c);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}v&=1}switch(Ie(es,v),T){case"forwards":for(m=c.child,T=null;m!==null;)o=m.alternate,o!==null&&Dl(o)===null&&(T=m),m=m.sibling;m=T,m===null?(T=c.child,c.child=null):(T=m.sibling,m.sibling=null),Gn(c,!1,T,m,R);break;case"backwards":for(m=null,T=c.child,c.child=null;T!==null;){if(o=T.alternate,o!==null&&Dl(o)===null){c.child=T;break}o=T.sibling,T.sibling=m,m=T,T=o}Gn(c,!0,m,null,R);break;case"together":Gn(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Us(o,c,m){if(o!==null&&(c.dependencies=o.dependencies),yo|=c.lanes,(m&c.childLanes)===0)if(o!==null){if(wa(o,c,m,!1),(m&c.childLanes)===0)return null}else return null;if(o!==null&&c.child!==o.child)throw Error(n(153));if(c.child!==null){for(o=c.child,m=$i(o,o.pendingProps),c.child=m,m.return=c;o.sibling!==null;)o=o.sibling,m=m.sibling=$i(o,o.pendingProps),m.return=c;m.sibling=null}return c.child}function Uf(o,c){return(o.lanes&c)!==0?!0:(o=o.dependencies,!!(o!==null&&yf(o)))}function Oa(o,c,m){switch(c.tag){case 3:tt(c,c.stateNode.containerInfo),pu(c,us,o.memoizedState.cache),Ch();break;case 27:case 5:Ct(c);break;case 4:tt(c,c.stateNode.containerInfo);break;case 10:pu(c,c.type,c.memoizedProps.value);break;case 13:var v=c.memoizedState;if(v!==null)return v.dehydrated!==null?(_u(c),c.flags|=128,null):(m&c.child.childLanes)!==0?kh(o,c,m):(_u(c),o=Us(o,c,m),o!==null?o.sibling:null);_u(c);break;case 19:var T=(o.flags&128)!==0;if(v=(m&c.childLanes)!==0,v||(wa(o,c,m,!1),v=(m&c.childLanes)!==0),T){if(v)return Pa(o,c,m);c.flags|=128}if(T=c.memoizedState,T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),Ie(es,es.current),v)break;return null;case 22:case 23:return c.lanes=0,yc(o,c,m);case 24:pu(c,us,o.memoizedState.cache)}return Us(o,c,m)}function Sc(o,c,m){if(o!==null)if(o.memoizedProps!==c.pendingProps)Ds=!0;else{if(!Uf(o,m)&&(c.flags&128)===0)return Ds=!1,Oa(o,c,m);Ds=(o.flags&131072)!==0}else Ds=!1,Wn&&(c.flags&1048576)!==0&&Vm(c,Nh,c.index);switch(c.lanes=0,c.tag){case 16:e:{o=c.pendingProps;var v=c.elementType,T=v._init;if(v=T(v._payload),c.type=v,typeof v=="function")ff(v)?(o=Po(v,o),c.tag=1,c=sa(null,c,v,o,m)):(c.tag=0,c=Hh(null,c,v,o,m));else{if(v!=null){if(T=v.$$typeof,T===D){c.tag=11,c=Pr(null,c,v,o,m);break e}else if(T===F){c.tag=14,c=Or(null,c,v,o,m);break e}}throw c=fe(v)||v,Error(n(306,c,""))}}return c;case 0:return Hh(o,c,c.type,c.pendingProps,m);case 1:return v=c.type,T=Po(v,c.pendingProps),sa(o,c,v,T,m);case 3:e:{if(tt(c,c.stateNode.containerInfo),o===null)throw Error(n(387));v=c.pendingProps;var R=c.memoizedState;T=R.element,cn(o,c),Ph(c,v,null,m);var V=c.memoizedState;if(v=V.cache,pu(c,us,v),v!==R.cache&&gf(c,[us],m,!0),Mf(),v=V.element,R.isDehydrated)if(R={element:v,isDehydrated:!1,cache:V.cache},c.updateQueue.baseState=R,c.memoizedState=R,c.flags&256){c=bu(o,c,v,m);break e}else if(v!==T){T=qs(Error(n(424)),c),dc(T),c=bu(o,c,v,m);break e}else{switch(o=c.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(Vi=Il(o.firstChild),pr=c,Wn=!0,Ca=null,ea=!0,m=DS(c,null,v,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling}else{if(Ch(),v===T){c=Us(o,c,m);break e}ts(o,c,v,m)}c=c.child}return c;case 26:return _c(o,c),o===null?(m=O2(c.type,null,c.pendingProps,null))?c.memoizedState=m:Wn||(m=c.type,o=c.pendingProps,v=kS(xe.current).createElement(m),v[os]=c,v[Oi]=o,xr(v,m,o),ls(v),c.stateNode=v):c.memoizedState=O2(c.type,o.memoizedProps,c.pendingProps,o.memoizedState),null;case 27:return Ct(c),o===null&&Wn&&(v=c.stateNode=L2(c.type,c.pendingProps,xe.current),pr=c,ea=!0,T=Vi,Jh(c.type)?(TA=T,Vi=Il(v.firstChild)):Vi=T),ts(o,c,c.pendingProps.children,m),_c(o,c),o===null&&(c.flags|=4194304),c.child;case 5:return o===null&&Wn&&((T=v=Vi)&&(v=oG(v,c.type,c.pendingProps,ea),v!==null?(c.stateNode=v,pr=c,Vi=Il(v.firstChild),ea=!1,T=!0):T=!1),T||du(c)),Ct(c),T=c.type,R=c.pendingProps,V=o!==null?o.memoizedProps:null,v=R.children,_A(T,R)?v=null:V!==null&&_A(T,V)&&(c.flags|=32),c.memoizedState!==null&&(T=Cl(o,c,nA,null,null,m),__._currentValue=T),_c(o,c),ts(o,c,v,m),c.child;case 6:return o===null&&Wn&&((o=m=Vi)&&(m=lG(m,c.pendingProps,ea),m!==null?(c.stateNode=m,pr=c,Vi=null,o=!0):o=!1),o||du(c)),null;case 13:return kh(o,c,m);case 4:return tt(c,c.stateNode.containerInfo),v=c.pendingProps,o===null?c.child=mc(c,null,v,m):ts(o,c,v,m),c.child;case 11:return Pr(o,c,c.type,c.pendingProps,m);case 7:return ts(o,c,c.pendingProps,m),c.child;case 8:return ts(o,c,c.pendingProps.children,m),c.child;case 12:return ts(o,c,c.pendingProps.children,m),c.child;case 10:return v=c.pendingProps,pu(c,c.type,v.value),ts(o,c,v.children,m),c.child;case 9:return T=c.type._context,v=c.pendingProps.children,Uo(c),T=Xi(T),v=v(T),c.flags|=1,ts(o,c,v,m),c.child;case 14:return Or(o,c,c.type,c.pendingProps,m);case 15:return l_(o,c,c.type,c.pendingProps,m);case 19:return Pa(o,c,m);case 31:return v=c.pendingProps,m=c.mode,v={mode:v.mode,children:v.children},o===null?(m=xc(v,m),m.ref=c.ref,c.child=m,m.return=c,c=m):(m=$i(o.child,v),m.ref=c.ref,c.child=m,m.return=c,c=m),c;case 22:return yc(o,c,m);case 24:return Uo(c),v=Xi(us),o===null?(T=mu(),T===null&&(T=gn,R=Hm(),T.pooledCache=R,R.refCount++,R!==null&&(T.pooledCacheLanes|=m),T=R),c.memoizedState={parent:v,cache:T},kv(c),pu(c,us,T)):((o.lanes&m)!==0&&(cn(o,c),Ph(c,null,null,m),Mf()),T=o.memoizedState,R=c.memoizedState,T.parent!==v?(T={parent:v,cache:v},c.memoizedState=T,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=T),pu(c,us,v)):(v=R.cache,pu(c,us,v),v!==T.cache&&gf(c,[us],m,!0))),ts(o,c,c.pendingProps.children,m),c.child;case 29:throw c.pendingProps}throw Error(n(156,c.tag))}function po(o){o.flags|=4}function Lf(o,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!G2(c)){if(c=di.current,c!==null&&((Qt&4194048)===Qt?co!==null:(Qt&62914560)!==Qt&&(Qt&536870912)===0||c!==co))throw Ua=Tf,Gv;o.flags|=8192}}function Ul(o,c){c!==null&&(o.flags|=4),o.flags&16384&&(c=o.tag!==22?at():536870912,o.lanes|=c,qn|=c)}function bc(o,c){if(!Wn)switch(o.tailMode){case"hidden":c=o.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?o.tail=null:m.sibling=null;break;case"collapsed":m=o.tail;for(var v=null;m!==null;)m.alternate!==null&&(v=m),m=m.sibling;v===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:v.sibling=null}}function xi(o){var c=o.alternate!==null&&o.alternate.child===o.child,m=0,v=0;if(c)for(var T=o.child;T!==null;)m|=T.lanes|T.childLanes,v|=T.subtreeFlags&65011712,v|=T.flags&65011712,T.return=o,T=T.sibling;else for(T=o.child;T!==null;)m|=T.lanes|T.childLanes,v|=T.subtreeFlags,v|=T.flags,T.return=o,T=T.sibling;return o.subtreeFlags|=v,o.childLanes=m,c}function u_(o,c,m){var v=c.pendingProps;switch(Ov(c),c.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xi(c),null;case 1:return xi(c),null;case 3:return m=c.stateNode,v=null,o!==null&&(v=o.memoizedState.cache),c.memoizedState.cache!==v&&(c.flags|=2048),El(us),Mt(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(o===null||o.child===null)&&(oo(c)?po(c):o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Qn())),xi(c),null;case 26:return m=c.memoizedState,o===null?(po(c),m!==null?(xi(c),Lf(c,m)):(xi(c),c.flags&=-16777217)):m?m!==o.memoizedState?(po(c),xi(c),Lf(c,m)):(xi(c),c.flags&=-16777217):(o.memoizedProps!==v&&po(c),xi(c),c.flags&=-16777217),null;case 27:rn(c),m=xe.current;var T=c.type;if(o!==null&&c.stateNode!=null)o.memoizedProps!==v&&po(c);else{if(!v){if(c.stateNode===null)throw Error(n(166));return xi(c),null}o=Ze.current,oo(c)?Kx(c):(o=L2(T,v,m),c.stateNode=o,po(c))}return xi(c),null;case 5:if(rn(c),m=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==v&&po(c);else{if(!v){if(c.stateNode===null)throw Error(n(166));return xi(c),null}if(o=Ze.current,oo(c))Kx(c);else{switch(T=kS(xe.current),o){case 1:o=T.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:o=T.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":o=T.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":o=T.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":o=T.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof v.is=="string"?T.createElement("select",{is:v.is}):T.createElement("select"),v.multiple?o.multiple=!0:v.size&&(o.size=v.size);break;default:o=typeof v.is=="string"?T.createElement(m,{is:v.is}):T.createElement(m)}}o[os]=c,o[Oi]=v;e:for(T=c.child;T!==null;){if(T.tag===5||T.tag===6)o.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===c)break e;for(;T.sibling===null;){if(T.return===null||T.return===c)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}c.stateNode=o;e:switch(xr(o,m,v),m){case"button":case"input":case"select":case"textarea":o=!!v.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&po(c)}}return xi(c),c.flags&=-16777217,null;case 6:if(o&&c.stateNode!=null)o.memoizedProps!==v&&po(c);else{if(typeof v!="string"&&c.stateNode===null)throw Error(n(166));if(o=xe.current,oo(c)){if(o=c.stateNode,m=c.memoizedProps,v=null,T=pr,T!==null)switch(T.tag){case 27:case 5:v=T.memoizedProps}o[os]=c,o=!!(o.nodeValue===m||v!==null&&v.suppressHydrationWarning===!0||A2(o.nodeValue,m)),o||du(c)}else o=kS(o).createTextNode(v),o[os]=c,c.stateNode=o}return xi(c),null;case 13:if(v=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(T=oo(c),v!==null&&v.dehydrated!==null){if(o===null){if(!T)throw Error(n(318));if(T=c.memoizedState,T=T!==null?T.dehydrated:null,!T)throw Error(n(317));T[os]=c}else Ch(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;xi(c),T=!1}else T=Qn(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=T),T=!0;if(!T)return c.flags&256?(Bo(c),c):(Bo(c),null)}if(Bo(c),(c.flags&128)!==0)return c.lanes=m,c;if(m=v!==null,o=o!==null&&o.memoizedState!==null,m){v=c.child,T=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(T=v.alternate.memoizedState.cachePool.pool);var R=null;v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(R=v.memoizedState.cachePool.pool),R!==T&&(v.flags|=2048)}return m!==o&&m&&(c.child.flags|=8192),Ul(c,c.updateQueue),xi(c),null;case 4:return Mt(),o===null&&pA(c.stateNode.containerInfo),xi(c),null;case 10:return El(c.type),xi(c),null;case 19:if(we(es),T=c.memoizedState,T===null)return xi(c),null;if(v=(c.flags&128)!==0,R=T.rendering,R===null)if(v)bc(T,!1);else{if(wi!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(R=Dl(o),R!==null){for(c.flags|=128,bc(T,!1),o=R.updateQueue,c.updateQueue=o,Ul(c,o),c.subtreeFlags=0,o=m,m=c.child;m!==null;)Bv(m,o),m=m.sibling;return Ie(es,es.current&1|2),c.child}o=o.sibling}T.tail!==null&&Be()>ir&&(c.flags|=128,v=!0,bc(T,!1),c.lanes=4194304)}else{if(!v)if(o=Dl(R),o!==null){if(c.flags|=128,v=!0,o=o.updateQueue,c.updateQueue=o,Ul(c,o),bc(T,!0),T.tail===null&&T.tailMode==="hidden"&&!R.alternate&&!Wn)return xi(c),null}else 2*Be()-T.renderingStartTime>ir&&m!==536870912&&(c.flags|=128,v=!0,bc(T,!1),c.lanes=4194304);T.isBackwards?(R.sibling=c.child,c.child=R):(o=T.last,o!==null?o.sibling=R:c.child=R,T.last=R)}return T.tail!==null?(c=T.tail,T.rendering=c,T.tail=c.sibling,T.renderingStartTime=Be(),c.sibling=null,o=es.current,Ie(es,v?o&1|2:o&1),c):(xi(c),null);case 22:case 23:return Bo(c),Ef(),v=c.memoizedState!==null,o!==null?o.memoizedState!==null!==v&&(c.flags|=8192):v&&(c.flags|=8192),v?(m&536870912)!==0&&(c.flags&128)===0&&(xi(c),c.subtreeFlags&6&&(c.flags|=8192)):xi(c),m=c.updateQueue,m!==null&&Ul(c,m.retryQueue),m=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),v=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(v=c.memoizedState.cachePool.pool),v!==m&&(c.flags|=2048),o!==null&&we(Da),null;case 24:return m=null,o!==null&&(m=o.memoizedState.cache),c.memoizedState.cache!==m&&(c.flags|=2048),El(us),xi(c),null;case 25:return null;case 30:return null}throw Error(n(156,c.tag))}function qh(o,c){switch(Ov(c),c.tag){case 1:return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return El(us),Mt(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 26:case 27:case 5:return rn(c),null;case 13:if(Bo(c),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(n(340));Ch()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return we(es),null;case 4:return Mt(),null;case 10:return El(c.type),null;case 22:case 23:return Bo(c),Ef(),o!==null&&we(Da),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 24:return El(us),null;case 25:return null;default:return null}}function Wh(o,c){switch(Ov(c),c.tag){case 3:El(us),Mt();break;case 26:case 27:case 5:rn(c);break;case 4:Mt();break;case 13:Bo(c);break;case 19:we(es);break;case 10:El(c.type);break;case 22:case 23:Bo(c),Ef(),o!==null&&we(Da);break;case 24:El(us)}}function Tc(o,c){try{var m=c.updateQueue,v=m!==null?m.lastEffect:null;if(v!==null){var T=v.next;m=T;do{if((m.tag&o)===o){v=void 0;var R=m.create,V=m.inst;v=R(),V.destroy=v}m=m.next}while(m!==T)}}catch(H){ue(c,c.return,H)}}function ra(o,c,m){try{var v=c.updateQueue,T=v!==null?v.lastEffect:null;if(T!==null){var R=T.next;v=R;do{if((v.tag&o)===o){var V=v.inst,H=V.destroy;if(H!==void 0){V.destroy=void 0,T=c;var ne=m,Me=H;try{Me()}catch(ke){ue(T,ne,ke)}}}v=v.next}while(v!==R)}}catch(ke){ue(c,c.return,ke)}}function Mc(o){var c=o.updateQueue;if(c!==null){var m=o.stateNode;try{$x(c,m)}catch(v){ue(o,o.return,v)}}}function Ll(o,c,m){m.props=Po(o.type,o.memoizedProps),m.state=o.memoizedState;try{m.componentWillUnmount()}catch(v){ue(o,c,v)}}function Ec(o,c){try{var m=o.ref;if(m!==null){switch(o.tag){case 26:case 27:case 5:var v=o.stateNode;break;case 30:v=o.stateNode;break;default:v=o.stateNode}typeof m=="function"?o.refCleanup=m(v):m.current=v}}catch(T){ue(o,c,T)}}function Io(o,c){var m=o.ref,v=o.refCleanup;if(m!==null)if(typeof v=="function")try{v()}catch(T){ue(o,c,T)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(T){ue(o,c,T)}else m.current=null}function Xh(o){var c=o.type,m=o.memoizedProps,v=o.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":m.autoFocus&&v.focus();break e;case"img":m.src?v.src=m.src:m.srcSet&&(v.srcset=m.srcSet)}}catch(T){ue(o,o.return,T)}}function Bf(o,c,m){try{var v=o.stateNode;nG(v,o.type,m,c),v[Oi]=c}catch(T){ue(o,o.return,T)}}function Pf(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Jh(o.type)||o.tag===4}function Tu(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Pf(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Jh(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Mu(o,c,m){var v=o.tag;if(v===5||v===6)o=o.stateNode,c?(m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m).insertBefore(o,c):(c=m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m,c.appendChild(o),m=m._reactRootContainer,m!=null||c.onclick!==null||(c.onclick=HS));else if(v!==4&&(v===27&&Jh(o.type)&&(m=o.stateNode,c=null),o=o.child,o!==null))for(Mu(o,c,m),o=o.sibling;o!==null;)Mu(o,c,m),o=o.sibling}function Eu(o,c,m){var v=o.tag;if(v===5||v===6)o=o.stateNode,c?m.insertBefore(o,c):m.appendChild(o);else if(v!==4&&(v===27&&Jh(o.type)&&(m=o.stateNode),o=o.child,o!==null))for(Eu(o,c,m),o=o.sibling;o!==null;)Eu(o,c,m),o=o.sibling}function Au(o){var c=o.stateNode,m=o.memoizedProps;try{for(var v=o.type,T=c.attributes;T.length;)c.removeAttributeNode(T[0]);xr(c,v,m),c[os]=o,c[Oi]=m}catch(R){ue(o,o.return,R)}}var Fo=!1,Si=!1,Yh=!1,aa=typeof WeakSet=="function"?WeakSet:Set,fi=null;function Ts(o,c){if(o=o.containerInfo,yA=KS,o=Rv(o),uf(o)){if("selectionStart"in o)var m={start:o.selectionStart,end:o.selectionEnd};else e:{m=(m=o.ownerDocument)&&m.defaultView||window;var v=m.getSelection&&m.getSelection();if(v&&v.rangeCount!==0){m=v.anchorNode;var T=v.anchorOffset,R=v.focusNode;v=v.focusOffset;try{m.nodeType,R.nodeType}catch{m=null;break e}var V=0,H=-1,ne=-1,Me=0,ke=0,Qe=o,Ae=null;t:for(;;){for(var Re;Qe!==m||T!==0&&Qe.nodeType!==3||(H=V+T),Qe!==R||v!==0&&Qe.nodeType!==3||(ne=V+v),Qe.nodeType===3&&(V+=Qe.nodeValue.length),(Re=Qe.firstChild)!==null;)Ae=Qe,Qe=Re;for(;;){if(Qe===o)break t;if(Ae===m&&++Me===T&&(H=V),Ae===R&&++ke===v&&(ne=V),(Re=Qe.nextSibling)!==null)break;Qe=Ae,Ae=Qe.parentNode}Qe=Re}m=H===-1||ne===-1?null:{start:H,end:ne}}else m=null}m=m||{start:0,end:0}}else m=null;for(vA={focusedElem:o,selectionRange:m},KS=!1,fi=c;fi!==null;)if(c=fi,o=c.child,(c.subtreeFlags&1024)!==0&&o!==null)o.return=c,fi=o;else for(;fi!==null;){switch(c=fi,R=c.alternate,o=c.flags,c.tag){case 0:break;case 11:case 15:break;case 1:if((o&1024)!==0&&R!==null){o=void 0,m=c,T=R.memoizedProps,R=R.memoizedState,v=m.stateNode;try{var fn=Po(m.type,T,m.elementType===m.type);o=v.getSnapshotBeforeUpdate(fn,R),v.__reactInternalSnapshotBeforeUpdate=o}catch(an){ue(m,m.return,an)}}break;case 3:if((o&1024)!==0){if(o=c.stateNode.containerInfo,m=o.nodeType,m===9)SA(o);else if(m===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":SA(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(n(163))}if(o=c.sibling,o!==null){o.return=c.return,fi=o;break}fi=c.return}}function Bl(o,c,m){var v=m.flags;switch(m.tag){case 0:case 11:case 15:vr(o,m),v&4&&Tc(5,m);break;case 1:if(vr(o,m),v&4)if(o=m.stateNode,c===null)try{o.componentDidMount()}catch(V){ue(m,m.return,V)}else{var T=Po(m.type,c.memoizedProps);c=c.memoizedState;try{o.componentDidUpdate(T,c,o.__reactInternalSnapshotBeforeUpdate)}catch(V){ue(m,m.return,V)}}v&64&&Mc(m),v&512&&Ec(m,m.return);break;case 3:if(vr(o,m),v&64&&(o=m.updateQueue,o!==null)){if(c=null,m.child!==null)switch(m.child.tag){case 27:case 5:c=m.child.stateNode;break;case 1:c=m.child.stateNode}try{$x(o,c)}catch(V){ue(m,m.return,V)}}break;case 27:c===null&&v&4&&Au(m);case 26:case 5:vr(o,m),c===null&&v&4&&Xh(m),v&512&&Ec(m,m.return);break;case 12:vr(o,m);break;case 13:vr(o,m),v&4&&Ru(o,m),v&64&&(o=m.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(m=Di.bind(null,m),uG(o,m))));break;case 22:if(v=m.memoizedState!==null||Fo,!v){c=c!==null&&c.memoizedState!==null||Si,T=Fo;var R=Si;Fo=v,(Si=c)&&!R?Vo(o,m,(m.subtreeFlags&8772)!==0):vr(o,m),Fo=T,Si=R}break;case 30:break;default:vr(o,m)}}function En(o){var c=o.alternate;c!==null&&(o.alternate=null,En(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&_i(c)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Jt=null,kn=!1;function Ia(o,c,m){for(m=m.child;m!==null;)Ac(o,c,m),m=m.sibling}function Ac(o,c,m){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(De,m)}catch{}switch(m.tag){case 26:Si||Io(m,c),Ia(o,c,m),m.memoizedState?m.memoizedState.count--:m.stateNode&&(m=m.stateNode,m.parentNode.removeChild(m));break;case 27:Si||Io(m,c);var v=Jt,T=kn;Jh(m.type)&&(Jt=m.stateNode,kn=!1),Ia(o,c,m),m_(m.stateNode),Jt=v,kn=T;break;case 5:Si||Io(m,c);case 6:if(v=Jt,T=kn,Jt=null,Ia(o,c,m),Jt=v,kn=T,Jt!==null)if(kn)try{(Jt.nodeType===9?Jt.body:Jt.nodeName==="HTML"?Jt.ownerDocument.body:Jt).removeChild(m.stateNode)}catch(R){ue(m,c,R)}else try{Jt.removeChild(m.stateNode)}catch(R){ue(m,c,R)}break;case 18:Jt!==null&&(kn?(o=Jt,D2(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,m.stateNode),T_(o)):D2(Jt,m.stateNode));break;case 4:v=Jt,T=kn,Jt=m.stateNode.containerInfo,kn=!0,Ia(o,c,m),Jt=v,kn=T;break;case 0:case 11:case 14:case 15:Si||ra(2,m,c),Si||ra(4,m,c),Ia(o,c,m);break;case 1:Si||(Io(m,c),v=m.stateNode,typeof v.componentWillUnmount=="function"&&Ll(m,c,v)),Ia(o,c,m);break;case 21:Ia(o,c,m);break;case 22:Si=(v=Si)||m.memoizedState!==null,Ia(o,c,m),Si=v;break;default:Ia(o,c,m)}}function Ru(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{T_(o)}catch(m){ue(c,c.return,m)}}function ug(o){switch(o.tag){case 13:case 19:var c=o.stateNode;return c===null&&(c=o.stateNode=new aa),c;case 22:return o=o.stateNode,c=o._retryCache,c===null&&(c=o._retryCache=new aa),c;default:throw Error(n(435,o.tag))}}function Rc(o,c){var m=ug(o);c.forEach(function(v){var T=hn.bind(null,o,v);m.has(v)||(m.add(v),v.then(T,T))})}
vendor: 5,154 bytes, line 48
48function Ls(o,c){var m=c.deletions;if(m!==null)for(var v=0;v<m.length;v++){var T=m[v],R=o,V=c,H=V;e:for(;H!==null;){switch(H.tag){case 27:if(Jh(H.type)){Jt=H.stateNode,kn=!1;break e}break;case 5:Jt=H.stateNode,kn=!1;break e;case 3:case 4:Jt=H.stateNode.containerInfo,kn=!0;break e}H=H.return}if(Jt===null)throw Error(n(160));Ac(R,V,T),Jt=null,kn=!1,R=T.alternate,R!==null&&(R.return=null),T.return=null}if(c.subtreeFlags&13878)for(c=c.child;c!==null;)cg(c,o),c=c.sibling}var mo=null;function cg(o,c){var m=o.alternate,v=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Ls(c,o),Yi(o),v&4&&(ra(3,o,o.return),Tc(3,o),ra(5,o,o.return));break;case 1:Ls(c,o),Yi(o),v&512&&(Si||m===null||Io(m,m.return)),v&64&&Fo&&(o=o.updateQueue,o!==null&&(v=o.callbacks,v!==null&&(m=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=m===null?v:m.concat(v))));break;case 26:var T=mo;if(Ls(c,o),Yi(o),v&512&&(Si||m===null||Io(m,m.return)),v&4){var R=m!==null?m.memoizedState:null;if(v=o.memoizedState,m===null)if(v===null)if(o.stateNode===null){e:{v=o.type,m=o.memoizedProps,T=T.ownerDocument||T;t:switch(v){case"title":R=T.getElementsByTagName("title")[0],(!R||R[$r]||R[os]||R.namespaceURI==="http://www.w3.org/2000/svg"||R.hasAttribute("itemprop"))&&(R=T.createElement(v),T.head.insertBefore(R,T.querySelector("head > title"))),xr(R,v,m),R[os]=o,ls(R),v=R;break e;case"link":var V=V2("link","href",T).get(v+(m.href||""));if(V){for(var H=0;H<V.length;H++)if(R=V[H],R.getAttribute("href")===(m.href==null||m.href===""?null:m.href)&&R.getAttribute("rel")===(m.rel==null?null:m.rel)&&R.getAttribute("title")===(m.title==null?null:m.title)&&R.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){V.splice(H,1);break t}}R=T.createElement(v),xr(R,v,m),T.head.appendChild(R);break;case"meta":if(V=V2("meta","content",T).get(v+(m.content||""))){for(H=0;H<V.length;H++)if(R=V[H],R.getAttribute("content")===(m.content==null?null:""+m.content)&&R.getAttribute("name")===(m.name==null?null:m.name)&&R.getAttribute("property")===(m.property==null?null:m.property)&&R.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&R.getAttribute("charset")===(m.charSet==null?null:m.charSet)){V.splice(H,1);break t}}R=T.createElement(v),xr(R,v,m),T.head.appendChild(R);break;default:throw Error(n(468,v))}R[os]=o,ls(R),v=R}o.stateNode=v}else z2(T,o.type,o.stateNode);else o.stateNode=F2(T,v,o.memoizedProps);else R!==v?(R===null?m.stateNode!==null&&(m=m.stateNode,m.parentNode.removeChild(m)):R.count--,v===null?z2(T,o.type,o.stateNode):F2(T,v,o.memoizedProps)):v===null&&o.stateNode!==null&&Bf(o,o.memoizedProps,m.memoizedProps)}break;case 27:Ls(c,o),Yi(o),v&512&&(Si||m===null||Io(m,m.return)),m!==null&&v&4&&Bf(o,o.memoizedProps,m.memoizedProps);break;case 5:if(Ls(c,o),Yi(o),v&512&&(Si||m===null||Io(m,m.return)),o.flags&32){T=o.stateNode;try{xs(T,"")}catch(Re){ue(o,o.return,Re)}}v&4&&o.stateNode!=null&&(T=o.memoizedProps,Bf(o,T,m!==null?m.memoizedProps:T)),v&1024&&(Yh=!0);break;case 6:if(Ls(c,o),Yi(o),v&4){if(o.stateNode===null)throw Error(n(162));v=o.memoizedProps,m=o.stateNode;try{m.nodeValue=v}catch(Re){ue(o,o.return,Re)}}break;case 3:if(XS=null,T=mo,mo=qS(c.containerInfo),Ls(c,o),mo=T,Yi(o),v&4&&m!==null&&m.memoizedState.isDehydrated)try{T_(c.containerInfo)}catch(Re){ue(o,o.return,Re)}Yh&&(Yh=!1,Nu(o));break;case 4:v=mo,mo=qS(o.stateNode.containerInfo),Ls(c,o),Yi(o),mo=v;break;case 12:Ls(c,o),Yi(o);break;case 13:Ls(c,o),Yi(o),o.child.flags&8192&&o.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(oi=Be()),v&4&&(v=o.updateQueue,v!==null&&(o.updateQueue=null,Rc(o,v)));break;case 22:T=o.memoizedState!==null;var ne=m!==null&&m.memoizedState!==null,Me=Fo,ke=Si;if(Fo=Me||T,Si=ke||ne,Ls(c,o),Si=ke,Fo=Me,Yi(o),v&8192)e:for(c=o.stateNode,c._visibility=T?c._visibility&-2:c._visibility|1,T&&(m===null||ne||Fo||Si||oa(o)),m=null,c=o;;){if(c.tag===5||c.tag===26){if(m===null){ne=m=c;try{if(R=ne.stateNode,T)V=R.style,typeof V.setProperty=="function"?V.setProperty("display","none","important"):V.display="none";else{H=ne.stateNode;var Qe=ne.memoizedProps.style,Ae=Qe!=null&&Qe.hasOwnProperty("display")?Qe.display:null;H.style.display=Ae==null||typeof Ae=="boolean"?"":(""+Ae).trim()}}catch(Re){ue(ne,ne.return,Re)}}}else if(c.tag===6){if(m===null){ne=c;try{ne.stateNode.nodeValue=T?"":ne.memoizedProps}catch(Re){ue(ne,ne.return,Re)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===o)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break e;for(;c.sibling===null;){if(c.return===null||c.return===o)break e;m===c&&(m=null),c=c.return}m===c&&(m=null),c.sibling.return=c.return,c=c.sibling}v&4&&(v=o.updateQueue,v!==null&&(m=v.retryQueue,m!==null&&(v.retryQueue=null,Rc(o,m))));break;case 19:Ls(c,o),Yi(o),v&4&&(v=o.updateQueue,v!==null&&(o.updateQueue=null,Rc(o,v)));break;case 30:break;case 21:break;default:Ls(c,o),Yi(o)}}function Yi(o){var c=o.flags;if(c&2){try{for(var m,v=o.return;v!==null;){if(Pf(v)){m=v;break}v=v.return}if(m==null)throw Error(n(160));switch(m.tag){case 27:var T=m.stateNode,R=Tu(o);Eu(o,R,T);break;case 5:var V=m.stateNode;m.flags&32&&(xs(V,""),m.flags&=-33);var H=Tu(o);Eu(o,H,V);break;
vendor: 18,812 bytes, line 48
48case 3:case 4:var ne=m.stateNode.containerInfo,Me=Tu(o);Mu(o,Me,ne);break;default:throw Error(n(161))}}catch(ke){ue(o,o.return,ke)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function Nu(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var c=o;Nu(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),o=o.sibling}}function vr(o,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)Bl(o,c.alternate,c),c=c.sibling}function oa(o){for(o=o.child;o!==null;){var c=o;switch(c.tag){case 0:case 11:case 14:case 15:ra(4,c,c.return),oa(c);break;case 1:Io(c,c.return);var m=c.stateNode;typeof m.componentWillUnmount=="function"&&Ll(c,c.return,m),oa(c);break;case 27:m_(c.stateNode);case 26:case 5:Io(c,c.return),oa(c);break;case 22:c.memoizedState===null&&oa(c);break;case 30:oa(c);break;default:oa(c)}o=o.sibling}}function Vo(o,c,m){for(m=m&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var v=c.alternate,T=o,R=c,V=R.flags;switch(R.tag){case 0:case 11:case 15:Vo(T,R,m),Tc(4,R);break;case 1:if(Vo(T,R,m),v=R,T=v.stateNode,typeof T.componentDidMount=="function")try{T.componentDidMount()}catch(Me){ue(v,v.return,Me)}if(v=R,T=v.updateQueue,T!==null){var H=v.stateNode;try{var ne=T.shared.hiddenCallbacks;if(ne!==null)for(T.shared.hiddenCallbacks=null,T=0;T<ne.length;T++)Oh(ne[T],H)}catch(Me){ue(v,v.return,Me)}}m&&V&64&&Mc(R),Ec(R,R.return);break;case 27:Au(R);case 26:case 5:Vo(T,R,m),m&&v===null&&V&4&&Xh(R),Ec(R,R.return);break;case 12:Vo(T,R,m);break;case 13:Vo(T,R,m),m&&V&4&&Ru(T,R);break;case 22:R.memoizedState===null&&Vo(T,R,m),Ec(R,R.return);break;case 30:break;default:Vo(T,R,m)}c=c.sibling}}function hg(o,c){var m=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),o=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(o=c.memoizedState.cachePool.pool),o!==m&&(o!=null&&o.refCount++,m!=null&&wh(m))}function dg(o,c){o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&wh(o))}function pi(o,c,m,v){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)fg(o,c,m,v),c=c.sibling}function fg(o,c,m,v){var T=c.flags;switch(c.tag){case 0:case 11:case 15:pi(o,c,m,v),T&2048&&Tc(9,c);break;case 1:pi(o,c,m,v);break;case 3:pi(o,c,m,v),T&2048&&(o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&wh(o)));break;case 12:if(T&2048){pi(o,c,m,v),o=c.stateNode;try{var R=c.memoizedProps,V=R.id,H=R.onPostCommit;typeof H=="function"&&H(V,c.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(ne){ue(c,c.return,ne)}}else pi(o,c,m,v);break;case 13:pi(o,c,m,v);break;case 23:break;case 22:R=c.stateNode,V=c.alternate,c.memoizedState!==null?R._visibility&2?pi(o,c,m,v):go(o,c):R._visibility&2?pi(o,c,m,v):(R._visibility|=2,Pl(o,c,m,v,(c.subtreeFlags&10256)!==0)),T&2048&&hg(V,c);break;case 24:pi(o,c,m,v),T&2048&&dg(c.alternate,c);break;default:pi(o,c,m,v)}}function Pl(o,c,m,v,T){for(T=T&&(c.subtreeFlags&10256)!==0,c=c.child;c!==null;){var R=o,V=c,H=m,ne=v,Me=V.flags;switch(V.tag){case 0:case 11:case 15:Pl(R,V,H,ne,T),Tc(8,V);break;case 23:break;case 22:var ke=V.stateNode;V.memoizedState!==null?ke._visibility&2?Pl(R,V,H,ne,T):go(R,V):(ke._visibility|=2,Pl(R,V,H,ne,T)),T&&Me&2048&&hg(V.alternate,V);break;case 24:Pl(R,V,H,ne,T),T&&Me&2048&&dg(V.alternate,V);break;default:Pl(R,V,H,ne,T)}c=c.sibling}}function go(o,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var m=o,v=c,T=v.flags;switch(v.tag){case 22:go(m,v),T&2048&&hg(v.alternate,v);break;case 24:go(m,v),T&2048&&dg(v.alternate,v);break;default:go(m,v)}c=c.sibling}}var la=8192;function jh(o){if(o.subtreeFlags&la)for(o=o.child;o!==null;)FS(o),o=o.sibling}function FS(o){switch(o.tag){case 26:jh(o),o.flags&la&&o.memoizedState!==null&&bG(mo,o.memoizedState,o.memoizedProps);break;case 5:jh(o);break;case 3:case 4:var c=mo;mo=qS(o.stateNode.containerInfo),jh(o),mo=c;break;case 22:o.memoizedState===null&&(c=o.alternate,c!==null&&c.memoizedState!==null?(c=la,la=16777216,jh(o),la=c):jh(o));break;default:jh(o)}}function VS(o){var c=o.alternate;if(c!==null&&(o=c.child,o!==null)){c.child=null;do c=o.sibling,o.sibling=null,o=c;while(o!==null)}}function bi(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var m=0;m<c.length;m++){var v=c[m];fi=v,Go(v,o)}VS(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)c_(o),o=o.sibling}function c_(o){switch(o.tag){case 0:case 11:case 15:bi(o),o.flags&2048&&ra(9,o,o.return);break;case 3:bi(o);break;case 12:bi(o);break;case 22:var c=o.stateNode;o.memoizedState!==null&&c._visibility&2&&(o.return===null||o.return.tag!==13)?(c._visibility&=-3,zo(o)):bi(o);break;default:bi(o)}}function zo(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var m=0;m<c.length;m++){var v=c[m];fi=v,Go(v,o)}VS(o)}for(o=o.child;o!==null;){switch(c=o,c.tag){case 0:case 11:case 15:ra(8,c,c.return),zo(c);break;case 22:m=c.stateNode,m._visibility&2&&(m._visibility&=-3,zo(c));break;default:zo(c)}o=o.sibling}}function Go(o,c){for(;fi!==null;){var m=fi;switch(m.tag){case 0:case 11:case 15:ra(8,m,c);break;case 23:case 22:if(m.memoizedState!==null&&m.memoizedState.cachePool!==null){var v=m.memoizedState.cachePool.pool;v!=null&&v.refCount++}break;case 24:wh(m.memoizedState.cache)}if(v=m.child,v!==null)v.return=m,fi=v;else e:for(m=o;fi!==null;){v=fi;var T=v.sibling,R=v.return;if(En(v),v===m){fi=null;break e}if(T!==null){T.return=R,fi=T;break e}fi=R}}}var ji={getCacheForType:function(o){var c=Xi(us),m=c.data.get(o);return m===void 0&&(m=o(),c.data.set(o,m)),m}},h_=typeof WeakMap=="function"?WeakMap:Map,$n=0,gn=null,wn=null,Qt=0,Mn=0,zi=null,ua=!1,Kh=!1,Zh=!1,Fa=0,wi=0,yo=0,Ho=0,Nc=0,Va=0,qn=0,Jn=null,sn=null,Pn=!1,oi=0,ir=1/0,za=null,ca=null,Ms=0,sr=null,mi=null,ha=0,Ol=0,Of=null,da=null,ko=0,Cc=null;function Ki(){if(($n&2)!==0&&Qt!==0)return Qt&-Qt;if(k.T!==null){var o=xn;return o!==0?o:cA()}return Bn()}function pg(){Va===0&&(Va=(Qt&536870912)===0||Wn?he():536870912);var o=di.current;return o!==null&&(o.flags|=32),Va}function _r(o,c,m){(o===gn&&(Mn===2||Mn===9)||o.cancelPendingCommit!==null)&&(wu(o,0),vo(o,Qt,Va,!1)),Nt(o,m),(($n&2)===0||o!==gn)&&(o===gn&&(($n&2)===0&&(Ho|=m),wi===4&&vo(o,Qt,Va,!1)),Lu(o))}function Qh(o,c,m){if(($n&6)!==0)throw Error(n(327));var v=!m&&(c&124)===0&&(c&o.expiredLanes)===0||yt(o,c),T=v?M(o,c):f(o,c,!0),R=v;do{if(T===0){Kh&&!v&&vo(o,c,0,!1);break}else{if(m=o.current.alternate,R&&!Cu(m)){T=f(o,c,!1),R=!1;continue}if(T===2){if(R=c,o.errorRecoveryDisabledLanes&R)var V=0;else V=o.pendingLanes&-536870913,V=V!==0?V:V&536870912?536870912:0;if(V!==0){c=V;e:{var H=o;T=Jn;var ne=H.current.memoizedState.isDehydrated;if(ne&&(wu(H,V).flags|=256),V=f(H,V,!1),V!==2){if(Zh&&!ne){H.errorRecoveryDisabledLanes|=R,Ho|=R,T=4;break e}R=sn,sn=T,R!==null&&(sn===null?sn=R:sn.push.apply(sn,R))}T=V}if(R=!1,T!==2)continue}}if(T===1){wu(o,0),vo(o,c,0,!0);break}e:{switch(v=o,R=T,R){case 0:case 1:throw Error(n(345));case 4:if((c&4194048)!==c)break;case 6:vo(v,c,Va,!ua);break e;case 2:sn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((c&62914560)===c&&(T=oi+300-Be(),10<T)){if(vo(v,c,Va,!ua),Lt(v,0,!0)!==0)break e;v.timeoutHandle=C2(If.bind(null,v,m,sn,za,Pn,c,Va,Ho,qn,ua,R,2,-0,0),T);break e}If(v,m,sn,za,Pn,c,Va,Ho,qn,ua,R,0,-0,0)}}break}while(!0);Lu(o)}function If(o,c,m,v,T,R,V,H,ne,Me,ke,Qe,Ae,Re){if(o.timeoutHandle=-1,Qe=c.subtreeFlags,(Qe&8192||(Qe&16785408)===16785408)&&(v_={stylesheets:null,count:0,unsuspend:SG},FS(c),Qe=TG(),Qe!==null)){o.cancelPendingCommit=Qe(ut.bind(null,o,c,R,m,v,T,V,H,ne,ke,1,Ae,Re)),vo(o,R,V,!Me);return}ut(o,c,R,m,v,T,V,H,ne)}function Cu(o){for(var c=o;;){var m=c.tag;if((m===0||m===11||m===15)&&c.flags&16384&&(m=c.updateQueue,m!==null&&(m=m.stores,m!==null)))for(var v=0;v<m.length;v++){var T=m[v],R=T.getSnapshot;T=T.value;try{if(!wr(R(),T))return!1}catch{return!1}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function vo(o,c,m,v){c&=~Nc,c&=~Ho,o.suspendedLanes|=c,o.pingedLanes&=~c,v&&(o.warmLanes|=c),v=o.expirationTimes;for(var T=c;0<T;){var R=31-St(T),V=1<<R;v[R]=-1,T&=~V}m!==0&&Ke(o,m,c)}function qo(){return($n&6)===0?(d_(0),!1):!0}function wc(){if(wn!==null){if(Mn===0)var o=wn.return;else o=wn,Ml=fu=null,Yv(o),pc=null,Cf=0,o=wn;for(;o!==null;)Wh(o.alternate,o),o=o.return;wn=null}}function wu(o,c){var m=o.timeoutHandle;m!==-1&&(o.timeoutHandle=-1,sG(m)),m=o.cancelPendingCommit,m!==null&&(o.cancelPendingCommit=null,m()),wc(),gn=o,wn=m=$i(o.current,null),Qt=c,Mn=0,zi=null,ua=!1,Kh=yt(o,c),Zh=!1,qn=Va=Nc=Ho=yo=wi=0,sn=Jn=null,Pn=!1,(c&8)!==0&&(c|=c&32);var v=o.entangledLanes;if(v!==0)for(o=o.entanglements,v&=c;0<v;){var T=31-St(v),R=1<<T;c|=o[T],v&=~R}return Fa=c,df(),m}function mg(o,c){Sn=null,k.H=Nf,c===bf||c===lo?(c=Hv(),Mn=3):c===Gv?(c=Hv(),Mn=4):Mn=c===IS?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,zi=c,wn===null&&(wi=1,ag(o,qs(c,o.current)))}function $h(){var o=k.H;return k.H=Nf,o===null?Nf:o}function gg(){var o=k.A;return k.A=ji,o}function d(){wi=4,ua||(Qt&4194048)!==Qt&&di.current!==null||(Kh=!0),(yo&134217727)===0&&(Ho&134217727)===0||gn===null||vo(gn,Qt,Va,!1)}function f(o,c,m){var v=$n;$n|=2;var T=$h(),R=gg();(gn!==o||Qt!==c)&&(za=null,wu(o,c)),c=!1;var V=wi;e:do try{if(Mn!==0&&wn!==null){var H=wn,ne=zi;switch(Mn){case 8:wc(),V=6;break e;case 3:case 2:case 9:case 6:di.current===null&&(c=!0);var Me=Mn;if(Mn=0,zi=null,ie(o,H,ne,Me),m&&Kh){V=0;break e}break;default:Me=Mn,Mn=0,zi=null,ie(o,H,ne,Me)}}x(),V=wi;break}catch(ke){mg(o,ke)}while(!0);return c&&o.shellSuspendCounter++,Ml=fu=null,$n=v,k.H=T,k.A=R,wn===null&&(gn=null,Qt=0,df()),V}function x(){for(;wn!==null;)L(wn)}function M(o,c){var m=$n;$n|=2;var v=$h(),T=gg();gn!==o||Qt!==c?(za=null,ir=Be()+500,wu(o,c)):Kh=yt(o,c);e:do try{if(Mn!==0&&wn!==null){c=wn;var R=zi;t:switch(Mn){case 1:Mn=0,zi=null,ie(o,c,R,1);break;case 2:case 9:if(Wm(R)){Mn=0,zi=null,X(c);break}c=function(){Mn!==2&&Mn!==9||gn!==o||(Mn=7),Lu(o)},R.then(c,c);break e;case 3:Mn=7;break e;case 4:Mn=5;break e;case 7:Wm(R)?(Mn=0,zi=null,X(c)):(Mn=0,zi=null,ie(o,c,R,7));break;case 5:var V=null;switch(wn.tag){case 26:V=wn.memoizedState;case 5:case 27:var H=wn;if(!V||G2(V)){Mn=0,zi=null;var ne=H.sibling;if(ne!==null)wn=ne;else{var Me=H.return;Me!==null?(wn=Me,ve(Me)):wn=null}break t}}Mn=0,zi=null,ie(o,c,R,5);break;case 6:Mn=0,zi=null,ie(o,c,R,6);break;case 8:wc(),wi=6;break e;default:throw Error(n(462))}}N();break}catch(ke){mg(o,ke)}while(!0);return Ml=fu=null,k.H=v,k.A=T,$n=m,wn!==null?0:(gn=null,Qt=0,df(),wi)}function N(){for(;wn!==null&&!Ye();)L(wn)}function L(o){var c=Sc(o.alternate,o,Fa);o.memoizedProps=o.pendingProps,c===null?ve(o):wn=c}function X(o){var c=o,m=c.alternate;switch(c.tag){case 15:case 0:c=ia(m,c,c.pendingProps,c.type,void 0,Qt);break;case 11:c=ia(m,c,c.pendingProps,c.type.render,c.ref,Qt);break;case 5:Yv(c);default:Wh(m,c),c=wn=Bv(c,Fa),c=Sc(m,c,Fa)}o.memoizedProps=o.pendingProps,c===null?ve(o):wn=c}function ie(o,c,m,v){Ml=fu=null,Yv(c),pc=null,Cf=0;var T=c.return;try{if(lA(o,T,c,m,Qt)){wi=1,ag(o,qs(m,o.current)),wn=null;return}}catch(R){if(T!==null)throw wn=T,R;wi=1,ag(o,qs(m,o.current)),wn=null;return}c.flags&32768?(Wn||v===1?o=!0:Kh||(Qt&536870912)!==0?o=!1:(ua=o=!0,(v===2||v===9||v===3||v===6)&&(v=di.current,v!==null&&v.tag===13&&(v.flags|=16384))),He(c,o)):ve(c)}function ve(o){var c=o;do{if((c.flags&32768)!==0){He(c,ua);return}o=c.return;var m=u_(c.alternate,c,Fa);if(m!==null){wn=m;return}if(c=c.sibling,c!==null){wn=c;return}wn=c=o}while(c!==null);wi===0&&(wi=5)}function He(o,c){do{var m=qh(o.alternate,o);if(m!==null){m.flags&=32767,wn=m;return}if(m=o.return,m!==null&&(m.flags|=32768,m.subtreeFlags=0,m.deletions=null),!c&&(o=o.sibling,o!==null)){wn=o;return}wn=o=m}while(o!==null);wi=6,wn=null}function ut(o,c,m,v,T,R,V,H,ne){o.cancelPendingCommit=null;do Du();while(Ms!==0);if(($n&6)!==0)throw Error(n(327));if(c!==null){if(c===o.current)throw Error(n(177));if(R=c.lanes|c.childLanes,R|=Om,it(o,m,R,V,H,ne),o===gn&&(wn=gn=null,Qt=0),mi=c,sr=o,ha=m,Ol=R,Of=T,da=v,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,Xn(qt,function(){return Uu(),null})):(o.callbackNode=null,o.callbackPriority=0),v=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||v){v=k.T,k.T=null,T=Q.p,Q.p=2,V=$n,$n|=4;try{Ts(o,c,m)}finally{$n=V,Q.p=T,k.T=v}}Ms=1,bt(),At(),yn()}}function bt(){if(Ms===1){Ms=0;var o=sr,c=mi,m=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||m){m=k.T,k.T=null;var v=Q.p;Q.p=2;var T=$n;$n|=4;try{cg(c,o);var R=vA,V=Rv(o.containerInfo),H=R.focusedElem,ne=R.selectionRange;if(V!==H&&H&&H.ownerDocument&&Av(H.ownerDocument.documentElement,H)){if(ne!==null&&uf(H)){var Me=ne.start,ke=ne.end;if(ke===void 0&&(ke=Me),"selectionStart"in H)H.selectionStart=Me,H.selectionEnd=Math.min(ke,H.value.length);else{var Qe=H.ownerDocument||document,Ae=Qe&&Qe.defaultView||window;if(Ae.getSelection){var Re=Ae.getSelection(),fn=H.textContent.length,an=Math.min(ne.start,fn),Mi=ne.end===void 0?an:Math.min(ne.end,fn);!Re.extend&&an>Mi&&(V=Mi,Mi=an,an=V);var me=Ev(H,an),ce=Ev(H,Mi);if(me&&ce&&(Re.rangeCount!==1||Re.anchorNode!==me.node||Re.anchorOffset!==me.offset||Re.focusNode!==ce.node||Re.focusOffset!==ce.offset)){var be=Qe.createRange();be.setStart(me.node,me.offset),Re.removeAllRanges(),an>Mi?(Re.addRange(be),Re.extend(ce.node,ce.offset)):(be.setEnd(ce.node,ce.offset),Re.addRange(be))}}}}for(Qe=[],Re=H;Re=Re.parentNode;)Re.nodeType===1&&Qe.push({element:Re,left:Re.scrollLeft,top:Re.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<Qe.length;H++){var je=Qe[H];je.element.scrollLeft=je.left,je.element.scrollTop=je.top}}KS=!!yA,vA=yA=null}finally{$n=T,Q.p=v,k.T=m}}o.current=c,Ms=2}}function At(){if(Ms===2){Ms=0;var o=sr,c=mi,m=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||m){m=k.T,k.T=null;var v=Q.p;Q.p=2;var T=$n;$n|=4;try{Bl(o,c.alternate,c)}finally{$n=T,Q.p=v,k.T=m}}Ms=3}}function yn(){if(Ms===4||Ms===3){Ms=0,qe();var o=sr,c=mi,m=ha,v=da;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?Ms=5:(Ms=0,mi=sr=null,fa(o,o.pendingLanes));var T=o.pendingLanes;if(T===0&&(ca=null),zn(m),c=c.stateNode,We&&typeof We.onCommitFiberRoot=="function")try{We.onCommitFiberRoot(De,c,void 0,(c.current.flags&128)===128)}catch{}if(v!==null){c=k.T,T=Q.p,Q.p=2,k.T=null;try{for(var R=o.onRecoverableError,V=0;V<v.length;V++){var H=v[V];R(H.value,{componentStack:H.stack})}}finally{k.T=c,Q.p=T}}(ha&3)!==0&&Du(),Lu(o),T=o.pendingLanes,(m&4194090)!==0&&(T&42)!==0?o===Cc?ko++:(ko=0,Cc=o):ko=0,d_(0)}}function fa(o,c){(o.pooledCacheLanes&=c)===0&&(c=o.pooledCache,c!=null&&(o.pooledCache=null,wh(c)))}function Du(o){return bt(),At(),yn(),Uu()}function Uu(){if(Ms!==5)return!1;var o=sr,c=Ol;Ol=0;var m=zn(ha),v=k.T,T=Q.p;try{Q.p=32>m?32:m,k.T=null,m=Of,Of=null;var R=sr,V=ha;if(Ms=0,mi=sr=null,ha=0,($n&6)!==0)throw Error(n(331));var H=$n;if($n|=4,c_(R.current),fg(R,R.current,V,m),$n=H,d_(0,!1),We&&typeof We.onPostCommitFiberRoot=="function")try{We.onPostCommitFiberRoot(De,R)}catch{}return!0}finally{Q.p=T,k.T=v,fa(o,c)}}function Ee(o,c,m){c=qs(m,c),c=og(o.stateNode,c,2),o=Rl(o,c,2),o!==null&&(Nt(o,2),Lu(o))}function ue(o,c,m){if(o.tag===3)Ee(o,o,m);else for(;c!==null;){if(c.tag===3){Ee(c,o,m);break}else if(c.tag===1){var v=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(ca===null||!ca.has(v))){o=qs(m,o),m=OS(2),v=Rl(c,m,2),v!==null&&(lg(m,v,c,o),Nt(v,2),Lu(v));break}}c=c.return}}function Ce(o,c,m){var v=o.pingCache;if(v===null){v=o.pingCache=new h_;var T=new Set;v.set(c,T)}else T=v.get(c),T===void 0&&(T=new Set,v.set(c,T));T.has(m)||(Zh=!0,T.add(m),o=ot.bind(null,o,c,m),c.then(o,o))}function ot(o,c,m){var v=o.pingCache;v!==null&&v.delete(c),o.pingedLanes|=o.suspendedLanes&m,o.warmLanes&=~m,gn===o&&(Qt&m)===m&&(wi===4||wi===3&&(Qt&62914560)===Qt&&300>Be()-oi?($n&2)===0&&wu(o,0):Nc|=m,qn===Qt&&(qn=0)),Lu(o)}function Wt(o,c){c===0&&(c=at()),o=bl(o,c),o!==null&&(Nt(o,c),Lu(o))}function Di(o){var c=o.memoizedState,m=0;c!==null&&(m=c.retryLane),Wt(o,m)}function hn(o,c){var m=0;switch(o.tag){case 13:var v=o.stateNode,T=o.memoizedState;T!==null&&(m=T.retryLane);break;case 19:v=o.stateNode;break;case 22:v=o.stateNode._retryCache;break;default:throw Error(n(314))}v!==null&&v.delete(c),Wt(o,m)}function Xn(o,c){return te(o,c)}var ns=null,Un=null,Wo=!1,yg=!1,uA=!1,Ff=0;function Lu(o){o!==Un&&o.next===null&&(Un===null?ns=Un=o:Un=Un.next=o),yg=!0,Wo||(Wo=!0,Kz())}function d_(o,c){if(!uA&&yg){uA=!0;do for(var m=!1,v=ns;v!==null;){if(o!==0){var T=v.pendingLanes;if(T===0)var R=0;else{var V=v.suspendedLanes,H=v.pingedLanes;R=(1<<31-St(42|o)+1)-1,R&=T&~(V&~H),R=R&201326741?R&201326741|1:R?R|2:0}R!==0&&(m=!0,_2(v,R))}else R=Qt,R=Lt(v,v===gn?R:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(R&3)===0||yt(v,R)||(m=!0,_2(v,R));v=v.next}while(m);uA=!1}}function jz(){g2()}function g2(){yg=Wo=!1;var o=0;Ff!==0&&(iG()&&(o=Ff),Ff=0);for(var c=Be(),m=null,v=ns;v!==null;){var T=v.next,R=y2(v,c);R===0?(v.next=null,m===null?ns=T:m.next=T,T===null&&(Un=m)):(m=v,(o!==0||(R&3)!==0)&&(yg=!0)),v=T}d_(o)}function y2(o,c){for(var m=o.suspendedLanes,v=o.pingedLanes,T=o.expirationTimes,R=o.pendingLanes&-62914561;0<R;){var V=31-St(R),H=1<<V,ne=T[V];ne===-1?((H&m)===0||(H&v)!==0)&&(T[V]=un(H,c)):ne<=c&&(o.expiredLanes|=H),R&=~H}if(c=gn,m=Qt,m=Lt(o,o===c?m:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),v=o.callbackNode,m===0||o===c&&(Mn===2||Mn===9)||o.cancelPendingCommit!==null)return v!==null&&v!==null&&$e(v),o.callbackNode=null,o.callbackPriority=0;if((m&3)===0||yt(o,m)){if(c=m&-m,c===o.callbackPriority)return c;switch(v!==null&&$e(v),zn(m)){case 2:case 8:m=nt;break;case 32:m=qt;break;case 268435456:m=Z;break;default:m=qt}return v=v2.bind(null,o),m=te(m,v),o.callbackPriority=c,o.callbackNode=m,c}return v!==null&&v!==null&&$e(v),o.callbackPriority=2,o.callbackNode=null,2}function v2(o,c){if(Ms!==0&&Ms!==5)return o.callbackNode=null,o.callbackPriority=0,null;var m=o.callbackNode;if(Du()&&o.callbackNode!==m)return null;var v=Qt;return v=Lt(o,o===gn?v:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),v===0?null:(Qh(o,v,c),y2(o,Be()),o.callbackNode!=null&&o.callbackNode===m?v2.bind(null,o):null)}function _2(o,c){if(Du())return null;Qh(o,c,!0)}function Kz(){rG(function(){($n&6)!==0?te(Je,jz):g2()})}function cA(){return Ff===0&&(Ff=he()),Ff}function x2(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Kd(""+o)}function S2(o,c){var m=c.ownerDocument.createElement("input");return m.name=c.name,m.value=c.value,o.id&&m.setAttribute("form",o.id),c.parentNode.insertBefore(m,c),o=new FormData(o),m.parentNode.removeChild(m),o}function Zz(o,c,m,v,T){if(c==="submit"&&m&&m.stateNode===T){var R=x2
vendor: 4,153 bytes, line 48
48((T[Oi]||null).action),V=v.submitter;V&&(c=(c=V[Oi]||null)?x2(c.formAction):V.getAttribute("formAction"),c!==null&&(R=c,V=null));var H=new yh("action","action",null,v,T);o.push({event:H,listeners:[{instance:null,listener:function(){if(v.defaultPrevented){if(Ff!==0){var ne=V?S2(T,V):new FormData(T);r_(m,{pending:!0,data:ne,method:T.method,action:R},null,ne)}}else typeof R=="function"&&(H.preventDefault(),ne=V?S2(T,V):new FormData(T),r_(m,{pending:!0,data:ne,method:T.method,action:R},R,ne))},currentTarget:T}]})}}for(var hA=0;hA<hf.length;hA++){var dA=hf[hA],Qz=dA.toLowerCase(),$z=dA[0].toUpperCase()+dA.slice(1);Cs(Qz,"on"+$z)}Cs(fr,"onAnimationEnd"),Cs(wv,"onAnimationIteration"),Cs(Ur,"onAnimationStart"),Cs("dblclick","onDoubleClick"),Cs("focusin","onFocus"),Cs("focusout","onBlur"),Cs(jx,"onTransitionRun"),Cs(xl,"onTransitionStart"),Cs(Eh,"onTransitionCancel"),Cs(Sl,"onTransitionEnd"),de("onMouseEnter",["mouseout","mouseover"]),de("onMouseLeave",["mouseout","mouseover"]),de("onPointerEnter",["pointerout","pointerover"]),de("onPointerLeave",["pointerout","pointerover"]),q("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),q("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),q("onBeforeInput",["compositionend","keypress","textInput","paste"]),q("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),q("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),q("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var f_="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Jz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(f_));function b2(o,c){c=(c&4)!==0;for(var m=0;m<o.length;m++){var v=o[m],T=v.event;v=v.listeners;e:{var R=void 0;if(c)for(var V=v.length-1;0<=V;V--){var H=v[V],ne=H.instance,Me=H.currentTarget;if(H=H.listener,ne!==R&&T.isPropagationStopped())break e;R=H,T.currentTarget=Me;try{R(T)}catch(ke){gc(ke)}T.currentTarget=null,R=ne}else for(V=0;V<v.length;V++){if(H=v[V],ne=H.instance,Me=H.currentTarget,H=H.listener,ne!==R&&T.isPropagationStopped())break e;R=H,T.currentTarget=Me;try{R(T)}catch(ke){gc(ke)}T.currentTarget=null,R=ne}}}}function Fn(o,c){var m=c[Kr];m===void 0&&(m=c[Kr]=new Set);var v=o+"__bubble";m.has(v)||(T2(c,o,2,!1),m.add(v))}function fA(o,c,m){var v=0;c&&(v|=4),T2(m,o,v,c)}var zS="_reactListening"+Math.random().toString(36).slice(2);function pA(o){if(!o[zS]){o[zS]=!0,dh.forEach(function(m){m!=="selectionchange"&&(Jz.has(m)||fA(m,!1,o),fA(m,!0,o))});var c=o.nodeType===9?o:o.ownerDocument;c===null||c[zS]||(c[zS]=!0,fA("selectionchange",!1,c))}}function T2(o,c,m,v){switch(Y2(c)){case 2:var T=AG;break;case 8:T=RG;break;default:T=NA}m=T.bind(null,c,m,o),T=void 0,!Qd||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(T=!0),v?T!==void 0?o.addEventListener(c,m,{capture:!0,passive:T}):o.addEventListener(c,m,!0):T!==void 0?o.addEventListener(c,m,{passive:T}):o.addEventListener(c,m,!1)}function mA(o,c,m,v,T){var R=v;if((c&1)===0&&(c&2)===0&&v!==null)e:for(;;){if(v===null)return;var V=v.tag;if(V===3||V===4){var H=v.stateNode.containerInfo;if(H===T)break;if(V===4)for(V=v.return;V!==null;){var ne=V.tag;if((ne===3||ne===4)&&V.stateNode.containerInfo===T)return;V=V.return}for(;H!==null;){if(V=ro(H),V===null)return;if(ne=V.tag,ne===5||ne===6||ne===26||ne===27){v=R=V;continue e}H=H.parentNode}}v=v.return}fv(function(){var Me=R,ke=Tm(m),Qe=[];e:{var Ae=Pm.get(o);if(Ae!==void 0){var Re=yh,fn=o;switch(o){case"keypress":if(tu(m)===0)break e;case"keydown":case"keyup":Re=vv;break;case"focusin":fn="focus",Re=Em;break;case"focusout":fn="blur",Re=Em;break;case"beforeblur":case"afterblur":Re=Em;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":
vendor: 37,112 bytes, lines 48-49
48Re=gv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Re=QE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Re=xv;break;case fr:case wv:case Ur:Re=Lx;break;case Sl:Re=gl;break;case"scroll":case"scrollend":Re=wx;break;case"wheel":Re=$E;break;case"copy":case"cut":case"paste":Re=Px;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Re=Rm;break;case"toggle":case"beforetoggle":Re=iu}var an=(c&4)!==0,Mi=!an&&(o==="scroll"||o==="scrollend"),me=an?Ae!==null?Ae+"Capture":null:Ae;an=[];for(var ce=Me,be;ce!==null;){var je=ce;if(be=je.stateNode,je=je.tag,je!==5&&je!==26&&je!==27||be===null||me===null||(je=ph(ce,me),je!=null&&an.push(p_(ce,je,be))),Mi)break;ce=ce.return}0<an.length&&(Ae=new Re(Ae,fn,null,m,ke),Qe.push({event:Ae,listeners:an}))}}if((c&7)===0){e:{if(Ae=o==="mouseover"||o==="pointerover",Re=o==="mouseout"||o==="pointerout",Ae&&m!==bm&&(fn=m.relatedTarget||m.fromElement)&&(ro(fn)||fn[Aa]))break e;if((Re||Ae)&&(Ae=ke.window===ke?ke:(Ae=ke.ownerDocument)?Ae.defaultView||Ae.parentWindow:window,Re?(fn=m.relatedTarget||m.toElement,Re=Me,fn=fn?ro(fn):null,fn!==null&&(Mi=r(fn),an=fn.tag,fn!==Mi||an!==5&&an!==27&&an!==6)&&(fn=null)):(Re=null,fn=Me),Re!==fn)){if(an=gv,je="onMouseLeave",me="onMouseEnter",ce="mouse",(o==="pointerout"||o==="pointerover")&&(an=Rm,je="onPointerLeave",me="onPointerEnter",ce="pointer"),Mi=Re==null?Ae:Jl(Re),be=fn==null?Ae:Jl(fn),Ae=new an(je,ce+"leave",Re,m,ke),Ae.target=Mi,Ae.relatedTarget=be,je=null,ro(ke)===Me&&(an=new an(me,ce+"enter",fn,m,ke),an.target=be,an.relatedTarget=Mi,je=an),Mi=je,Re&&fn)t:{for(an=Re,me=fn,ce=0,be=an;be;be=vg(be))ce++;for(be=0,je=me;je;je=vg(je))be++;for(;0<ce-be;)an=vg(an),ce--;for(;0<be-ce;)me=vg(me),be--;for(;ce--;){if(an===me||me!==null&&an===me.alternate)break t;an=vg(an),me=vg(me)}an=null}else an=null;Re!==null&&M2(Qe,Ae,Re,an,!1),fn!==null&&Mi!==null&&M2(Qe,Mi,fn,an,!0)}}e:{if(Ae=Me?Jl(Me):window,Re=Ae.nodeName&&Ae.nodeName.toLowerCase(),Re==="select"||Re==="input"&&Ae.type==="file")var Ft=Cm;else if(Mv(Ae))if(wm)Ft=au;else{Ft=Wx;var On=JE}else Re=Ae.nodeName,!Re||Re.toLowerCase()!=="input"||Ae.type!=="checkbox"&&Ae.type!=="radio"?Me&&Sm(Me.elementType)&&(Ft=Cm):Ft=lf;if(Ft&&(Ft=Ft(o,Me))){Cr(Qe,Ft,m,ke);break e}On&&On(o,Ae,Me),o==="focusout"&&Me&&Ae.type==="number"&&Me.memoizedProps.value!=null&&Vs(Ae,"number",Ae.value)}switch(On=Me?Jl(Me):window,o){case"focusin":(Mv(On)||On.contentEditable==="true")&&(vl=On,Um=Me,cf=null);break;case"focusout":cf=Um=vl=null;break;case"mousedown":Lm=!0;break;case"contextmenu":case"mouseup":case"dragend":Lm=!1,Cv(Qe,m,ke);break;case"selectionchange":if(Nv)break;case"keydown":case"keyup":Cv(Qe,m,ke)}var jt;if(tf)e:{switch(o){case"compositionstart":var on="onCompositionStart";break e;case"compositionend":on="onCompositionEnd";break e;case"compositionupdate":on="onCompositionUpdate";break e}on=void 0}else ru?rf(o,m)&&(on="onCompositionEnd"):o==="keydown"&&m.keyCode===229&&(on="onCompositionStart");on&&(sf&&m.locale!=="ko"&&(ru||on!=="onCompositionStart"?on==="onCompositionEnd"&&ru&&(jt=mv()):(pl=ke,pv="value"in pl?pl.value:pl.textContent,ru=!0)),On=GS(Me,on),0<On.length&&(on=new Am(on,o,null,m,ke),Qe.push({event:on,listeners:On}),jt?on.data=jt:(jt=bv(m),jt!==null&&(on.data=jt)))),(jt=nf?af(o,m):Tv(o,m))&&(on=GS(Me,"onBeforeInput"),0<on.length&&(On=new Am("onBeforeInput","beforeinput",null,m,ke),Qe.push({event:On,listeners:on}),On.data=jt)),Zz(Qe,o,Me,m,ke)}b2(Qe,c)})}function p_(o,c,m){return{instance:o,listener:c,currentTarget:m}}function GS(o,c){for(var m=c+"Capture",v=[];o!==null;){var T=o,R=T.stateNode;if(T=T.tag,T!==5&&T!==26&&T!==27||R===null||(T=ph(o,m),T!=null&&v.unshift(p_(o,T,R)),T=ph(o,c),T!=null&&v.push(p_(o,T,R))),o.tag===3)return v;o=o.return}return[]}function vg(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function M2(o,c,m,v,T){for(var R=c._reactName,V=[];m!==null&&m!==v;){var H=m,ne=H.alternate,Me=H.stateNode;if(H=H.tag,ne!==null&&ne===v)break;H!==5&&H!==26&&H!==27||Me===null||(ne=Me,T?(Me=ph(m,R),Me!=null&&V.unshift(p_(m,Me,ne))):T||(Me=ph(m,R),Me!=null&&V.push(p_(m,Me,ne)))),m=m.return}V.length!==0&&o.push({event:c,listeners:V})}var eG=/\r\n?/g,tG=/\u0000|\uFFFD/g;function E2(o){return(typeof o=="string"?o:""+o).replace(eG,` 49`).replace(tG,"")}function A2(o,c){return c=E2(c),E2(o)===c}function HS(){}function Ti(o,c,m,v,T,R){switch(m){case"children":typeof v=="string"?c==="body"||c==="textarea"&&v===""||xs(o,v):(typeof v=="number"||typeof v=="bigint")&&c!=="body"&&xs(o,""+v);break;case"className":wt(o,"class",v);break;case"tabIndex":wt(o,"tabindex",v);break;case"dir":case"role":case"viewBox":case"width":case"height":wt(o,m,v);break;case"style":jd(o,v,R);break;case"data":if(c!=="object"){wt(o,"data",v);break}case"src":case"href":if(v===""&&(c!=="a"||m!=="href")){o.removeAttribute(m);break}if(v==null||typeof v=="function"||typeof v=="symbol"||typeof v=="boolean"){o.removeAttribute(m);break}v=Kd(""+v),o.setAttribute(m,v);break;case"action":case"formAction":if(typeof v=="function"){o.setAttribute(m,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof R=="function"&&(m==="formAction"?(c!=="input"&&Ti(o,c,"name",T.name,T,null),Ti(o,c,"formEncType",T.formEncType,T,null),Ti(o,c,"formMethod",T.formMethod,T,null),Ti(o,c,"formTarget",T.formTarget,T,null)):(Ti(o,c,"encType",T.encType,T,null),Ti(o,c,"method",T.method,T,null),Ti(o,c,"target",T.target,T,null)));if(v==null||typeof v=="symbol"||typeof v=="boolean"){o.removeAttribute(m);break}v=Kd(""+v),o.setAttribute(m,v);break;case"onClick":v!=null&&(o.onclick=HS);break;case"onScroll":v!=null&&Fn("scroll",o);break;case"onScrollEnd":v!=null&&Fn("scrollend",o);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(n(61));if(m=v.__html,m!=null){if(T.children!=null)throw Error(n(60));o.innerHTML=m}}break;case"multiple":o.multiple=v&&typeof v!="function"&&typeof v!="symbol";break;case"muted":o.muted=v&&typeof v!="function"&&typeof v!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(v==null||typeof v=="function"||typeof v=="boolean"||typeof v=="symbol"){o.removeAttribute("xlink:href");break}m=Kd(""+v),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":v!=null&&typeof v!="function"&&typeof v!="symbol"?o.setAttribute(m,""+v):o.removeAttribute(m);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":v&&typeof v!="function"&&typeof v!="symbol"?o.setAttribute(m,""):o.removeAttribute(m);break;case"capture":case"download":v===!0?o.setAttribute(m,""):v!==!1&&v!=null&&typeof v!="function"&&typeof v!="symbol"?o.setAttribute(m,v):o.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":v!=null&&typeof v!="function"&&typeof v!="symbol"&&!isNaN(v)&&1<=v?o.setAttribute(m,v):o.removeAttribute(m);break;case"rowSpan":case"start":v==null||typeof v=="function"||typeof v=="symbol"||isNaN(v)?o.removeAttribute(m):o.setAttribute(m,v);break;case"popover":Fn("beforetoggle",o),Fn("toggle",o),pt(o,"popover",v);break;case"xlinkActuate":_t(o,"http://www.w3.org/1999/xlink","xlink:actuate",v);break;case"xlinkArcrole":_t(o,"http://www.w3.org/1999/xlink","xlink:arcrole",v);break;case"xlinkRole":_t(o,"http://www.w3.org/1999/xlink","xlink:role",v);break;case"xlinkShow":_t(o,"http://www.w3.org/1999/xlink","xlink:show",v);break;case"xlinkTitle":_t(o,"http://www.w3.org/1999/xlink","xlink:title",v);break;case"xlinkType":_t(o,"http://www.w3.org/1999/xlink","xlink:type",v);break;case"xmlBase":_t(o,"http://www.w3.org/XML/1998/namespace","xml:base",v);break;case"xmlLang":_t(o,"http://www.w3.org/XML/1998/namespace","xml:lang",v);break;case"xmlSpace":_t(o,"http://www.w3.org/XML/1998/namespace","xml:space",v);break;case"is":pt(o,"is",v);break;case"innerText":case"textContent":break;default:(!(2<m.length)||m[0]!=="o"&&m[0]!=="O"||m[1]!=="n"&&m[1]!=="N")&&(m=hv.get(m)||m,pt(o,m,v))}}function gA(o,c,m,v,T,R){switch(m){case"style":jd(o,v,R);break;case"dangerouslySetInnerHTML":if(v!=null){if(typeof v!="object"||!("__html"in v))throw Error(n(61));if(m=v.__html,m!=null){if(T.children!=null)throw Error(n(60));o.innerHTML=m}}break;case"children":typeof v=="string"?xs(o,v):(typeof v=="number"||typeof v=="bigint")&&xs(o,""+v);break;case"onScroll":v!=null&&Fn("scroll",o);break;case"onScrollEnd":v!=null&&Fn("scrollend",o);break;case"onClick":v!=null&&(o.onclick=HS);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!fh.hasOwnProperty(m))e:{if(m[0]==="o"&&m[1]==="n"&&(T=m.endsWith("Capture"),c=m.slice(2,T?m.length-7:void 0),R=o[Oi]||null,R=R!=null?R[m]:null,typeof R=="function"&&o.removeEventListener(c,R,T),typeof v=="function")){typeof R!="function"&&R!==null&&(m in o?o[m]=null:o.hasAttribute(m)&&o.removeAttribute(m)),o.addEventListener(c,v,T);break e}m in o?o[m]=v:v===!0?o.setAttribute(m,""):pt(o,m,v)}}}function xr(o,c,m){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fn("error",o),Fn("load",o);var v=!1,T=!1,R;for(R in m)if(m.hasOwnProperty(R)){var V=m[R];if(V!=null)switch(R){case"src":v=!0;break;case"srcSet":T=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,c));default:Ti(o,c,R,V,m,null)}}T&&Ti(o,c,"srcSet",m.srcSet,m,null),v&&Ti(o,c,"src",m.src,m,null);return;case"input":Fn("invalid",o);var H=R=V=T=null,ne=null,Me=null;for(v in m)if(m.hasOwnProperty(v)){var ke=m[v];if(ke!=null)switch(v){case"name":T=ke;break;case"type":V=ke;break;case"checked":ne=ke;break;case"defaultChecked":Me=ke;break;case"value":R=ke;break;case"defaultValue":H=ke;break;case"children":case"dangerouslySetInnerHTML":if(ke!=null)throw Error(n(137,c));break;default:Ti(o,c,v,ke,m,null)}}er(o,R,H,ne,Me,V,T,!1),Cn(o);return;case"select":Fn("invalid",o),v=V=R=null;for(T in m)if(m.hasOwnProperty(T)&&(H=m[T],H!=null))switch(T){case"value":R=H;break;case"defaultValue":V=H;break;case"multiple":v=H;default:Ti(o,c,T,H,m,null)}c=R,m=V,o.multiple=!!v,c!=null?Fi(o,!!v,c,!1):m!=null&&Fi(o,!!v,m,!0);return;case"textarea":Fn("invalid",o),R=T=v=null;for(V in m)if(m.hasOwnProperty(V)&&(H=m[V],H!=null))switch(V){case"value":v=H;break;case"defaultValue":T=H;break;case"children":R=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(n(91));break;default:Ti(o,c,V,H,m,null)}lc(o,v,T,R),Cn(o);return;case"option":for(ne in m)if(m.hasOwnProperty(ne)&&(v=m[ne],v!=null))switch(ne){case"selected":o.selected=v&&typeof v!="function"&&typeof v!="symbol";break;default:Ti(o,c,ne,v,m,null)}return;case"dialog":Fn("beforetoggle",o),Fn("toggle",o),Fn("cancel",o),Fn("close",o);break;case"iframe":case"object":Fn("load",o);break;case"video":case"audio":for(v=0;v<f_.length;v++)Fn(f_[v],o);break;case"image":Fn("error",o),Fn("load",o);break;case"details":Fn("toggle",o);break;case"embed":case"source":case"link":Fn("error",o),Fn("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Me in m)if(m.hasOwnProperty(Me)&&(v=m[Me],v!=null))switch(Me){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,c));default:Ti(o,c,Me,v,m,null)}return;default:if(Sm(c)){for(ke in m)m.hasOwnProperty(ke)&&(v=m[ke],v!==void 0&&gA(o,c,ke,v,m,void 0));return}}for(H in m)m.hasOwnProperty(H)&&(v=m[H],v!=null&&Ti(o,c,H,v,m,null))}function nG(o,c,m,v){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var T=null,R=null,V=null,H=null,ne=null,Me=null,ke=null;for(Re in m){var Qe=m[Re];if(m.hasOwnProperty(Re)&&Qe!=null)switch(Re){case"checked":break;case"value":break;case"defaultValue":ne=Qe;default:v.hasOwnProperty(Re)||Ti(o,c,Re,null,v,Qe)}}for(var Ae in v){var Re=v[Ae];if(Qe=m[Ae],v.hasOwnProperty(Ae)&&(Re!=null||Qe!=null))switch(Ae){case"type":R=Re;break;case"name":T=Re;break;case"checked":Me=Re;break;case"defaultChecked":ke=Re;break;case"value":V=Re;break;case"defaultValue":H=Re;break;case"children":case"dangerouslySetInnerHTML":if(Re!=null)throw Error(n(137,c));break;default:Re!==Qe&&Ti(o,c,Ae,Re,v,Qe)}}ai(o,V,H,ne,Me,ke,R,T);return;case"select":Re=V=H=Ae=null;for(R in m)if(ne=m[R],m.hasOwnProperty(R)&&ne!=null)switch(R){case"value":break;case"multiple":Re=ne;default:v.hasOwnProperty(R)||Ti(o,c,R,null,v,ne)}for(T in v)if(R=v[T],ne=m[T],v.hasOwnProperty(T)&&(R!=null||ne!=null))switch(T){case"value":Ae=R;break;case"defaultValue":H=R;break;case"multiple":V=R;default:R!==ne&&Ti(o,c,T,R,v,ne)}c=H,m=V,v=Re,Ae!=null?Fi(o,!!m,Ae,!1):!!v!=!!m&&(c!=null?Fi(o,!!m,c,!0):Fi(o,!!m,m?[]:"",!1));return;case"textarea":Re=Ae=null;for(H in m)if(T=m[H],m.hasOwnProperty(H)&&T!=null&&!v.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:Ti(o,c,H,null,v,T)}for(V in v)if(T=v[V],R=m[V],v.hasOwnProperty(V)&&(T!=null||R!=null))switch(V){case"value":Ae=T;break;case"defaultValue":Re=T;break;case"children":break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(n(91));break;default:T!==R&&Ti(o,c,V,T,v,R)}zs(o,Ae,Re);return;case"option":for(var fn in m)if(Ae=m[fn],m.hasOwnProperty(fn)&&Ae!=null&&!v.hasOwnProperty(fn))switch(fn){case"selected":o.selected=!1;break;default:Ti(o,c,fn,null,v,Ae)}for(ne in v)if(Ae=v[ne],Re=m[ne],v.hasOwnProperty(ne)&&Ae!==Re&&(Ae!=null||Re!=null))switch(ne){case"selected":o.selected=Ae&&typeof Ae!="function"&&typeof Ae!="symbol";break;default:Ti(o,c,ne,Ae,v,Re)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var an in m)Ae=m[an],m.hasOwnProperty(an)&&Ae!=null&&!v.hasOwnProperty(an)&&Ti(o,c,an,null,v,Ae);for(Me in v)if(Ae=v[Me],Re=m[Me],v.hasOwnProperty(Me)&&Ae!==Re&&(Ae!=null||Re!=null))switch(Me){case"children":case"dangerouslySetInnerHTML":if(Ae!=null)throw Error(n(137,c));break;default:Ti(o,c,Me,Ae,v,Re)}return;default:if(Sm(c)){for(var Mi in m)Ae=m[Mi],m.hasOwnProperty(Mi)&&Ae!==void 0&&!v.hasOwnProperty(Mi)&&gA(o,c,Mi,void 0,v,Ae);for(ke in v)Ae=v[ke],Re=m[ke],!v.hasOwnProperty(ke)||Ae===Re||Ae===void 0&&Re===void 0||gA(o,c,ke,Ae,v,Re);return}}for(var me in m)Ae=m[me],m.hasOwnProperty(me)&&Ae!=null&&!v.hasOwnProperty(me)&&Ti(o,c,me,null,v,Ae);for(Qe in v)Ae=v[Qe],Re=m[Qe],!v.hasOwnProperty(Qe)||Ae===Re||Ae==null&&Re==null||Ti(o,c,Qe,Ae,v,Re)}var yA=null,vA=null;function kS(o){return o.nodeType===9?o:o.ownerDocument}function R2(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function N2(o,c){if(o===0)switch(c){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&c==="foreignObject"?0:o}function _A(o,c){return o==="textarea"||o==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.children=="bigint"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var xA=null;function iG(){var o=window.event;return o&&o.type==="popstate"?o===xA?!1:(xA=o,!0):(xA=null,!1)}var C2=typeof setTimeout=="function"?setTimeout:void 0,sG=typeof clearTimeout=="function"?clearTimeout:void 0,w2=typeof Promise=="function"?Promise:void 0,rG=typeof queueMicrotask=="function"?queueMicrotask:typeof w2<"u"?function(o){return w2.resolve(null).then(o).catch(aG)}:C2;function aG(o){setTimeout(function(){throw o})}function Jh(o){return o==="head"}function D2(o,c){var m=c,v=0,T=0;do{var R=m.nextSibling;if(o.removeChild(m),R&&R.nodeType===8)if(m=R.data,m==="/$"){if(0<v&&8>v){m=v;var V=o.ownerDocument;if(m&1&&m_(V.documentElement),m&2&&m_(V.body),m&4)for(m=V.head,m_(m),V=m.firstChild;V;){var H=V.nextSibling,ne=V.nodeName;V[$r]||ne==="SCRIPT"||ne==="STYLE"||ne==="LINK"&&V.rel.toLowerCase()==="stylesheet"||m.removeChild(V),V=H}}if(T===0){o.removeChild(R),T_(c);return}T--}else m==="$"||m==="$?"||m==="$!"?T++:v=m.charCodeAt(0)-48;else v=0;m=R}while(m);T_(c)}function SA(o){var c=o.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var m=c;switch(c=c.nextSibling,m.nodeName){case"HTML":case"HEAD":case"BODY":SA(m),_i(m);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(m.rel.toLowerCase()==="stylesheet")continue}o.removeChild(m)}}function oG(o,c,m,v){for(;o.nodeType===1;){var T=m;if(o.nodeName.toLowerCase()!==c.toLowerCase()){if(!v&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(v){if(!o[$r])switch(c){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(R=o.getAttribute("rel"),R==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(R!==T.rel||o.getAttribute("href")!==(T.href==null||T.href===""?null:T.href)||o.getAttribute("crossorigin")!==(T.crossOrigin==null?null:T.crossOrigin)||o.getAttribute("title")!==(T.title==null?null:T.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(R=o.getAttribute("src"),(R!==(T.src==null?null:T.src)||o.getAttribute("type")!==(T.type==null?null:T.type)||o.getAttribute("crossorigin")!==(T.crossOrigin==null?null:T.crossOrigin))&&R&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(c==="input"&&o.type==="hidden"){var R=T.name==null?null:""+T.name;if(T.type==="hidden"&&o.getAttribute("name")===R)return o}else return o;if(o=Il(o.nextSibling),o===null)break}return null}function lG(o,c,m){if(c==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!m||(o=Il(o.nextSibling),o===null))return null;return o}function bA(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState==="complete"}function uG(o,c){var m=o.ownerDocument;if(o.data!=="$?"||m.readyState==="complete")c();else{var v=function(){c(),m.removeEventListener("DOMContentLoaded",v)};m.addEventListener("DOMContentLoaded",v),o._reactRetry=v}}function Il(o){for(;o!=null;o=o.nextSibling){var c=o.nodeType;if(c===1||c===3)break;if(c===8){if(c=o.data,c==="$"||c==="$!"||c==="$?"||c==="F!"||c==="F")break;if(c==="/$")return null}}return o}var TA=null;function U2(o){o=o.previousSibling;for(var c=0;o;){if(o.nodeType===8){var m=o.data;if(m==="$"||m==="$!"||m==="$?"){if(c===0)return o;c--}else m==="/$"&&c++}o=o.previousSibling}return null}function L2(o,c,m){switch(c=kS(m),o){case"html":if(o=c.documentElement,!o)throw Error(n(452));return o;case"head":if(o=c.head,!o)throw Error(n(453));return o;case"body":if(o=c.body,!o)throw Error(n(454));return o;default:throw Error(n(451))}}function m_(o){for(var c=o.attributes;c.length;)o.removeAttributeNode(c[0]);_i(o)}var Xo=new Map,B2=new Set;function qS(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Dc=Q.d;Q.d={f:cG,r:hG,D:dG,C:fG,L:pG,m:mG,X:yG,S:gG,M:vG};function cG(){var o=Dc.f(),c=qo();return o||c}function hG(o){var c=No(o);c!==null&&c.tag===5&&c.type==="form"?TS(c):Dc.r(o)}var _g=typeof document>"u"?null:document;function P2(o,c,m){var v=_g;if(v&&typeof c=="string"&&c){var T=_s(c);T='link[rel="'+o+'"][href="'+T+'"]',typeof m=="string"&&(T+='[crossorigin="'+m+'"]'),B2.has(T)||(B2.add(T),o={rel:o,crossOrigin:m,href:c},v.querySelector(T)===null&&(c=v.createElement("link"),xr(c,"link",o),ls(c),v.head.appendChild(c)))}}function dG(o){Dc.D(o),P2("dns-prefetch",o,null)}function fG(o,c){Dc.C(o,c),P2("preconnect",o,c)}function pG(o,c,m){Dc.L(o,c,m);var v=_g;if(v&&o&&c){var T='link[rel="preload"][as="'+_s(c)+'"]';c==="image"&&m&&m.imageSrcSet?(T+='[imagesrcset="'+_s(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(T+='[imagesizes="'+_s(m.imageSizes)+'"]')):T+='[href="'+_s(o)+'"]';var R=T;switch(c){case"style":R=xg(o);break;case"script":R=Sg(o)}Xo.has(R)||(o=p({rel:"preload",href:c==="image"&&m&&m.imageSrcSet?void 0:o,as:c},m),Xo.set(R,o),v.querySelector(T)!==null||c==="style"&&v.querySelector(g_(R))||c==="script"&&v.querySelector(y_(R))||(c=v.createElement("link"),xr(c,"link",o),ls(c),v.head.appendChild(c)))}}function mG(o,c){Dc.m(o,c);var m=_g;if(m&&o){var v=c&&typeof c.as=="string"?c.as:"script",T='link[rel="modulepreload"][as="'+_s(v)+'"][href="'+_s(o)+'"]',R=T;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":R=Sg(o)}if(!Xo.has(R)&&(o=p({rel:"modulepreload",href:o},c),Xo.set(R,o),m.querySelector(T)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(y_(R)))return}v=m.createElement("link"),xr(v,"link",o),ls(v),m.head.appendChild(v)}}}function gG(o,c,m){Dc.S(o,c,m);var v=_g;if(v&&o){var T=fl(v).hoistableStyles,R=xg(o);c=c||"default";var V=T.get(R);if(!V){var H={loading:0,preload:null};if(V=v.querySelector(g_(R)))H.loading=5;else{o=p({rel:"stylesheet",href:o,"data-precedence":c},m),(m=Xo.get(R))&&MA(o,m);var ne=V=v.createElement("link");ls(ne),xr(ne,"link",o),ne._p=new Promise(function(Me,ke){ne.onload=Me,ne.onerror=ke}),ne.addEventListener("load",function(){H.loading|=1}),ne.addEventListener("error",function(){H.loading|=2}),H.loading|=4,WS(V,c,v)}V={type:"stylesheet",instance:V,count:1,state:H},T.set(R,V)}}}function yG(o,c){Dc.X(o,c);var m=_g;if(m&&o){var v=fl(m).hoistableScripts,T=Sg(o),R=v.get(T);R||(R=m.querySelector(y_(T)),R||(o=p({src:o,async:!0},c),(c=Xo.get(T))&&EA(o,c),R=m.createElement("script"),ls(R),xr(R,"link",o),m.head.appendChild(R)),R={type:"script",instance:R,count:1,state:null},v.set(T,R))}}function vG(o,c){Dc.M(o,c);var m=_g;if(m&&o){var v=fl(m).hoistableScripts,T=Sg(o),R=v.get(T);R||(R=m.querySelector(y_(T)),R||(o=p({src:o,async:!0,type:"module"},c),(c=Xo.get(T))&&EA(o,c),R=m.createElement("script"),ls(R),xr(R,"link",o),m.head.appendChild(R)),R={type:"script",instance:R,count:1,state:null},v.set(T,R))}}function O2(o,c,m,v){var T=(T=xe.current)?qS(T):null;if(!T)throw Error(n(446));switch(o){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(c=xg(m.href),m=fl(T).hoistableStyles,v=m.get(c),v||(v={type:"style",instance:null,count:0,state:null},m.set(c,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){o=xg(m.href);var R=fl(T).hoistableStyles,V=R.get(o);if(V||(T=T.ownerDocument||T,V={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},R.set(o,V),(R=T.querySelector(g_(o)))&&!R._p&&(V.instance=R,V.state.loading=5),Xo.has(o)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},Xo.set(o,m),R||_G(T,o,m,V.state))),c&&v===null)throw Error(n(528,""));return V}if(c&&v!==null)throw Error(n(529,""));return null;case"script":return c=m.async,m=m.src,typeof m=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=Sg(m),m=fl(T).hoistableScripts,v=m.get(c),v||(v={type:"script",instance:null,count:0,state:null},m.set(c,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,o))}}function xg(o){return'href="'+_s(o)+'"'}function g_(o){return'link[rel="stylesheet"]['+o+"]"}function I2(o){return p({},o,{"data-precedence":o.precedence,precedence:null})}function _G(o,c,m,v){o.querySelector('link[rel="preload"][as="style"]['+c+"]")?v.loading=1:(c=o.createElement("link"),v.preload=c,c.addEventListener("load",function(){return v.loading|=1}),c.addEventListener("error",function(){return v.loading|=2}),xr(c,"link",m),ls(c),o.head.appendChild(c))}function Sg(o){return'[src="'+_s(o)+'"]'}function y_(o){return"script[async]"+o}function F2(o,c,m){if(c.count++,c.instance===null)switch(c.type){case"style":var v=o.querySelector('style[data-href~="'+_s(m.href)+'"]');if(v)return c.instance=v,ls(v),v;var T=p({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return v=(o.ownerDocument||o).createElement("style"),ls(v),xr(v,"style",T),WS(v,m.precedence,o),c.instance=v;case"stylesheet":T=xg(m.href);var R=o.querySelector(g_(T));if(R)return c.state.loading|=4,c.instance=R,ls(R),R;v=I2(m),(T=Xo.get(T))&&MA(v,T),R=(o.ownerDocument||o).createElement("link"),ls(R);var V=R;return V._p=new Promise(function(H,ne){V.onload=H,V.onerror=ne}),xr(R,"link",v),c.state.loading|=4,WS(R,m.precedence,o),c.instance=R;case"script":return R=Sg(m.src),(T=o.querySelector(y_(R)))?(c.instance=T,ls(T),T):(v=m,(T=Xo.get(R))&&(v=p({},m),EA(v,T)),o=o.ownerDocument||o,T=o.createElement("script"),ls(T),xr(T,"link",v),o.head.appendChild(T),c.instance=T);case"void":return null;default:throw Error(n(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(v=c.instance,c.state.loading|=4,WS(v,m.precedence,o));return c.instance}function WS(o,c,m){for(var v=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),T=v.length?v[v.length-1]:null,R=T,V=0;V<v.length;V++){var H=v[V];if(H.dataset.precedence===c)R=H;else if(R!==T)break}R?R.parentNode.insertBefore(o,R.nextSibling):(c=m.nodeType===9?m.head:m,c.insertBefore(o,c.firstChild))}function MA(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.title==null&&(o.title=c.title)}function EA(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.integrity==null&&(o.integrity=c.integrity)}var XS=null;function V2(o,c,m){if(XS===null){var v=new Map,T=XS=new Map;T.set(m,v)}else T=XS,v=T.get(m),v||(v=new Map,T.set(m,v));if(v.has(o))return v;for(v.set(o,null),m=m.getElementsByTagName(o),T=0;T<m.length;T++){var R=m[T];if(!(R[$r]||R[os]||o==="link"&&R.getAttribute("rel")==="stylesheet")&&R.namespaceURI!=="http://www.w3.org/2000/svg"){var V=R.getAttribute(c)||"";V=o+V;var H=v.get(V);H?H.push(R):v.set(V,[R])}}return v}function z2(o,c,m){o=o.ownerDocument||o,o.head.insertBefore(m,c==="title"?o.querySelector("head > title"):null)}function xG(o,c,m){if(m===1||c.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;switch(c.rel){case"stylesheet":return o=c.disabled,typeof c.precedence=="string"&&o==null;default:return!0}case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function G2(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}var v_=null;function SG(){}function bG(o,c,m){if(v_===null)throw Error(n(475));var v=v_;if(c.type==="stylesheet"&&(typeof m.media!="string"||matchMedia(m.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var T=xg(m.href),R=o.querySelector(g_(T));if(R){o=R._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(v.count++,v=YS.bind(v),o.then(v,v)),c.state.loading|=4,c.instance=R,ls(R);return}R=o.ownerDocument||o,m=I2(m),(T=Xo.get(T))&&MA(m,T),R=R.createElement("link"),ls(R);var V=R;V._p=new Promise(function(H,ne){V.onload=H,V.onerror=ne}),xr(R,"link",m),c.instance=R}v.stylesheets===null&&(v.stylesheets=new Map),v.stylesheets.set(c,o),(o=c.state.preload)&&(c.state.loading&3)===0&&(v.count++,c=YS.bind(v),o.addEventListener("load",c),o.addEventListener("error",c))}}function TG(){if(v_===null)throw Error(n(475));var o=v_;return o.stylesheets&&o.count===0&&AA(o,o.stylesheets),0<o.count?function(c){var m=setTimeout(function(){if(o.stylesheets&&AA(o,o.stylesheets),o.unsuspend){var v=o.unsuspend;o.unsuspend=null,v()}},6e4);return o.unsuspend=c,function(){o.unsuspend=null,clearTimeout(m)}}:null}function YS(){if(this.count--,this.count===0){if(this.stylesheets)AA(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var jS=null;function AA(o,c){o.stylesheets=null,o.unsuspend!==null&&(o.count++,jS=new Map,c.forEach(MG,o),jS=null,YS.call(o))}function MG(o,c){if(!(c.state.loading&4)){var m=jS.get(o);if(m)var v=m.get(null);else{m=new Map,jS.set(o,m);for(var T=o.querySelectorAll("link[data-precedence],style[data-precedence]"),R=0;R<T.length;R++){var V=T[R];(V.nodeName==="LINK"||V.getAttribute("media")!=="not all")&&(m.set(V.dataset.precedence,V),v=V)}v&&m.set(null,v)}T=c.instance,V=T.getAttribute("data-precedence"),R=m.get(V)||v,R===v&&m.set(null,T),m.set(V,T),this.count++,v=YS.bind(this),T.addEventListener("load",v),T.addEventListener("error",v),R?R.parentNode.insertBefore(T,R.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(T,o.firstChild)),c.state.loading|=4}}var __={$$typeof:w,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function EG(o,c,m,v,T,R,V,H){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=dt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dt(0),this.hiddenUpdates=dt(null),this.identifierPrefix=v,this.onUncaughtError=T,this.onCaughtError=R,this.onRecoverableError=V,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function H2(o,c,m,v,T,R,V,H,ne,Me,ke,Qe){return o=new EG(o,c,m,V,H,ne,Me,Qe),c=1,R===!0&&(c|=24),R=Lr(3,null,null,c),o.current=R,R.stateNode=o,c=Hm(),c.refCount++,o.pooledCache=c,c.refCount++,R.memoizedState={element:v,isDehydrated:m,cache:c},kv(R),o}function k2(o){return o?(o=uu,o):uu}function q2(o,c,m,v,T,R){T=k2(T),v.context===null?v.context=T:v.pendingContext=T,v=Lo(c),v.payload={element:m},R=R===void 0?null:R,R!==null&&(v.callback=R),m=Rl(o,v,c),m!==null&&(_r(m,o,c),fc(m,o,c))}function W2(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var m=o.retryLane;o.retryLane=m!==0&&m<c?m:c}}function RA(o,c){W2(o,c),(o=o.alternate)&&W2(o,c)}function X2(o){if(o.tag===13){var c=bl(o,67108864);c!==null&&_r(c,o,67108864),RA(o,67108864)}}var KS=!0;function AG(o,c,m,v){var T=k.T;k.T=null;var R=Q.p;try{Q.p=2,NA(o,c,m,v)}finally{Q.p=R,k.T=T}}function RG(o,c,m,v){var T=k.T;k.T=null;var R=Q.p;try{Q.p=8,NA(o,c,m,v)}finally{Q.p=R,k.T=T}}function NA(o,c,m,v){if(KS){var T=CA(v);if(T===null)mA(o,c,v,ZS,m),j2(o,v);else if(CG(T,o,c,m,v))v.stopPropagation();else if(j2(o,v),c&4&&-1<NG.indexOf(o)){for(;T!==null;){var R=No(T);if(R!==null)switch(R.tag){case 3:if(R=R.stateNode,R.current.memoizedState.isDehydrated){var V=Ht(R.pendingLanes);if(V!==0){var H=R;for(H.pendingLanes|=2,H.entangledLanes|=2;V;){var ne=1<<31-St(V);H.entanglements[1]|=ne,V&=~ne}Lu(R),($n&6)===0&&(ir=Be()+500,d_(0))}}break;case 13:H=bl(R,2),H!==null&&_r(H,R,2),qo(),RA(R,2)}if(R=CA(v),R===null&&mA(o,c,v,ZS,m),R===T)break;T=R}T!==null&&v.stopPropagation()}else mA(o,c,v,null,m)}}function CA(o){return o=Tm(o),wA(o)}var ZS=null;function wA(o){if(ZS=null,o=ro(o),o!==null){var c=r(o);if(c===null)o=null;else{var m=c.tag;if(m===13){if(o=a(c),o!==null)return o;o=null}else if(m===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;o=null}else c!==o&&(o=null)}}return ZS=o,null}function Y2(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ft()){case Je:return 2;case nt:return 8;case qt:case tn:return 32;case Z:return 268435456;default:return 32}default:return 32}}var DA=!1,ed=null,td=null,nd=null,x_=new Map,S_=new Map,id=[],NG="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function j2(o,c){switch(o){case"focusin":case"focusout":ed=null;break;case"dragenter":case"dragleave":td=null;break;case"mouseover":case"mouseout":nd=null;break;case"pointerover":case"pointerout":x_.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":S_.delete(c.pointerId)}}function b_(o,c,m,v,T,R){return o===null||o.nativeEvent!==R?(o={blockedOn:c,domEventName:m,eventSystemFlags:v,nativeEvent:R,targetContainers:[T]},c!==null&&(c=No(c),c!==null&&X2(c)),o):(o.eventSystemFlags|=v,c=o.targetContainers,T!==null&&c.indexOf(T)===-1&&c.push(T),o)}function CG(o,c,m,v,T){switch(c){case"focusin":return ed=b_(ed,o,c,m,v,T),!0;case"dragenter":return td=b_(td,o,c,m,v,T),!0;case"mouseover":return nd=b_(nd,o,c,m,v,T),!0;case"pointerover":var R=T.pointerId;return x_.set(R,b_(x_.get(R)||null,o,c,m,v,T)),!0;case"gotpointercapture":return R=T.pointerId,S_.set(R,b_(S_.get(R)||null,o,c,m,v,T)),!0}return!1}function K2(o){var c=ro(o.target);if(c!==null){var m=r(c);if(m!==null){if(c=m.tag,c===13){if(c=a(m),c!==null){o.blockedOn=c,Ea(o.priority,function(){if(m.tag===13){var v=Ki();v=nn(v);var T=bl(m,v);T!==null&&_r(T,m,v),RA(m,v)}});return}}else if(c===3&&m.stateNode.current.memoizedState.isDehydrated){o.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}o.blockedOn=null}function QS(o){if(o.blockedOn!==null)return!1;for(var c=o.targetContainers;0<c.length;){var m=CA(o.nativeEvent);if(m===null){m=o.nativeEvent;var v=new m.constructor(m.type,m);bm=v,m.target.dispatchEvent(v),bm=null}else return c=No(m),c!==null&&X2(c),o.blockedOn=m,!1;c.shift()}return!0}function Z2(o,c,m){QS(o)&&m.delete(c)}function wG(){DA=!1,ed!==null&&QS(ed)&&(ed=null),td!==null&&QS(td)&&(td=null),nd!==null&&QS(nd)&&(nd=null),x_.forEach(Z2),S_.forEach(Z2)}function $S(o,c){o.blockedOn===c&&(o.blockedOn=null,DA||(DA=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,wG)))}var JS=null;function Q2(o){JS!==o&&(JS=o,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){JS===o&&(JS=null);for(var c=0;c<o.length;c+=3){var m=o[c],v=o[c+1],T=o[c+2];if(typeof v!="function"){if(wA(v||m)===null)continue;break}var R=No(m);R!==null&&(o.splice(c,3),c-=3,r_(R,{pending:!0,data:T,method:m.method,action:v},v,T))}}))}function T_(o){function c(ne){return $S(ne,o)}ed!==null&&$S(ed,o),td!==null&&$S(td,o),nd!==null&&$S(nd,o),x_.forEach(c),S_.forEach(c);for(var m=0;m<id.length;m++){var v=id[m];v.blockedOn===o&&(v.blockedOn=null)}for(;0<id.length&&(m=id[0],m.blockedOn===null);)K2(m),m.blockedOn===null&&id.shift();if(m=(o.ownerDocument||o).$$reactFormReplay,m!=null)for(v=0;v<m.length;v+=3){var T=m[v],R=m[v+1],V=T[Oi]||null;if(typeof R=="function")V||Q2(m);else if(V){var H=null;if(R&&R.hasAttribute("formAction")){if(T=R,V=R[Oi]||null)H=V.formAction;else if(wA(T)!==null)continue}else H=V.action;typeof H=="function"?m[v+1]=H:(m.splice(v,3),v-=3),Q2(m)}}}function UA(o){this._internalRoot=o}eb.prototype.render=UA.prototype.render=function(o){var c=this._internalRoot;if(c===null)throw Error(n(409));var m=c.current,v=Ki();q2(m,v,o,c,null,null)},eb.prototype.unmount=UA.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var c=o.containerInfo;q2(o.current,2,null,o,null,null),qo(),c[Aa]=null}};function eb(o){this._internalRoot=o}
49eb.prototype.unstable_scheduleHydration=function(o){if(o){var c=Bn();o={blockedOn:null,target:o,priority:c};for(var m=0;m<id.length&&c!==0&&c<id[m].priority;m++);id.splice(m,0,o),m===0&&K2(o)}};var $2=e.version;if($2!=="19.1.1")throw Error(n(527,$2,"19.1.1"));Q.findDOMNode=function(o){var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=u(c),o=o!==null?h(o):null,o=o===null?null:o.stateNode,o};var DG={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:k,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tb=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tb.isDisabled&&tb.supportsFiber)try{De=tb.inject(DG),We=tb}catch{}}return E_.createRoot=function(o,c){if(!i(o))throw Error(n(299));var m=!1,v="",T=Df,R=rg,V=PS,H=null;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(v=c.identifierPrefix),c.onUncaughtError!==void 0&&(T=c.onUncaughtError),c.onCaughtError!==void 0&&(R=c.onCaughtError),c.onRecoverableError!==void 0&&(V=c.onRecoverableError),c.unstable_transitionCallbacks!==void 0&&(H=c.unstable_transitionCallbacks)),c=H2(o,1,!1,null,null,m,v,T,R,V,H,null),o[Aa]=c.current,pA(o),new UA(c)},E_.hydrateRoot=function(o,c,m){if(!i(o))throw Error(n(299));var v=!1,T="",R=Df,V=rg,H=PS,ne=null,Me=null;return m!=null&&(m.unstable_strictMode===!0&&(v=!0),m.identifierPrefix!==void 0&&(T=m.identifierPrefix),m.onUncaughtError!==void 0&&(R=m.onUncaughtError),m.onCaughtError!==void 0&&(V=m.onCaughtError),m.onRecoverableError!==void 0&&(H=m.onRecoverableError),m.unstable_transitionCallbacks!==void 0&&(ne=m.unstable_transitionCallbacks),m.formState!==void 0&&(Me=m.formState)),c=H2(o,1,!0,c,m??null,v,T,R,V,H,ne,Me),c.context=k2(null),m=c.current,v=Ki(),v=nn(v),T=Lo(v),T.callback=null,Rl(m,T,v),m=v,c.current.lanes=m,Nt(c,m),Lu(c),o[Aa]=c.current,pA(o),new eb(c)},E_.version="19.1.1",E_}var lD;function zG(){if(lD)return PA.exports;lD=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),PA.exports=VG(),PA.exports}var GG=zG();const HG=_M(GG);var kG="Invariant failed";function eh(s,e){if(!s)throw new Error(kG)}const hy=new WeakMap,TT=new WeakMap,IT={current:[]};let VA=!1,u0=0;const n0=new Set,nb=new Map;function qB(s){const e=Array.from(s).sort((t,n)=>t instanceof dy&&t.options.deps.includes(n)?1:n instanceof dy&&n.options.deps.includes(t)?-1:0);for(const t of e){if(IT.current.includes(t))continue;IT.current.push(t),t.recompute();const n=TT.get(t);if(n)for(const i of n){const r=hy.get(i);r&&qB(r)}}}function qG(s){s.listeners.forEach(e=>e({prevVal:s.prevState,currentVal:s.state}))}function WG(s){s.listeners.forEach(e=>e({prevVal:s.prevState,currentVal:s.state}))}function WB(s){if(u0>0&&!nb.has(s)&&nb.set(s,s.prevState),n0.add(s),!(u0>0)&&!VA)try{for(VA=!0;n0.size>0;){const e=Array.from(n0);n0.clear();for(const t of e){const n=nb.get(t)??t.prevState;t.prevState=n,qG(t)}for(const t of e){const n=hy.get(t);n&&(IT.current.push(t),qB(n))}for(const t of e){const n=hy.get(t);if(n)for(const i of n)WG(i)}}}finally{VA=!1,IT.current=[],nb.clear()}}function c0(s){u0++;try{s()}finally{if(u0--,u0===0){const e=Array.from(n0)[0];e&&WB(e)}}}function XG(s){return typeof s=="function"}class DR{constructor(e,t){this.listeners=new Set,this.subscribe=n=>{var i,r;this.listeners.add(n);const a=(r=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:r.call(i,n,this);return()=>{this.listeners.delete(n),a?.()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,n,i;this.prevState=this.state,(t=this.options)!=null&&t.updateFn?this.state=this.options.updateFn(this.prevState)(e):XG(e)?this.state=e(this.prevState):this.state=e,(i=(n=this.options)==null?void 0:n.onUpdate)==null||i.call(n),WB(this)}}class dy{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const t=[],n=[];for(const i of this.options.deps)t.push(i.prevState),n.push(i.state);return this.lastSeenDepValues=n,{prevDepVals:t,currDepVals:n,prevVal:this.prevState??void 0}},this.recompute=()=>{var t,n;this.prevState=this.state;const{prevDepVals:i,currDepVals:r,prevVal:a}=this.getDepVals();this.state=this.options.fn({prevDepVals:i,currDepVals:r,prevVal:a}),(n=(t=this.options).onUpdate)==null||n.call(t)},this.checkIfRecalculationNeededDeeply=()=>{for(const r of this.options.deps)r instanceof dy&&r.checkIfRecalculationNeededDeeply();let t=!1;const n=this.lastSeenDepValues,{currDepVals:i}=this.getDepVals();for(let r=0;r<i.length;r++)if(i[r]!==n[r]){t=!0;break}t&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const t of this._subscriptions)t()}),this.subscribe=t=>{var n,i;this.listeners.add(t);const r=(i=(n=this.options).onSubscribe)==null?void 0:i.call(n,t,this);return()=>{this.listeners.delete(t),r?.()}},this.options=e,this.state=e.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(e=this.options.deps){for(const t of e)if(t instanceof dy)t.registerOnGraph(),this.registerOnGraph(t.options.deps);else if(t instanceof DR){let n=hy.get(t);n||(n=new Set,hy.set(t,n)),n.add(this);let i=TT.get(this);i||(i=new Set,TT.set(this,i)),i.add(t)}}unregisterFromGraph(e=this.options.deps){for(const t of e)if(t instanceof dy)this.unregisterFromGraph(t.options.deps);else if(t instanceof DR){const n=hy.get(t);n&&n.delete(this);const i=TT.get(this);i&&i.delete(t)}}}const bd="__TSR_index",uD="popstate",cD="beforeunload";function XB(s){let e=s.getLocation();const t=new Set,n=a=>{e=s.getLocation(),t.forEach(l=>l({location:e,action:a}))},i=a=>
49{s.notifyOnIndexChange??!0?n(a):e=s.getLocation()},r=async({task:a,navigateOpts:l,...u})=>{var h,p;if(l?.ignoreBlocker??!1){a();return}const y=((h=s.getBlockers)==null?void 0:h.call(s))??[],_=u.type==="PUSH"||u.type==="REPLACE";if(typeof document<"u"&&y.length&&_)for(const S of y){const A=E0(u.path,u.state);if(await S.blockerFn({currentLocation:e,nextLocation:A,action:u.type})){(p=s.onBlocked)==null||p.call(s);return}}a()};return{get location(){return e},get length(){return s.getLength()},subscribers:t,subscribe:a=>(t.add(a),()=>{t.delete(a)}),push:(a,l,u)=>{const h=e.state[bd];l=UR(h+1,l),r({task:()=>{s.pushState(a,l),n({type:"PUSH"})},navigateOpts:u,type:"PUSH",path:a,state:l})},replace:(a,l,u)=>{const h=e.state[bd];l=UR(h,l),r({task:()=>{s.replaceState(a,l),n({type:"REPLACE"})},navigateOpts:u,type:"REPLACE",path:a,state:l})},go:(a,l)=>{r({task:()=>{s.go(a),i({type:"GO",index:a})},navigateOpts:l,type:"GO"})},back:a=>{r({task:()=>{s.back(a?.ignoreBlocker??!1),i({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{r({task:()=>{s.forward(a?.ignoreBlocker??!1),i({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>e.state[bd]!==0,createHref:a=>s.createHref(a),block:a=>{var l;if(!s.setBlockers)return()=>{};const u=((l=s.getBlockers)==null?void 0:l.call(s))??[];return s.setBlockers([...u,a]),()=>{var h,p;const g=((h=s.getBlockers)==null?void 0:h.call(s))??[];(p=s.setBlockers)==null||p.call(s,g.filter(y=>y!==a))}},flush:()=>{var a;return(a=s.flush)==null?void 0:a.call(s)},destroy:()=>{var a;return(a=s.destroy)==null?void 0:a.call(s)},notify:n}}function UR(s,e){e||(e={});const t=EN();return{...e,key:t,__TSR_key:t,[bd]:s}}function YG(s){var e,t;const n=typeof document<"u"?window:void 0,i=n.history.pushState,r=n.history.replaceState;let a=[];const l=()=>a,u=O=>a=O,h=(O=>O),p=(()=>E0(`${n.location.pathname}${n.location.search}${n.location.hash}`,n.history.state));if(!((e=n.history.state)!=null&&e.__TSR_key)&&!((t=n.history.state)!=null&&t.key)){const O=EN();n.history.replaceState({[bd]:0,key:O,__TSR_key:O},"")}let g=p(),y,_=!1,S=!1,A=!1,E=!1;const b=()=>g;let C,w;const D=()=>{C&&(B._ignoreSubscribers=!0,(C.isPush?n.history.pushState:n.history.replaceState)(C.state,"",C.href),B._ignoreSubscribers=!1,C=void 0,w=void 0,y=void 0)},P=(O,W,ee)=>{const se=h(W);w||(y=g),g=E0(W,ee),C={href:se,state:ee,isPush:C?.isPush||O==="push"},w||(w=Promise.resolve().then(()=>D()))},I=O=>{g=p(),B.notify({type:O})},F=async()=>{if(S){S=!1;return}const O=p(),W=O.state[bd]-g.state[bd],ee=W===1,se=W===-1,fe=!ee&&!se||_;_=!1;const pe=fe?"GO":se?"BACK":"FORWARD",k=fe?{type:"GO",index:W}:{type:se?"BACK":"FORWARD"};if(A)A=!1;else{const Q=l();if(typeof document<"u"&&Q.length){for(const J of Q)if(await J.blockerFn({currentLocation:g,nextLocation:O,action:pe})){S=!0,n.history.go(1),B.notify(k);return}}}g=p(),B.notify(k)},z=O=>{if(E){E=!1;return}let W=!1;const ee=l();if(typeof document<"u"&&ee.length)for(const se of ee){const fe=se.enableBeforeUnload??!0;if(fe===!0){W=!0;break}if(typeof fe=="function"&&fe()===!0){W=!0;break}}if(W)return O.preventDefault(),O.returnValue=""},B=XB({getLocation:b,getLength:()=>n.history.length,pushState:(O,W)=>P("push",O,W),replaceState:(O,W)=>P("replace",O,W),back:O=>(O&&(A=!0),E=!0,n.history.back()),forward:O=>{O&&(A=!0),E=!0,n.history.forward()},go:O=>{_=!0,n.history.go(O)},createHref:O=>h(O),flush:D,destroy:()=>{n.history.pushState=i,n.history.replaceState=r,n.removeEventListener(cD,z,{capture:!0}),n.removeEventListener(uD,F)},onBlocked:()=>{y&&g!==y&&(g=y)},getBlockers:l,setBlockers:u,notifyOnIndexChange:!1});return n.addEventListener(cD,z,{capture:!0}),n.addEventListener(uD,F),n.history.pushState=function(...O){const W=i.apply(n.history,O);return B._ignoreSubscribers||I("PUSH"),W},n.history.replaceState=function(...O){const W=r.apply(n.history,O);return B._ignoreSubscribers||I("REPLACE"),W},B}function jG(s={initialEntries:["/"]}){const e=s.initialEntries;let t=s.initialIndex?Math.min(Math.max(s.initialIndex,0),e.length-1):e.length-1;const n=e.map((r,a)=>UR(a,void 0));return XB({getLocation:()=>E0(e[t],n[t]),getLength:()=>e.length,pushState:(r,a)=>{t<e.length-1&&(e.splice(t+1),n.splice(t+1)),n.push(a),e.push(r),t=Math.max(e.length-1,0)},replaceState:(r,a)=>{n[t]=a,e[t]=r},back:()=>{t=Math.max(t-1,0)},forward:()=>{t=Math.min(t+1,e.length-1)},go:r=>{t=Math.min(Math.max(t+r,0),e.length-1)},createHref:r=>r})}function E0(s,e){const t=s.indexOf("#"),n=s.indexOf("?"),i=EN();return{href:s,pathname:s.substring(0,t>0?n>0?Math.min(t,n):t:n>0?n:s.length),hash:t>-1?s.substring(t):"",search:n>-1?s.slice(n,t===-1?void 0:t):"",state:e||{[bd]:0,key:i,__TSR_key:i}}}function EN(){return(Math.random()+1).toString(36).substring(7)}function LR(s){return s[s.length-1]}function KG(s){return typeof s=="function"}function _p(s,e){return KG(s)?s(e):s}const ZG=Object.prototype.hasOwnProperty;function jo(s,e){if(s===e)return s;const t=e,n=fD(s)&&fD(t);if(!n&&!(FT(s)&&FT(t)))return t;const i=n?s:hD(s);if(!i)return t;const r=n?t:hD(t);if(!r)return t;const a=i.length,l=r.length,u=n?new Array(l):{};let h=0;for(let p=0;p<l;p++){const g=n?p:r[p],y=s[g],_=t[g];if(y===_){u[g]=y,(n?p<a:ZG.call(s,g))&&h++;continue}if(y===null||_===null||typeof y!="object"||typeof _!="object"){u[g]=_;continue}const S=jo(y,_);u[g]=S,S===y&&h++}return a===l&&h===a?s:u}function hD(s){const e=[],t=Object.getOwnPropertyNames(s);for(const i of t){if(!Object.prototype.propertyIsEnumerable.call(s,i))return!1;e.push(i)}const n=Object.getOwnPropertySymbols(s);for(const i of n){if(!Object.prototype.propertyIsEnumerable.call(s,i))return!1;e.push(i)}return e}function FT(s){if(!dD(s))return!1;const e=s.constructor;if(typeof e>"u")return!0;const t=e.prototype;return!(!dD(t)||!t.hasOwnProperty("isPrototypeOf"))}function dD(s){return Object.prototype.toString.call(s)==="[object Object]"}function fD(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function xp(s,e,t){if(s===e)return!0;
49if(typeof s!=typeof e)return!1;if(Array.isArray(s)&&Array.isArray(e)){if(s.length!==e.length)return!1;for(let n=0,i=s.length;n<i;n++)if(!xp(s[n],e[n],t))return!1;return!0}if(FT(s)&&FT(e)){const n=t?.ignoreUndefined??!0;if(t?.partial){for(const a in e)if((!n||e[a]!==void 0)&&!xp(s[a],e[a],t))return!1;return!0}let i=0;if(!n)i=Object.keys(s).length;else for(const a in s)s[a]!==void 0&&i++;let r=0;for(const a in e)if((!n||e[a]!==void 0)&&(r++,r>i||!xp(s[a],e[a],t)))return!1;return i===r}return!1}function vy(s){let e,t;const n=new Promise((i,r)=>{e=i,t=r});return n.status="pending",n.resolve=i=>{n.status="resolved",n.value=i,e(i),s?.(i)},n.reject=i=>{n.status="rejected",t(i)},n}function Td(s){return!!(s&&typeof s=="object"&&typeof s.then=="function")}const qc=0,Cp=1,wp=2,_y=3;function Wc(s){return AN(s.filter(e=>e!==void 0).join("/"))}function AN(s){return s.replace(/\/{2,}/g,"/")}function RN(s){return s==="/"?s:s.replace(/^\/{1,}/,"")}function xy(s){return s==="/"?s:s.replace(/\/{1,}$/,"")}function zA(s){return xy(RN(s))}function VT(s,e){return s?.endsWith("/")&&s!=="/"&&s!==`${e}/`?s.slice(0,-1):s}function QG(s,e,t){return VT(s,t)===VT(e,t)}function $G(s){const{type:e,value:t}=s;if(e===qc)return t;const{prefixSegment:n,suffixSegment:i}=s;if(e===Cp){const r=t.substring(1);if(n&&i)return`${n}{$${r}}${i}`;if(n)return`${n}{$${r}}`;if(i)return`{$${r}}${i}`}if(e===_y){const r=t.substring(1);return n&&i?`${n}{-$${r}}${i}`:n?`${n}{-$${r}}`:i?`{-$${r}}${i}`:`{-$${r}}`}if(e===wp){if(n&&i)return`${n}{$}${i}`;if(n)return`${n}{$}`;if(i)return`{$}${i}`}return t}function JG({basepath:s,base:e,to:t,trailingSlash:n="never",caseSensitive:i,parseCache:r}){var a;e=zT(s,e,i),t=zT(s,t,i);let l=Sy(e,r).slice();const u=Sy(t,r);l.length>1&&((a=LR(l))==null?void 0:a.value)==="/"&&l.pop();for(let g=0,y=u.length;g<y;g++){const _=u[g],S=_.value;S==="/"?g?g===y-1&&l.push(_):l=[_]:S===".."?l.pop():S==="."||l.push(_)}l.length>1&&(LR(l).value==="/"?n==="never"&&l.pop():n==="always"&&l.push({type:qc,value:"/"}));const h=l.map($G);return Wc([s,...h])}const Sy=(s,e)=>{if(!s)return[];const t=e?.get(s);if(t)return t;const n=r4(s);return e?.set(s,n),n},e4=/^\$.{1,}$/,t4=/^(.*?)\{(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,n4=/^(.*?)\{-(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,i4=/^\$$/,s4=/^(.*?)\{\$\}(.*)$/;function r4(s){s=AN(s);const e=[];if(s.slice(0,1)==="/"&&(s=s.substring(1),e.push({type:qc,value:"/"})),!s)return e;const t=s.split("/").filter(Boolean);return e.push(...t.map(n=>{const i=n.match(s4);if(i){const l=i[1],u=i[2];return{type:wp,value:"$",prefixSegment:l||void 0,suffixSegment:u||void 0}}const r=n.match(n4);if(r){const l=r[1],u=r[2],h=r[3];return{type:_y,value:u,prefixSegment:l||void 0,suffixSegment:h||void 0}}const a=n.match(t4);if(a){const l=a[1],u=a[2],h=a[3];return{type:Cp,value:""+u,prefixSegment:l||void 0,suffixSegment:h||void 0}}if(e4.test(n)){const l=n.substring(1);return{type:Cp,value:"$"+l,prefixSegment:void 0,suffixSegment:void 0}}return i4.test(n)?{type:wp,value:"$",prefixSegment:void 0,suffixSegment:void 0}:{type:qc,value:n.includes("%25")?n.split("%25").map(l=>decodeURI(l)).join("%25"):decodeURI(n)}})),s.slice(-1)==="/"&&(s=s.substring(1),e.push({type:qc,value:"/"})),e}function ib({path:s,params:e,leaveWildcards:t,leaveParams:n,decodeCharMap:i,parseCache:r}){const a=Sy(s,r);function l(g){const y=e[g],_=typeof y=="string";return g==="*"||g==="_splat"?_?encodeURI(y):y:_?a4(y,i):y}let u=!1;const h={},p=Wc(a.map(g=>{if(g.type===qc)return g.value;if(g.type===wp){h._splat=e._splat;const y=g.prefixSegment||"",_=g.suffixSegment||"";if(!("_splat"in e))return u=!0,t?`${y}${g.value}${_}`:y||_?`${y}${_}`:void 0;const S=l("_splat");return t?`${y}${g.value}${S??""}${_}`:`${y}${S}${_}`}if(g.type===Cp){const y=g.value.substring(1);!u&&!(y in e)&&(u=!0),h[y]=e[y];const _=g.prefixSegment||"",S=g.suffixSegment||"";if(n){const A=l(g.value);return`${_}${g.value}${A??""}${S}`}return`${_}${l(y)??"undefined"}${S}`}if(g.type===_y){const y=g.value.substring(1),_=g.prefixSegment||"",S=g.suffixSegment||"";if(!(y in e)||e[y]==null)return t?`${_}${y}${S}`:_||S?`${_}${S}`:void 0;if(h[y]=e[y],n){const A=l(g.value);return`${_}${g.value}${A??""}${S}`}return t?`${_}${y}${l(y)??""}${S}`:`${_}${l(y)??""}${S}`}return g.value}));return{usedParams:h,interpolatedPath:p,isMissingParams:u}}function a4(s,e){let t=encodeURIComponent(s);if(e)for(const[n,i]of e)t=t.replaceAll(n,i);return t}function BR(s,e,t,n){const i=o4(s,e,t,n);if(!(t.to&&!i))return i??{}}function zT(s,e,t=!1){const n=t?s:s.toLowerCase(),i=t?e:e.toLowerCase();switch(!0){case n==="/":return e;case i===n:return"";case e.length<s.length:return e;case i[n.length]!=="/":return e;case i.startsWith(n):return e.slice(s.length);default:return e}}function o4(s,e,{to:t,fuzzy:n,caseSensitive:i},r){if(s!=="/"&&!e.startsWith(s))return;e=zT(s,e,i),t=zT(s,`${t??"$"}`,i);const a=Sy(e.startsWith("/")?e:`/${e}`,r),l=Sy(t.startsWith("/")?t:`/${t}`,r),u={};return l4(a,l,u,n,i)?u:void 0}function l4(s,e,t,n,i){var r,a,l;let u=0,h=0;for(;u<s.length||h<e.length;){const p=s[u],g=e[h];if(g){if(g.type===wp){const y=s.slice(u);let _;if(g.prefixSegment||g.suffixSegment){if(!p)return!1;const S=g.prefixSegment||"",A=g.suffixSegment||"",E=p.value;if("prefixSegment"in g&&!E.startsWith(S)||"suffixSegment"in g&&!((r=s[s.length-1])!=null&&r.value.endsWith(A)))return!1;let b=decodeURI(Wc(y.map(C=>C.value)));S&&b.startsWith(S)&&(b=b.slice(S.length)),A&&b.endsWith(A)&&(b=b.slice(0,b.length-A.length)),_=b}else _=decodeURI(Wc(y.map(S=>S.value)));return t["*"]=_,t._splat=_,!0}if(g.type===qc){if(g.value==="/"&&!p?.value){h++;continue}
49if(p){if(i){if(g.value!==p.value)return!1}else if(g.value.toLowerCase()!==p.value.toLowerCase())return!1;u++,h++;continue}else return!1}if(g.type===Cp){if(!p||p.value==="/")return!1;let y="",_=!1;if(g.prefixSegment||g.suffixSegment){const S=g.prefixSegment||"",A=g.suffixSegment||"",E=p.value;if(S&&!E.startsWith(S)||A&&!E.endsWith(A))return!1;let b=E;S&&b.startsWith(S)&&(b=b.slice(S.length)),A&&b.endsWith(A)&&(b=b.slice(0,b.length-A.length)),y=decodeURIComponent(b),_=!0}else y=decodeURIComponent(p.value),_=!0;_&&(t[g.value.substring(1)]=y,u++),h++;continue}if(g.type===_y){if(!p){h++;continue}if(p.value==="/"){h++;continue}let y="",_=!1;if(g.prefixSegment||g.suffixSegment){const S=g.prefixSegment||"",A=g.suffixSegment||"",E=p.value;if((!S||E.startsWith(S))&&(!A||E.endsWith(A))){let b=E;S&&b.startsWith(S)&&(b=b.slice(S.length)),A&&b.endsWith(A)&&(b=b.slice(0,b.length-A.length)),y=decodeURIComponent(b),_=!0}}else{let S=!0;for(let A=h+1;A<e.length;A++){const E=e[A];if(E?.type===qc&&E.value===p.value){S=!1;break}if(E?.type===Cp||E?.type===wp){s.length<e.length&&(S=!1);break}}S&&(y=decodeURIComponent(p.value),_=!0)}_&&(t[g.value.substring(1)]=y,u++),h++;continue}}if(u<s.length&&h>=e.length)return t["**"]=Wc(s.slice(u).map(y=>y.value)),!!n&&((a=e[e.length-1])==null?void 0:a.value)!=="/";if(h<e.length&&u>=s.length){for(let y=h;y<e.length;y++)if(((l=e[y])==null?void 0:l.type)!==_y)return!1;break}break}return!0}function $u(s){return!!s?.isNotFound}function u4(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const GT="tsr-scroll-restoration-v1_3",c4=(s,e)=>{let t;return(...n)=>{t||(t=setTimeout(()=>{s(...n),t=null},e))}};function h4(){const s=u4();if(!s)return;const e=s.getItem(GT);let t=e?JSON.parse(e):{};return{state:t,set:n=>(t=_p(n,t)||t,s.setItem(GT,JSON.stringify(t)))}}const GA=h4(),PR=s=>s.state.__TSR_key||s.href;function d4(s){const e=[];let t;for(;t=s.parentNode;)e.push(`${s.tagName}:nth-child(${Array.prototype.indexOf.call(t.children,s)+1})`),s=t;return`${e.reverse().join(" > ")}`.toLowerCase()}let HT=!1;function YB({storageKey:s,key:e,behavior:t,shouldScrollRestoration:n,scrollToTopSelectors:i,location:r}){var a,l;let u;try{u=JSON.parse(sessionStorage.getItem(s)||"{}")}catch(g){console.error(g);return}const h=e||((a=window.history.state)==null?void 0:a.key),p=u[h];HT=!0;e:{if(n&&p&&Object.keys(p).length>0){for(const _ in p){const S=p[_];if(_==="window")window.scrollTo({top:S.scrollY,left:S.scrollX,behavior:t});else if(_){const A=document.querySelector(_);A&&(A.scrollLeft=S.scrollX,A.scrollTop=S.scrollY)}}break e}const g=(r??window.location).hash.split("#",2)[1];if(g){const _=((l=window.history.state)==null?void 0:l.__hashScrollIntoViewOptions)??!0;if(_){const S=document.getElementById(g);S&&S.scrollIntoView(_)}break e}const y={top:0,left:0,behavior:t};if(window.scrollTo(y),i)for(const _ of i){if(_==="window")continue;const S=typeof _=="function"?_():document.querySelector(_);S&&S.scrollTo(y)}}HT=!1}function f4(s,e){if(GA===void 0||((s.options.scrollRestoration??!1)&&(s.isScrollRestoring=!0),typeof document>"u"||s.isScrollRestorationSetup))return;s.isScrollRestorationSetup=!0,HT=!1;const n=s.options.getScrollRestorationKey||PR;window.history.scrollRestoration="manual";const i=r=>{if(HT||!s.isScrollRestoring)return;let a="";if(r.target===document||r.target===window)a="window";else{const u=r.target.getAttribute("data-scroll-restoration-id");u?a=`[data-scroll-restoration-id="${u}"]`:a=d4(r.target)}const l=n(s.state.location);GA.set(u=>{const h=u[l]||(u[l]={}),p=h[a]||(h[a]={});if(a==="window")p.scrollX=window.scrollX||0,p.scrollY=window.scrollY||0;else if(a){const g=document.querySelector(a);g&&(p.scrollX=g.scrollLeft||0,p.scrollY=g.scrollTop||0)}return u})};typeof document<"u"&&document.addEventListener("scroll",c4(i,100),!0),s.subscribe("onRendered",r=>{const a=n(r.toLocation);if(!s.resetNextScroll){s.resetNextScroll=!0;return}YB({storageKey:GT,key:a,behavior:s.options.scrollRestorationBehavior,shouldScrollRestoration:s.isScrollRestoring,scrollToTopSelectors:s.options.scrollToTopSelectors,location:s.history.location}),s.isScrollRestoring&&GA.set(l=>(l[a]||(l[a]={}),l))})}function p4(s){if(typeof document<"u"&&document.querySelector){const e=s.state.location.state.__hashScrollIntoViewOptions??!0;if(e&&s.state.location.hash!==""){const t=document.getElementById(s.state.location.hash);t&&t.scrollIntoView(e)}}}function m4(s,e=String){const t=new URLSearchParams;for(const n in s){const i=s[n];i!==void 0&&t.set(n,e(i))}return t.toString()}function HA(s){return s?s==="false"?!1:s==="true"?!0:+s*0===0&&+s+""===s?+s:s:""}function g4(s){const e=new URLSearchParams(s),t={};for(const[n,i]of e.entries()){const r=t[n];r==null?t[n]=HA(i):Array.isArray(r)?r.push(HA(i)):t[n]=[r,HA(i)]}return t}const y4=_4(JSON.parse),v4=x4(JSON.stringify,JSON.parse);function _4(s){return e=>{e[0]==="?"&&(e=e.substring(1));const t=g4(e);for(const n in t){const i=t[n];if(typeof i=="string")try{t[n]=s(i)}catch{}}return t}}function x4(s,e){const t=typeof e=="function";function n(i){if(typeof i=="object"&&i!==null)try{return s(i)}catch{}else if(t&&typeof i=="string")try{return e(i),s(i)}catch{}return i}return i=>{const r=m4(i,n);return r?`?${r}`:""}}const Qo="__root__";function S4(s){if(s.statusCode=s.statusCode||s.code||307,!s.reloadDocument&&typeof s.href=="string")try{new URL(s.href),s.reloadDocument=!0}catch{}const e=new Headers(s.headers);s.href&&e.get("Location")===null&&e.set("Location",s.href);const t=new Response(null,{status:s.statusCode,headers:e});if(t.options=s,s.throw)throw t;return t}function qu(s){return s instanceof Response&&!!s.options}function b4(s){const e=new Map;let t,n;const i=r=>{r.next&&(r.prev?(r.prev.next=r.next,r.next.prev=r.prev,r.next=void 0,n&&(n.next=r,r.prev=n)):(r.next.prev=void 0,t=r.next,r.next=void 0,n&&(r.prev=n,n.next=r)),n=r)};return{get(r){const a=e.get(r);if(a)return i(a),a.value},set(r,a){if(e.size>=s&&t){const u=t;e.delete(u.key),u.next&&(t=u.next,u.next.prev=void 0),u===n&&(n=void 0)}const l=e.get(r);if(l)l.value=a,i(l);else{const u={key:r,value:a,prev:n};n&&(n.next=u),n=u,t||(t=u),e.set(r,u)}}}}const MT=s=>{var e;if(!s.rendered)return s.rendered=!0,(e=s.onReady)==null?void 0:e.call(s)},xM=(s,e)=>!!(s.preload&&!s.router.state.matches.some(t=>t.id===e)),jB=(s,e)=>{var t;const n=s.router.routesById[e.routeId??""]??s.router.routeTree;!n.options.notFoundComponent&&((t=s.router.options)!=null&&t.defaultNotFoundComponent)&&(n.options.notFoundComponent=s.router.options.defaultNotFoundComponent),eh(n.options.notFoundComponent);const i=s.matches.find(r=>r.routeId===n.id);eh(i,"Could not find match for route: "+n.id),s.updateMatch(i.id,r=>({...r,status:"notFound",error:e,isFetching:!1})),e.routerCode==="BEFORE_LOAD"&&n.parentRoute&&(e.routeId=n.parentRoute.id,jB(s,e))},_d=(s,e,t)=>{var n,i,r;
49if(!(!qu(t)&&!$u(t))){if(qu(t)&&t.redirectHandled&&!t.options.reloadDocument)throw t;if(e){(n=e._nonReactive.beforeLoadPromise)==null||n.resolve(),(i=e._nonReactive.loaderPromise)==null||i.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loaderPromise=void 0;const a=qu(t)?"redirected":"notFound";s.updateMatch(e.id,l=>({...l,status:a,isFetching:!1,error:t})),$u(t)&&!t.routeId&&(t.routeId=e.routeId),(r=e._nonReactive.loadPromise)==null||r.resolve()}throw qu(t)?(s.rendered=!0,t.options._fromLocation=s.location,t.redirectHandled=!0,t=s.router.resolveRedirect(t),t):(jB(s,t),t)}},KB=(s,e)=>{const t=s.router.getMatch(e);return!!(!s.router.isServer&&t._nonReactive.dehydrated||s.router.isServer&&t.ssr===!1)},A_=(s,e,t,n)=>{var i,r;const{id:a,routeId:l}=s.matches[e],u=s.router.looseRoutesById[l];if(t instanceof Promise)throw t;t.routerCode=n,s.firstBadMatchIndex??(s.firstBadMatchIndex=e),_d(s,s.router.getMatch(a),t);try{(r=(i=u.options).onError)==null||r.call(i,t)}catch(h){t=h,_d(s,s.router.getMatch(a),t)}s.updateMatch(a,h=>{var p,g;return(p=h._nonReactive.beforeLoadPromise)==null||p.resolve(),h._nonReactive.beforeLoadPromise=void 0,(g=h._nonReactive.loadPromise)==null||g.resolve(),{...h,error:t,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}})},T4=(s,e,t,n)=>{var i;const r=s.router.getMatch(e),a=(i=s.matches[t-1])==null?void 0:i.id,l=a?s.router.getMatch(a):void 0;if(s.router.isShell()){r.ssr=e===Qo;return}if(l?.ssr===!1){r.ssr=!1;return}const u=S=>S===!0&&l?.ssr==="data-only"?"data-only":S,h=s.router.options.defaultSsr??!0;if(n.options.ssr===void 0){r.ssr=u(h);return}if(typeof n.options.ssr!="function"){r.ssr=u(n.options.ssr);return}const{search:p,params:g}=r,y={search:sb(p,r.searchError),params:sb(g,r.paramsError),location:s.location,matches:s.matches.map(S=>({index:S.index,pathname:S.pathname,fullPath:S.fullPath,staticData:S.staticData,id:S.id,routeId:S.routeId,search:sb(S.search,S.searchError),params:sb(S.params,S.paramsError),ssr:S.ssr}))},_=n.options.ssr(y);if(Td(_))return _.then(S=>{r.ssr=u(S??h)});r.ssr=u(_??h)},ZB=(s,e,t,n)=>{var i;if(n._nonReactive.pendingTimeout!==void 0)return;const r=t.options.pendingMs??s.router.options.defaultPendingMs;if(!!(s.onReady&&!s.router.isServer&&!xM(s,e)&&(t.options.loader||t.options.beforeLoad||JB(t))&&typeof r=="number"&&r!==1/0&&(t.options.pendingComponent??((i=s.router.options)==null?void 0:i.defaultPendingComponent)))){const l=setTimeout(()=>{MT(s)},r);n._nonReactive.pendingTimeout=l}},M4=(s,e,t)=>{const n=s.router.getMatch(e);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;ZB(s,e,t,n);const i=()=>{const r=s.router.getMatch(e);r.preload&&(r.status==="redirected"||r.status==="notFound")&&_d(s,r,r.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(i):i()},E4=(s,e,t,n)=>{var i;const r=s.router.getMatch(e),a=r._nonReactive.loadPromise;r._nonReactive.loadPromise=vy(()=>{a?.resolve()});const{paramsError:l,searchError:u}=r;l&&A_(s,t,l,"PARSE_PARAMS"),u&&A_(s,t,u,"VALIDATE_SEARCH"),ZB(s,e,n,r);const h=new AbortController,p=(i=s.matches[t-1])==null?void 0:i.id,g=p?s.router.getMatch(p):void 0,_={...g?.context??s.router.options.context??void 0,...r.__routeContext};let S=!1;const A=()=>{S||(S=!0,s.updateMatch(e,z=>({...z,isFetching:"beforeLoad",fetchCount:z.fetchCount+1,abortController:h,context:_})))},E=()=>{var z;(z=r._nonReactive.beforeLoadPromise)==null||z.resolve(),r._nonReactive.beforeLoadPromise=void 0,s.updateMatch(e,B=>({...B,isFetching:!1}))};if(!n.options.beforeLoad){c0(()=>{A(),E()});return}r._nonReactive.beforeLoadPromise=vy();const{search:b,params:C,cause:w}=r,D=xM(s,e),P={search:b,abortController:h,params:C,preload:D,context:_,location:s.location,navigate:z=>s.router.navigate({...z,_fromLocation:s.location}),buildLocation:s.router.buildLocation,cause:D?"preload":w,matches:s.matches},I=z=>{if(z===void 0){c0(()=>{A(),E()});return}(qu(z)||$u(z))&&(A(),A_(s,t,z,"BEFORE_LOAD")),c0(()=>{A(),s.updateMatch(e,B=>({...B,__beforeLoadContext:z,context:{...B.context,...z}})),E()})};let F;try{if(F=n.options.beforeLoad(P),Td(F))return A(),F.catch(z=>{A_(s,t,z,"BEFORE_LOAD")}).then(I)}catch(z){A(),A_(s,t,z,"BEFORE_LOAD")}I(F)},A4=(s,e)=>{const{id:t,routeId:n}=s.matches[e],i=s.router.looseRoutesById[n],r=()=>{if(s.router.isServer){const u=T4(s,t,e,i);if(Td(u))return u.then(a)}return a()},a=()=>
49{if(KB(s,t))return;const u=M4(s,t,i);return Td(u)?u.then(l):l()},l=()=>E4(s,t,e,i);return r()},h0=(s,e,t)=>{var n,i,r,a,l,u;const h=s.router.getMatch(e);if(!h||!t.options.head&&!t.options.scripts&&!t.options.headers)return;const p={matches:s.matches,match:h,params:h.params,loaderData:h.loaderData};return Promise.all([(i=(n=t.options).head)==null?void 0:i.call(n,p),(a=(r=t.options).scripts)==null?void 0:a.call(r,p),(u=(l=t.options).headers)==null?void 0:u.call(l,p)]).then(([g,y,_])=>{const S=g?.meta,A=g?.links,E=g?.scripts,b=g?.styles;return{meta:S,links:A,headScripts:E,headers:_,scripts:y,styles:b}})},QB=(s,e,t,n)=>{const i=s.matchPromises[t-1],{params:r,loaderDeps:a,abortController:l,context:u,cause:h}=s.router.getMatch(e),p=xM(s,e);return{params:r,deps:a,preload:!!p,parentMatchPromise:i,abortController:l,context:u,location:s.location,navigate:g=>s.router.navigate({...g,_fromLocation:s.location}),cause:p?"preload":h,route:n}},pD=async(s,e,t,n)=>{var i,r,a,l;try{const u=s.router.getMatch(e);try{(!s.router.isServer||u.ssr===!0)&&$B(n);const h=(r=(i=n.options).loader)==null?void 0:r.call(i,QB(s,e,t,n)),p=n.options.loader&&Td(h);if(!!(p||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||u._nonReactive.minPendingPromise)&&s.updateMatch(e,A=>({...A,isFetching:"loader"})),n.options.loader){const A=p?await h:h;_d(s,s.router.getMatch(e),A),A!==void 0&&s.updateMatch(e,E=>({...E,loaderData:A}))}n._lazyPromise&&await n._lazyPromise;const y=h0(s,e,n),_=y?await y:void 0,S=u._nonReactive.minPendingPromise;S&&await S,n._componentsPromise&&await n._componentsPromise,s.updateMatch(e,A=>({...A,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),..._}))}catch(h){let p=h;const g=u._nonReactive.minPendingPromise;g&&await g,_d(s,s.router.getMatch(e),h);try{(l=(a=n.options).onError)==null||l.call(a,h)}catch(S){p=S,_d(s,s.router.getMatch(e),S)}const y=h0(s,e,n),_=y?await y:void 0;s.updateMatch(e,S=>({...S,error:p,status:"error",isFetching:!1,..._}))}}catch(u){const h=s.router.getMatch(e);if(h){const p=h0(s,e,n);if(p){const g=await p;s.updateMatch(e,y=>({...y,...g}))}h._nonReactive.loaderPromise=void 0}_d(s,h,u)}},R4=async(s,e)=>{var t,n;const{id:i,routeId:r}=s.matches[e];let a=!1,l=!1;const u=s.router.looseRoutesById[r];if(KB(s,i)){if(s.router.isServer){const g=h0(s,i,u);if(g){const y=await g;s.updateMatch(i,_=>({..._,...y}))}return s.router.getMatch(i)}}else{const g=s.router.getMatch(i);if(g._nonReactive.loaderPromise){if(g.status==="success"&&!s.sync&&!g.preload)return g;await g._nonReactive.loaderPromise;const y=s.router.getMatch(i);y.error&&_d(s,y,y.error)}else{const y=Date.now()-g.updatedAt,_=xM(s,i),S=_?u.options.preloadStaleTime??s.router.options.defaultPreloadStaleTime??3e4:u.options.staleTime??s.router.options.defaultStaleTime??0,A=u.options.shouldReload,E=typeof A=="function"?A(QB(s,i,e,u)):A,b=!!_&&!s.router.state.matches.some(P=>P.id===i),C=s.router.getMatch(i);C._nonReactive.loaderPromise=vy(),b!==C.preload&&s.updateMatch(i,P=>({...P,preload:b}));const{status:w,invalid:D}=C;if(a=w==="success"&&(D||(E??y>S)),!(_&&u.options.preload===!1))if(a&&!s.sync)l=!0,(async()=>{var P,I;try{await pD(s,i,e,u);const F=s.router.getMatch(i);(P=F._nonReactive.loaderPromise)==null||P.resolve(),(I=F._nonReactive.loadPromise)==null||I.resolve(),F._nonReactive.loaderPromise=void 0}catch(F){qu(F)&&await s.router.navigate(F.options)}})();else if(w!=="success"||a&&s.sync)await pD(s,i,e,u);else{const P=h0(s,i,u);if(P){const I=await P;s.updateMatch(i,F=>({...F,...I}))}}}}const h=s.router.getMatch(i);l||((t=h._nonReactive.loaderPromise)==null||t.resolve(),(n=h._nonReactive.loadPromise)==null||n.resolve()),clearTimeout(h._nonReactive.pendingTimeout),h._nonReactive.pendingTimeout=void 0,l||(h._nonReactive.loaderPromise=void 0),h._nonReactive.dehydrated=void 0;const p=l?h.isFetching:!1;return p!==h.isFetching||h.invalid!==!1?(s.updateMatch(i,g=>({...g,isFetching:p,invalid:!1})),s.router.getMatch(i)):h};async function mD(s){const e=Object.assign(s,{matchPromises:[]});!e.router.isServer&&e.router.state.matches.some(t=>t._forcePending)&&MT(e);try{for(let i=0;i<e.matches.length;i++){const r=A4(e,i);Td(r)&&await r}const t=e.firstBadMatchIndex??e.matches.length;for(let i=0;i<t;i++)e.matchPromises.push(R4(e,i));await Promise.all(e.matchPromises);const n=MT(e);Td(n)&&await n}catch(t){if($u(t)&&!e.preload){const n=MT(e);throw Td(n)&&await n,t}if(qu(t))throw t}return e.matches}async function $B(s){if(!s._lazyLoaded&&s._lazyPromise===void 0&&(s.lazyFn?s._lazyPromise=s.lazyFn().then(e=>{const{id:t,...n}=e.options;Object.assign(s.options,n),s._lazyLoaded=!0,s._lazyPromise=void 0}):s._lazyLoaded=!0),!s._componentsLoaded&&s._componentsPromise===void 0){const e=()=>{var t;const n=[];for(const i of eP){const r=(t=s.options[i])==null?void 0:t.preload;
49r&&n.push(r())}if(n.length)return Promise.all(n).then(()=>{s._componentsLoaded=!0,s._componentsPromise=void 0});s._componentsLoaded=!0,s._componentsPromise=void 0};s._componentsPromise=s._lazyPromise?s._lazyPromise.then(e):e()}return s._componentsPromise}function sb(s,e){return e?{status:"error",error:e}:{status:"success",value:s}}function JB(s){var e;for(const t of eP)if((e=s.options[t])!=null&&e.preload)return!0;return!1}const eP=["component","errorComponent","pendingComponent","notFoundComponent"];function Sp(s){const e=s.resolvedLocation,t=s.location,n=e?.pathname!==t.pathname,i=e?.href!==t.href,r=e?.hash!==t.hash;return{fromLocation:e,toLocation:t,pathChanged:n,hrefChanged:i,hashChanged:r}}class N4{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=t=>t(),this.update=t=>{var n;t.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const i=this.options;this.options={...this.options,...t},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(r=>[encodeURIComponent(r),r])):void 0,(!this.basepath||t.basepath&&t.basepath!==i.basepath)&&(t.basepath===void 0||t.basepath===""||t.basepath==="/"?this.basepath="/":this.basepath=`/${zA(t.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??(this.isServer?jG({initialEntries:[this.basepath||"/"]}):YG()),this.updateLatestLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new DR(w4(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(r=>!["redirected"].includes(r.status))}}}),f4(this)),typeof window<"u"&&"CSS"in window&&typeof((n=window.CSS)==null?void 0:n.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:t,routesByPath:n,flatRoutes:i}=I4({routeTree:this.routeTree,initRoute:(a,l)=>{a.init({originalIndex:l})}});this.routesById=t,this.routesByPath=n,this.flatRoutes=i;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)},this.subscribe=(t,n)=>{const i={eventType:t,fn:n};return this.subscribers.add(i),()=>{this.subscribers.delete(i)}},this.emit=t=>{this.subscribers.forEach(n=>{n.eventType===t.type&&n.fn(t)})},this.parseLocation=(t,n)=>{const i=({pathname:u,search:h,hash:p,state:g})=>{const y=this.options.parseSearch(h),_=this.options.stringifySearch(y);return{pathname:u,searchStr:_,search:jo(n?.search,y),hash:p.split("#").reverse()[0]??"",href:`${u}${_}${p}`,state:jo(n?.state,g)}},r=i(t),{__tempLocation:a,__tempKey:l}=r.state;if(a&&(!l||l===this.tempLocationKey)){const u=i(a);return u.state.key=r.state.key,u.state.__TSR_key=r.state.__TSR_key,delete u.state.__tempLocation,{...u,maskedLocation:r}}return r},this.resolvePathWithBase=(t,n)=>JG({basepath:this.basepath,base:t,to:AN(n),trailingSlash:this.options.trailingSlash,caseSensitive:this.options.caseSensitive,parseCache:this.parsePathnameCache}),this.matchRoutes=(t,n,i)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:n},i):this.matchRoutesInternal(t,n),this.parsePathnameCache=b4(1e3),this.getMatchedRoutes=(t,n)=>F4({pathname:t,routePathname:n,basepath:this.basepath,caseSensitive:this.options.caseSensitive,routesByPath:this.routesByPath,routesById:this.routesById,flatRoutes:this.flatRoutes,parseCache:this.parsePathnameCache}),this.cancelMatch=t=>{const n=this.getMatch(t);
49n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{var t;(t=this.state.pendingMatches)==null||t.forEach(n=>{this.cancelMatch(n.id)})},this.buildLocation=t=>{const n=(r={})=>{var a,l;const u=r._fromLocation||this.latestLocation,h=this.matchRoutes(u,{_buildLocation:!0}),p=LR(h);r.from;const g=r.unsafeRelative==="path"?u.pathname:r.from??p.fullPath,y=this.resolvePathWithBase(g,"."),_=p.search,S={...p.params},A=r.to?this.resolvePathWithBase(y,`${r.to}`):this.resolvePathWithBase(y,"."),E=r.params===!1||r.params===null?{}:(r.params??!0)===!0?S:Object.assign(S,_p(r.params,S)),b=ib({path:A,params:E,parseCache:this.parsePathnameCache}).interpolatedPath,C=this.matchRoutes(b,void 0,{_buildLocation:!0}).map(B=>this.looseRoutesById[B.routeId]);if(Object.keys(E).length>0)for(const B of C){const O=((a=B.options.params)==null?void 0:a.stringify)??B.options.stringifyParams;O&&Object.assign(E,O(E))}const w=ib({path:A,params:E,leaveWildcards:!1,leaveParams:t.leaveParams,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath;let D=_;if(t._includeValidateSearch&&((l=this.options.search)!=null&&l.strict)){const B={};C.forEach(O=>{if(O.options.validateSearch)try{Object.assign(B,OR(O.options.validateSearch,{...B,...D}))}catch{}}),D=B}D=V4({search:D,dest:r,destRoutes:C,_includeValidateSearch:t._includeValidateSearch}),D=jo(_,D);const P=this.options.stringifySearch(D),I=r.hash===!0?u.hash:r.hash?_p(r.hash,u.hash):void 0,F=I?`#${I}`:"";let z=r.state===!0?u.state:r.state?_p(r.state,u.state):{};return z=jo(u.state,z),{pathname:w,search:D,searchStr:P,state:z,hash:I??"",href:`${w}${P}${F}`,unmaskOnReload:r.unmaskOnReload}},i=(r={},a)=>{var l;const u=n(r);let h=a?n(a):void 0;if(!h){let p={};const g=(l=this.options.routeMasks)==null?void 0:l.find(y=>{const _=BR(this.basepath,u.pathname,{to:y.from,caseSensitive:!1,fuzzy:!1},this.parsePathnameCache);return _?(p=_,!0):!1});if(g){const{from:y,..._}=g;a={from:t.from,..._,params:p},h=n(a)}}if(h){const p=n(a);u.maskedLocation=p}return u};return t.mask?i(t,{from:t.from,...t.mask}):i(t)},this.commitLocation=({viewTransition:t,ignoreBlocker:n,...i})=>{const r=()=>{const u=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];u.forEach(p=>{i.state[p]=this.latestLocation.state[p]});const h=xp(i.state,this.latestLocation.state);return u.forEach(p=>{delete i.state[p]}),h},a=this.latestLocation.href===i.href,l=this.commitLocationPromise;if(this.commitLocationPromise=vy(()=>{l?.resolve()}),a&&r())this.load();else{let{maskedLocation:u,hashScrollIntoView:h,...p}=i;u&&(p={...u,state:{...u.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=h??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,this.history[i.replace?"replace":"push"](p.href,p.state,{ignoreBlocker:n})}return this.resetNextScroll=i.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:n,hashScrollIntoView:i,viewTransition:r,ignoreBlocker:a,href:l,...u}={})=>
49{if(l){const p=this.history.location.state.__TSR_index,g=E0(l,{__TSR_index:t?p:p+1});u.to=g.pathname,u.search=this.options.parseSearch(g.search),u.hash=g.hash.slice(1)}const h=this.buildLocation({...u,_includeValidateSearch:!0});return this.commitLocation({...h,viewTransition:r,replace:t,resetScroll:n,hashScrollIntoView:i,ignoreBlocker:a})},this.navigate=({to:t,reloadDocument:n,href:i,...r})=>{if(!n&&i)try{new URL(`${i}`),n=!0}catch{}if(n){if(!i){const a=this.buildLocation({to:t,...r});i=this.history.createHref(a.href)}return r.replace?window.location.replace(i):window.location.href=i,Promise.resolve()}return this.buildAndCommitLocation({...r,href:i,to:t,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const n=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),i=r=>{try{return encodeURI(decodeURI(r))}catch{return r}};if(zA(i(this.latestLocation.href))!==zA(i(n.href)))throw S4({href:n.href})}const t=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:t,cachedMatches:n.cachedMatches.filter(i=>!t.some(r=>r.id===i.id))}))},this.load=async t=>{let n,i,r;for(r=new Promise(a=>{this.startTransition(async()=>{var l;try{this.beforeLoad();const u=this.latestLocation,h=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...Sp({resolvedLocation:h,location:u})}),this.emit({type:"onBeforeLoad",...Sp({resolvedLocation:h,location:u})}),await mD({router:this,sync:t?.sync,matches:this.state.pendingMatches,location:u,updateMatch:this.updateMatch,onReady:async()=>{this.startViewTransition(async()=>{let p,g,y;c0(()=>{this.__store.setState(_=>{const S=_.matches,A=_.pendingMatches||_.matches;return p=S.filter(E=>!A.some(b=>b.id===E.id)),g=A.filter(E=>!S.some(b=>b.id===E.id)),y=S.filter(E=>A.some(b=>b.id===E.id)),{..._,isLoading:!1,loadedAt:Date.now(),matches:A,pendingMatches:void 0,cachedMatches:[..._.cachedMatches,...p.filter(E=>E.status!=="error")]}}),this.clearExpiredCache()}),[[p,"onLeave"],[g,"onEnter"],[y,"onStay"]].forEach(([_,S])=>{_.forEach(A=>{var E,b;(b=(E=this.looseRoutesById[A.routeId].options)[S])==null||b.call(E,A)})})})}})}catch(u){qu(u)?(n=u,this.isServer||this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):$u(u)&&(i=u),this.__store.setState(h=>({...h,statusCode:n?n.status:i?404:h.matches.some(p=>p.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===r&&((l=this.commitLocationPromise)==null||l.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;this.hasNotFoundMatch()&&this.__store.setState(a=>({...a,statusCode:404}))},this.startViewTransition=t=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let i;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const r=this.latestLocation,a=this.state.resolvedLocation,l=typeof n.types=="function"?n.types(Sp({resolvedLocation:a,location:r})):n.types;i={update:t,types:l}}else i=t;document.startViewTransition(i)}else t()},this.updateMatch=(t,n)=>{var i;const r=(i=this.state.pendingMatches)!=null&&i.some(a=>a.id===t)?"pendingMatches":this.state.matches.some(a=>a.id===t)?"matches":this.state.cachedMatches.some(a=>a.id===t)?"cachedMatches":"";r&&this.__store.setState(a=>{var l;return{...a,[r]:(l=a[r])==null?void 0:l.map(u=>u.id===t?n(u):u)}})},this.getMatch=t=>{var n;const i=r=>r.id===t;return this.state.cachedMatches.find(i)??((n=this.state.pendingMatches)==null?void 0:n.find(i))??this.state.matches.find(i)},this.invalidate=t=>{const n=i=>{var r;return((r=t?.filter)==null?void 0:r.call(t,i))??!0?{...i,invalid:!0,...t?.forcePending||i.status==="error"?{status:"pending",error:void 0}:void 0}:i};return this.__store.setState(i=>{var r;return{...i,matches:i.matches.map(n),cachedMatches:i.cachedMatches.map(n),pendingMatches:(r=i.pendingMatches)==null?void 0:r.map(n)}}),this.shouldViewTransition=!1,this.load({sync:t?.sync})},this.resolveRedirect=t=>(t.options.href||(t.options.href=this.buildLocation(t.options).href,t.headers.set("Location",t.options.href)),t.headers.get("Location")||t.headers.set("Location",t.options.href),t),this.clearCache=t=>{const n=t?.filter;n!==void 0?this.__store.setState(i=>({...i,cachedMatches:i.cachedMatches.filter(r=>!n(r))})):this.__store.setState(i=>({...i,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=n=>{const i=this.looseRoutesById[n.routeId];if(!i.options.loader)return!0;const r=(n.preload?i.options.preloadGcTime??this.options.defaultPreloadGcTime:i.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=r};this.clearCache({filter:t})},this.loadRouteChunk=$B,this.preloadRoute=async t=>{const n=this.buildLocation(t);let i=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:t});const r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(l=>l.id)),a=new Set([...r,...this.state.cachedMatches.map(l=>l.id)]);c0(()=>
49{i.forEach(l=>{a.has(l.id)||this.__store.setState(u=>({...u,cachedMatches:[...u.cachedMatches,l]}))})});try{return i=await mD({router:this,matches:i,location:n,preload:!0,updateMatch:(l,u)=>{r.has(l)?i=i.map(h=>h.id===l?u(h):h):this.updateMatch(l,u)}}),i}catch(l){if(qu(l))return l.options.reloadDocument?void 0:await this.preloadRoute({...l.options,_fromLocation:n});$u(l)||console.error(l);return}},this.matchRoute=(t,n)=>{const i={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},r=this.buildLocation(i);if(n?.pending&&this.state.status!=="pending")return!1;const l=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,u=BR(this.basepath,l.pathname,{...n,to:r.pathname},this.parsePathnameCache);return!u||t.params&&!xp(u,t.params,{partial:!0})?!1:u&&(n?.includeSearch??!0)?xp(l.search,r.search,{partial:!0})?u:!1:u},this.hasNotFoundMatch=()=>this.__store.state.matches.some(t=>t.status==="notFound"||t.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??v4,parseSearch:e.parseSearch??y4}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(e,t){var n;const{foundRoute:i,matchedRoutes:r,routeParams:a}=this.getMatchedRoutes(e.pathname,(n=t?.dest)==null?void 0:n.to);let l=!1;(i?i.path!=="/"&&a["**"]:xy(e.pathname))&&(this.options.notFoundRoute?r.push(this.options.notFoundRoute):l=!0);const u=(()=>{if(l){if(this.options.notFoundMode!=="root")for(let y=r.length-1;y>=0;y--){const _=r[y];if(_.children)return _.id}return Qo}})(),h=r.map(y=>{var _;let S;const A=((_=y.options.params)==null?void 0:_.parse)??y.options.parseParams;if(A)try{const E=A(a);Object.assign(a,E)}catch(E){if(S=new C4(E.message,{cause:E}),t?.throwOnError)throw S;return S}}),p=[],g=y=>y?.id?y.context??this.options.context??void 0:this.options.context??void 0;return r.forEach((y,_)=>{var S,A;const E=p[_-1],[b,C,w]=(()=>{const fe=E?.search??e.search,pe=E?._strictSearch??void 0;try{const k=OR(y.options.validateSearch,{...fe})??void 0;return[{...fe,...k},{...pe,...k},void 0]}catch(k){let Q=k;if(k instanceof kT||(Q=new kT(k.message,{cause:k})),t?.throwOnError)throw Q;return[fe,{},Q]}})(),D=((A=(S=y.options).loaderDeps)==null?void 0:A.call(S,{search:b}))??"",P=D?JSON.stringify(D):"",{usedParams:I,interpolatedPath:F}=ib({path:y.fullPath,params:a,decodeCharMap:this.pathParamsDecodeCharMap}),z=ib({path:y.id,params:a,leaveWildcards:!0,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath+P,B=this.getMatch(z),O=this.state.matches.find(fe=>fe.routeId===y.id),W=O?"stay":"enter";let ee;if(B)ee={...B,cause:W,params:O?jo(O.params,a):a,_strictParams:I,search:jo(O?O.search:B.search,b),_strictSearch:C};else{const fe=y.options.loader||y.options.beforeLoad||y.lazyFn||JB(y)?"pending":"success";ee={id:z,index:_,routeId:y.id,params:O?jo(O.params,a):a,_strictParams:I,pathname:Wc([this.basepath,F]),updatedAt:Date.now(),search:O?jo(O.search,b):b,_strictSearch:C,searchError:void 0,status:fe,isFetching:!1,error:void 0,paramsError:h[_],__routeContext:void 0,_nonReactive:{loadPromise:vy()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:W,loaderDeps:O?jo(O.loaderDeps,D):D,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:y.options.staticData||{},fullPath:y.fullPath}}t?.preload||(ee.globalNotFound=u===y.id),ee.searchError=w;const se=g(E);ee.context={...se,...ee.__routeContext,...ee.__beforeLoadContext},p.push(ee)}),p.forEach((y,_)=>{const S=this.looseRoutesById[y.routeId];if(!this.getMatch(y.id)&&t?._buildLocation!==!0){const E=p[_-1],b=g(E);if(S.options.context){const C={deps:y.loaderDeps,params:y.params,context:b??{},location:e,navigate:w=>this.navigate({...w,_fromLocation:e}),buildLocation:this.buildLocation,cause:y.cause,abortController:y.abortController,preload:!!y.preload,matches:p};
49y.__routeContext=S.options.context(C)??void 0}y.context={...b,...y.__routeContext,...y.__beforeLoadContext}}}),p}}class kT extends Error{}class C4 extends Error{}function w4(s){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:s,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function OR(s,e){if(s==null)return{};if("~standard"in s){const t=s["~standard"].validate(e);if(t instanceof Promise)throw new kT("Async validation not supported");if(t.issues)throw new kT(JSON.stringify(t.issues,void 0,2),{cause:t});return t.value}return"parse"in s?s.parse(e):typeof s=="function"?s(e):{}}const D4=.5,U4=.4,L4=.25,B4=.05,P4=.02,O4=.01,gD=2e-4,yD=1e-4;function vD(s,e){return s.prefixSegment&&s.suffixSegment?e+B4+gD*s.prefixSegment.length+yD*s.suffixSegment.length:s.prefixSegment?e+P4+gD*s.prefixSegment.length:s.suffixSegment?e+O4+yD*s.suffixSegment.length:e}function I4({routeTree:s,initRoute:e}){const t={},n={},i=u=>{u.forEach((h,p)=>{e?.(h,p);const g=t[h.id];if(eh(!g,`Duplicate routes found with id: ${String(h.id)}`),t[h.id]=h,!h.isRoot&&h.path){const _=xy(h.fullPath);(!n[_]||h.fullPath.endsWith("/"))&&(n[_]=h)}const y=h.children;y?.length&&i(y)})};i([s]);const r=[];Object.values(t).forEach((u,h)=>{var p;if(u.isRoot||!u.path)return;const g=RN(u.fullPath);let y=Sy(g),_=0;for(;y.length>_+1&&((p=y[_])==null?void 0:p.value)==="/";)_++;_>0&&(y=y.slice(_));let S=0,A=!1;const E=y.map((b,C)=>{if(b.value==="/")return .75;let w;if(b.type===Cp?w=D4:b.type===_y?(w=U4,S++):b.type===wp&&(w=L4),w){for(let D=C+1;D<y.length;D++){const P=y[D];if(P.type===qc&&P.value!=="/")return A=!0,vD(b,w+.2)}return vD(b,w)}return 1});r.push({child:u,trimmed:g,parsed:y,index:h,scores:E,optionalParamCount:S,hasStaticAfter:A})});const l=r.sort((u,h)=>{const p=Math.min(u.scores.length,h.scores.length);for(let g=0;g<p;g++)if(u.scores[g]!==h.scores[g])return h.scores[g]-u.scores[g];if(u.scores.length!==h.scores.length){if(u.optionalParamCount!==h.optionalParamCount){if(u.hasStaticAfter===h.hasStaticAfter)return u.optionalParamCount-h.optionalParamCount;if(u.hasStaticAfter&&!h.hasStaticAfter)return-1;if(!u.hasStaticAfter&&h.hasStaticAfter)return 1}return h.scores.length-u.scores.length}for(let g=0;g<p;g++)if(u.parsed[g].value!==h.parsed[g].value)return u.parsed[g].value>h.parsed[g].value?1:-1;return u.index-h.index}).map((u,h)=>(u.child.rank=h,u.child));return{routesById:t,routesByPath:n,flatRoutes:l}}function F4({pathname:s,routePathname:e,basepath:t,caseSensitive:n,routesByPath:i,routesById:r,flatRoutes:a,parseCache:l}){let u={};const h=xy(s),p=S=>{var A;return BR(t,h,{to:S.fullPath,caseSensitive:((A=S.options)==null?void 0:A.caseSensitive)??n,fuzzy:!0},l)};let g=e!==void 0?i[e]:void 0;if(g)u=p(g);else{let S;for(const A of a){const E=p(A);if(E)if(A.path!=="/"&&E["**"])S||(S={foundRoute:A,routeParams:E});else{g=A,u=E;break}}!g&&S&&(g=S.foundRoute,u=S.routeParams)}let y=g||r[Qo];const _=[y];for(;y.parentRoute;)y=y.parentRoute,_.push(y);return _.reverse(),{matchedRoutes:_,routeParams:u,foundRoute:g}}function V4({search:s,dest:e,destRoutes:t,_includeValidateSearch:n}){const i=t.reduce((l,u)=>{var h;const p=[];if("search"in u.options)(h=u.options.search)!=null&&h.middlewares&&p.push(...u.options.search.middlewares);else if(u.options.preSearchFilters||u.options.postSearchFilters){const g=({search:y,next:_})=>{let S=y;"preSearchFilters"in u.options&&u.options.preSearchFilters&&(S=u.options.preSearchFilters.reduce((E,b)=>b(E),y));const A=_(S);return"postSearchFilters"in u.options&&u.options.postSearchFilters?u.options.postSearchFilters.reduce((E,b)=>b(E),A):A};p.push(g)}if(n&&u.options.validateSearch){const g=({search:y,next:_})=>{const S=_(y);try{return{...S,...OR(u.options.validateSearch,S)??void 0}}catch{return S}};p.push(g)}return l.concat(p)},[])??[],r=({search:l})=>e.search?e.search===!0?l:_p(e.search,l):{};i.push(r);const a=(l,u)=>{if(l>=i.length)return u;const h=i[l];return h({search:u,next:g=>a(l+1,g)})};return a(0,s)}const z4="Error preloading route! âï¸";class tP{constructor(e){if(this.init=t=>{var n,i;this.originalIndex=t.originalIndex;const r=this.options,a=!r?.path&&!r?.id;this.parentRoute=(i=(n=this.options).getParentRoute)==null?void 0:i.call(n),a?this._path=Qo:this.parentRoute||eh(!1);let l=a?Qo:r?.path;l&&l!=="/"&&(l=RN(l));const u=r?.id||l;let h=a?Qo:Wc([this.parentRoute.id===Qo?"":this.parentRoute.id,u]);l===Qo&&(l="/"),h!==Qo&&(h=Wc(["/",h]));const p=h===Qo?"/":Wc([this.parentRoute.fullPath,l]);this._path=l,this._id=h,this._fullPath=p,this._to=p},this.clone=t=>{this._path=t._path,this._id=t._id,this._fullPath=t._fullPath,this._to=t._to,this.options.getParentRoute=t.options.getParentRoute,this.children=t.children},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class G4 extends tP{constructor(e){super(e)}}function NN(s){const e=s.errorComponent??SM;return Xe.jsx(H4,{getResetKey:s.getResetKey,onCatch:s.onCatch,children:({error:t,reset:n})=>t?ze.createElement(e,{error:t,reset:n}):s.children})}class H4 extends ze.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function SM({error:s}){const[e,t]=ze.useState(!1);return Xe.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[Xe.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[Xe.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),Xe.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>t(n=>!n),children:e?"Hide Error":"Show Error"})]}),Xe.jsx("div",{style:{height:".25rem"}}),e?Xe.jsx("div",{children:Xe.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:s.message?Xe.jsx("code",{children:s.message}):null})}):null]})}function k4({children:s,fallback:e=null}){return q4()?Xe.jsx(yy.Fragment,{children:s}):Xe.jsx(yy.Fragment,{children:e})}function q4(){return yy.useSyncExternalStore(W4,()=>!0,()=>!1)}function W4(){return()=>{}}var kA={exports:{}},qA={},WA={exports:{}},XA={};/** 50 * @license React 51 * use-sync-external-store-shim.production.js 52 * 53 * Copyright (c) Meta Platforms, Inc. and affiliates. 54 * 55 * This source code is licensed under the MIT license found in the 56 * LICENSE file in the root directory of this source tree. 57 */var _D;function X4(){if(_D)return XA;_D=1;var s=jy();function e(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var t=typeof Object.is=="function"?Object.is:e,n=s.useState,i=s.useEffect,r=s.useLayoutEffect,a=s.useDebugValue;function l(g,y){var _=y(),S=n({inst:{value:_,getSnapshot:y}}),A=S[0].inst,E=S[1];return r(function(){A.value=_,A.getSnapshot=y,u(A)&&E({inst:A})},[g,_,y]),i(function(){return u(A)&&E({inst:A}),g(function(){u(A)&&E({inst:A})})},[g]),a(_),_}function u(g){var y=g.getSnapshot;g=g.value;try{var _=y();return!t(g,_)}catch{return!0}}function h(g,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:l;return XA.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:p,XA}var xD;function Y4(){return xD||(xD=1,WA.exports=X4()),WA.exports}/** 58 * @license React 59 * use-sync-external-store-shim/with-selector.production.js 60 * 61 * Copyright (c) Meta Platforms, Inc. and affiliates. 62 * 63 * This source code is licensed under the MIT license found in the 64 * LICENSE file in the root directory of this source tree. 65 */var SD;function j4(){if(SD)return qA;SD=1;var s=jy(),e=Y4();function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,r=s.useRef,a=s.useEffect,l=s.useMemo,u=s.useDebugValue;
65return qA.useSyncExternalStoreWithSelector=function(h,p,g,y,_){var S=r(null);if(S.current===null){var A={hasValue:!1,value:null};S.current=A}else A=S.current;S=l(function(){function b(I){if(!C){if(C=!0,w=I,I=y(I),_!==void 0&&A.hasValue){var F=A.value;if(_(F,I))return D=F}return D=I}if(F=D,n(w,I))return F;var z=y(I);return _!==void 0&&_(F,z)?(w=I,F):(w=I,D=z)}var C=!1,w,D,P=g===void 0?null:g;return[function(){return b(p())},P===null?void 0:function(){return b(P())}]},[p,g,y,_]);var E=i(h,S[0],S[1]);return a(function(){A.hasValue=!0,A.value=E},[E]),u(E),E},qA}var bD;function K4(){return bD||(bD=1,kA.exports=j4()),kA.exports}var nP=K4();const Z4=_M(nP);function Q4(s,e=t=>t){return nP.useSyncExternalStoreWithSelector(s.subscribe,()=>s.state,()=>s.state,e,$4)}function $4(s,e){if(Object.is(s,e))return!0;if(typeof s!="object"||s===null||typeof e!="object"||e===null)return!1;if(s instanceof Map&&e instanceof Map){if(s.size!==e.size)return!1;for(const[n,i]of s)if(!e.has(n)||!Object.is(i,e.get(n)))return!1;return!0}if(s instanceof Set&&e instanceof Set){if(s.size!==e.size)return!1;for(const n of s)if(!e.has(n))return!1;return!0}if(s instanceof Date&&e instanceof Date)return s.getTime()===e.getTime();const t=Object.keys(s);if(t.length!==Object.keys(e).length)return!1;for(let n=0;n<t.length;n++)if(!Object.prototype.hasOwnProperty.call(e,t[n])||!Object.is(s[t[n]],e[t[n]]))return!1;return!0}const YA=ze.createContext(null);function iP(){return typeof document>"u"?YA:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=YA,YA)}function ul(s){const e=ze.useContext(iP());return s?.warn,e}function Ka(s){const e=ul({warn:s?.router===void 0}),t=s?.router||e,n=ze.useRef(void 0);return Q4(t.__store,i=>{if(s?.select){if(s.structuralSharing??t.options.defaultStructuralSharing){const r=jo(n.current,s.select(i));return n.current=r,r}return s.select(i)}return i})}const bM=ze.createContext(void 0),J4=ze.createContext(void 0);function Ju(s){const e=ze.useContext(s.from?J4:bM);return Ka({select:n=>{const i=n.matches.find(r=>s.from?s.from===r.routeId:r.id===e);if(eh(!((s.shouldThrow??!0)&&!i),`Could not find ${s.from?`an active match from "${s.from}"`:"a nearest match!"}`),i!==void 0)return s.select?s.select(i):i},structuralSharing:s.structuralSharing})}function CN(s){return Ju({from:s.from,strict:s.strict,structuralSharing:s.structuralSharing,select:e=>s.select?s.select(e.loaderData):e.loaderData})}function wN(s){const{select:e,...t}=s;return Ju({...t,select:n=>e?e(n.loaderDeps):n.loaderDeps})}function DN(s){return Ju({from:s.from,strict:s.strict,shouldThrow:s.shouldThrow,structuralSharing:s.structuralSharing,select:e=>s.select?s.select(e.params):e.params})}function UN(s){return Ju({from:s.from,strict:s.strict,shouldThrow:s.shouldThrow,structuralSharing:s.structuralSharing,select:e=>s.select?s.select(e.search):e.search})}function LN(s){const e=ul();return ze.useCallback(t=>e.navigate({...t,from:t.from??s?.from}),[s?.from,e])}var eH=kB();const rb=typeof window<"u"?ze.useLayoutEffect:ze.useEffect;function jA(s){const e=ze.useRef({value:s,prev:null}),t=e.current.value;return s!==t&&(e.current={value:s,prev:t}),e.current.prev}function tH(s,e,t={},n={}){ze.useEffect(()=>{if(!s.current||n.disabled||typeof IntersectionObserver!="function")return;const i=new IntersectionObserver(([r])=>{e(r)},t);return i.observe(s.current),()=>{i.disconnect()}},[e,t,n.disabled,s])}function nH(s){const e=ze.useRef(null);return ze.useImperativeHandle(s,()=>e.current,[]),e}function iH(s,e){const t=ul(),[n,i]=ze.useState(!1),r=ze.useRef(!1),a=nH(e),{activeProps:l,inactiveProps:u,activeOptions:h,to:p,preload:g,preloadDelay:y,hashScrollIntoView:_,replace:S,startTransition:A,resetScroll:E,viewTransition:b,children:C,target:w,disabled:D,style:P,className:I,onClick:F,onFocus:z,onMouseEnter:B,onMouseLeave:O,onTouchStart:W,ignoreBlocker:ee,params:se,search:fe,hash:pe,state:k,mask:Q,reloadDocument:J,unsafeRelative:Se,from:K,_fromLocation:oe,...we}=s,Ie=ze.useMemo(()=>{try{return new URL(p),"external"}catch{}return"internal"},[p]),Ze=Ka({select:Z=>Z.location.search,structuralSharing:!0}),mt=s.from,xe=ze.useMemo(()=>({...s,from:mt}),[t,Ze,mt,s._fromLocation,s.hash,s.to,s.search,s.params,s.state,s.mask,s.unsafeRelative]),Ve=ze.useMemo(()=>t.buildLocation({...xe}),[t,xe]),tt=Ie==="external",Mt=s.reloadDocument||tt?!1:g??t.options.defaultPreload,Ct=y??t.options.defaultPreloadDelay??0,r
65n=Ka({select:Z=>{if(tt)return!1;if(h?.exact){if(!QG(Z.location.pathname,Ve.pathname,t.basepath))return!1}else{const G=VT(Z.location.pathname,t.basepath),ge=VT(Ve.pathname,t.basepath);if(!(G.startsWith(ge)&&(G.length===ge.length||G[ge.length]==="/")))return!1}return(h?.includeSearch??!0)&&!xp(Z.location.search,Ve.search,{partial:!h?.exact,ignoreUndefined:!h?.explicitUndefined})?!1:h?.includeHash?Z.location.hash===Ve.hash:!0}}),vn=ze.useCallback(()=>{t.preloadRoute({...xe}).catch(Z=>{console.warn(Z),console.warn(z4)})},[t,xe]),te=ze.useCallback(Z=>{Z?.isIntersecting&&vn()},[vn]);tH(a,te,lH,{disabled:!!D||Mt!=="viewport"}),ze.useEffect(()=>{r.current||!D&&Mt==="render"&&(vn(),r.current=!0)},[D,vn,Mt]);const $e=Z=>{if(!D&&!uH(Z)&&!Z.defaultPrevented&&(!w||w==="_self")&&Z.button===0){Z.preventDefault(),eH.flushSync(()=>{i(!0)});const G=t.subscribe("onResolved",()=>{G(),i(!1)});t.navigate({...xe,replace:S,resetScroll:E,hashScrollIntoView:_,startTransition:A,viewTransition:b,ignoreBlocker:ee})}};if(tt)return{...we,ref:a,type:Ie,href:p,...C&&{children:C},...w&&{target:w},...D&&{disabled:D},...P&&{style:P},...I&&{className:I},...F&&{onClick:F},...z&&{onFocus:z},...B&&{onMouseEnter:B},...O&&{onMouseLeave:O},...W&&{onTouchStart:W}};const Ye=Z=>{D||Mt&&vn()},qe=Ye,Be=Z=>{if(!(D||!Mt))if(!Ct)vn();else{const G=Z.target;if(R_.has(G))return;const ge=setTimeout(()=>{R_.delete(G),vn()},Ct);R_.set(G,ge)}},ft=Z=>{if(D||!Mt||!Ct)return;const G=Z.target,ge=R_.get(G);ge&&(clearTimeout(ge),R_.delete(G))},Je=rn?_p(l,{})??sH:KA,nt=rn?KA:_p(u,{})??KA,qt=[I,Je.className,nt.className].filter(Boolean).join(" "),tn=(P||Je.style||nt.style)&&{...P,...Je.style,...nt.style};return{...we,...Je,...nt,href:D?void 0:Ve.maskedLocation?t.history.createHref(Ve.maskedLocation.href):t.history.createHref(Ve.href),ref:a,onClick:N_([F,$e]),onFocus:N_([z,Ye]),onMouseEnter:N_([B,Be]),onMouseLeave:N_([O,ft]),onTouchStart:N_([W,qe]),disabled:!!D,target:w,...tn&&{style:tn},...qt&&{className:qt},...D&&rH,...rn&&aH,...n&&oH}}const KA={},sH={className:"active"},rH={role:"link","aria-disabled":!0},aH={"data-status":"active","aria-current":"page"},oH={"data-transitioning":"transitioning"},R_=new WeakMap,lH={rootMargin:"100px"},N_=s=>e=>{s.filter(Boolean).forEach(t=>{e.defaultPrevented||t(e)})},BN=ze.forwardRef((s,e)=>{const{_asChild:t,...n}=s,{type:i,ref:r,...a}=iH(n,e),l=typeof n.children=="function"?n.children({isActive:a["data-status"]==="active"}):n.children;return t===void 0&&delete a.disabled,ze.createElement(t||"a",{...a,ref:r},l)});function uH(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}let cH=class extends tP{constructor(e){super(e),this.useMatch=t=>Ju({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Ju({...t,from:this.id,select:n=>t?.select?t.select(n.context):n.context}),this.useSearch=t=>UN({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>DN({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>wN({...t,from:this.id}),this.useLoaderData=t=>CN({...t,from:this.id}),this.useNavigate=()=>LN({from:this.fullPath}),this.Link=yy.forwardRef((t,n)=>Xe.jsx(BN,{ref:n,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function hH(s){return new cH(s)}class dH extends G4{constructor(e){super(e),this.useMatch=t=>Ju({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Ju({...t,from:this.id,select:n=>t?.select?t.select(n.context):n.context}),this.useSearch=t=>UN({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>DN({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>wN({...t,from:this.id}),this.useLoaderData=t=>CN({...t,from:this.id}),this.useNavigate=()=>LN({from:this.fullPath}),this.Link=yy.forwardRef((t,n)=>Xe.jsx(BN,{ref:n,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}}function fH(s){return new dH(s)}function A0(s){return typeof s=="object"?new TD(s,{silent:!0}).createRoute(s):new TD(s,{silent:!0}).createRoute}class TD{constructor(e,t){this.path=e,this.createRoute=n=>{this.silent;const i=hH(n);return i.isRoot=!1,i},this.silent=t?.silent}}class MD{constructor(e){this.useMatch=t=>Ju({select:t?.select,from:this.options.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Ju({from:this.options.id,select:n=>t?.select?t.select(n.context):n.context}),this.useSearch=t=>UN({select:t?.select,structuralSharing:t?.structuralSharing,from:this.options.id}),this.useParams=t=>DN({select:t?.select,structuralSharing:t?.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>wN({...t,from:this.options.id}),this.useLoaderData=t=>CN({...t,from:this.options.id}),this.useNavigate=()=>{const t=ul();return LN({from:t.routesById[this.options.id].fullPath})},this.options=e,this.$$typeof=Symbol.for("react.memo")}}function ED(s){return typeof s=="object"?new MD(s):e=>new MD({id:s,...e})}function pH(){const s=ul(),e=ze.useRef({router:s,mounted:!1}),[t,n]=ze.useState(!1),{hasPendingMatches:i,isLoading:r}=Ka({select:g=>({isLoading:g.isLoading,hasPendingMatches:g.matches.some(y=>y.status==="pending")}),structuralSharing:!0}),a=jA(r),l=r||t||i,u=jA(l),h=r||i,p=jA(h);return s.startTransition=g=>{n(!0),ze.startTransition(()=>{g(),n(!1)})},ze.useEffect(()=>{const g=s.history.subscribe(s.load),y=s.buildLocation({to:s.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return xy(s.latestLocation.href)!==xy(y.href)&&s.commitLocation({...y,replace:!0}),()=>{g()}},[s,s.history]),rb(()=>{if(typeof window<"u"&&s.ssr||e.current.router===s&&e.current.mounted)return;e.current={router:s,mounted:!0},(async()=>{try{await s.load()}catch(y){console.error(y)}})()},[s]),rb(()=>{a&&!r&&s.emit({type:"onLoad",...Sp(s.state)})},[a,s,r]),rb(()=>{p&&!h&&s.emit({type:"onBeforeRouteMount",...Sp(s.state)})},[h,p,s]),rb(()=>{u&&!l&&(s.emit({type:"onResolved",...Sp(s.state)}),s.__store.setState(g=>({...g,status:"idle",resolvedLocation:g.location})),p4(s))},[l,u,s]),null}function mH(s){const e=Ka({select:t=>`not-found-${t.location.pathname}-${t.status}`});return Xe.jsx(NN,{getResetKey:()=>e,onCatch:(t,n)=>{var i;if($u(t))(i=s.onCatch)==null||i.call(s,t,n);else throw t},errorComponent:({error:t})=>{var n;if($u(t))return(n=s.fallback)==null?void 0:n.call(s,t);throw t},children:s.children})}function gH(){return Xe.jsx("p",{children:"Not Found"})}function ty(s){return Xe.jsx(Xe.Fragment,{children:s.children})}function sP(s,e,t){return e.options.notFoundComponent?Xe.jsx(e.options.notFoundComponent,{data:t}):s.options.defaultNotFoundComponent?Xe.jsx(s.options.defaultNotFoundComponent,{data:t}):Xe.jsx(gH,{})}function yH({children:s}){return typeof document<"u"?null:Xe.jsx("script",{className:"$tsr",dangerouslySetInnerHTML:{__html:[s].filter(
65Boolean).join(` 66`)}})}function vH(){const s=ul(),t=(s.options.getScrollRestorationKey||PR)(s.latestLocation),n=t!==PR(s.latestLocation)?t:void 0;if(!s.isScrollRestoring||!s.isServer)return null;const i={storageKey:GT,shouldScrollRestoration:!0};return n&&(i.key=n),Xe.jsx(yH,{children:`(${YB.toString()})(${JSON.stringify(i)})`})}const rP=ze.memo(function({matchId:e}){var t,n;const i=ul(),r=Ka({select:w=>{const D=w.matches.find(P=>P.id===e);return eh(D),{routeId:D.routeId,ssr:D.ssr,_displayPending:D._displayPending}},structuralSharing:!0}),a=i.routesById[r.routeId],l=a.options.pendingComponent??i.options.defaultPendingComponent,u=l?Xe.jsx(l,{}):null,h=a.options.errorComponent??i.options.defaultErrorComponent,p=a.options.onCatch??i.options.defaultOnCatch,g=a.isRoot?a.options.notFoundComponent??((t=i.options.notFoundRoute)==null?void 0:t.options.component):a.options.notFoundComponent,y=r.ssr===!1||r.ssr==="data-only",_=(!a.isRoot||a.options.wrapInSuspense||y)&&(a.options.wrapInSuspense??l??(((n=a.options.errorComponent)==null?void 0:n.preload)||y))?ze.Suspense:ty,S=h?NN:ty,A=g?mH:ty,E=Ka({select:w=>w.loadedAt}),b=Ka({select:w=>{var D;const P=w.matches.findIndex(I=>I.id===e);return(D=w.matches[P-1])==null?void 0:D.routeId}}),C=a.isRoot?a.options.shellComponent??ty:ty;return Xe.jsxs(C,{children:[Xe.jsx(bM.Provider,{value:e,children:Xe.jsx(_,{fallback:u,children:Xe.jsx(S,{getResetKey:()=>E,errorComponent:h||SM,onCatch:(w,D)=>{if($u(w))throw w;p?.(w,D)},children:Xe.jsx(A,{fallback:w=>
66{if(!g||w.routeId&&w.routeId!==r.routeId||!w.routeId&&!a.isRoot)throw w;return ze.createElement(g,w)},children:y||r._displayPending?Xe.jsx(k4,{fallback:u,children:Xe.jsx(AD,{matchId:e})}):Xe.jsx(AD,{matchId:e})})})})}),b===Qo&&i.options.scrollRestoration?Xe.jsxs(Xe.Fragment,{children:[Xe.jsx(_H,{}),Xe.jsx(vH,{})]}):null]})});function _H(){const s=ul(),e=ze.useRef(void 0);return Xe.jsx("script",{suppressHydrationWarning:!0,ref:t=>{t&&(e.current===void 0||e.current.href!==s.latestLocation.href)&&(s.emit({type:"onRendered",...Sp(s.state)}),e.current=s.latestLocation)}},s.latestLocation.state.__TSR_key)}const AD=ze.memo(function({matchId:e}){var t,n,i,r;const a=ul(),{match:l,key:u,routeId:h}=Ka({select:y=>{const _=y.matches.find(C=>C.id===e),S=_.routeId,A=a.routesById[S].options.remountDeps??a.options.defaultRemountDeps,E=A?.({routeId:S,loaderDeps:_.loaderDeps,params:_._strictParams,search:_._strictSearch});return{key:E?JSON.stringify(E):void 0,routeId:S,match:{id:_.id,status:_.status,error:_.error,_forcePending:_._forcePending,_displayPending:_._displayPending}}},structuralSharing:!0}),p=a.routesById[h],g=ze.useMemo(()=>{const y=p.options.component??a.options.defaultComponent;return y?Xe.jsx(y,{},u):Xe.jsx(aP,{})},[u,p.options.component,a.options.defaultComponent]);if(l._displayPending)throw(t=a.getMatch(l.id))==null?void 0:t._nonReactive.displayPendingPromise;if(l._forcePending)throw(n=a.getMatch(l.id))==null?void 0:n._nonReactive.minPendingPromise;if(l.status==="pending"){const y=p.options.pendingMinMs??a.options.defaultPendingMinMs;if(y){const _=a.getMatch(l.id);if(_&&!_._nonReactive.minPendingPromise&&!a.isServer){const S=vy();_._nonReactive.minPendingPromise=S,setTimeout(()=>{S.resolve(),_._nonReactive.minPendingPromise=void 0},y)}}throw(i=a.getMatch(l.id))==null?void 0:i._nonReactive.loadPromise}if(l.status==="notFound")return eh($u(l.error)),sP(a,p,l.error);if(l.status==="redirected")throw eh(qu(l.error)),(r=a.getMatch(l.id))==null?void 0:r._nonReactive.loadPromise;if(l.status==="error"){if(a.isServer){const y=(p.options.errorComponent??a.options.defaultErrorComponent)||SM;return Xe.jsx(y,{error:l.error,reset:void 0,info:{componentStack:""}})}throw l.error}return g}),aP=ze.memo(function(){const e=ul(),t=ze.useContext(bM),n=Ka({select:h=>{var p;return(p=h.matches.find(g=>g.id===t))==null?void 0:p.routeId}}),i=e.routesById[n],r=Ka({select:h=>{const g=h.matches.find(y=>y.id===t);return eh(g),g.globalNotFound}}),a=Ka({select:h=>{var p;const g=h.matches,y=g.findIndex(_=>_.id===t);return(p=g[y+1])==null?void 0:p.id}}),l=e.options.defaultPendingComponent?Xe.jsx(e.options.defaultPendingComponent,{}):null;if(r)return sP(e,i,void 0);if(!a)return null;const u=Xe.jsx(rP,{matchId:a});return t===Qo?Xe.jsx(ze.Suspense,{fallback:l,children:u}):u});function xH(){const s=ul(),e=s.options.defaultPendingComponent?Xe.jsx(s.options.defaultPendingComponent,{}):null,t=s.isServer||typeof document<"u"&&s.ssr?ty:ze.Suspense,n=Xe.jsxs(t,{fallback:e,children:[!s.isServer&&Xe.jsx(pH,{}),Xe.jsx(SH,{})]});return s.options.InnerWrap?Xe.jsx(s.options.InnerWrap,{children:n}):n}function SH(){const s=ul(),e=Ka({select:i=>{var r;return(r=i.matches[0])==null?void 0:r.id}}),t=Ka({select:i=>i.loadedAt}),n=e?Xe.jsx(rP,{matchId:e}):null;return Xe.jsx(bM.Provider,{value:e,children:s.options.disableGlobalCatchBoundary?n:Xe.jsx(NN,{getResetKey:()=>t,errorComponent:SM,onCatch:i=>{i.message||i.toString()},children:n})})}const bH=s=>new TH(s);class TH extends N4{constructor(e){super(e)}}typeof globalThis<"u"?(globalThis.createFileRoute=A0,globalThis.createLazyFileRoute=ED):typeof window<"u"&&(window.createFileRoute=A0,window.createLazyFileRoute=ED);function MH({router:s,children:e,...t}){Object.keys(t).length>0&&s.update({...s.options,...t,context:{...s.options.context,...t.context}});const n=iP(),i=Xe.jsx(n.Provider,{value:s,children:e});return s.options.Wrap?Xe.jsx(s.options.Wrap,{children:i}):i}function EH({router:s,...e}){return Xe.jsx(MH,{router:s,...e,children:Xe.jsx(xH,{})})}const AH=(...s)=>{const e=[];for(let t=0;t<s.length;t++){const n=s[t];n!=null&&n!==!1&&e.push(n)}return e.join(" ")},RH=({className:s,children:e})=>{const t=ze.useRef(null);return Xe.jsx("main",{ref:t,className:AH(s,"fragments-boilerplate__main"),children:e})},TM=fH({component:()=>Xe.jsx(RH,{children:Xe.jsx(aP,{})})}),NH="modulepreload",CH=function(s){return"/"+s}
66,RD={},ab=function(e,t,n){let i=Promise.resolve();if(t&&t.length>0){let a=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=l?.nonce||l?.getAttribute("nonce");i=a(t.map(h=>{if(h=CH(h),h in RD)return;RD[h]=!0;const p=h.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":NH,p||(y.as="script"),y.crossOrigin="",y.href=h,u&&y.setAttribute("nonce",u),document.head.appendChild(y),p)return new Promise((_,S)=>{y.addEventListener("load",_),y.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})},wH=(s,e,t)=>{const n=s[e];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((i,r)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(r.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==t?". Note that variables only represent file names one level deep.":""))))})};var ZA={exports:{}},Uc={};/** 67 * @license React 68 * react-reconciler-constants.production.js 69 * 70 * Copyright (c) Meta Platforms, Inc. and affiliates. 71 * 72 * This source code is licensed under the MIT license found in the 73 * LICENSE file in the root directory of this source tree. 74 */var ND;
vendor: 4,601 bytes, lines 74-78
74function DH(){return ND||(ND=1,Uc.ConcurrentRoot=1,Uc.ContinuousEventPriority=8,Uc.DefaultEventPriority=32,Uc.DiscreteEventPriority=2,Uc.IdleEventPriority=268435456,Uc.LegacyRoot=0,Uc.NoEventPriority=0),Uc}var CD;function UH(){return CD||(CD=1,ZA.exports=DH()),ZA.exports}var ET=UH();/** 75 * @license 76 * Copyright 2010-2025 Three.js Authors 77 * SPDX-License-Identifier: MIT 78 */const Ky="180",LH={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},BH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},PN=0,qT=1,ON=2,PH=3,IN=0,Y0=1,d0=2,ya=3,Za=0,yi=1,br=2,Qa=0,$a=1,Dp=2,Up=3,Lp=4,bp=5,Tr=100,MM=101,EM=102,FN=103,VN=104,Gu=200,AM=201,RM=202,NM=203,by=204,Ty=205,CM=206,wM=207,DM=208,UM=209,LM=210,oP=211,lP=212,uP=213,cP=214,My=0,Ey=1,Ay=2,th=3,Ry=4,Ny=5,Cy=6,wy=7,Zy=0,zN=1,GN=2,Rr=0,HN=1,kN=2,qN=3,BM=4,hP=5,WN=6,XN=7,IR="attached",dP="detached",j0=300,Eo=301,sl=302,Cd=303,wd=304,nh=306,ih=1e3,Sa=1001,sh=1002,Ai=1003,K0=1004,OH=1004,ql=1005,IH=1005,hi=1006,Md=1007,FH=1007,Mr=1008,fP=1008,ki=1009,Ed=1010,Ad=1011,$o=1012,Zs=1013,gi=1014,Bi=1015,As=1016,Z0=1017,Q0=1018,Ja=1020,$0=35902,J0=35899,PM=1021,Qy=1022,Pi=1023,eo=1026,to=1027,um=1028,Od=1029,Wu=1030,cm=1031,pP=1032,hm=1033,Xc=33776,Yc=33777,jc=33778,Kc=33779,Dy=35840,Uy=35841,Ly=35842,By=35843,Bp=36196,Pp=37492,Op=37496,Ip=37808,Fp=37809,Vp=37810,zp=37811,Gp=37812,Hp=37813,kp=37814,qp=37815,Wp=37816,Xp=37817,Yp=37818,jp=37819,Kp=37820,Zp=37821,Qp=36492,WT=36494,XT=36495,$p=36283,Jp=36284,em=36285,tm=36286,mP=2200,gP=2201,yP=2202,R0=2300,YT=2301,AT=2302,hp=2400,dp=2401,N0=2402,OM=2500,YN=2501,VH=0,zH=1,GH=2,vP=3200,_P=3201,HH=3202,kH=3203,ec=0,jN=1,va="",lr="srgb",Yl="srgb-linear",nm="linear",Et="srgb",xP=0,fd=7680,SP=7681,bP=7682,TP=7683,MP=34055,EP=34056,AP=5386,RP=512,NP=513,CP=514,wP=515,DP=516,UP=517,LP=518,jT=519,IM=512,ex=513,FM=514,tx=515,VM=516,zM=517,GM=518,HM=519,Py=35044,fp=35048,qH=35040,WH=35045,XH=35049,YH=35041,jH=35046,KH=35050,ZH=35042,QH="100",FR="300 es",Er=2e3,rl=2001,pp={COMPUTE:"compute",RENDER:"render"},$H={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},JH={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};class Ro{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}}const Fr=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let wD=1234567;const Tp=Math.PI/180,im=180/Math.PI;function Mo(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Fr[s&255]+Fr[s>>8&255]+Fr[s>>16&255]+Fr[s>>24&255]+"-"+Fr[e&255]+Fr[e>>8&255]+"-"+Fr[e>>16&15|64]+Fr[e>>24&255]+"-"+Fr[t&63|128]+Fr[t>>8&255]+"-"+Fr[t>>16&255]+Fr[t>>24&255]+Fr[n&255]+Fr[n>>8&255]+Fr[n>>16&255]+Fr[n>>24&255]).toLowerCase()}function dn(s,e,t){return Math.max(e,Math.min(t,s))}function KN(s,e){return(s%e+e)%e}function e5(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}
vendor: 4,304 bytes, line 78
78function t5(s,e,t){return s!==e?(t-s)/(e-s):0}function f0(s,e,t){return(1-t)*s+t*e}function n5(s,e,t,n){return f0(s,e,1-Math.exp(-t*n))}function i5(s,e=1){return e-Math.abs(KN(s,e*2)-e)}function s5(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function r5(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function a5(s,e){return s+Math.floor(Math.random()*(e-s+1))}function o5(s,e){return s+Math.random()*(e-s)}function l5(s){return s*(.5-Math.random())}function u5(s){s!==void 0&&(wD=s);let e=wD+=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 c5(s){return s*Tp}function h5(s){return s*im}function d5(s){return(s&s-1)===0&&s!==0}function f5(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function p5(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function m5(s,e,t,n,i){const r=Math.cos,a=Math.sin,l=r(t/2),u=a(t/2),h=r((e+n)/2),p=a((e+n)/2),g=r((e-n)/2),y=a((e-n)/2),_=r((n-e)/2),S=a((n-e)/2);switch(i){case"XYX":s.set(l*p,u*g,u*y,l*h);break;case"YZY":s.set(u*y,l*p,u*g,l*h);break;case"ZXZ":s.set(u*g,u*y,l*p,l*h);break;case"XZX":s.set(l*p,u*S,u*_,l*h);break;case"YXY":s.set(u*_,l*p,u*S,l*h);break;case"ZYZ":s.set(u*S,u*_,l*p,l*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function _a(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function An(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const ZN={DEG2RAD:Tp,RAD2DEG:im,generateUUID:Mo,clamp:dn,euclideanModulo:KN,mapLinear:e5,inverseLerp:t5,lerp:f0,damp:n5,pingpong:i5,smoothstep:s5,smootherstep:r5,randInt:a5,randFloat:o5,randFloatSpread:l5,seededRandom:u5,degToRad:c5,radToDeg:h5,isPowerOfTwo:d5,ceilPowerOfTwo:f5,floorPowerOfTwo:p5,setQuaternionFromProperEuler:m5,normalize:An,denormalize:_a};class Ge{constructor(e=0,t=0){Ge.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=dn(this.x,e.x,t.x),this.y=dn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dn(this.x,e,t),this.y=dn(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dn(n,e,t))}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}
vendor: 9,284 bytes, line 78
78round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ba{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,l){let u=n[i+0],h=n[i+1],p=n[i+2],g=n[i+3];const y=r[a+0],_=r[a+1],S=r[a+2],A=r[a+3];if(l===0){e[t+0]=u,e[t+1]=h,e[t+2]=p,e[t+3]=g;return}if(l===1){e[t+0]=y,e[t+1]=_,e[t+2]=S,e[t+3]=A;return}if(g!==A||u!==y||h!==_||p!==S){let E=1-l;const b=u*y+h*_+p*S+g*A,C=b>=0?1:-1,w=1-b*b;if(w>Number.EPSILON){const P=Math.sqrt(w),I=Math.atan2(P,b*C);E=Math.sin(E*I)/P,l=Math.sin(l*I)/P}const D=l*C;if(u=u*E+y*D,h=h*E+_*D,p=p*E+S*D,g=g*E+A*D,E===1-l){const P=1/Math.sqrt(u*u+h*h+p*p+g*g);u*=P,h*=P,p*=P,g*=P}}e[t]=u,e[t+1]=h,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,i,r,a){const l=n[i],u=n[i+1],h=n[i+2],p=n[i+3],g=r[a],y=r[a+1],_=r[a+2],S=r[a+3];return e[t]=l*S+p*g+u*_-h*y,e[t+1]=u*S+p*y+h*g-l*_,e[t+2]=h*S+p*_+l*y-u*g,e[t+3]=p*S-l*g-u*y-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,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,a=e._order,l=Math.cos,u=Math.sin,h=l(n/2),p=l(i/2),g=l(r/2),y=u(n/2),_=u(i/2),S=u(r/2);switch(a){case"XYZ":this._x=y*p*g+h*_*S,this._y=h*_*g-y*p*S,this._z=h*p*S+y*_*g,this._w=h*p*g-y*_*S;break;case"YXZ":this._x=y*p*g+h*_*S,this._y=h*_*g-y*p*S,this._z=h*p*S-y*_*g,this._w=h*p*g+y*_*S;break;case"ZXY":this._x=y*p*g-h*_*S,this._y=h*_*g+y*p*S,this._z=h*p*S+y*_*g,this._w=h*p*g-y*_*S;break;case"ZYX":this._x=y*p*g-h*_*S,this._y=h*_*g+y*p*S,this._z=h*p*S-y*_*g,this._w=h*p*g+y*_*S;break;case"YZX":this._x=y*p*g+h*_*S,this._y=h*_*g+y*p*S,this._z=h*p*S-y*_*g,this._w=h*p*g-y*_*S;break;case"XZY":this._x=y*p*g-h*_*S,this._y=h*_*g-y*p*S,this._z=h*p*S+y*_*g,this._w=h*p*g+y*_*S;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],l=t[5],u=t[9],h=t[2],p=t[6],g=t[10],y=n+l+g;if(y>0){const _=.5/Math.sqrt(y+1);this._w=.25/_,this._x=(p-u)*_,this._y=(r-h)*_,this._z=(a-i)*_}else if(n>l&&n>g){const _=2*Math.sqrt(1+n-l-g);this._w=(p-u)/_,this._x=.25*_,this._y=(i+a)/_,this._z=(r+h)/_}else if(l>g){const _=2*Math.sqrt(1+l-n-g);this._w=(r-h)/_,this._x=(i+a)/_,this._y=.25*_,this._z=(u+p)/_}else{const _=2*Math.sqrt(1+g-n-l);this._w=(a-i)/_,this._x=(r+h)/_,this._y=(u+p)/_,this._z=.25*_}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,a=e._w,l=t._x,u=t._y,h=t._z,p=t._w;return this._x=n*p+a*l+i*h-r*u,this._y=i*p+a*u+r*l-n*h,this._z=r*p+a*h+n*u-i*l,this._w=a*p-n*l-i*u-r*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let l=a*e._w+n*e._x+i*e._y+r*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const u=1-l*l;if(u<=Number.EPSILON){const _=1-t;return this._w=_*a+t*this._w,this._x=_*n+t*this._x,this._y=_*i+t*this._y,this._z=_*r+t*this._z,this.normalize(),this}const h=Math.sqrt(u),p=Math.atan2(h,l),g=Math.sin((1-t)*p)/h,y=Math.sin(t*p)/h;return this._w=a*g+this._w*y,this._x=n*g+this._x*y,this._y=i*g+this._y*y,this._z=r*g+this._z*y,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Y{constructor(e=0,t=0,n=0){Y.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(DD.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(DD.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}
vendor: 7,559 bytes, line 78
78applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,l=e.z,u=e.w,h=2*(a*i-l*n),p=2*(l*t-r*i),g=2*(r*n-a*t);return this.x=t+u*h+a*g-l*p,this.y=n+u*p+l*h-r*g,this.z=i+u*g+r*p-a*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,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=dn(this.x,e.x,t.x),this.y=dn(this.y,e.y,t.y),this.z=dn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dn(this.x,e,t),this.y=dn(this.y,e,t),this.z=dn(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,l=t.y,u=t.z;return this.x=i*u-r*l,this.y=r*a-n*u,this.z=n*l-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return QA.copy(this).projectOnVector(e),this.sub(QA)}reflect(e){return this.sub(QA.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(dn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const QA=new Y,DD=new ba;class pn{constructor(e,t,n,i,r,a,l,u,h){pn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,l,u,h)}set(e,t,n,i,r,a,l,u,h){const p=this.elements;return p[0]=e,p[1]=i,p[2]=l,p[3]=t,p[4]=r,p[5]=u,p[6]=n,p[7]=a,p[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],l=n[3],u=n[6],h=n[1],p=n[4],g=n[7],y=n[2],_=n[5],S=n[8],A=i[0],E=i[3],b=i[6],C=i[1],w=i[4],D=i[7],P=i[2],I=i[5],F=i[8];return r[0]=a*A+l*C+u*P,r[3]=a*E+l*w+u*I,r[6]=a*b+l*D+u*F,r[1]=h*A+p*C+g*P,r[4]=h*E+p*w+g*I,r[7]=h*b+p*D+g*F,r[2]=y*A+_*C+S*P,r[5]=y*E+_*w+S*I,r[8]=y*b+_*D+S*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],l=e[5],u=e[6],h=e[7],p=e[8];return t*a*p-t*l*h-n*r*p+n*l*u+i*r*h-i*a*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],l=e[5],u=e[6],h=e[7],p=e[8],g=p*a-l*h,y=l*u-p*r,_=h*r-a*u,S=t*g+n*y+i*_;if(S===0)return this.set(0,0,0,0,0,0,0,0,0);const A=1/S;return e[0]=g*A,e[1]=(i*h-p*n)*A,e[2]=(l*n-i*a)*A,e[3]=y*A,e[4]=(p*t-i*u)*A,e[5]=(i*r-l*t)*A,e[6]=_*A,e[7]=(n*u-h*t)*A,e[8]=(a*t-n*r)*A,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,l){const u=Math.cos(r),h=Math.sin(r);return this.set(n*u,n*h,-n*(u*a+h*l)+a+e,-i*h,i*u,-i*(-h*a+u*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply($A.makeScale(e,t)),this}rotate(e){return this.premultiply($A.makeRotation(-e)),this}translate(e,t){return this.premultiply($A.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}
vendor: 28,454 bytes, line 78
78const $A=new pn;function QN(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const g5={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ry(s,e){return new g5[s](e)}function C0(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function $N(){const s=C0("canvas");return s.style.display="block",s}const UD={};function qr(s){s in UD||(UD[s]=!0,console.warn(s))}function y5(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}const LD=new pn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),BD=new pn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function v5(){const s={enabled:!0,workingColorSpace:Yl,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===Et&&(i.r=Zc(i.r),i.g=Zc(i.g),i.b=Zc(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Et&&(i.r=fy(i.r),i.g=fy(i.g),i.b=fy(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===va?nm:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return qr("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return qr("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[Yl]:{primaries:e,whitePoint:n,transfer:nm,toXYZ:LD,fromXYZ:BD,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:lr},outputColorSpaceConfig:{drawingBufferColorSpace:lr}},[lr]:{primaries:e,whitePoint:n,transfer:Et,toXYZ:LD,fromXYZ:BD,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:lr}}}),s}const Kt=v5();function Zc(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function fy(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let bg;class BP{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{bg===void 0&&(bg=C0("canvas")),bg.width=e.width,bg.height=e.height;const i=bg.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=bg}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=C0("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let a=0;a<r.length;a++)r[a]=Zc(r[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Zc(t[n]/255)*255):t[n]=Zc(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let _5=0;class xd{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:_5++}),this.uuid=Mo(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let a=0,l=i.length;a<l;a++)i[a].isDataTexture?r.push(JA(i[a].image)):r.push(JA(i[a]))}else r=JA(i);n.url=r}return t||(e.images[this.uuid]=n),n}}function JA(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?BP.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let x5=0;const e1=new Y;class qi extends Ro{constructor(e=qi.DEFAULT_IMAGE,t=qi.DEFAULT_MAPPING,n=Sa,i=Sa,r=hi,a=Mr,l=Pi,u=ki,h=qi.DEFAULT_ANISOTROPY,p=va){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:x5++}),this.uuid=Mo(),this.name="",this.source=new xd(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=h,this.format=l,this.internalFormat=null,this.type=u,this.offset=new Ge(0,0),this.repeat=new Ge(1,1),this.center=new Ge(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new pn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=p,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(e1).x}get height(){return this.source.getSize(e1).y}get depth(){return this.source.getSize(e1).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==j0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ih:e.x=e.x-Math.floor(e.x);break;case Sa:e.x=e.x<0?0:1;break;case sh: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 ih:e.y=e.y-Math.floor(e.y);break;case Sa:e.y=e.y<0?0:1;break;case sh:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}qi.DEFAULT_IMAGE=null;qi.DEFAULT_MAPPING=j0;qi.DEFAULT_ANISOTROPY=1;class kt{constructor(e=0,t=0,n=0,i=1){kt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const u=e.elements,h=u[0],p=u[4],g=u[8],y=u[1],_=u[5],S=u[9],A=u[2],E=u[6],b=u[10];if(Math.abs(p-y)<.01&&Math.abs(g-A)<.01&&Math.abs(S-E)<.01){if(Math.abs(p+y)<.1&&Math.abs(g+A)<.1&&Math.abs(S+E)<.1&&Math.abs(h+_+b-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(h+1)/2,D=(_+1)/2,P=(b+1)/2,I=(p+y)/4,F=(g+A)/4,z=(S+E)/4;return w>D&&w>P?w<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(w),i=I/n,r=F/n):D>P?D<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(D),n=I/i,r=z/i):P<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(P),n=F/r,i=z/r),this.set(n,i,r,t),this}let C=Math.sqrt((E-S)*(E-S)+(g-A)*(g-A)+(y-p)*(y-p));return Math.abs(C)<.001&&(C=1),this.x=(E-S)/C,this.y=(g-A)/C,this.z=(y-p)/C,this.w=Math.acos((h+_+b-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],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=dn(this.x,e.x,t.x),this.y=dn(this.y,e.y,t.y),this.z=dn(this.z,e.z,t.z),this.w=dn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dn(this.x,e,t),this.y=dn(this.y,e,t),this.z=dn(this.z,e,t),this.w=dn(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(dn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Ql extends Ro{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:hi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new kt(0,0,e,t),this.scissorTest=!1,this.viewport=new kt(0,0,e,t);const i={width:e,height:t,depth:n.depth},r=new qi(i);this.textures=[];const a=n.count;for(let l=0;l<a;l++)this.textures[l]=r.clone(),this.textures[l].isRenderTargetTexture=!0,this.textures[l].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:hi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new xd(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class jl extends Ql{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class nx extends qi{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Ai,this.minFilter=Ai,this.wrapR=Sa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class S5 extends jl{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new nx(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class kM extends qi{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Ai,this.minFilter=Ai,this.wrapR=Sa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class b5 extends jl{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new kM(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Wr{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Fl.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Fl.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Fl.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let a=0,l=r.count;a<l;a++)e.isMesh===!0?e.getVertexPosition(a,Fl):Fl.fromBufferAttribute(r,a),Fl.applyMatrix4(e.matrixWorld),this.expandByPoint(Fl);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ob.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ob.copy(n.boundingBox)),ob.applyMatrix4(e.matrixWorld),this.union(ob)}const i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Fl),Fl.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(C_),lb.subVectors(this.max,C_),Tg.subVectors(e.a,C_),Mg.subVectors(e.b,C_),Eg.subVectors(e.c,C_),rd.subVectors(Mg,Tg),ad.subVectors(Eg,Mg),Vf.subVectors(Tg,Eg);let t=[0,-rd.z,rd.y,0,-ad.z,ad.y,0,-Vf.z,Vf.y,rd.z,0,-rd.x,ad.z,0,-ad.x,Vf.z,0,-Vf.x,-rd.y,rd.x,0,-ad.y,ad.x,0,-Vf.y,Vf.x,0];return!t1(t,Tg,Mg,Eg,lb)||(t=[1,0,0,0,1,0,0,0,1],!t1(t,Tg,Mg,Eg,lb))?!1:(ub.crossVectors(rd,ad),t=[ub.x,ub.y,ub.z],t1(t,Tg,Mg,Eg,lb))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Fl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Fl).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:(Lc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Lc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Lc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Lc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Lc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Lc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Lc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Lc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Lc),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Lc=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],Fl=new Y,ob=new Wr,Tg=new Y,Mg=new Y,Eg=new Y,rd=new Y,ad=new Y,Vf=new Y,C_=new Y,lb=new Y,ub=new Y,zf=new Y;function t1(s,e,t,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){zf.fromArray(s,r);const l=i.x*Math.abs(zf.x)+i.y*Math.abs(zf.y)+i.z*Math.abs(zf.z),u=e.dot(zf),h=t.dot(zf),p=n.dot(zf);if(Math.max(-Math.max(u,h,p),Math.min(u,h,p))>l)return!1}return!0}const T5=new Wr,w_=new Y,n1=new Y;class cr{constructor(e=new Y,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):T5.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;w_.subVectors(e,this.center);const t=w_.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(w_,i/n),this.radius+=i}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):(n1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(w_.copy(e.center).add(n1)),this.expandByPoint(w_.copy(e.center).sub(n1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const Bc=new Y,i1=new Y,cb=new Y,od=new Y,s1=new Y,hb=new Y,r1=new Y;class $y{constructor(e=new Y,t=new Y(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,Bc)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Bc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Bc.copy(this.origin).addScaledVector(this.direction,t),Bc.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){i1.copy(e).add(t).multiplyScalar(.5),cb.copy(t).sub(e).normalize(),od.copy(this.origin).sub(i1);const r=e.distanceTo(t)*.5,a=-this.direction.dot(cb),l=od.dot(this.direction),u=-od.dot(cb),h=od.lengthSq(),p=Math.abs(1-a*a);let g,y,_,S;if(p>0)if(g=a*u-l,y=a*l-u,S=r*p,g>=0)if(y>=-S)if(y<=S){const A=1/p;g*=A,y*=A,_=g*(g+a*y+2*l)+y*(a*g+y+2*u)+h}else y=r,g=Math.max(0,-(a*y+l)),_=-g*g+y*(y+2*u)+h;else y=-r,g=Math.max(0,-(a*y+l)),_=-g*g+y*(y+2*u)+h;else y<=-S?(g=Math.max(0,-(-a*r+l)),y=g>0?-r:Math.min(Math.max(-r,-u),r),_=-g*g+y*(y+2*u)+h):y<=S?(g=0,y=Math.min(Math.max(-r,-u),r),_=y*(y+2*u)+h):(g=Math.max(0,-(a*r+l)),y=g>0?r:Math.min(Math.max(-r,-u),r),_=-g*g+y*(y+2*u)+h);else y=a>0?-r:r,g=Math.max(0,-(a*y+l)),_=-g*g+y*(y+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(i1).addScaledVector(cb,y),_}intersectSphere(e,t){Bc.subVectors(e.center,this.origin);
vendor: 7,096 bytes, line 78
78const n=Bc.dot(this.direction),i=Bc.dot(Bc)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),l=n-a,u=n+a;return u<0?null:l<0?this.at(u,t):this.at(l,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,l,u;const h=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,y=this.origin;return h>=0?(n=(e.min.x-y.x)*h,i=(e.max.x-y.x)*h):(n=(e.max.x-y.x)*h,i=(e.min.x-y.x)*h),p>=0?(r=(e.min.y-y.y)*p,a=(e.max.y-y.y)*p):(r=(e.max.y-y.y)*p,a=(e.min.y-y.y)*p),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),g>=0?(l=(e.min.z-y.z)*g,u=(e.max.z-y.z)*g):(l=(e.max.z-y.z)*g,u=(e.min.z-y.z)*g),n>u||l>i)||((l>n||n!==n)&&(n=l),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Bc)!==null}intersectTriangle(e,t,n,i,r){s1.subVectors(t,e),hb.subVectors(n,e),r1.crossVectors(s1,hb);let a=this.direction.dot(r1),l;if(a>0){if(i)return null;l=1}else if(a<0)l=-1,a=-a;else return null;od.subVectors(this.origin,e);const u=l*this.direction.dot(hb.crossVectors(od,hb));if(u<0)return null;const h=l*this.direction.dot(s1.cross(od));if(h<0||u+h>a)return null;const p=-l*od.dot(r1);return p<0?null:this.at(p/a,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 Ot{constructor(e,t,n,i,r,a,l,u,h,p,g,y,_,S,A,E){Ot.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,l,u,h,p,g,y,_,S,A,E)}set(e,t,n,i,r,a,l,u,h,p,g,y,_,S,A,E){const b=this.elements;return b[0]=e,b[4]=t,b[8]=n,b[12]=i,b[1]=r,b[5]=a,b[9]=l,b[13]=u,b[2]=h,b[6]=p,b[10]=g,b[14]=y,b[3]=_,b[7]=S,b[11]=A,b[15]=E,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 Ot().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Ag.setFromMatrixColumn(e,0).length(),r=1/Ag.setFromMatrixColumn(e,1).length(),a=1/Ag.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),l=Math.sin(n),u=Math.cos(i),h=Math.sin(i),p=Math.cos(r),g=Math.sin(r);if(e.order==="XYZ"){const y=a*p,_=a*g,S=l*p,A=l*g;t[0]=u*p,t[4]=-u*g,t[8]=h,t[1]=_+S*h,t[5]=y-A*h,t[9]=-l*u,t[2]=A-y*h,t[6]=S+_*h,t[10]=a*u}else if(e.order==="YXZ"){const y=u*p,_=u*g,S=h*p,A=h*g;t[0]=y+A*l,t[4]=S*l-_,t[8]=a*h,t[1]=a*g,t[5]=a*p,t[9]=-l,t[2]=_*l-S,t[6]=A+y*l,t[10]=a*u}else if(e.order==="ZXY"){const y=u*p,_=u*g,S=h*p,A=h*g;t[0]=y-A*l,t[4]=-a*g,t[8]=S+_*l,t[1]=_+S*l,t[5]=a*p,t[9]=A-y*l,t[2]=-a*h,t[6]=l,t[10]=a*u}else if(e.order==="ZYX"){const y=a*p,_=a*g,S=l*p,A=l*g;t[0]=u*p,t[4]=S*h-_,t[8]=y*h+A,t[1]=u*g,t[5]=A*h+y,t[9]=_*h-S,t[2]=-h,t[6]=l*u,t[10]=a*u}else if(e.order==="YZX"){const y=a*u,_=a*h,S=l*u,A=l*h;t[0]=u*p,t[4]=A-y*g,t[8]=S*g+_,t[1]=g,t[5]=a*p,t[9]=-l*p,t[2]=-h*p,t[6]=_*g+S,t[10]=y-A*g}else if(e.order==="XZY"){const y=a*u,_=a*h,S=l*u,A=l*h;t[0]=u*p,t[4]=-g,t[8]=h*p,t[1]=y*g+A,t[5]=a*p,t[9]=_*g-S,t[2]=S*g-_,t[6]=l*p,t[10]=A*g+y}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(M5,e,E5)}lookAt(e,t,n){const i=this.elements;return _o.subVectors(e,t),_o.lengthSq()===0&&(_o.z=1),_o.normalize(),ld.crossVectors(n,_o),ld.lengthSq()===0&&(Math.abs(n.z)===1?_o.x+=1e-4:_o.z+=1e-4,_o.normalize(),ld.crossVectors(n,_o)),ld.normalize(),db.crossVectors(_o,ld),i[0]=ld.x,i[4]=db.x,i[8]=_o.x,i[1]=ld.y,i[5]=db.y,i[9]=_o.y,i[2]=ld.z,i[6]=db.z,i[10]=_o.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],l=n[4],u=n[8],h=n[12],p=n[1],g=n[5],y=n[9],_=n[13],S=n[2],A=n[6],E=n[10],b=n[14],C=n[3],w=n[7],D=n[11],P=n[15],I=i[0],F=i[4],z=i[8],B=i[12],O=i[1],W=i[5],ee=i[9],se=i[13],fe=i[2],pe=i[6],k=i[10],Q=i[14],J=i[3],Se=i[7],K=i[11],oe=i[15];return r[0]=a*I+l*O+u*fe+h*J,r[4]=a*F+l*W+u*pe+h*Se,r[8]=a*z+l*ee+u*k+h*K,r[12]=a*B+l*se+u*Q+h*oe,r[1]=p*I+g*O+y*fe+_*J,r[5]=p*F+g*W+y*pe+_*Se,r[9]=p*z+g*ee+y*k+_*K,r[13]=p*B+g*se+y*Q+_*oe,r[2]=S*I+A*O+E*fe+b*J,r[6]=S*F+A*W+E*pe+b*Se,r[10]=S*z+A*ee+E*k+b*K,r[14]=S*B+A*se+E*Q+b*oe,r[3]=C*I+w*O+D*fe+P*J,r[7]=C*F+w*W+D*pe+P*Se,r[11]=C*z+w*ee+D*k+P*K,r[15]=C*B+w*se+D*Q+P*oe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],l=e[5],u=e[9],h=e[13],p=e[2],g=e[6],y=e[10],_=e[14],S=e[3],A=e[7],E=e[11],b=e[15];return S*(+r*u*g-i*h*g-r*l*y+n*h*y+i*l*_-n*u*_)+A*(+t*u*_-t*h*y+r*a*y-i*a*_+i*h*p-r*u*p)+E*(+t*h*g-t*l*_-r*a*g+n*a*_+r*l*p-n*h*p)+b*(-i*l*p-t*u*g+t*l*y+i*a*g-n*a*y+n*u*p)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],l=e[5],u=e[6],h=e[7],p=e[8],g=e[9],y=e[10],_=e[11],S=e[12],A=e[13],E=e[14],b=e[15],C=g*E*h-A*y*h+A*u*_-l*E*_-g*u*b+l*y*b,w=S*y*h-p*E*h-S*u*_+a*E*_+p*u*b-a*y*b,D=p*A*h-S*g*h+S*l*_-a*A*_-p*l*b+a*g*b,P=S*g*u-p*A*u-S*l*y+a*A*y+p*l*E-a*g*E,I=t*C+n*w+i*D+r*P;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const F=1/I;return e[0]=C*F,e[1]=(A*y*r-g*E*r-A*i*_+n*E*_+g*i*b-n*y*b)*F,e[2]=(l*E*r-A*u*r+A*i*h-n*E*h-l*i*b+n*u*b)*F,e[3]=(g*u*r-l*y*r-g*i*h+n*y*h+l*i*_-n*u*_)*F,e[4]=w*F,e[5]=(p*E*r-S*y*r+S*i*_-t*E*_-p*i*b+t*y*b)*F,e[6]=(S*u*r-a*E*r-S*i*h+t*E*h+a*i*b-t*u*b)*F,e[7]=(a
vendor: 4,493 bytes, line 78
78*y*r-p*u*r+p*i*h-t*y*h-a*i*_+t*u*_)*F,e[8]=D*F,e[9]=(S*g*r-p*A*r-S*n*_+t*A*_+p*n*b-t*g*b)*F,e[10]=(a*A*r-S*l*r+S*n*h-t*A*h-a*n*b+t*l*b)*F,e[11]=(p*l*r-a*g*r-p*n*h+t*g*h+a*n*_-t*l*_)*F,e[12]=P*F,e[13]=(p*A*i-S*g*i+S*n*y-t*A*y-p*n*E+t*g*E)*F,e[14]=(S*l*i-a*A*i-S*n*u+t*A*u+a*n*E-t*l*E)*F,e[15]=(a*g*i-p*l*i+p*n*u-t*g*u-a*n*y+t*l*y)*F,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,l=e.y,u=e.z,h=r*a,p=r*l;return this.set(h*a+n,h*l-i*u,h*u+i*l,0,h*l+i*u,p*l+n,p*u-i*a,0,h*u-i*l,p*u+i*a,r*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,l=t._z,u=t._w,h=r+r,p=a+a,g=l+l,y=r*h,_=r*p,S=r*g,A=a*p,E=a*g,b=l*g,C=u*h,w=u*p,D=u*g,P=n.x,I=n.y,F=n.z;return i[0]=(1-(A+b))*P,i[1]=(_+D)*P,i[2]=(S-w)*P,i[3]=0,i[4]=(_-D)*I,i[5]=(1-(y+b))*I,i[6]=(E+C)*I,i[7]=0,i[8]=(S+w)*F,i[9]=(E-C)*F,i[10]=(1-(y+A))*F,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Ag.set(i[0],i[1],i[2]).length();const a=Ag.set(i[4],i[5],i[6]).length(),l=Ag.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Vl.copy(this);const h=1/r,p=1/a,g=1/l;return Vl.elements[0]*=h,Vl.elements[1]*=h,Vl.elements[2]*=h,Vl.elements[4]*=p,Vl.elements[5]*=p,Vl.elements[6]*=p,Vl.elements[8]*=g,Vl.elements[9]*=g,Vl.elements[10]*=g,t.setFromRotationMatrix(Vl),n.x=r,n.y=a,n.z=l,this}makePerspective(e,t,n,i,r,a,l=Er,u=!1){const h=this.elements,p=2*r/(t-e),g=2*r/(n-i),y=(t+e)/(t-e),_=(n+i)/(n-i);let S,A;if(u)S=r/(a-r),A=a*r/(a-r);else if(l===Er)S=-(a+r)/(a-r),A=-2*a*r/(a-r);else if(l===rl)S=-a/(a-r),A=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return h[0]=p,h[4]=0,h[8]=y,h[12]=0,h[1]=0,h[5]=g,h[9]=_,h[13]=0,h[2]=0,h[6]=0,h[10]=S,h[14]=A,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,n,i,r,a,l=Er,u=!1){const h=this.elements,p=2/(t-e),g=2/(n-i),y=-(t+e)/(t-e),_=-(n+i)/(n-i);let S,A;if(u)S=1/(a-r),A=a/(a-r);else if(l===Er)S=-2/(a-r),A=-(a+r)/(a-r);else if(l===rl)S=-1/(a-r),A=-r/(a-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return h[0]=p,h[4]=0,h[8]=0,h[12]=y,h[1]=0,h[5]=g,h[9]=0,h[13]=_,h[2]=0,h[6]=0,h[10]=S,h[14]=A,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Ag=new Y,Vl=new Ot,M5=new Y(0,0,0),E5=new Y(1,1,1),ld=new Y,db=new Y,_o=new Y,PD=new Ot,OD=new ba;class Ma{constructor(e=0,t=0,n=0,i=Ma.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],a=i[4],l=i[8],u=i[1],h=i[5
vendor: 7,715 bytes, line 78
78],p=i[9],g=i[2],y=i[6],_=i[10];switch(t){case"XYZ":this._y=Math.asin(dn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-p,_),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(y,h),this._z=0);break;case"YXZ":this._x=Math.asin(-dn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(l,_),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-g,r),this._z=0);break;case"ZXY":this._x=Math.asin(dn(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-g,_),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(u,r));break;case"ZYX":this._y=Math.asin(-dn(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(y,_),this._z=Math.atan2(u,r)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(dn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-p,h),this._y=Math.atan2(-g,r)):(this._x=0,this._y=Math.atan2(l,_));break;case"XZY":this._z=Math.asin(-dn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(y,h),this._y=Math.atan2(l,r)):(this._x=Math.atan2(-p,_),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return PD.makeRotationFromQuaternion(e),this.setFromRotationMatrix(PD,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return OD.setFromEuler(this),this.setFromQuaternion(OD,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}}Ma.DEFAULT_ORDER="XYZ";class Oy{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let A5=0;const ID=new Y,Rg=new ba,Pc=new Ot,fb=new Y,D_=new Y,R5=new Y,N5=new ba,FD=new Y(1,0,0),VD=new Y(0,1,0),zD=new Y(0,0,1),GD={type:"added"},C5={type:"removed"},Ng={type:"childadded",child:null},a1={type:"childremoved",child:null};class jn extends Ro{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:A5++}),this.uuid=Mo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=jn.DEFAULT_UP.clone();const e=new Y,t=new Ma,n=new ba,i=new Y(1,1,1);function r(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ot},normalMatrix:{value:new pn}}),this.matrix=new Ot,this.matrixWorld=new Ot,this.matrixAutoUpdate=jn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=jn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Oy,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Rg.setFromAxisAngle(e,t),this.quaternion.multiply(Rg),this}rotateOnWorldAxis(e,t){return Rg.setFromAxisAngle(e,t),this.quaternion.premultiply(Rg),this}rotateX(e){return this.rotateOnAxis(FD,e)}rotateY(e){return this.rotateOnAxis(VD,e)}rotateZ(e){return this.rotateOnAxis(zD,e)}translateOnAxis(e,t){return ID.copy(e).applyQuaternion(this.quaternion),this.position.add(ID.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(FD,e)}translateY(e){return this.translateOnAxis(VD,e)}translateZ(e){return this.translateOnAxis(zD,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Pc.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?fb.copy(e):fb.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),D_.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Pc.lookAt(D_,fb,this.up):Pc.lookAt(fb,D_,this.up),this.quaternion.setFromRotationMatrix(Pc),i&&(Pc.extractRotation(i.matrixWorld),Rg.setFromRotationMatrix(Pc),this.quaternion.premultiply(Rg.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(GD),Ng.child=e,this.dispatchEvent(Ng),Ng.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(C5),a1.child=e,this.dispatchEvent(a1),a1.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Pc.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Pc.multiply(e.parent.matrixWorld)),e.applyMatrix4(Pc),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(GD),Ng.child=e,this.dispatchEvent(Ng),Ng.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(D_,e,R5),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(D_,N5,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 8,175 bytes, line 78
78):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(l=>({...l,boundingBox:l.boundingBox?l.boundingBox.toJSON():void 0,boundingSphere:l.boundingSphere?l.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(l=>({...l})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const u=l.shapes;if(Array.isArray(u))for(let h=0,p=u.length;h<p;h++){const g=u[h];r(e.shapes,g)}else r(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let u=0,h=this.material.length;u<h;u++)l.push(r(e.materials,this.material[u]));i.material=l}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let l=0;l<this.children.length;l++)i.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let l=0;l<this.animations.length;l++){const u=this.animations[l];i.animations.push(r(e.animations,u))}}if(t){const l=a(e.geometries),u=a(e.materials),h=a(e.textures),p=a(e.images),g=a(e.shapes),y=a(e.skeletons),_=a(e.animations),S=a(e.nodes);l.length>0&&(n.geometries=l),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),y.length>0&&(n.skeletons=y),_.length>0&&(n.animations=_),S.length>0&&(n.nodes=S)}return n.object=i,n;function a(l){const u=[];for(const h in l){const p=l[h];delete p.metadata,u.push(p)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}jn.DEFAULT_UP=new Y(0,1,0);jn.DEFAULT_MATRIX_AUTO_UPDATE=!0;jn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const zl=new Y,Oc=new Y,o1=new Y,Ic=new Y,Cg=new Y,wg=new Y,HD=new Y,l1=new Y,u1=new Y,c1=new Y,h1=new kt,d1=new kt,f1=new kt;class Wa{constructor(e=new Y,t=new Y,n=new Y){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),zl.subVectors(e,t),i.cross(zl);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){zl.subVectors(i,t),Oc.subVectors(n,t),o1.subVectors(e,t);const a=zl.dot(zl),l=zl.dot(Oc),u=zl.dot(o1),h=Oc.dot(Oc),p=Oc.dot(o1),g=a*h-l*l;if(g===0)return r.set(0,0,0),null;const y=1/g,_=(h*u-l*p)*y,S=(a*p-l*u)*y;return r.set(1-_-S,S,_)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Ic)===null?!1:Ic.x>=0&&Ic.y>=0&&Ic.x+Ic.y<=1}static getInterpolation(e,t,n,i,r,a,l,u){return this.getBarycoord(e,t,n,i,Ic)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(r,Ic.x),u.addScaledVector(a,Ic.y),u.addScaledVector(l,Ic.z),u)}static getInterpolatedAttribute(e,t,n,i,r,a){return h1.setScalar(0),d1.setScalar(0),f1.setScalar(0),h1.fromBufferAttribute(e,t),d1.fromBufferAttribute(e,n),f1.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(h1,r.x),a.addScaledVector(d1,r.y),a.addScaledVector(f1,r.z),a}static isFrontFacing(e,t,n,i){return zl.subVectors(n,t),Oc.subVectors(e,t),zl.cross(Oc).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 zl.subVectors(this.c,this.b),Oc.subVectors(this.a,this.b),zl.cross(Oc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Wa.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wa.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Wa.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Wa.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wa.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,l;Cg.subVectors(i,n),wg.subVectors(r,n),l1.subVectors(e,n);const u=Cg.dot(l1),h=wg.dot(l1);if(u<=0&&h<=0)return t.copy(n);u1.subVectors(e,i);const p=Cg.dot(u1),g=wg.dot(u1);if(p>=0&&g<=p)return t.copy(i);const y=u*g-p*h;if(y<=0&&u>=0&&p<=0)return a=u/(u-p),t.copy(n).addScaledVector(Cg,a);c1.subVectors(e,r);const _=Cg.dot(c1),S=wg.dot(c1);if(S>=0&&_<=S)return t.copy(r);const A=_*h-u*S;
vendor: 6,064 bytes, line 78
78if(A<=0&&h>=0&&S<=0)return l=h/(h-S),t.copy(n).addScaledVector(wg,l);const E=p*S-_*g;if(E<=0&&g-p>=0&&_-S>=0)return HD.subVectors(r,i),l=(g-p)/(g-p+(_-S)),t.copy(i).addScaledVector(HD,l);const b=1/(E+A+y);return a=A*b,l=y*b,t.copy(n).addScaledVector(Cg,a).addScaledVector(wg,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const PP={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},ud={h:0,s:0,l:0},pb={h:0,s:0,l:0};function p1(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class lt{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=lr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Kt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Kt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Kt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Kt.workingColorSpace){if(e=KN(e,1),t=dn(t,0,1),n=dn(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=p1(a,r,e+1/3),this.g=p1(a,r,e),this.b=p1(a,r,e-1/3)}return Kt.colorSpaceToWorking(this,i),this}setStyle(e,t=lr){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],l=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(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(l))return n(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(l))return n(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(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===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=lr){const n=PP[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Zc(e.r),this.g=Zc(e.g),this.b=Zc(e.b),this}copyLinearToSRGB(e){return this.r=fy(e.r),this.g=fy(e.g),this.b=fy(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=lr){return Kt.workingToColorSpace(Vr.copy(this),e),Math.round(dn(Vr.r*255,0,255))*65536+Math.round(dn(Vr.g*255,0,255))*256+Math.round(dn(Vr.b*255,0,255))}getHexString(e=lr){return("000000"+this.getHex(e).toString(16)).slice(-6)}
vendor: 3,913 bytes, line 78
78getHSL(e,t=Kt.workingColorSpace){Kt.workingToColorSpace(Vr.copy(this),t);const n=Vr.r,i=Vr.g,r=Vr.b,a=Math.max(n,i,r),l=Math.min(n,i,r);let u,h;const p=(l+a)/2;if(l===a)u=0,h=0;else{const g=a-l;switch(h=p<=.5?g/(a+l):g/(2-a-l),a){case n:u=(i-r)/g+(i<r?6:0);break;case i:u=(r-n)/g+2;break;case r:u=(n-i)/g+4;break}u/=6}return e.h=u,e.s=h,e.l=p,e}getRGB(e,t=Kt.workingColorSpace){return Kt.workingToColorSpace(Vr.copy(this),t),e.r=Vr.r,e.g=Vr.g,e.b=Vr.b,e}getStyle(e=lr){Kt.workingToColorSpace(Vr.copy(this),e);const t=Vr.r,n=Vr.g,i=Vr.b;return e!==lr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(ud),this.setHSL(ud.h+e,ud.s+t,ud.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ud),e.getHSL(pb);const n=f0(ud.h,pb.h,t),i=f0(ud.s,pb.s,t),r=f0(ud.l,pb.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Vr=new lt;lt.NAMES=PP;let w5=0;class hr extends Ro{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:w5++}),this.uuid=Mo(),this.name="",this.type="Material",this.blending=$a,this.side=Za,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=by,this.blendDst=Ty,this.blendEquation=Tr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new lt(0,0,0),this.blendAlpha=0,this.depthFunc=th,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=jT,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=fd,this.stencilZFail=fd,this.stencilZPass=fd,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.allowOverride=!0,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}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 9,052 bytes, line 78
78n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==$a&&(n.blending=this.blending),this.side!==Za&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==by&&(n.blendSrc=this.blendSrc),this.blendDst!==Ty&&(n.blendDst=this.blendDst),this.blendEquation!==Tr&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==th&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==jT&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fd&&(n.stencilFail=this.stencilFail),this.stencilZFail!==fd&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==fd&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const a=[];for(const l in r){const u=r[l];delete u.metadata,a.push(u)}return a}if(t){const r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,184 bytes, line 78
78adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class xa extends hr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new lt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ma,this.combine=Zy,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Hc=D5();function D5(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,i[u]=24,i[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,i[u]=-h-1,i[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,i[u]=13,i[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,i[u]=24,i[u|256]=24):(n[u]=31744,n[u|256]=64512,i[u]=13,i[u|256]=13)}const r=new Uint32Array(2048),a=new Uint32Array(64),l=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,p=0;for(;(h&8388608)===0;)h<<=1,p-=8388608;h&=-8388609,p+=947912704,r[u]=h|p}for(let u=1024;u<2048;++u)r[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)a[u]=u<<23;a[31]=1199570944,a[32]=2147483648;for(let u=33;u<63;++u)a[u]=2147483648+(u-32<<23);a[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(l[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:a,offsetTable:l}}function Ha(s){Math.abs(s)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),s=dn(s,-65504,65504),Hc.floatView[0]=s;const e=Hc.uint32View[0],t=e>>23&511;return Hc.baseTable[t]+((e&8388607)>>Hc.shiftTable[t])}function i0(s){const e=s>>10;return Hc.uint32View[0]=Hc.mantissaTable[Hc.offsetTable[e]+(s&1023)]+Hc.exponentTable[e],Hc.floatView[0]}class U5{static toHalfFloat(e){return Ha(e)}static fromHalfFloat(e){return i0(e)}}const Bs=new Y,mb=new Ge;let L5=0;class ti{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:L5++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Py,this.updateRanges=[],this.gpuType=Bi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;
vendor: 4,567 bytes, line 78
78t++)mb.fromBufferAttribute(this,t),mb.applyMatrix3(e),this.setXY(t,mb.x,mb.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Bs.fromBufferAttribute(this,t),Bs.applyMatrix3(e),this.setXYZ(t,Bs.x,Bs.y,Bs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Bs.fromBufferAttribute(this,t),Bs.applyMatrix4(e),this.setXYZ(t,Bs.x,Bs.y,Bs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Bs.fromBufferAttribute(this,t),Bs.applyNormalMatrix(e),this.setXYZ(t,Bs.x,Bs.y,Bs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Bs.fromBufferAttribute(this,t),Bs.transformDirection(e),this.setXYZ(t,Bs.x,Bs.y,Bs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=_a(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=An(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=_a(t,this.array)),t}setX(e,t){return this.normalized&&(t=An(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=_a(t,this.array)),t}setY(e,t){return this.normalized&&(t=An(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=_a(t,this.array)),t}setZ(e,t){return this.normalized&&(t=An(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=_a(t,this.array)),t}setW(e,t){return this.normalized&&(t=An(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=An(t,this.array),n=An(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=An(t,this.array),n=An(n,this.array),i=An(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=An(t,this.array),n=An(n,this.array),i=An(i,this.array),r=An(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Py&&(e.usage=this.usage),e}}class B5 extends ti{constructor(e,t,n){super(new Int8Array(e),t,n)}}class P5 extends ti{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class O5 extends ti{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class I5 extends ti{constructor(e,t,n){super(new Int16Array(e),t,n)}}class qM extends ti{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class F5 extends ti{constructor(e,t,n){super(new Int32Array(e),t,n)}}class WM extends ti{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class JN extends ti{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=i0(this.array[e*this.itemSize]);return this.normalized&&(t=_a(t,this.array)),t}setX(e,t){return this.normalized&&(t=An(t,this.array)),this.array[e*this.itemSize]=Ha(t),this}getY(e){let t=i0(this.array[e*this.itemSize+1]);return this.normalized&&(t=_a(t,this.array)),t}setY(e,t){return this.normalized&&(t=An(t,this.array)),this.array[e*this.itemSize+1]=Ha(t),this}getZ(e){let t=i0(this.array[e*this.itemSize+2]);return this.normalized&&(t=_a(t,this.array)),t}setZ(e,t){return this.normalized&&(t=An(t,this.array)),this.array[e*this.itemSize+2]=Ha(t),this}getW(e){let t=i0(this.array[e*this.itemSize+3]);return this.normalized&&(t=_a(t,this.array)),t}setW(e,t){return this.normalized&&(t=An(t,this.array)),this.array[e*this.itemSize+3]=Ha(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=An(t,this.array),n=An(n,this.array)),this.array[e+0]=Ha(t),this.array[e+1]=Ha(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=An(t,this.array),n=An(n,this.array),i=An(i,this.array)),this.array[e+0]=Ha(t),this.array[e+1]=Ha(n),this.array[e+2]=Ha(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=An(t,this.array),n=An(n,this.array),i=An(i,this.array),r=An(r,this.array)),this.array[e+0]=Ha(t),this.array[e+1]=Ha(n),this.array[e+2]=Ha(i),this.array[e+3]=Ha(r),this}}class It extends ti{constructor(e,t,n){super(new Float32Array(e),t,n)}}let V5=0;const Yo=new Ot,m1=new jn,Dg=new Y,xo=new Wr,U_=new Wr,ar=new Y;
vendor: 5,211 bytes, line 78
78class bn extends Ro{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:V5++}),this.uuid=Mo(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(QN(e)?WM:qM)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new pn().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Yo.makeRotationFromQuaternion(e),this.applyMatrix4(Yo),this}rotateX(e){return Yo.makeRotationX(e),this.applyMatrix4(Yo),this}rotateY(e){return Yo.makeRotationY(e),this.applyMatrix4(Yo),this}rotateZ(e){return Yo.makeRotationZ(e),this.applyMatrix4(Yo),this}translate(e,t,n){return Yo.makeTranslation(e,t,n),this.applyMatrix4(Yo),this}scale(e,t,n){return Yo.makeScale(e,t,n),this.applyMatrix4(Yo),this}lookAt(e){return m1.lookAt(e),m1.updateMatrix(),this.applyMatrix4(m1.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Dg).negate(),this.translate(Dg.x,Dg.y,Dg.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,r=e.length;i<r;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new It(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const r=t[n];xo.setFromBufferAttribute(r),this.morphTargetsRelative?(ar.addVectors(this.boundingBox.min,xo.min),this.boundingBox.expandByPoint(ar),ar.addVectors(this.boundingBox.max,xo.max),this.boundingBox.expandByPoint(ar)):(this.boundingBox.expandByPoint(xo.min),this.boundingBox.expandByPoint(xo.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new cr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Y,1/0);return}if(e){const n=this.boundingSphere.center;if(xo.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const l=t[r];U_.setFromBufferAttribute(l),this.morphTargetsRelative?(ar.addVectors(xo.min,U_.min),xo.expandByPoint(ar),ar.addVectors(xo.max,U_.max),xo.expandByPoint(ar)):(xo.expandByPoint(U_.min),xo.expandByPoint(U_.max))}xo.getCenter(n);let i=0;for(let r=0,a=e.count;r<a;r++)ar.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(ar));if(t)for(let r=0,a=t.length;r<a;r++){const l=t[r],u=this.morphTargetsRelative;for(let h=0,p=l.count;h<p;h++)ar.fromBufferAttribute(l,h),u&&(Dg.fromBufferAttribute(e,h),ar.add(Dg)),i=Math.max(i,n.distanceToSquared(ar))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ti(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),l=[],u=[];for(let z=0;z<n.count;z++)l[z]=new Y,u[z]=new Y;
vendor: 5,062 bytes, line 78
78const h=new Y,p=new Y,g=new Y,y=new Ge,_=new Ge,S=new Ge,A=new Y,E=new Y;function b(z,B,O){h.fromBufferAttribute(n,z),p.fromBufferAttribute(n,B),g.fromBufferAttribute(n,O),y.fromBufferAttribute(r,z),_.fromBufferAttribute(r,B),S.fromBufferAttribute(r,O),p.sub(h),g.sub(h),_.sub(y),S.sub(y);const W=1/(_.x*S.y-S.x*_.y);isFinite(W)&&(A.copy(p).multiplyScalar(S.y).addScaledVector(g,-_.y).multiplyScalar(W),E.copy(g).multiplyScalar(_.x).addScaledVector(p,-S.x).multiplyScalar(W),l[z].add(A),l[B].add(A),l[O].add(A),u[z].add(E),u[B].add(E),u[O].add(E))}let C=this.groups;C.length===0&&(C=[{start:0,count:e.count}]);for(let z=0,B=C.length;z<B;++z){const O=C[z],W=O.start,ee=O.count;for(let se=W,fe=W+ee;se<fe;se+=3)b(e.getX(se+0),e.getX(se+1),e.getX(se+2))}const w=new Y,D=new Y,P=new Y,I=new Y;function F(z){P.fromBufferAttribute(i,z),I.copy(P);const B=l[z];w.copy(B),w.sub(P.multiplyScalar(P.dot(B))).normalize(),D.crossVectors(I,B);const W=D.dot(u[z])<0?-1:1;a.setXYZW(z,w.x,w.y,w.z,W)}for(let z=0,B=C.length;z<B;++z){const O=C[z],W=O.start,ee=O.count;for(let se=W,fe=W+ee;se<fe;se+=3)F(e.getX(se+0)),F(e.getX(se+1)),F(e.getX(se+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ti(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let y=0,_=n.count;y<_;y++)n.setXYZ(y,0,0,0);const i=new Y,r=new Y,a=new Y,l=new Y,u=new Y,h=new Y,p=new Y,g=new Y;if(e)for(let y=0,_=e.count;y<_;y+=3){const S=e.getX(y+0),A=e.getX(y+1),E=e.getX(y+2);i.fromBufferAttribute(t,S),r.fromBufferAttribute(t,A),a.fromBufferAttribute(t,E),p.subVectors(a,r),g.subVectors(i,r),p.cross(g),l.fromBufferAttribute(n,S),u.fromBufferAttribute(n,A),h.fromBufferAttribute(n,E),l.add(p),u.add(p),h.add(p),n.setXYZ(S,l.x,l.y,l.z),n.setXYZ(A,u.x,u.y,u.z),n.setXYZ(E,h.x,h.y,h.z)}else for(let y=0,_=t.count;y<_;y+=3)i.fromBufferAttribute(t,y+0),r.fromBufferAttribute(t,y+1),a.fromBufferAttribute(t,y+2),p.subVectors(a,r),g.subVectors(i,r),p.cross(g),n.setXYZ(y+0,p.x,p.y,p.z),n.setXYZ(y+1,p.x,p.y,p.z),n.setXYZ(y+2,p.x,p.y,p.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ar.fromBufferAttribute(e,t),ar.normalize(),e.setXYZ(t,ar.x,ar.y,ar.z)}toNonIndexed(){function e(l,u){const h=l.array,p=l.itemSize,g=l.normalized,y=new h.constructor(u.length*p);let _=0,S=0;for(let A=0,E=u.length;A<E;A++){l.isInterleavedBufferAttribute?_=u[A]*l.data.stride+l.offset:_=u[A]*p;for(let b=0;b<p;b++)y[S++]=h[_++]}return new ti(y,p,g)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new bn,n=this.index.array,i=this.attributes;for(const l in i){const u=i[l],h=e(u,n);t.setAttribute(l,h)}const r=this.morphAttributes;for(const l in r){const u=[],h=r[l];for(let p=0,g=h.length;p<g;p++){const y=h[p],_=e(y,n);u.push(_)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let l=0,u=a.length;l<u;l++){const h=a[l];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const i={};let r=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],p=[];for(let g=0,y=h.length;g<y;g++){const _=h[g];p.push(_.toJSON(e.data))}p.length>0&&(i[u]=p,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere=l.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const h in i){const p=i[h];this.setAttribute(h,p.clone(t))}const r=e.morphAttributes;for(const h in r){const p=[],g=r[h];for(let y=0,_=g.length;y<_;y++)p.push(g[y].clone(t));this.morphAttributes[h]=p}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let h=0,p=a.length;h<p;h++){const g=a[h];this.addGroup(g.start,g.count,g.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}
vendor: 4,980 bytes, line 78
78const kD=new Ot,Gf=new $y,gb=new cr,qD=new Y,yb=new Y,vb=new Y,_b=new Y,g1=new Y,xb=new Y,WD=new Y,Sb=new Y;class Ri extends jn{constructor(e=new bn,t=new xa){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const l=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=r}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const l=this.morphTargetInfluences;if(r&&l){xb.set(0,0,0);for(let u=0,h=r.length;u<h;u++){const p=l[u],g=r[u];p!==0&&(g1.fromBufferAttribute(g,e),a?xb.addScaledVector(g1,p):xb.addScaledVector(g1.sub(t),p))}t.add(xb)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),gb.copy(n.boundingSphere),gb.applyMatrix4(r),Gf.copy(e.ray).recast(e.near),!(gb.containsPoint(Gf.origin)===!1&&(Gf.intersectSphere(gb,qD)===null||Gf.origin.distanceToSquared(qD)>(e.far-e.near)**2))&&(kD.copy(r).invert(),Gf.copy(e.ray).applyMatrix4(kD),!(n.boundingBox!==null&&Gf.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Gf)))}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,l=r.index,u=r.attributes.position,h=r.attributes.uv,p=r.attributes.uv1,g=r.attributes.normal,y=r.groups,_=r.drawRange;if(l!==null)if(Array.isArray(a))for(let S=0,A=y.length;S<A;S++){const E=y[S],b=a[E.materialIndex],C=Math.max(E.start,_.start),w=Math.min(l.count,Math.min(E.start+E.count,_.start+_.count));for(let D=C,P=w;D<P;D+=3){const I=l.getX(D),F=l.getX(D+1),z=l.getX(D+2);i=bb(this,b,e,n,h,p,g,I,F,z),i&&(i.faceIndex=Math.floor(D/3),i.face.materialIndex=E.materialIndex,t.push(i))}}else{const S=Math.max(0,_.start),A=Math.min(l.count,_.start+_.count);for(let E=S,b=A;E<b;E+=3){const C=l.getX(E),w=l.getX(E+1),D=l.getX(E+2);i=bb(this,a,e,n,h,p,g,C,w,D),i&&(i.faceIndex=Math.floor(E/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(a))for(let S=0,A=y.length;S<A;S++){const E=y[S],b=a[E.materialIndex],C=Math.max(E.start,_.start),w=Math.min(u.count,Math.min(E.start+E.count,_.start+_.count));for(let D=C,P=w;D<P;D+=3){const I=D,F=D+1,z=D+2;i=bb(this,b,e,n,h,p,g,I,F,z),i&&(i.faceIndex=Math.floor(D/3),i.face.materialIndex=E.materialIndex,t.push(i))}}else{const S=Math.max(0,_.start),A=Math.min(u.count,_.start+_.count);for(let E=S,b=A;E<b;E+=3){const C=E,w=E+1,D=E+2;i=bb(this,a,e,n,h,p,g,C,w,D),i&&(i.faceIndex=Math.floor(E/3),t.push(i))}}}}function z5(s,e,t,n,i,r,a,l){let u;if(e.side===yi?u=n.intersectTriangle(a,r,i,!0,l):u=n.intersectTriangle(i,r,a,e.side===Za,l),u===null)return null;Sb.copy(l),Sb.applyMatrix4(s.matrixWorld);const h=t.ray.origin.distanceTo(Sb);return h<t.near||h>t.far?null:{distance:h,point:Sb.clone(),object:s}}function bb(s,e,t,n,i,r,a,l,u,h){s.getVertexPosition(l,yb),s.getVertexPosition(u,vb),s.getVertexPosition(h,_b);const p=z5(s,e,t,n,yb,vb,_b,WD);if(p){const g=new Y;Wa.getBarycoord(WD,yb,vb,_b,g),i&&(p.uv=Wa.getInterpolatedAttribute(i,l,u,h,g,new Ge)),r&&(p.uv1=Wa.getInterpolatedAttribute(r,l,u,h,g,new Ge)),a&&(p.normal=Wa.getInterpolatedAttribute(a,l,u,h,g,new Y),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const y={a:l,b:u,c:h,normal:new Y,materialIndex:0};Wa.getNormal(yb,vb,_b,y.normal),p.face=y,p.barycoord=g}return p}class uh extends bn{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const l=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const u=[],h=[],p=[],g=[];let y=0,_=0;S("z","y","x",-1,-1,n,t,e,a,r,0),S("z","y","x",1,-1,n,t,-e,a,r,1),S("x","z","y",1,1,e,n,t,i,a,2),S("x","z","y",1,-1,e,n,-t,i,a,3),S("x","y","z",1,-1,e,t,n,i,r,4),S("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(u),this.setAttribute("position",new It(h,3)),this.setAttribute("normal",new It(p,3)),this.setAttribute("uv",new It(g,2));function S(A,E,b,C,w,D,P,I,F,z,B){const O=D/F,W=P/z,ee=D/2,se=P/2,fe=I/2,pe=F+1,k=z+1;let Q=0,J=0;const Se=new Y;for(let K=0;K<k;K++){const oe=K*W-se;for(let we=0;we<pe;we++){const Ie=we*O-ee;Se[A]=Ie*C,Se[E]=oe*w,Se[b]=fe,h.push(Se.x,Se.y,Se.z),Se[A]=0,Se[E]=0,Se[b]=I>0?1:-1,p.push(Se.x,Se.y,Se.z),g.push(we/F),g.push(1-K/z),Q+=1}}for(let K=0;K<z;K++)for(let oe=0;oe<F;
vendor: 4,735 bytes, lines 78-82
78oe++){const we=y+oe+pe*K,Ie=y+oe+pe*(K+1),Ze=y+(oe+1)+pe*(K+1),mt=y+(oe+1)+pe*K;u.push(we,Ie,mt),u.push(Ie,Ze,mt),J+=6}l.addGroup(_,J,B),_+=J,y+=Q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uh(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Iy(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function ma(s){const e={};for(let t=0;t<s.length;t++){const n=Iy(s[t]);for(const i in n)e[i]=n[i]}return e}function G5(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function OP(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Kt.workingColorSpace}const IP={clone:Iy,merge:ma};var H5=`void main() { 79 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 80}`,k5=`void main() { 81 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 82}`;class Kl extends hr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=H5,this.fragmentShader=k5,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Iy(e.uniforms),this.uniformsGroups=G5(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 i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class ix extends jn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ot,this.projectionMatrix=new Ot,this.projectionMatrixInverse=new Ot,this.coordinateSystem=Er,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const cd=new Y,XD=new Ge,YD=new Ge;class ps extends ix{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=im*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Tp*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,175 bytes, line 82
82getEffectiveFOV(){return im*2*Math.atan(Math.tan(Tp*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){cd.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(cd.x,cd.y).multiplyScalar(-e/cd.z),cd.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(cd.x,cd.y).multiplyScalar(-e/cd.z)}getViewSize(e,t){return this.getViewBounds(e,XD,YD),t.subVectors(YD,XD)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Tp*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const u=a.fullWidth,h=a.fullHeight;r+=a.offsetX*i/u,t-=a.offsetY*n/h,i*=a.width/u,n*=a.height/h}const l=this.filmOffset;l!==0&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),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 Ug=-90,Lg=1;class XM extends jn{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new ps(Ug,Lg,e,t);i.layers=this.layers,this.add(i);const r=new ps(Ug,Lg,e,t);r.layers=this.layers,this.add(r);const a=new ps(Ug,Lg,e,t);a.layers=this.layers,this.add(a);const l=new ps(Ug,Lg,e,t);l.layers=this.layers,this.add(l);const u=new ps(Ug,Lg,e,t);u.layers=this.layers,this.add(u);const h=new ps(Ug,Lg,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,l,u]=t;for(const h of t)this.remove(h);if(e===Er)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===rl)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,l,u,h,p]=this.children,g=e.getRenderTarget(),y=e.getActiveCubeFace(),_=e.getActiveMipmapLevel(),S=e.xr.enabled;e.xr.enabled=!1;const A=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,l),e.setRenderTarget(n,3,i),e.render(t,u),e.setRenderTarget(n,4,i),e.render(t,h),n.texture.generateMipmaps=A,e.setRenderTarget(n,5,i),e.render(t,p),e.setRenderTarget(g,y,_),e.xr.enabled=S,n.texture.needsPMREMUpdate=!0}}class Id extends qi{constructor(e=[],t=Eo,n,i,r,a,l,u,h,p){super(e,t,n,i,r,a,l,u,h,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class YM extends jl{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Id(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace
vendor: 21,828 bytes, lines 82-117
82=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` 83 84 varying vec3 vWorldDirection; 85 86 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 87 88 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 89 90 } 91 92 void main() { 93 94 vWorldDirection = transformDirection( position, modelMatrix ); 95 96 #include <begin_vertex> 97 #include <project_vertex> 98 99 } 100 `,fragmentShader:` 101 102 uniform sampler2D tEquirect; 103 104 varying vec3 vWorldDirection; 105 106 #include <common> 107 108 void main() { 109 110 vec3 direction = normalize( vWorldDirection ); 111 112 vec2 sampleUV = equirectUv( direction ); 113 114 gl_FragColor = texture2D( tEquirect, sampleUV ); 115 116 } 117 `},i=new uh(5,5,5),r=new Kl({name:"CubemapFromEquirect",uniforms:Iy(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:yi,blending:Qa});r.uniforms.tEquirect.value=t;const a=new Ri(i,r),l=t.minFilter;return t.minFilter===Mr&&(t.minFilter=hi),new XM(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}class ay extends jn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const q5={type:"move"};class p0{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ay,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 ay,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ay,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null;const l=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const A of e.hand.values()){const E=t.getJointPose(A,n),b=this._getHandJoint(h,A);E!==null&&(b.matrix.fromArray(E.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,b.jointRadius=E.radius),b.visible=E!==null}const p=h.joints["index-finger-tip"],g=h.joints["thumb-tip"],y=p.position.distanceTo(g.position),_=.02,S=.005;h.inputState.pinching&&y>_+S?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&y<=_-S&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(u.matrix.fromArray(r.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,r.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(r.linearVelocity)):u.hasLinearVelocity=!1,r.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(r.angularVelocity)):u.hasAngularVelocity=!1));l!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(l.matrix.fromArray(i.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,i.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(i.linearVelocity)):l.hasLinearVelocity=!1,i.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(i.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(q5)))}return l!==null&&(l.visible=i!==null),u!==null&&(u.visible=r!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ay;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class jM{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new lt(e),this.density=t}clone(){return new jM(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class KM{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new lt(e),this.near=t,this.far=n}clone(){return new KM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Jy extends jn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ma,this.environmentIntensity=1,this.environmentRotation=new Ma,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class sx{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Py,this.updateRanges=[],this.version=0,this.uuid=Mo()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Mo()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Mo()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const pa=new Y;class Dd{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)pa.fromBufferAttribute(this,t),pa.applyMatrix4(e),this.setXYZ(t,pa.x,pa.y,pa.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)pa.fromBufferAttribute(this,t),pa.applyNormalMatrix(e),this.setXYZ(t,pa.x,pa.y,pa.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)pa.fromBufferAttribute(this,t),pa.transformDirection(e),this.setXYZ(t,pa.x,pa.y,pa.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=_a(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=An(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=An(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=An(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=An(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=An(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=_a(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=_a(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=_a(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=_a(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=An(t,this.array),n=An(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=An(t,this.array),n=An(n,this.array),i=An(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=An(t,this.array),n=An(n,this.array),i=An(i,this.array),r=An(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new ti(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Dd(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class ZM extends hr{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new lt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Bg;const L_=new Y,Pg=new Y,Og=new Y,Ig=new Ge,B_=new Ge,FP=new Ot,Tb=new Y,P_=new Y,Mb=new Y,jD=new Ge,y1=new Ge,KD=new Ge;class VP extends jn{constructor(e=new ZM){if(super(),this.isSprite=!0,this.type="Sprite",Bg===void 0){Bg=new bn;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new sx(t,5);Bg.setIndex([0,1,2,0,2,3]),Bg.setAttribute("position",new Dd(n,3,0,!1)),Bg.setAttribute("uv",new Dd(n,2,3,!1))}this.geometry=Bg,this.material=e,this.center=new Ge(.5,.5),this.count=1}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Pg.setFromMatrixScale(this.matrixWorld),FP.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Og.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Pg.multiplyScalar(-Og.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const a=this.center;Eb(Tb.set(-.5,-.5,0),Og,a,Pg,i,r),Eb(P_.set(.5,-.5,0),Og,a,Pg,i,r),Eb(Mb.set(.5,.5,0),Og,a,Pg,i,r),jD.set(0,0),y1.set(1,0),KD.set(1,1);let l=e.ray.intersectTriangle(Tb,P_,Mb,!1,L_);if(l===null&&(Eb(P_.set(-.5,.5,0),Og,a,Pg,i,r),y1.set(0,1),l=e.ray.intersectTriangle(Tb,Mb,P_,!1,L_),l===null))return;const u=e.ray.origin.distanceTo(L_);u<e.near||u>e.far||t.push({distance:u,point:L_.clone(),uv:Wa.getInterpolation(L_,Tb,P_,Mb,jD,y1,KD,new Ge),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 Eb(s,e,t,n,i,r){Ig.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(B_.x=r*Ig.x-i*Ig.y,B_.y=i*Ig.x+r*Ig.y):B_.copy(Ig),s.copy(e),s.x+=B_.x,s.y+=B_.y,s.applyMatrix4(FP)}const Ab=new Y,ZD=new Y;class zP extends jn{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const r=t[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Ab.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Ab);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ab.setFromMatrixPosition(e.matrixWorld),ZD.setFromMatrixPosition(this.matrixWorld);const n=Ab.distanceTo(ZD)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r;i++){let a=t[i].distance;if(t[i].object.visible&&(a-=a*t[i].hysteresis),n>=a)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const QD=new Y,$D=new kt,JD=new kt,W5=new Y,eU=new Ot,Rb=new Y,v1=new cr,tU=new Ot,_1=new $y;class GP extends Ri{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=IR,this.bindMatrix=new Ot,this.bindMatrixInverse=new Ot,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Wr),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Rb),this.boundingBox.expandByPoint(Rb)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new cr),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Rb),this.boundingSphere.expandByPoint(Rb)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),v1.copy(this.boundingSphere),v1.applyMatrix4(i),e.ray.intersectsSphere(v1)!==!1&&(tU.copy(i).invert(),_1.copy(e.ray).applyMatrix4(tU),!(this.boundingBox!==null&&_1.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,_1)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new kt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===IR?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===dP?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;$D.fromBufferAttribute(i.attributes.skinIndex,e),JD.fromBufferAttribute(i.attributes.skinWeight,e),QD.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const a=JD.getComponent(r);if(a!==0){const l=$D.getComponent(r);eU.multiplyMatrices(n.bones[l].matrixWorld,n.boneInverses[l]),t.addScaledVector(W5.copy(QD).applyMatrix4(eU),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class eC extends jn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Xl extends qi{constructor(e=null,t=1,n=1,i,r,a,l,u,h=Ai,p=Ai,g,y){super(null,a,l,u,h,p,i,r,g,y),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const nU=new Ot,X5=new Ot;class QM{constructor(e=[],t=[]){this.uuid=Mo(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ot)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Ot;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,a=e.length;r<a;r++){const l=e[r]?e[r].matrixWorld:X5;nU.multiplyMatrices(l,t[r]),nU.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new QM(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Xl(t,e,e,Pi,Bi);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let a=t[r];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new eC),this.bones.push(a),this.boneInverses.push(new Ot().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const a=t[i];e.bones.push(a.uuid);const l=n[i];e.boneInverses.push(l.toArray())}return e}}class nl extends ti{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Fg=new Ot,iU=new Ot,Nb=[],sU=new Wr,Y5=new Ot,O_=new Ri,I_=new cr;class HP extends Ri{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new nl(ne
vendor: 4,175 bytes, line 117
117w Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,Y5)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Wr),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Fg),sU.copy(e.boundingBox).applyMatrix4(Fg),this.boundingBox.union(sU)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new cr),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Fg),I_.copy(e.boundingSphere).applyMatrix4(Fg),this.boundingSphere.union(I_)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,a=e*r+1;for(let l=0;l<n.length;l++)n[l]=i[a+l]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(O_.geometry=this.geometry,O_.material=this.material,O_.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),I_.copy(this.boundingSphere),I_.applyMatrix4(n),e.ray.intersectsSphere(I_)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,Fg),iU.multiplyMatrices(n,Fg),O_.matrixWorld=iU,O_.raycast(e,Nb);for(let a=0,l=Nb.length;a<l;a++){const u=Nb[a];u.instanceId=r,u.object=this,t.push(u)}Nb.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new nl(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Xl(new Float32Array(i*this.count),i,this.count,um,Bi));const r=this.morphTexture.source.data.data;let a=0;for(let h=0;h<n.length;h++)a+=n[h];const l=this.geometry.morphTargetsRelative?1:1-a,u=i*e;r[u]=l,r.set(n,u+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const x1=new Y,j5=new Y,K5=new pn;class Hu{constructor(e=new Y(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=x1.subVectors(n,t).cross(j5.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(x1),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||K5.getNormalMatrix(e),i=this.coplanarPoint(x1).applyMatrix4(e),r=this.normal.applyM
vendor: 4,458 bytes, line 117
117atrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Hf=new cr,Z5=new Ge(.5,.5),Cb=new Y;class dm{constructor(e=new Hu,t=new Hu,n=new Hu,i=new Hu,r=new Hu,a=new Hu){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(n),l[3].copy(i),l[4].copy(r),l[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Er,n=!1){const i=this.planes,r=e.elements,a=r[0],l=r[1],u=r[2],h=r[3],p=r[4],g=r[5],y=r[6],_=r[7],S=r[8],A=r[9],E=r[10],b=r[11],C=r[12],w=r[13],D=r[14],P=r[15];if(i[0].setComponents(h-a,_-p,b-S,P-C).normalize(),i[1].setComponents(h+a,_+p,b+S,P+C).normalize(),i[2].setComponents(h+l,_+g,b+A,P+w).normalize(),i[3].setComponents(h-l,_-g,b-A,P-w).normalize(),n)i[4].setComponents(u,y,E,D).normalize(),i[5].setComponents(h-u,_-y,b-E,P-D).normalize();else if(i[4].setComponents(h-u,_-y,b-E,P-D).normalize(),t===Er)i[5].setComponents(h+u,_+y,b+E,P+D).normalize();else if(t===rl)i[5].setComponents(u,y,E,D).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Hf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Hf.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Hf)}intersectsSprite(e){Hf.center.set(0,0,0);const t=Z5.distanceTo(e.center);return Hf.radius=.7071067811865476+t,Hf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Hf)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Cb.x=i.normal.x>0?e.max.x:e.min.x,Cb.y=i.normal.y>0?e.max.y:e.min.y,Cb.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Cb)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const Bu=new Ot,Pu=new dm;class rx{constructor(){this.coordinateSystem=Er}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Bu.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pu.setFromProjectionMatrix(Bu,i.coordinateSystem,i.reversedDepth),Pu.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Bu.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pu.setFromProjectionMatrix(Bu,i.coordinateSystem,i.reversedDepth),Pu.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Bu.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pu.setFromProjectionMatrix(Bu,i.coordinateSystem,i.reversedDepth),Pu.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Bu.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pu.setFromProjectionMatrix(Bu,i.coordinateSystem,i.reversedDepth),Pu.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if(Bu.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Pu.setFromProjectionMatrix(Bu,i.coordinateSystem,i.reversedDepth),Pu.containsPoint(e))return!0}return!1}clone(){return new rx}}function S1(s,e){return s-e}function Q5(s,e){return s.z-e.z}function $5(s,e){return e.z-s.z}class J5{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const r=this.pool,a=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const l=r[this.index];a.push(l),this.index++,l.start=e,l.count=t,l.z=n,l.index=i}reset(){this.list.length=0,this.index=0}}const Ga=new Ot,e6=new lt(1,1,1),rU=new dm,t6=new rx,wb=new Wr,kf=new cr,F_=new Y,aU=new Y,n6=new Y,b1=new J5,zr=new Ri,Db=[];function i6(s,e,t=0){const n=e.itemSize;
vendor: 1,944 bytes, line 117
117if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let r=0;r<i;r++)for(let a=0;a<n;a++)e.setComponent(r+t,a,s.getComponent(r,a))}else e.array.set(s.array,t*n);e.needsUpdate=!0}function qf(s,e){if(s.constructor!==e.constructor){const t=Math.min(s.length,e.length);for(let n=0;n<t;n++)e[n]=s[n]}else{const t=Math.min(s.length,e.length);e.set(new s.constructor(s.buffer,0,t))}}class kP extends Ri{constructor(e,t,n=t*2,i){super(new bn,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Xl(t,e,e,Pi,Bi);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Xl(t,e,e,Od,gi);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Xl(t,e,e,Pi,Bi);
117n.colorSpace=Kt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const r in e.attributes){const a=e.getAttribute(r),{array:l,itemSize:u,normalized:h}=a,p=new l.constructor(n*u),g=new ti(p,u,h);t.setAttribute(r,g)}if(e.getIndex()!==null){const r=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new ti(r,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wr);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,Ga),this.getBoundingBoxAt(r,wb).applyMatrix4(Ga),e.union(wb)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new cr);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const r=t[n].geometryIndex;this.getMatrixAt(n,Ga),this.getBoundingSphereAt(r,kf).applyMatrix4(Ga),e.union(kf)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(S1),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const r=this._matricesTexture;Ga.identity().toArray(r.image.data,i*16),r.needsUpdate=!0;const a=this._colorsTexture;return a&&(e6.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const a=e.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?a.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let u;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(S1),u=this._availableGeometryIds.shift(),r[u]=i):(u=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(u,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,r=n.getIndex(),a=t.getIndex(),l=this._geometryInfo[e];if(i&&a.count>l.reservedIndexCount||t.attributes.position.count>l.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const u=l.vertexStart,h=l.reservedVertexCount;l.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),y=n.getAttribute(p);i6(g,y,u);const _=g.itemSize;
vendor: 9,268 bytes, line 117
117for(let S=g.count,A=h;S<A;S++){const E=u+S;for(let b=0;b<_;b++)y.setComponent(E,b,0)}y.needsUpdate=!0,y.addUpdateRange(u*_,h*_)}if(i){const p=l.indexStart,g=l.reservedIndexCount;l.indexCount=t.getIndex().count;for(let y=0;y<a.count;y++)r.setX(p+y,u+a.getX(y));for(let y=a.count,_=g;y<_;y++)r.setX(p+y,u);r.needsUpdate=!0,r.addUpdateRange(p,l.reservedIndexCount)}return l.start=i?l.indexStart:l.vertexStart,l.count=i?l.indexCount:l.vertexCount,l.boundingBox=null,t.boundingBox!==null&&(l.boundingBox=t.boundingBox.clone()),l.boundingSphere=null,t.boundingSphere!==null&&(l.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,r=n.length;i<r;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((a,l)=>l).sort((a,l)=>n[a].vertexStart-n[l].vertexStart),r=this.geometry;for(let a=0,l=n.length;a<l;a++){const u=i[a],h=n[u];if(h.active!==!1){if(r.index!==null){if(h.indexStart!==t){const{indexStart:p,vertexStart:g,reservedIndexCount:y}=h,_=r.index,S=_.array,A=e-g;for(let E=p;E<p+y;E++)S[E]=S[E]+A;_.array.copyWithin(t,p,p+y),_.addUpdateRange(t,y),h.indexStart=t}t+=h.reservedIndexCount}if(h.vertexStart!==e){const{vertexStart:p,reservedVertexCount:g}=h,y=r.attributes;for(const _ in y){const S=y[_],{array:A,itemSize:E}=S;A.copyWithin(e*E,p*E,(p+g)*E),S.addUpdateRange(e*E,g*E)}h.vertexStart=e}e+=h.reservedVertexCount,h.start=r.index?h.indexStart:h.vertexStart,this._nextIndexStart=r.index?h.indexStart+h.reservedIndexCount:0,this._nextVertexStart=h.vertexStart+h.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const r=new Wr,a=n.index,l=n.attributes.position;for(let u=i.start,h=i.start+i.count;u<h;u++){let p=u;a&&(p=a.getX(p)),r.expandByPoint(F_.fromBufferAttribute(l,p))}i.boundingBox=r}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const r=new cr;this.getBoundingBoxAt(e,wb),wb.getCenter(r.center);const a=n.index,l=n.attributes.position;let u=0;for(let h=i.start,p=i.start+i.count;h<p;h++){let g=h;a&&(g=a.getX(g)),F_.fromBufferAttribute(l,g),u=Math.max(u,r.center.distanceToSquared(F_))}r.radius=Math.sqrt(u),i.boundingSphere=r}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(S1);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),r=new Int32Array(e);qf(this._multiDrawCounts,i),qf(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=e;const a=this._indirectTexture,l=this._matricesTexture,u=this._colorsTexture;a.dispose(),this._initIndirectTexture(),qf(a.image.data,this._indirectTexture.image.data),l.dispose(),this._initMatricesTexture(),qf(l.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),qf(u.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(l=>l.active);if(Math.max(...n.map(l=>l.vertexStart+l.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(u=>u.indexStart+u.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new bn,this._initializeGeometry(r));const a=this.geometry;r.index&&qf(r.index.array,a.index.array);for(const l in r.attributes)qf(r.attributes[l].array,a.attributes[l].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,a=this.geometry;zr.material=this.material,zr.geometry.index=a.index,zr.geometry.attributes=a.attributes,zr.geometry.boundingBox===null&&(zr.geometry.boundingBox=new Wr),zr.geometry.boundingSphere===null&&(zr.geometry.boundingSphere=new cr);for(let l=0,u=n.length;l<u;l++){if(!n[l].visible||!n[l].active)continue;const h=n[l].geometryIndex,p=i[h];zr.geometry.setDrawRange(p.start,p.count),this.getMatrixAt(l,zr.matrixWorld).premultiply(r),this.getBoundingBoxAt(h,zr.geometry.boundingBox),this.getBoundingSphereAt(h,zr.geometry.boundingSphere),zr.raycast(e,Db);for(let g=0,y=Db.length;g<y;g++){const _=Db[g];_.object=this,_.batchId=l,t.push(_)}Db.length=0}zr.material=null,zr.geometry.index=null,zr.geometry.attributes={},zr.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),l=a===null?1:a.array.BYTES_PER_ELEMENT,u=this._instanceInfo,h=this._multiDrawStarts,p=this._multiDrawCounts,g=this._geometryInfo,y=this.perObjectFrustumCulled,_=this._indirectTexture,S=_.image.data,A=n.isArrayCamera?t6:rU;y&&!n.isArrayCamera&&(Ga.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),rU.setFromProjectionMatrix(Ga,n.coordinateSystem,n.reversedDepth));let E=0;if(this.sortObjects){Ga.copy(this.matrixWorld).invert(),F_.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ga),aU.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ga);for(let w=0,D=u.length;w<D;w++)if(u[w].visible&&u[w].active){const P=u[w].geometryIndex;this.getMatrixAt(w,Ga),this.getBoundingSphereAt(P,kf).applyMatrix4(Ga);let I=!1;if(y&&(I=!A.intersectsSphere(kf,n)),!I){const F=g[P],z=n6.subVectors(kf.center,F_).dot(aU);b1.push(F.start,F.count,z,w)}}const b=b1.list,C=this.customSort;C===null?b.sort(r.transparent?$5:Q5):C.call(this,b,n);for(let w=0,D=b.length;w<D;w++){const P=b[w];
vendor: 7,861 bytes, line 117
117h[E]=P.start*l,p[E]=P.count,S[E]=P.index,E++}b1.reset()}else for(let b=0,C=u.length;b<C;b++)if(u[b].visible&&u[b].active){const w=u[b].geometryIndex;let D=!1;if(y&&(this.getMatrixAt(b,Ga),this.getBoundingSphereAt(w,kf).applyMatrix4(Ga),D=!A.intersectsSphere(kf,n)),!D){const P=g[w];h[E]=P.start*l,p[E]=P.count,S[E]=b,E++}}_.needsUpdate=!0,this._multiDrawCount=E,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,a){this.onBeforeRender(e,null,i,r,a)}}class jr extends hr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new lt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const KT=new Y,ZT=new Y,oU=new Ot,V_=new $y,Ub=new cr,T1=new Y,lU=new Y;class Ud extends jn{constructor(e=new bn,t=new jr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)KT.fromBufferAttribute(t,i-1),ZT.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=KT.distanceTo(ZT);e.setAttribute("lineDistance",new It(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ub.copy(n.boundingSphere),Ub.applyMatrix4(i),Ub.radius+=r,e.ray.intersectsSphere(Ub)===!1)return;oU.copy(i).invert(),V_.copy(e.ray).applyMatrix4(oU);const l=r/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,h=this.isLineSegments?2:1,p=n.index,y=n.attributes.position;if(p!==null){const _=Math.max(0,a.start),S=Math.min(p.count,a.start+a.count);for(let A=_,E=S-1;A<E;A+=h){const b=p.getX(A),C=p.getX(A+1),w=Lb(this,e,V_,u,b,C,A);w&&t.push(w)}if(this.isLineLoop){const A=p.getX(S-1),E=p.getX(_),b=Lb(this,e,V_,u,A,E,S-1);b&&t.push(b)}}else{const _=Math.max(0,a.start),S=Math.min(y.count,a.start+a.count);for(let A=_,E=S-1;A<E;A+=h){const b=Lb(this,e,V_,u,A,A+1,A);b&&t.push(b)}if(this.isLineLoop){const A=Lb(this,e,V_,u,S-1,_,S-1);A&&t.push(A)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const l=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=r}}}}}function Lb(s,e,t,n,i,r,a){const l=s.geometry.attributes.position;if(KT.fromBufferAttribute(l,i),ZT.fromBufferAttribute(l,r),t.distanceSqToSegment(KT,ZT,T1,lU)>n)return;T1.applyMatrix4(s.matrixWorld);const h=e.ray.origin.distanceTo(T1);if(!(h<e.near||h>e.far))return{distance:h,point:lU.clone().applyMatrix4(s.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:s}}const uU=new Y,cU=new Y;class sc extends Ud{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)uU.fromBufferAttribute(t,i),cU.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+uU.distanceTo(cU);e.setAttribute("lineDistance",new It(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class qP extends Ud{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class $M extends hr{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new lt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const hU=new Ot,VR=new $y,Bb=new cr,Pb=new Y;class WP extends jn{constructor(e=new bn,t=new $M){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Bb.copy(n.boundingSphere),Bb.applyMatrix4(i),Bb.radius+=r,e.ray.intersectsSphere(Bb)===!1)return;hU.copy(i).invert(),VR.copy(e.ray).applyMatrix4(hU);const l=r/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,h=n.index,g=n.attributes.position;if(h!==null){const y=Math.max(0,a.start),_=Math.min(h.count,a.start+a.count);for(let S=y,A=_;S<A;S++){const E=h.getX(S);Pb.fromBufferAttribute(g,E),dU(Pb,E,u,i,e,t,this)}}else{const y=Math.max(0,a.start),_=Math.min(g.count,a.start+a.count);for(let S=y,A=_;S<A;S++)Pb.fromBufferAttribute(g,S),dU(Pb,S,u,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r<a;r++){const l=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=r}}}}}function dU(s,e,t,n,i,r,a){const l=VR.distanceSqToPoint(s);if(l<t){const u=new Y;VR.closestPointToPoint(s,u),u.applyMatrix4(n);const h=i.ray.origin.distanceTo(u);if(h<i.near||h>i.far)return;r.push({distance:h,distanceToRay:Math.sqrt(l),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class XP extends qi{constructor(e,t,n,i,r=hi,a=hi,l,u,h){super(e,t,n,i,r,a,l,u,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}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)}dispose(){this._requestVideoFrameCallbackId!==0&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}}class s6 extends XP{constructor(e,t,n,i,r,a,l,u){super({},e,t,n,i,r,a,l,u),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class tC extends qi{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Ai,this.minFilter=Ai,this.generateMipmaps=!1,this.needsUpdate=!0}}class JM extends qi{constructor(e,t,n,i,r,a,l,u,h,p,g,y){super(null,a,l,u,h,p,i,r,g,y),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class r6 extends JM{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Sa,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class a6 extends JM{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Eo),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class o6 extends qi{constructor(e,t,n,i,r,a,l,u,h){super(e,t,n,i,r,a,l,u,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ta extends qi{constructor(e,t,n=gi,i,r,a,l=Ai,u=Ai,h,p=eo,g=1){
vendor: 4,363 bytes, line 117
117if(p!==eo&&p!==to)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const y={width:e,height:t,depth:g};super(y,i,r,a,l,u,p,n,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new xd(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class nC extends qi{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class eE extends bn{constructor(e=1,t=1,n=4,i=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:r},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),r=Math.max(1,Math.floor(r));const a=[],l=[],u=[],h=[],p=t/2,g=Math.PI/2*e,y=t,_=2*g+y,S=n*2+r,A=i+1,E=new Y,b=new Y;for(let C=0;C<=S;C++){let w=0,D=0,P=0,I=0;if(C<=n){const B=C/n,O=B*Math.PI/2;D=-p-e*Math.cos(O),P=e*Math.sin(O),I=-e*Math.cos(O),w=B*g}else if(C<=n+r){const B=(C-n)/r;D=-p+B*t,P=e,I=0,w=g+B*y}else{const B=(C-n-r)/n,O=B*Math.PI/2;D=p+e*Math.sin(O),P=e*Math.cos(O),I=e*Math.sin(O),w=g+y+B*g}const F=Math.max(0,Math.min(1,w/_));let z=0;C===0?z=.5/i:C===S&&(z=-.5/i);for(let B=0;B<=i;B++){const O=B/i,W=O*Math.PI*2,ee=Math.sin(W),se=Math.cos(W);b.x=-P*se,b.y=D,b.z=P*ee,l.push(b.x,b.y,b.z),E.set(-P*se,I,P*ee),E.normalize(),u.push(E.x,E.y,E.z),h.push(O+z,F)}if(C>0){const B=(C-1)*A;for(let O=0;O<i;O++){const W=B+O,ee=B+O+1,se=C*A+O,fe=C*A+O+1;a.push(W,ee,se),a.push(ee,fe,se)}}}this.setIndex(a),this.setAttribute("position",new It(l,3)),this.setAttribute("normal",new It(u,3)),this.setAttribute("uv",new It(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new eE(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class tE extends bn{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],a=[],l=[],u=[],h=new Y,p=new Ge;a.push(0,0,0),l.push(0,0,1),u.push(.5,.5);for(let g=0,y=3;g<=t;g++,y+=3){const _=n+g/t*i;h.x=e*Math.cos(_),h.y=e*Math.sin(_),a.push(h.x,h.y,h.z),l.push(0,0,1),p.x=(a[y]/e+1)/2,p.y=(a[y+1]/e+1)/2,u.push(p.x,p.y)}for(let g=1;g<=t;g++)r.push(g,g+1,0);this.setIndex(r),this.setAttribute("position",new It(a,3)),this.setAttribute("normal",new It(l,3)),this.setAttribute("uv",new It(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tE(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ev extends bn{constructor(e=1,t=1,n=1,i=32,r=1,a=!1,l=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:l,thetaLength:u};const h=this;i=Math.floor(i),r=Math.floor(r);const p=[],g=[],y=[],_=[];let S=0;const A=[],E=n/2;let b=0;C(),a===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(p),this.setAttribute("position",new It(g,3)),this.setAttribute("normal",new It(y,3)),this.setAttribute("uv",new It(_,2));function C(){const D=new Y,P=new Y;let I=0;const F=(t-e)/n;for(let z=0;z<=r;z++){const B=[],O=z/r,W=O*(t-e)+e;for(let ee=0;ee<=i;ee++){const se=ee/i,fe=se*u+l,pe=Math.sin(fe),k=Math.cos(fe);P.x=W*pe,P.y=-O*n+E,P.z=W*k,g.push(P.x,P.y,P.z),D.set(pe,F,k).normalize(),y.push(D.x,D.y,D.z),_.push(se,1-O),B.push(S++)}A.push(B)}for(let z=0;z<i;z++)for(let B=0;B<r;B++){const O=A[B][z],W=A[B+1][z],ee=A[B+1][z+1],se=A[B][z+1];(e>0||B!==0)&&(p.push(O,W,se),I+=3),(t>0||B!==r-1)&&(p.push(W,ee,se),I+=3)}h.addGroup(b,I,0),b+=I}function w(D){const P=S,I=new Ge,F=new Y;let z=0;const B=D===!0?e:t,O=D===!0?1:-1;for(let ee=1;ee<=i;ee++)g.push(0,E*O,0),y.push(0,O,0),_.push(.5,.5),S++;const W=S;for(let ee=0;ee<=i;ee++){const fe=ee/i*u+l,pe=Math.cos(fe),k=Math.sin(fe);F.x=B*k,F.y=E*O,F.z=B*pe,g.push(F.x,F.y,F.z),y.push(0,O,0),I.x=pe*.5+.5,I.y=k*.5*O+.5,_.push(I.x,I.y),S++}for(let ee=0;ee<i;ee++){const se=P+ee,fe=W+ee;D===!0?p.push(fe,fe+1,se):p.push(fe+1,fe,se),z+=3}h.addGroup(b,z,D===!0?1:2),b+=z}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}
vendor: 11,535 bytes, line 117
117static fromJSON(e){return new ev(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ax extends ev{constructor(e=1,t=1,n=32,i=1,r=!1,a=0,l=Math.PI*2){super(0,e,t,n,i,r,a,l),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:l}}static fromJSON(e){return new ax(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Fd extends bn{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],a=[];l(i),h(n),p(),this.setAttribute("position",new It(r,3)),this.setAttribute("normal",new It(r.slice(),3)),this.setAttribute("uv",new It(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function l(C){const w=new Y,D=new Y,P=new Y;for(let I=0;I<t.length;I+=3)_(t[I+0],w),_(t[I+1],D),_(t[I+2],P),u(w,D,P,C)}function u(C,w,D,P){const I=P+1,F=[];for(let z=0;z<=I;z++){F[z]=[];const B=C.clone().lerp(D,z/I),O=w.clone().lerp(D,z/I),W=I-z;for(let ee=0;ee<=W;ee++)ee===0&&z===I?F[z][ee]=B:F[z][ee]=B.clone().lerp(O,ee/W)}for(let z=0;z<I;z++)for(let B=0;B<2*(I-z)-1;B++){const O=Math.floor(B/2);B%2===0?(y(F[z][O+1]),y(F[z+1][O]),y(F[z][O])):(y(F[z][O+1]),y(F[z+1][O+1]),y(F[z+1][O]))}}function h(C){const w=new Y;for(let D=0;D<r.length;D+=3)w.x=r[D+0],w.y=r[D+1],w.z=r[D+2],w.normalize().multiplyScalar(C),r[D+0]=w.x,r[D+1]=w.y,r[D+2]=w.z}function p(){const C=new Y;for(let w=0;w<r.length;w+=3){C.x=r[w+0],C.y=r[w+1],C.z=r[w+2];const D=E(C)/2/Math.PI+.5,P=b(C)/Math.PI+.5;a.push(D,1-P)}S(),g()}function g(){for(let C=0;C<a.length;C+=6){const w=a[C+0],D=a[C+2],P=a[C+4],I=Math.max(w,D,P),F=Math.min(w,D,P);I>.9&&F<.1&&(w<.2&&(a[C+0]+=1),D<.2&&(a[C+2]+=1),P<.2&&(a[C+4]+=1))}}function y(C){r.push(C.x,C.y,C.z)}function _(C,w){const D=C*3;w.x=e[D+0],w.y=e[D+1],w.z=e[D+2]}function S(){const C=new Y,w=new Y,D=new Y,P=new Y,I=new Ge,F=new Ge,z=new Ge;for(let B=0,O=0;B<r.length;B+=9,O+=6){C.set(r[B+0],r[B+1],r[B+2]),w.set(r[B+3],r[B+4],r[B+5]),D.set(r[B+6],r[B+7],r[B+8]),I.set(a[O+0],a[O+1]),F.set(a[O+2],a[O+3]),z.set(a[O+4],a[O+5]),P.copy(C).add(w).add(D).divideScalar(3);const W=E(P);A(I,O+0,C,W),A(F,O+2,w,W),A(z,O+4,D,W)}}function A(C,w,D,P){P<0&&C.x===1&&(a[w]=C.x-1),D.x===0&&D.z===0&&(a[w]=P/2/Math.PI+.5)}function E(C){return Math.atan2(C.z,-C.x)}function b(C){return Math.atan2(-C.y,Math.sqrt(C.x*C.x+C.z*C.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fd(e.vertices,e.indices,e.radius,e.details)}}class nE extends Fd{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new nE(e.radius,e.detail)}}const Ob=new Y,Ib=new Y,M1=new Y,Fb=new Wa;class YP extends bn{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),r=Math.cos(Tp*t),a=e.getIndex(),l=e.getAttribute("position"),u=a?a.count:l.count,h=[0,0,0],p=["a","b","c"],g=new Array(3),y={},_=[];for(let S=0;S<u;S+=3){a?(h[0]=a.getX(S),h[1]=a.getX(S+1),h[2]=a.getX(S+2)):(h[0]=S,h[1]=S+1,h[2]=S+2);const{a:A,b:E,c:b}=Fb;if(A.fromBufferAttribute(l,h[0]),E.fromBufferAttribute(l,h[1]),b.fromBufferAttribute(l,h[2]),Fb.getNormal(M1),g[0]=`${Math.round(A.x*i)},${Math.round(A.y*i)},${Math.round(A.z*i)}`,g[1]=`${Math.round(E.x*i)},${Math.round(E.y*i)},${Math.round(E.z*i)}`,g[2]=`${Math.round(b.x*i)},${Math.round(b.y*i)},${Math.round(b.z*i)}`,!(g[0]===g[1]||g[1]===g[2]||g[2]===g[0]))for(let C=0;C<3;C++){const w=(C+1)%3,D=g[C],P=g[w],I=Fb[p[C]],F=Fb[p[w]],z=`${D}_${P}`,B=`${P}_${D}`;B in y&&y[B]?(M1.dot(y[B].normal)<=r&&(_.push(I.x,I.y,I.z),_.push(F.x,F.y,F.z)),y[B]=null):z in y||(y[z]={index0:h[C],index1:h[w],normal:M1.clone()})}}for(const S in y)if(y[S]){const{index0:A,index1:E}=y[S];Ob.fromBufferAttribute(l,A),Ib.fromBufferAttribute(l,E),_.push(Ob.x,Ob.y,Ob.z),_.push(Ib.x,Ib.y,Ib.z)}this.setAttribute("position",new It(_,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class $l{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const r=n.length;let a;t?a=t:a=e*n[r-1];let l=0,u=r-1,h;for(;l<=u;)if(i=Math.floor(l+(u-l)/2),h=n[i]-a,h<0)l=i+1;else if(h>0)u=i-1;else{u=i;break}if(i=u,n[i]===a)return i/(r-1);const p=n[i],y=n[i+1]-p,_=(a-p)/y;return(i+_)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const a=this.getPoint(i),l=this.getPoint(r),u=t||(a.isVector2?new Ge:new Y);return u.copy(l).sub(a).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new Y,i=[],r=[],a=[],l=new Y,u=new Ot;for(let _=0;_<=e;_++){const S=_/e;i[_]=this.getTangentAt(S,new Y)}r[0]=new Y,a[0]=new Y;let h=Number.MAX_VALUE;const p=Math.abs(i[0].x),g=Math.abs(i[0].y),y=Math.abs(i[0].z);p<=h&&(h=p,n.set(1,0,0)),g<=h&&(h=g,n.set(0,1,0)),y<=h&&n.set(0,0,1),l.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],l),a[0].crossVectors(i[0],r[0]);for(let _=1;_<=e;_++){if(r[_]=r[_-1].clone(),a[_]=a[_-1].clone(),l.crossVectors(i[_-1],i[_]),l.length()>Number.EPSILON){l.normalize();const S=Math.acos(dn(i[_-1].dot(i[_]),-1,1));r[_].applyMatrix4(u.makeRotationAxis(l,S))}a[_].crossVectors(i[_],r[_])}if(t===!0){let _=Math.acos(dn(r[0].dot(r[e]),-1,1));_/=e,i[0].dot(l.crossVectors(r[0],r[e]))>0&&(_=-_);for(let S=1;S<=e;S++)r[S].applyMatrix4(u.makeRotationAxis(i[S],_*S)),a[S].crossVectors(i[S],r[S])}return{tangents:i,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class iE extends $l{constructor(e=0,t=0,n=1,i=1,r=0,a=Math.PI*2,l=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=l,this.aRotation=u}getPoint(e,t=new Ge){const n=t,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(a?r=0:r=i),this.aClockwise===!0&&!a&&(r===i?r=-i:r=r-i);const l=this.aStartAngle+e*r;let u=this.aX+this.xRadius*Math.cos(l),h=this.aY+this.yRadius*Math.sin(l);if(this.aRotation!==0){const p=Math.cos(this.aRotation),g=Math.sin(this.aRotation),y=u-this.aX,_=h-this.aY;u=y*p-_*g+this.aX,h=y*g+_*p+this.aY}return n.set(u,h)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class jP extends iE{constructor(e,t,n,i,r,a){super(e,t,n,n,i,r,a),this.isArcCurve=!0,this.type="ArcCurve"}}function iC(){let s=0,e=0,t=0,n=0;function i(r,a,l,u){s=r,e=l,t=-3*r+3*a-2*l-u,n=2*r-2*a+l+u}return{initCatmullRom:function(r,a,l,u,h){i(a,l,h*(l-r),h*(u-a))},initNonuniformCatmullRom:function(r,a,l,u,h,p,g){let y=(a-r)/h-(l-r)/(h+p)+(l-a)/p,_=(l-a)/p-(u-a)/(p+g)+(u-l)/g;y*=p,_*=p,i(a,l,y,_)},calc:function(r){const a=r*r,l=a*r;return s+e*r+t*a+n*l}}}const Vb=new Y,E1=new iC,A1=new iC,R1=new iC;class KP extends $l{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new Y){const n=t,i=this.points,r=i.length,a=(r-(this.closed?0:1))*e;let l=Math.floor(a),u=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:u===0&&l===r-1&&(l=r-2,u=1);let h,p;this.closed||l>0?h=i[(l-1)%r]:(Vb.subVectors(i[0],i[1]).add(i[0]),h=Vb);const g=i[l%r],y=i[(l+1)%r];if(this.closed||l+2<r?p=i[(l+2)%r]:(Vb.subVectors(i[r-1],i[r-2]).add(i[r-1]),p=Vb),this.curveType==="centripetal"||this.curveType==="chordal"){const _=this.curveType==="chordal"?.5:.25;let S=Math.pow(h.distanceToSquared(g),_),A=Math.pow(g.distanceToSquared(y),_),E=Math.pow(y.distanceToSquared(p),_);A<1e-4&&(A=1),S<1e-4&&(S=A),E<1e-4&&(E=A),E1.initNonuniformCatmullRom(h.x,g.x,y.x,p.x,S,A,E),A1.initNonuniformCatmullRom(h.y,g.y,y.y,p.y,S,A,E),R1.initNonuniformCatmullRom(h.z,g.z,y.z,p.z,S,A,E)}else this.curveType==="catmullrom"&&(E1.initCatmullRom(h.x,g.x,y.x,p.x,this.tension),A1.initCatmullRom(h.y,g.y,y.y,p.y,this.tension),R1.initCatmullRom(h.z,g.z,y.z,p.z,this.tension));return n.set(E1.calc(u),A1.calc(u),R1.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new Y().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function fU(s,e,t,n,i){const r=(n-e)*.5,a=(i-t)*.5,l=s*s,u=s*l;return(2*t-2*n+r+a)*u+(-3*t+3*n-2*r-a)*l+r*s+t}function l6(s,e){const t=1-s;return t*t*e}function u6(s,e){return 2*(1-s)*s*e}function c6(s,e){return s*s*e}function m0(s,e,t,n){return l6(s,e)+u6(s,t)+c6(s,n)}function h6(s,e){const t=1-s;return t*t*t*e}function d6(s,e){const t=1-s;return 3*t*t*s*e}function f6(s,e){return 3*(1-s)*s*s*e}function p6(s,e){return s*s*s*e}function g0(s,e,t,n,i){return h6(s,e)+d6(s,t)+f6(s,n)+p6(s,i)}
vendor: 15,636 bytes, line 117
117class sC extends $l{constructor(e=new Ge,t=new Ge,n=new Ge,i=new Ge){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Ge){const n=t,i=this.v0,r=this.v1,a=this.v2,l=this.v3;return n.set(g0(e,i.x,r.x,a.x,l.x),g0(e,i.y,r.y,a.y,l.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class ZP extends $l{constructor(e=new Y,t=new Y,n=new Y,i=new Y){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Y){const n=t,i=this.v0,r=this.v1,a=this.v2,l=this.v3;return n.set(g0(e,i.x,r.x,a.x,l.x),g0(e,i.y,r.y,a.y,l.y),g0(e,i.z,r.z,a.z,l.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class rC extends $l{constructor(e=new Ge,t=new Ge){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Ge){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Ge){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class QP extends $l{constructor(e=new Y,t=new Y){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Y){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Y){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class aC extends $l{constructor(e=new Ge,t=new Ge,n=new Ge){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Ge){const n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(m0(e,i.x,r.x,a.x),m0(e,i.y,r.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class oC extends $l{constructor(e=new Y,t=new Y,n=new Y){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Y){const n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(m0(e,i.x,r.x,a.x),m0(e,i.y,r.y,a.y),m0(e,i.z,r.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class lC extends $l{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Ge){const n=t,i=this.points,r=(i.length-1)*e,a=Math.floor(r),l=r-a,u=i[a===0?a:a-1],h=i[a],p=i[a>i.length-2?i.length-1:a+1],g=i[a>i.length-3?i.length-1:a+2];return n.set(fU(l,u.x,h.x,p.x,g.x),fU(l,u.y,h.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new Ge().fromArray(i))}return this}}var QT=Object.freeze({__proto__:null,ArcCurve:jP,CatmullRomCurve3:KP,CubicBezierCurve:sC,CubicBezierCurve3:ZP,EllipseCurve:iE,LineCurve:rC,LineCurve3:QP,QuadraticBezierCurve:aC,QuadraticBezierCurve3:oC,SplineCurve:lC});class $P extends $l{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new QT[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const a=i[r]-n,l=this.curves[r],u=l.getLength(),h=u===0?0:1-a/u;return l.getPointAt(h,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 n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const a=r[i],l=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,u=a.getPoints(l);for(let h=0;h<u.length;h++){const p=u[h];n&&n.equals(p)||(t.push(p),n=p)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new QT[i.type]().fromJSON(i))}return this}}class $T extends $P{constructor(e){super(),this.type="Path",this.currentPoint=new Ge,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new rC(this.currentPoint.clone(),new Ge(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new aC(this.currentPoint.clone(),new Ge(e,t),new Ge(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,a){const l=new sC(this.currentPoint.clone(),new Ge(e,t),new Ge(n,i),new Ge(r,a));return this.curves.push(l),this.currentPoint.set(r,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new lC(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,a){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+l,t+u,n,i,r,a),this}absarc(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this}ellipse(e,t,n,i,r,a,l,u){const h=this.currentPoint.x,p=this.currentPoint.y;return this.absellipse(e+h,t+p,n,i,r,a,l,u),this}absellipse(e,t,n,i,r,a,l,u){const h=new iE(e,t,n,i,r,a,l,u);if(this.curves.length>0){const g=h.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(h);const p=h.getPoint(1);return this.currentPoint.copy(p),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 Mp extends $T{constructor(e){super(e),this.uuid=Mo(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new $T().fromJSON(i))}return this}}function m6(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=JP(s,0,i,t,!0);const a=[];if(!r||r.next===r.prev)return a;let l,u,h;if(n&&(r=x6(s,e,r,t)),s.length>80*t){l=1/0,u=1/0;let p=-1/0,g=-1/0;for(let y=t;y<i;y+=t){const _=s[y],S=s[y+1];_<l&&(l=_),S<u&&(u=S),_>p&&(p=_),S>g&&(g=S)}h=Math.max(p-l,g-u),h=h!==0?32767/h:0}return w0(r,a,t,l,u,h,0),a}function JP(s,e,t,n,i){let r;if(i===D6(s,e,t,n)>0)for(let a=e;a<t;a+=n)r=pU(a/n|0,s[a],s[a+1],r);else for(let a=t-n;a>=e;a-=n)r=pU(a/n|0,s[a],s[a+1],r);return r&&Fy(r,r.next)&&(U0(r),r=r.next),r}function sm(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(Fy(t,t.next)||ss(t.prev,t,t.next)===0)){if(U0(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function w0(s,e,t,n,i,r,a){if(!s)return;!a&&r&&E6(s,n,i,r);let l=s;for(;s.prev!==s.next;){const u=s.prev,h=s.next;if(r?y6(s,n,i,r):g6(s)){e.push(u.i,s.i,h.i),U0(s),s=h.next,l=h.next;continue}if(s=h,s===l){a?a===1?(s=v6(sm(s),e),w0(s,e,t,n,i,r,2)):a===2&&_6(s,e,t,n,i,r):w0(sm(s),e,t,n,i,r,1);break}}}function g6(s){const e=s.prev,t=s,n=s.next;if(ss(e,t,n)>=0)return!1;const i=e.x,r=t.x,a=n.x,l=e.y,u=t.y,h=n.y,p=Math.min(i,r,a),g=Math.min(l,u,h),y=Math.max(i,r,a),_=Math.max(l,u,h);let S=n.next;for(;S!==e;){if(S.x>=p&&S.x<=y&&S.y>=g&&S.y<=_&&s0(i,l,r,u,a,h,S.x,S.y)&&ss(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function y6(s,e,t,n){const i=s.prev,r=s,a=s.next;if(ss(i,r,a)>=0)return!1;const l=i.x,u=r.x,h=a.x,p=i.y,g=r.y,y=a.y,_=Math.min(l,u,h),S=Math.min(p,g,y),A=Math.max(l,u,h),E=Math.max(p,g,y),b=zR(_,S,e,t,n),C=zR(A,E,e,t,n);let w=s.prevZ,D=s.nextZ;for(;w&&w.z>=b&&D&&D.z<=C;){if(w.x>=_&&w.x<=A&&w.y>=S&&w.y<=E&&w!==i&&w!==a&&s0(l,p,u,g,h,y,w.x,w.y)&&ss(w.prev,w,w.next)>=0||(w=w.prevZ,D.x>=_&&D.x<=A&&D.y>=S&&D.y<=E&&D!==i&&D!==a&&s0(l,p,u,g,h,y,D.x,D.y)&&ss(D.prev,D,D.next)>=0))return!1;D=D.nextZ}for(;w&&w.z>=b;){if(w.x>=_&&w.x<=A&&w.y>=S&&w.y<=E&&w!==i&&w!==a&&s0(l,p,u,g,h,y,w.x,w.y)&&ss(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;D&&D.z<=C;){if(D.x>=_&&D.x<=A&&D.y>=S&&D.y<=E&&D!==i&&D!==a&&s0(l,p,u,g,h,y,D.x,D.y)&&ss(D.prev,D,D.next)>=0)return!1;D=D.nextZ}return!0}function v6(s,e){let t=s;do{const n=t.prev,i=t.next.next;!Fy(n,i)&&t3(n,t,t.next,i)&&D0(n,i)&&D0(i,n)&&(e.push(n.i,t.i,i.i),U0(t),U0(t.next),t=s=i),t=t.next}while(t!==s);return sm(t)}function _6(s,e,t,n,i,r){let a=s;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&N6(a,l)){let u=n3(a,l);a=sm(a,a.next),u=sm(u,u.next),w0(a,e,t,n,i,r,0),w0(u,e,t,n,i,r,0);return}l=l.next}a=a.next}while(a!==s)}function x6(s,e,t,n){const i=[];for(let r=0,a=e.length;r<a;r++){const l=e[r]*n,u=r<a-1?e[r+1]*n:s.length,h=JP(s,l,u,n,!1);h===h.next&&(h.steiner=!0),i.push(R6(h))}i.sort(S6);for(let r=0;r<i.length;r++)t=b6(i[r],t);return t}function S6(s,e){let t=s.x-e.x;if(t===0&&(t=s.y-e.y,t===0)){const n=(s.next.y-s.y)/(s.next.x-s.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function b6(s,e){const t=T6(s,e);if(!t)return e;const n=n3(t,s);return sm(n,n.next),sm(t,t.next)}function T6(s,e){let t=e;const n=s.x,i=s.y;let r=-1/0,a;if(Fy(s,t))return t;do{if(Fy(s,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const g=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>r&&(r=g,a=t.x<t.next.x?t:t.next,g===n))return a}t=t.next}while(t!==e);if(!a)return null;const l=a,u=a.x,h=a.y;let p=1/0;t=a;do{if(n>=t.x&&t.x>=u&&n!==t.x&&e3(i<h?n:r,i,u,h,i<h?r:n,i,t.x,t.y)){const g=Math.abs(i-t.y)/(n-t.x);D0(t,s)&&(g<p||g===p&&(t.x>a.x||t.x===a.x&&M6(a,t)))&&(a=t,p=g)}t=t.next}while(t!==l);return a}function M6(s,e){return ss(s.prev,s,e.prev)<0&&ss(e.next,s,s.next)<0}function E6(s,e,t,n){let i=s;do i.z===0&&(i.z=zR(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,A6(i)}function A6(s){let e,t=1;do{let n=s,i;s=null;let r=null;for(e=0;n;){e++;let a=n,l=0;for(let h=0;h<t&&(l++,a=a.nextZ,!!a);h++);let u=t;for(;l>0||u>0&&a;)l!==0&&(u===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,l--):(i=a,a=a.nextZ,u--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;n=a}r.nextZ=null,t*=2}while(e>1);return s}function zR(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function R6(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function e3(s,e,t,n,i,r,a,l){return(i-a)*(e-l)>=(s-a)*(r-l)&&(s-a)*(n-l)>=(t-a)*(e-l)&&(t-a)*(r-l)>=(i-a)*(n-l)}function s0(s,e,t,n,i,r,a,l){return!(s===a&&e===l)&&e3(s,e,t,n,i,r,a,l)}function N6(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!C6(s,e)&&(D0(s,e)&&D0(e,s)&&w6(s,e)&&(ss(s.prev,s,e.prev)||ss(s,e.prev,e))||Fy(s,e)&&ss(s.prev,s,s.next)>0&&ss(e.prev,e,e.next)>0)}function ss(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function Fy(s,e){return s.x===e.x&&s.y===e.y}function t3(s,e,t,n){const i=Gb(ss(s,e,t)),r=Gb(ss(s,e,n)),a=Gb(ss(t,n,s)),l=Gb(ss(t,n,e));return!!(i!==r&&a!==l||i===0&&zb(s,t,e)||r===0&&zb(s,n,e)||a===0&&zb(t,s,n)||l===0&&zb(t,e,n))}function zb(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function Gb(s){return s>0?1:s<0?-1:0}function C6(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&t3(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function D0(s,e){return ss(s.prev,s,s.next)<0?ss(s,e,s.next)>=0&&ss(s,s.prev,e)>=0:ss(s,e,s.prev)<0||ss(s,s.next,e)<0}function w6(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function n3(s,e){const t=GR(s.i,s.x,s.y),n=GR(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function pU(s,e,t,n){const i=GR(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function U0(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function GR(s,e,t){return{i:s,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function D6(s,e,t,n){let i=0;for(let r=e,a=t-n;r<t;r+=n)i+=(s[a]-s[r])*(s[r+1]+s[a+1]),a=r;return i}class U6{static triangulate(e,t,n=2){return m6(e,t,n)}}class Wl{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return Wl.area(e)<0}
vendor: 43,224 bytes, line 117
117static triangulateShape(e,t){const n=[],i=[],r=[];mU(e),gU(n,e);let a=e.length;t.forEach(mU);for(let u=0;u<t.length;u++)i.push(a),a+=t[u].length,gU(n,t[u]);const l=U6.triangulate(n,i);for(let u=0;u<l.length;u+=3)r.push(l.slice(u,u+3));return r}}function mU(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function gU(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class sE extends bn{constructor(e=new Mp([new Ge(.5,.5),new Ge(-.5,.5),new Ge(-.5,-.5),new Ge(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let l=0,u=e.length;l<u;l++){const h=e[l];a(h)}this.setAttribute("position",new It(i,3)),this.setAttribute("uv",new It(r,2)),this.computeVertexNormals();function a(l){const u=[],h=t.curveSegments!==void 0?t.curveSegments:12,p=t.steps!==void 0?t.steps:1,g=t.depth!==void 0?t.depth:1;let y=t.bevelEnabled!==void 0?t.bevelEnabled:!0,_=t.bevelThickness!==void 0?t.bevelThickness:.2,S=t.bevelSize!==void 0?t.bevelSize:_-.1,A=t.bevelOffset!==void 0?t.bevelOffset:0,E=t.bevelSegments!==void 0?t.bevelSegments:3;const b=t.extrudePath,C=t.UVGenerator!==void 0?t.UVGenerator:L6;let w,D=!1,P,I,F,z;b&&(w=b.getSpacedPoints(p),D=!0,y=!1,P=b.computeFrenetFrames(p,!1),I=new Y,F=new Y,z=new Y),y||(E=0,_=0,S=0,A=0);const B=l.extractPoints(h);let O=B.shape;const W=B.holes;if(!Wl.isClockWise(O)){O=O.reverse();for(let $e=0,Ye=W.length;$e<Ye;$e++){const qe=W[$e];Wl.isClockWise(qe)&&(W[$e]=qe.reverse())}}function se($e){const qe=10000000000000001e-36;let Be=$e[0];for(let ft=1;ft<=$e.length;ft++){const Je=ft%$e.length,nt=$e[Je],qt=nt.x-Be.x,tn=nt.y-Be.y,Z=qt*qt+tn*tn,G=Math.max(Math.abs(nt.x),Math.abs(nt.y),Math.abs(Be.x),Math.abs(Be.y)),ge=qe*G*G;if(Z<=ge){$e.splice(Je,1),ft--;continue}Be=nt}}se(O),W.forEach(se);const fe=W.length,pe=O;for(let $e=0;$e<fe;$e++){const Ye=W[$e];O=O.concat(Ye)}function k($e,Ye,qe){return Ye||console.error("THREE.ExtrudeGeometry: vec does not exist"),$e.clone().addScaledVector(Ye,qe)}const Q=O.length;function J($e,Ye,qe){let Be,ft,Je;const nt=$e.x-Ye.x,qt=$e.y-Ye.y,tn=qe.x-$e.x,Z=qe.y-$e.y,G=nt*nt+qt*qt,ge=nt*Z-qt*tn;if(Math.abs(ge)>Number.EPSILON){const De=Math.sqrt(G),We=Math.sqrt(tn*tn+Z*Z),Ue=Ye.x-qt/De,St=Ye.y+nt/De,ht=qe.x-Z/We,Dt=qe.y+tn/We,Ut=((ht-Ue)*Z-(Dt-St)*tn)/(nt*Z-qt*tn);Be=Ue+nt*Ut-$e.x,ft=St+qt*Ut-$e.y;const et=Be*Be+ft*ft;if(et<=2)return new Ge(Be,ft);Je=Math.sqrt(et/2)}else{let De=!1;nt>Number.EPSILON?tn>Number.EPSILON&&(De=!0):nt<-Number.EPSILON?tn<-Number.EPSILON&&(De=!0):Math.sign(qt)===Math.sign(Z)&&(De=!0),De?(Be=-qt,ft=nt,Je=Math.sqrt(G)):(Be=nt,ft=qt,Je=Math.sqrt(G/2))}return new Ge(Be/Je,ft/Je)}const Se=[];for(let $e=0,Ye=pe.length,qe=Ye-1,Be=$e+1;$e<Ye;$e++,qe++,Be++)qe===Ye&&(qe=0),Be===Ye&&(Be=0),Se[$e]=J(pe[$e],pe[qe],pe[Be]);const K=[];let oe,we=Se.concat();for(let $e=0,Ye=fe;$e<Ye;$e++){const qe=W[$e];oe=[];for(let Be=0,ft=qe.length,Je=ft-1,nt=Be+1;Be<ft;Be++,Je++,nt++)Je===ft&&(Je=0),nt===ft&&(nt=0),oe[Be]=J(qe[Be],qe[Je],qe[nt]);K.push(oe),we=we.concat(oe)}let Ie;if(E===0)Ie=Wl.triangulateShape(pe,W);else{const $e=[],Ye=[];for(let qe=0;qe<E;qe++){const Be=qe/E,ft=_*Math.cos(Be*Math.PI/2),Je=S*Math.sin(Be*Math.PI/2)+A;for(let nt=0,qt=pe.length;nt<qt;nt++){const tn=k(pe[nt],Se[nt],Je);Mt(tn.x,tn.y,-ft),Be===0&&$e.push(tn)}for(let nt=0,qt=fe;nt<qt;nt++){const tn=W[nt];oe=K[nt];const Z=[];for(let G=0,ge=tn.length;G<ge;G++){const De=k(tn[G],oe[G],Je);Mt(De.x,De.y,-ft),Be===0&&Z.push(De)}Be===0&&Ye.push(Z)}}Ie=Wl.triangulateShape($e,Ye)}const Ze=Ie.length,mt=S+A;for(let $e=0;$e<Q;$e++){const Ye=y?k(O[$e],we[$e],mt):O[$e];D?(F.copy(P.normals[0]).multiplyScalar(Ye.x),I.copy(P.binormals[0]).multiplyScalar(Ye.y),z.copy(w[0]).add(F).add(I),Mt(z.x,z.y,z.z)):Mt(Ye.x,Ye.y,0)}for(let $e=1;$e<=p;$e++)for(let Ye=0;Ye<Q;Ye++){const qe=y?k(O[Ye],we[Ye],mt):O[Ye];D?(F.copy(P.normals[$e]).multiplyScalar(qe.x),I.copy(P.binormals[$e]).multiplyScalar(qe.y),z.copy(w[$e]).add(F).add(I),Mt(z.x,z.y,z.z)):Mt(qe.x,qe.y,g/p*$e)}for(let $e=E-1;$e>=0;$e--){const Ye=$e/E,qe=_*Math.cos(Ye*Math.PI/2),Be=S*Math.sin(Ye*Math.PI/2)+A;for(let ft=0,Je=pe.length;ft<Je;ft++){const nt=k(pe[ft],Se[ft],Be);Mt(nt.x,nt.y,g+qe)}for(let ft=0,Je=W.length;ft<Je;ft++){const nt=W[ft];oe=K[ft];for(let qt=0,tn=nt.length;qt<tn;qt++){const Z=k(nt[qt],oe[qt],Be);D?Mt(Z.x,Z.y+w[p-1].y,w[p-1].x+qe):Mt(Z.x,Z.y,g+qe)}}}xe(),Ve();function xe(){const $e=i.length/3;if(y){let Ye=0,qe=Q*Ye;for(let Be=0;Be<Ze;Be++){const ft=Ie[Be];Ct(ft[2]+qe,ft[1]+qe,ft[0]+qe)}Ye=p+E*2,qe=Q*Ye;for(let Be=0;Be<Ze;Be++){const ft=Ie[Be];Ct(ft[0]+qe,ft[1]+qe,ft[2]+qe)}}else{for(let Ye=0;Ye<Ze;Ye++){const qe=Ie[Ye];Ct(qe[2],qe[1],qe[0])}for(let Ye=0;Ye<Ze;Ye++){const qe=Ie[Ye];Ct(qe[0]+Q*p,qe[1]+Q*p,qe[2]+Q*p)}}n.addGroup($e,i.length/3-$e,0)}function Ve(){const $e=i.length/3;let Ye=0;tt(pe,Ye),Ye+=pe.length;for(let qe=0,Be=W.length;qe<Be;qe++){const ft=W[qe];tt(ft,Ye),Ye+=ft.length}n.addGroup($e,i.length/3-$e,1)}function tt($e,Ye){let qe=$e.length;for(;--qe>=0;){const Be=qe;let ft=qe-1;ft<0&&(ft=$e.length-1);for(let Je=0,nt=p+E*2;Je<nt;Je++){const qt=Q*Je,tn=Q*(Je+1),Z=Ye+Be+qt,G=Ye+ft+qt,ge=Ye+ft+tn,De=Ye+Be+tn;rn(Z,G,ge,De)}}}function Mt($e,Ye,qe){u.push($e),u.push(Ye),u.push(qe)}function Ct($e,Ye,qe){vn($e),vn(Ye),vn(qe);const Be=i.length/3,ft=C.generateTopUV(n,i,Be-3,Be-2,Be-1);te(ft[0]),te(ft[1]),te(ft[2])}function rn($e,Ye,qe,Be){vn($e),vn(Ye),vn(Be),vn(Ye),vn(qe),vn(Be);const ft=i.length/3,Je=C.generateSideWallUV(n,i,ft-6,ft-3,ft-2,ft-1);te(Je[0]),te(Je[1]),te(Je[3]),te(Je[1]),te(Je[2]),te(Je[3])}function vn($e){i.push(u[$e*3+0]),i.push(u[$e*3+1]),i.push(u[$e*3+2])}function te($e){r.push($e.x),r.push($e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return B6(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,a=e.shapes.length;r<a;r++){const l=t[e.shapes[r]];n.push(l)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new QT[i.type]().fromJSON(i)),new sE(n,e.options)}}const L6={generateTopUV:function(s,e,t,n,i){const r=e[t*3],a=e[t*3+1],l=e[n*3],u=e[n*3+1],h=e[i*3],p=e[i*3+1];return[new Ge(r,a),new Ge(l,u),new Ge(h,p)]},generateSideWallUV:function(s,e,t,n,i,r){const a=e[t*3],l=e[t*3+1],u=e[t*3+2],h=e[n*3],p=e[n*3+1],g=e[n*3+2],y=e[i*3],_=e[i*3+1],S=e[i*3+2],A=e[r*3],E=e[r*3+1],b=e[r*3+2];return Math.abs(l-p)<Math.abs(a-h)?[new Ge(a,1-u),new Ge(h,1-g),new Ge(y,1-S),new Ge(A,1-b)]:[new Ge(l,1-u),new Ge(p,1-g),new Ge(_,1-S),new Ge(E,1-b)]}};function B6(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class rE extends Fd{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rE(e.radius,e.detail)}}class aE extends bn{constructor(e=[new Ge(0,-.5),new Ge(.5,0),new Ge(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=dn(i,0,Math.PI*2);const r=[],a=[],l=[],u=[],h=[],p=1/t,g=new Y,y=new Ge,_=new Y,S=new Y,A=new Y;let E=0,b=0;for(let C=0;C<=e.length-1;C++)switch(C){case 0:E=e[C+1].x-e[C].x,b=e[C+1].y-e[C].y,_.x=b*1,_.y=-E,_.z=b*0,A.copy(_),_.normalize(),u.push(_.x,_.y,_.z);break;case e.length-1:u.push(A.x,A.y,A.z);break;default:E=e[C+1].x-e[C].x,b=e[C+1].y-e[C].y,_.x=b*1,_.y=-E,_.z=b*0,S.copy(_),_.x+=A.x,_.y+=A.y,_.z+=A.z,_.normalize(),u.push(_.x,_.y,_.z),A.copy(S)}for(let C=0;C<=t;C++){const w=n+C*p*i,D=Math.sin(w),P=Math.cos(w);for(let I=0;I<=e.length-1;I++){g.x=e[I].x*D,g.y=e[I].y,g.z=e[I].x*P,a.push(g.x,g.y,g.z),y.x=C/t,y.y=I/(e.length-1),l.push(y.x,y.y);const F=u[3*I+0]*D,z=u[3*I+1],B=u[3*I+0]*P;h.push(F,z,B)}}for(let C=0;C<t;C++)for(let w=0;w<e.length-1;w++){const D=w+C*e.length,P=D,I=D+e.length,F=D+e.length+1,z=D+1;r.push(P,I,z),r.push(F,z,I)}this.setIndex(r),this.setAttribute("position",new It(a,3)),this.setAttribute("uv",new It(l,2)),this.setAttribute("normal",new It(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new aE(e.points,e.segments,e.phiStart,e.phiLength)}}class ox extends Fd{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ox(e.radius,e.detail)}}class fm extends bn{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,l=Math.floor(n),u=Math.floor(i),h=l+1,p=u+1,g=e/l,y=t/u,_=[],S=[],A=[],E=[];for(let b=0;b<p;b++){const C=b*y-a;for(let w=0;w<h;w++){const D=w*g-r;S.push(D,-C,0),A.push(0,0,1),E.push(w/l),E.push(1-b/u)}}for(let b=0;b<u;b++)for(let C=0;C<l;C++){const w=C+h*b,D=C+h*(b+1),P=C+1+h*(b+1),I=C+1+h*b;_.push(w,D,I),_.push(D,P,I)}this.setIndex(_),this.setAttribute("position",new It(S,3)),this.setAttribute("normal",new It(A,3)),this.setAttribute("uv",new It(E,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fm(e.width,e.height,e.widthSegments,e.heightSegments)}}class oE extends bn{constructor(e=.5,t=1,n=32,i=1,r=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const l=[],u=[],h=[],p=[];let g=e;const y=(t-e)/i,_=new Y,S=new Ge;for(let A=0;A<=i;A++){for(let E=0;E<=n;E++){const b=r+E/n*a;_.x=g*Math.cos(b),_.y=g*Math.sin(b),u.push(_.x,_.y,_.z),h.push(0,0,1),S.x=(_.x/t+1)/2,S.y=(_.y/t+1)/2,p.push(S.x,S.y)}g+=y}for(let A=0;A<i;A++){const E=A*(n+1);for(let b=0;b<n;b++){const C=b+E,w=C,D=C+n+1,P=C+n+2,I=C+1;l.push(w,D,I),l.push(D,P,I)}}this.setIndex(l),this.setAttribute("position",new It(u,3)),this.setAttribute("normal",new It(h,3)),this.setAttribute("uv",new It(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oE(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class lE extends bn{constructor(e=new Mp([new Ge(0,.5),new Ge(-.5,-.5),new Ge(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],a=[];let l=0,u=0;if(Array.isArray(e)===!1)h(e);else for(let p=0;p<e.length;p++)h(e[p]),this.addGroup(l,u,p),l+=u,u=0;this.setIndex(n),this.setAttribute("position",new It(i,3)),this.setAttribute("normal",new It(r,3)),this.setAttribute("uv",new It(a,2));function h(p){const g=i.length/3,y=p.extractPoints(t);let _=y.shape;const S=y.holes;Wl.isClockWise(_)===!1&&(_=_.reverse());for(let E=0,b=S.length;E<b;E++){const C=S[E];Wl.isClockWise(C)===!0&&(S[E]=C.reverse())}const A=Wl.triangulateShape(_,S);for(let E=0,b=S.length;E<b;E++){const C=S[E];_=_.concat(C)}for(let E=0,b=_.length;E<b;E++){const C=_[E];i.push(C.x,C.y,0),r.push(0,0,1),a.push(C.x,C.y)}for(let E=0,b=A.length;E<b;E++){const C=A[E],w=C[0]+g,D=C[1]+g,P=C[2]+g;n.push(w,D,P),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return P6(t,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const a=t[e.shapes[i]];n.push(a)}return new lE(n,e.curveSegments)}}function P6(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class tv extends bn{constructor(e=1,t=32,n=16,i=0,r=Math.PI*2,a=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:l},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(a+l,Math.PI);let h=0;const p=[],g=new Y,y=new Y,_=[],S=[],A=[],E=[];for(let b=0;b<=n;b++){const C=[],w=b/n;let D=0;b===0&&a===0?D=.5/t:b===n&&u===Math.PI&&(D=-.5/t);for(let P=0;P<=t;P++){const I=P/t;g.x=-e*Math.cos(i+I*r)*Math.sin(a+w*l),g.y=e*Math.cos(a+w*l),g.z=e*Math.sin(i+I*r)*Math.sin(a+w*l),S.push(g.x,g.y,g.z),y.copy(g).normalize(),A.push(y.x,y.y,y.z),E.push(I+D,1-w),C.push(h++)}p.push(C)}for(let b=0;b<n;b++)for(let C=0;C<t;C++){const w=p[b][C+1],D=p[b][C],P=p[b+1][C],I=p[b+1][C+1];(b!==0||a>0)&&_.push(w,D,I),(b!==n-1||u<Math.PI)&&_.push(D,P,I)}this.setIndex(_),this.setAttribute("position",new It(S,3)),this.setAttribute("normal",new It(A,3)),this.setAttribute("uv",new It(E,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tv(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class uE extends Fd{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new uE(e.radius,e.detail)}}class cE extends bn{constructor(e=1,t=.4,n=12,i=48,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const a=[],l=[],u=[],h=[],p=new Y,g=new Y,y=new Y;for(let _=0;_<=n;_++)for(let S=0;S<=i;S++){const A=S/i*r,E=_/n*Math.PI*2;g.x=(e+t*Math.cos(E))*Math.cos(A),g.y=(e+t*Math.cos(E))*Math.sin(A),g.z=t*Math.sin(E),l.push(g.x,g.y,g.z),p.x=e*Math.cos(A),p.y=e*Math.sin(A),y.subVectors(g,p).normalize(),u.push(y.x,y.y,y.z),h.push(S/i),h.push(_/n)}for(let _=1;_<=n;_++)for(let S=1;S<=i;S++){const A=(i+1)*_+S-1,E=(i+1)*(_-1)+S-1,b=(i+1)*(_-1)+S,C=(i+1)*_+S;a.push(A,E,C),a.push(E,b,C)}this.setIndex(a),this.setAttribute("position",new It(l,3)),this.setAttribute("normal",new It(u,3)),this.setAttribute("uv",new It(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cE(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class hE extends bn{constructor(e=1,t=.4,n=64,i=8,r=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},n=Math.floor(n),i=Math.floor(i);const l=[],u=[],h=[],p=[],g=new Y,y=new Y,_=new Y,S=new Y,A=new Y,E=new Y,b=new Y;for(let w=0;w<=n;++w){const D=w/n*r*Math.PI*2;C(D,r,a,e,_),C(D+.01,r,a,e,S),E.subVectors(S,_),b.addVectors(S,_),A.crossVectors(E,b),b.crossVectors(A,E),A.normalize(),b.normalize();for(let P=0;P<=i;++P){const I=P/i*Math.PI*2,F=-t*Math.cos(I),z=t*Math.sin(I);g.x=_.x+(F*b.x+z*A.x),g.y=_.y+(F*b.y+z*A.y),g.z=_.z+(F*b.z+z*A.z),u.push(g.x,g.y,g.z),y.subVectors(g,_).normalize(),h.push(y.x,y.y,y.z),p.push(w/n),p.push(P/i)}}for(let w=1;w<=n;w++)for(let D=1;D<=i;D++){const P=(i+1)*(w-1)+(D-1),I=(i+1)*w+(D-1),F=(i+1)*w+D,z=(i+1)*(w-1)+D;l.push(P,I,z),l.push(I,F,z)}this.setIndex(l),this.setAttribute("position",new It(u,3)),this.setAttribute("normal",new It(h,3)),this.setAttribute("uv",new It(p,2));function C(w,D,P,I,F){const z=Math.cos(w),B=Math.sin(w),O=P/D*w,W=Math.cos(O);F.x=I*(2+W)*.5*z,F.y=I*(2+W)*B*.5,F.z=I*Math.sin(O)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hE(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class dE extends bn{constructor(e=new oC(new Y(-1,-1,0),new Y(-1,1,0),new Y(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const l=new Y,u=new Y,h=new Ge;let p=new Y;const g=[],y=[],_=[],S=[];A(),this.setIndex(S),this.setAttribute("position",new It(g,3)),this.setAttribute("normal",new It(y,3)),this.setAttribute("uv",new It(_,2));function A(){for(let w=0;w<t;w++)E(w);E(r===!1?t:0),C(),b()}function E(w){p=e.getPointAt(w/t,p);const D=a.normals[w],P=a.binormals[w];for(let I=0;I<=i;I++){const F=I/i*Math.PI*2,z=Math.sin(F),B=-Math.cos(F);u.x=B*D.x+z*P.x,u.y=B*D.y+z*P.y,u.z=B*D.z+z*P.z,u.normalize(),y.push(u.x,u.y,u.z),l.x=p.x+n*u.x,l.y=p.y+n*u.y,l.z=p.z+n*u.z,g.push(l.x,l.y,l.z)}}function b(){for(let w=1;w<=t;w++)for(let D=1;D<=i;D++){const P=(i+1)*(w-1)+(D-1),I=(i+1)*w+(D-1),F=(i+1)*w+D,z=(i+1)*(w-1)+D;S.push(P,I,z),S.push(I,F,z)}}function C(){for(let w=0;w<=t;w++)for(let D=0;D<=i;D++)h.x=w/t,h.y=D/i,_.push(h.x,h.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new dE(new QT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class i3 extends bn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new Y,r=new Y;if(e.index!==null){const a=e.attributes.position,l=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:l.count,materialIndex:0}]);for(let h=0,p=u.length;h<p;++h){const g=u[h],y=g.start,_=g.count;for(let S=y,A=y+_;S<A;S+=3)for(let E=0;E<3;E++){const b=l.getX(S+E),C=l.getX(S+(E+1)%3);i.fromBufferAttribute(a,b),r.fromBufferAttribute(a,C),yU(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const a=e.attributes.position;for(let l=0,u=a.count/3;l<u;l++)for(let h=0;h<3;h++){const p=3*l+h,g=3*l+(h+1)%3;i.fromBufferAttribute(a,p),r.fromBufferAttribute(a,g),yU(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new It(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function yU(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var vU=Object.freeze({__proto__:null,BoxGeometry:uh,CapsuleGeometry:eE,CircleGeometry:tE,ConeGeometry:ax,CylinderGeometry:ev,DodecahedronGeometry:nE,EdgesGeometry:YP,ExtrudeGeometry:sE,IcosahedronGeometry:rE,LatheGeometry:aE,OctahedronGeometry:ox,PlaneGeometry:fm,PolyhedronGeometry:Fd,RingGeometry:oE,ShapeGeometry:lE,SphereGeometry:tv,TetrahedronGeometry:uE,TorusGeometry:cE,TorusKnotGeometry:hE,TubeGeometry:dE,WireframeGeometry:i3});class uC extends hr{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new lt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class s3 extends Kl{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class fE extends hr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new lt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ma,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,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 cC extends fE{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ge(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new lt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new lt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new lt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=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 dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=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.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,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.dispersion=e.dispersion,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 hC extends hr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new lt(16777215),this.specular=new lt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ma,this.combine=Zy,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.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class dC extends hr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new lt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Ge(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 fC extends hr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Ge(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 pC extends hr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new lt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ma,this.combine=Zy,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.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class mC extends hr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=vP,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class gC extends hr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class yC extends hr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new lt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Ge(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 vC extends jr{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 mp(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function r3(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function a3(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function HR(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){const l=t[r]*e;for(let u=0;u!==e;++u)i[a++]=s[l+u]}return i}function _C(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(e.push(r.time),t.push(...a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(e.push(r.time),a.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=s[i++];while(r!==void 0)}function O6(s,e,t,n,i=30){const r=s.clone();r.name=e;const a=[];for(let u=0;u<r.tracks.length;++u){const h=r.tracks[u],p=h.getValueSize(),g=[],y=[];for(let _=0;_<h.times.length;++_){const S=h.times[_]*i;if(!(S<t||S>=n)){g.push(h.times[_]);for(let A=0;A<p;++A)y.push(h.values[_*p+A])}}g.length!==0&&(h.times=mp(g,h.times.constructor),h.values=mp(y,h.values.constructor),a.push(h))}r.tracks=a;let l=1/0;for(let u=0;u<r.tracks.length;++u)l>r.tracks[u].times[0]&&(l=r.tracks[u].times[0]);for(let u=0;u<r.tracks.length;++u)r.tracks[u].shift(-1*l);return r.resetDuration(),r}function I6(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,r=e/n;for(let a=0;a<i;++a){const l=t.tracks[a],u=l.ValueTypeName;if(u==="bool"||u==="string")continue;const h=s.tracks.find(function(b){return b.name===l.name&&b.ValueTypeName===u});if(h===void 0)continue;let p=0;const g=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=g/3);let y=0;const _=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(y=_/3);const S=l.times.length-1;let A;if(r<=l.times[0]){const b=p,C=g-p;A=l.values.slice(b,C)}else if(r>=l.times[S]){const b=S*g+p,C=b+g-p;A=l.values.slice(b,C)}else{const b=l.createInterpolant(),C=p,w=g-p;b.evaluate(r),A=b.resultBuffer.slice(C,w)}u==="quaternion"&&new ba().fromArray(A).normalize().conjugate().toArray(A);const E=h.times.length;for(let b=0;b<E;++b){const C=b*_+y;if(u==="quaternion")ba.multiplyQuaternionsFlat(h.values,C,A,0,h.values,C);else{const w=_-y*2;for(let D=0;D<w;++D)h.values[C+D]-=A[D]}}}return s.blendMode=YN,s}class F6{static convertArray(e,t){return mp(e,t)}static isTypedArray(e){return r3(e)}static getKeyframeOrder(e){return a3(e)}static sortedArray(e,t,n){return HR(e,t,n)}static flattenJSON(e,t,n,i){_C(e,t,n,i)}static subclip(e,t,n,i,r=30){return O6(e,t,n,i,r)}static makeClipAdditive(e,t=0,n=e,i=30){return I6(e,t,n,i)}}class lx{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let l=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===l)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=r)){const l=t[1];e<l&&(n=2,r=l);for(let u=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0;break n}break e}for(;n<a;){const l=n+a>>>1;e<t[l]?a=l:n=l+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let a=0;a!==i;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class o3 extends lx{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:hp,endingEnd:hp}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,l=i[r],u=i[a];if(l===void 0)switch(this.getSettings_().endingStart){case dp:r=e,l=2*t-n;break;case N0:r=i.length-2,l=t+i[r]-i[r+1];break;default:r=e,l=n}if(u===void 0)switch(this.getSettings_().endingEnd){case dp:a=e,u=2*n-t;break;case N0:a=1,u=n+i[1]-i[0];break;default:a=e-1,u=t}const h=(n-t)*.5,p=this.valueSize;this._weightPrev=h/(t-l),this._weightNext=h/(u-n),this._offsetPrev=r*p,this._offsetNext=a*p}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,l=this.valueSize,u=e*l,h=u-l,p=this._offsetPrev,g=this._offsetNext,y=this._weightPrev,_=this._weightNext,S=(n-t)/(i-t),A=S*S,E=A*S,b=-y*E+2*y*A-y*S,C=(1+y)*E+(-1.5-2*y)*A+(-.5+y)*S+1,w=(-1-_)*E+(1.5+_)*A+.5*S,D=_*E-_*A;for(let P=0;P!==l;++P)r[P]=b*a[p+P]+C*a[h+P]+w*a[u+P]+D*a[g+P];return r}}class xC extends lx{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,l=this.valueSize,u=e*l,h=u-l,p=(n-t)/(i-t),g=1-p;for(let y=0;y!==l;++y)r[y]=a[h+y]*g+a[u+y]*p;return r}}class l3 extends lx{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class cl{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=mp(t,this.TimeBufferType),this.values=mp(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:mp(e.times,Array),values:mp(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new l3(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new xC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new o3(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case R0:t=this.InterpolantFactoryMethodDiscrete;break;case YT:t=this.InterpolantFactoryMethodLinear;break;case AT:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return R0;case this.InterpolantFactoryMethodLinear:return YT;case this.InterpolantFactoryMethodSmooth:return AT}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const l=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*l,a*l)}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 n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let l=0;l!==r;l++){const u=n[l];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,u),e=!1;break}if(a!==null&&a>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,u,a),e=!1;break}a=u}if(i!==void 0&&r3(i))for(let l=0,u=i.length;l!==u;++l){const h=i[l];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===AT,r=e.length-1;let a=1;for(let l=1;l<r;++l){let u=!1;const h=e[l],p=e[l+1];if(h!==p&&(l!==1||h!==e[0]))if(i)u=!0;else{const g=l*n,y=g-n,_=g+n;for(let S=0;S!==n;++S){const A=t[g+S];if(A!==t[y+S]||A!==t[_+S]){u=!0;break}}}if(u){if(l!==a){e[a]=e[l];const g=l*n,y=a*n;for(let _=0;_!==n;++_)t[y+_]=t[g+_]}++a}}if(r>0){e[a]=e[r];for(let l=r*n,u=a*n,h=0;h!==n;++h)t[u+h]=t[l+h];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}cl.prototype.ValueTypeName="";cl.prototype.TimeBufferType=Float32Array;cl.prototype.ValueBufferType=Float32Array;cl.prototype.DefaultInterpolation=YT;class pm extends cl{constructor(e,t,n){super(e,t,n)}}pm.prototype.ValueTypeName="bool";pm.prototype.ValueBufferType=Array;pm.prototype.DefaultInterpolation=R0;pm.prototype.InterpolantFactoryMethodLinear=void 0;pm.prototype.InterpolantFactoryMethodSmooth=void 0;class SC extends cl{constructor(e,t,n,i){super(e,t,n,i)}}SC.prototype.ValueTypeName="color";class L0 extends cl{constructor(e,t,n,i){super(e,t,n,i)}}L0.prototype.ValueTypeName="number";class u3 extends lx{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,l=this.valueSize,u=(n-t)/(i-t);let h=e*l;for(let p=h+l;h!==p;h+=4)ba.slerpFlat(r,0,a,h-l,a,h,u);return r}}class ux extends cl{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new u3(this.times,this.values,this.getValueSize(),e)}}ux.prototype.ValueTypeName="quaternion";ux.prototype.InterpolantFactoryMethodSmooth=void 0;class mm extends cl{constructor(e,t,n){super(e,t,n)}}mm.prototype.ValueTypeName="string";mm.prototype.ValueBufferType=Array;mm.prototype.DefaultInterpolation=R0;mm.prototype.InterpolantFactoryMethodLinear=void 0;mm.prototype.InterpolantFactoryMethodSmooth=void 0;class B0 extends cl{constructor(e,t,n,i){super(e,t,n,i)}}B0.prototype.ValueTypeName="vector";class P0{constructor(e="",t=-1,n=[],i=OM){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Mo(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,l=n.length;a!==l;++a)t.push(z6(n[a]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,a=n.length;r!==a;++r)t.push(cl.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let l=0;l<r;l++){let u=[],h=[];u.push((l+r-1)%r,l,(l+1)%r),h.push(0,1,0);const p=a3(u);
vendor: 4,746 bytes, line 117
117u=HR(u,1,p),h=HR(h,1,p),!i&&u[0]===0&&(u.push(r),h.push(h[0])),a.push(new L0(".morphTargetInfluences["+t[l].name+"]",u,h).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let l=0,u=e.length;l<u;l++){const h=e[l],p=h.name.match(r);if(p&&p.length>1){const g=p[1];let y=i[g];y||(i[g]=y=[]),y.push(h)}}const a=[];for(const l in i)a.push(this.CreateFromMorphTargetSequence(l,i[l],t,n));return a}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(g,y,_,S,A){if(_.length!==0){const E=[],b=[];_C(_,E,b,S),E.length!==0&&A.push(new g(y,E,b))}},i=[],r=e.name||"default",a=e.fps||30,l=e.blendMode;let u=e.length||-1;const h=e.hierarchy||[];for(let g=0;g<h.length;g++){const y=h[g].keys;if(!(!y||y.length===0))if(y[0].morphTargets){const _={};let S;for(S=0;S<y.length;S++)if(y[S].morphTargets)for(let A=0;A<y[S].morphTargets.length;A++)_[y[S].morphTargets[A]]=-1;for(const A in _){const E=[],b=[];for(let C=0;C!==y[S].morphTargets.length;++C){const w=y[S];E.push(w.time),b.push(w.morphTarget===A?1:0)}i.push(new L0(".morphTargetInfluence["+A+"]",E,b))}u=_.length*a}else{const _=".bones["+t[g].name+"]";n(B0,_+".position",y,"pos",i),n(ux,_+".quaternion",y,"rot",i),n(B0,_+".scale",y,"scl",i)}}return i.length===0?null:new this(r,u,i,l)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function V6(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return L0;case"vector":case"vector2":case"vector3":case"vector4":return B0;case"color":return SC;case"quaternion":return ux;case"bool":case"boolean":return pm;case"string":return mm}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function z6(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=V6(s.type);if(s.times===void 0){const t=[],n=[];_C(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Xu={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class bC{constructor(e,t,n){const i=this;let r=!1,a=0,l=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.abortController=new AbortController,this.itemStart=function(p){l++,r===!1&&i.onStart!==void 0&&i.onStart(p,a,l),r=!0},this.itemEnd=function(p){a++,i.onProgress!==void 0&&i.onProgress(p,a,l),a===l&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(p){i.onError!==void 0&&i.onError(p)},this.resolveURL=function(p){return u?u(p):p},this.setURLModifier=function(p){return u=p,this},this.addHandler=function(p,g){return h.push(p,g),this},this.removeHandler=function(p){const g=h.indexOf(p);return g!==-1&&h.splice(g,2),this},this.getHandler=function(p){for(let g=0,y=h.length;g<y;g+=2){const _=h[g],S=h[g+1];if(_.global&&(_.lastIndex=0),_.test(p))return S}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const c3=new bC;class so{constructor(e){this.manager=e!==void 0?e:c3,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}so.DEFAULT_MATERIAL_NAME="__DEFAULT";const Fc={};
vendor: 3,965 bytes, line 117
117class G6 extends Error{constructor(e,t){super(e),this.response=t}}class rh extends so{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Xu.get(`file:${e}`);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(Fc[e]!==void 0){Fc[e].push({onLoad:t,onProgress:n,onError:i});return}Fc[e]=[],Fc[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),l=this.mimeType,u=this.responseType;fetch(a).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const p=Fc[e],g=h.body.getReader(),y=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),_=y?parseInt(y):0,S=_!==0;let A=0;const E=new ReadableStream({start(b){C();function C(){g.read().then(({done:w,value:D})=>{if(w)b.close();else{A+=D.byteLength;const P=new ProgressEvent("progress",{lengthComputable:S,loaded:A,total:_});for(let I=0,F=p.length;I<F;I++){const z=p[I];z.onProgress&&z.onProgress(P)}b.enqueue(D),C()}},w=>{b.error(w)})}}});return new Response(E)}else throw new G6(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(u){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(p=>new DOMParser().parseFromString(p,l));case"json":return h.json();default:if(l==="")return h.text();{const g=/charset="?([^;"\s]*)"?/i.exec(l),y=g&&g[1]?g[1].toLowerCase():void 0,_=new TextDecoder(y);return h.arrayBuffer().then(S=>_.decode(S))}}}).then(h=>{Xu.add(`file:${e}`,h);const p=Fc[e];delete Fc[e];for(let g=0,y=p.length;g<y;g++){const _=p[g];_.onLoad&&_.onLoad(h)}}).catch(h=>{const p=Fc[e];if(p===void 0)throw this.manager.itemError(e),h;delete Fc[e];for(let g=0,y=p.length;g<y;g++){const _=p[g];_.onError&&_.onError(h)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class H6 extends so{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new rh(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{t(r.parse(JSON.parse(l)))}catch(u){i?i(u):console.error(u),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=P0.parse(e[n]);t.push(i)}return t}}class k6 extends so{constructor(e){super(e)}load(e,t,n,i){const r=this,a=[],l=new JM,u=new rh(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(r.withCredentials);let h=0;function p(g){u.load(e[g],function(y){const _=r.parse(y,!0);a[g]={width:_.width,height:_.height,format:_.format,mipmaps:_.mipmaps},h+=1,h===6&&(_.mipmapCount===1&&(l.minFilter=hi),l.image=a,l.format=_.format,l.needsUpdate=!0,t&&t(l))},n,i)}if(Array.isArray(e))for(let g=0,y=e.length;g<y;++g)p(g);else u.load(e,function(g){const y=r.parse(g,!0);if(y.isCubemap){const _=y.mipmaps.length/y.mipmapCount;for(let S=0;S<_;S++){a[S]={mipmaps:[]};for(let A=0;A<y.mipmapCount;A++)a[S].mipmaps.push(y.mipmaps[S*y.mipmapCount+A]),a[S].format=y.format,a[S].width=y.width,a[S].height=y.height}l.image=a}else l.image.width=y.width,l.image.height=y.height,l.mipmaps=y.mipmaps;y.mipmapCount===1&&(l.minFilter=hi),l.format=y.format,l.needsUpdate=!0,t&&t(l)},n,i);return l}}
117const Vg=new WeakMap;class O0 extends so{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Xu.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);else{let g=Vg.get(a);g===void 0&&(g=[],Vg.set(a,g)),g.push({onLoad:t,onError:i})}return a}const l=C0("img");function u(){p(),t&&t(this);const g=Vg.get(this)||[];for(let y=0;y<g.length;y++){const _=g[y];_.onLoad&&_.onLoad(this)}Vg.delete(this),r.manager.itemEnd(e)}function h(g){p(),i&&i(g),Xu.remove(`image:${e}`);const y=Vg.get(this)||[];for(let _=0;_<y.length;_++){const S=y[_];S.onError&&S.onError(g)}Vg.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function p(){l.removeEventListener("load",u,!1),l.removeEventListener("error",h,!1)}return l.addEventListener("load",u,!1),l.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),Xu.add(`image:${e}`,l),r.manager.itemStart(e),l.src=e,l}}class q6 extends so{constructor(e){super(e)}load(e,t,n,i){const r=new Id;r.colorSpace=lr;const a=new O0(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let l=0;function u(h){a.load(e[h],function(p){r.images[h]=p,l++,l===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let h=0;h<e.length;++h)u(h);return r}}class W6 extends so{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new Xl,l=new rh(this.manager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(r.withCredentials),l.load(e,function(u){let h;try{h=r.parse(u)}catch(p){if(i!==void 0)i(p);else{console.error(p);return}}h.image!==void 0?a.image=h.image:h.data!==void 0&&(a.image.width=h.width,a.image.height=h.height,a.image.data=h.data),a.wrapS=h.wrapS!==void 0?h.wrapS:Sa,a.wrapT=h.wrapT!==void 0?h.wrapT:Sa,a.magFilter=h.magFilter!==void 0?h.magFilter:hi,a.minFilter=h.minFilter!==void 0?h.minFilter:hi,a.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(a.colorSpace
vendor: 5,761 bytes, line 117
117=h.colorSpace),h.flipY!==void 0&&(a.flipY=h.flipY),h.format!==void 0&&(a.format=h.format),h.type!==void 0&&(a.type=h.type),h.mipmaps!==void 0&&(a.mipmaps=h.mipmaps,a.minFilter=Mr),h.mipmapCount===1&&(a.minFilter=hi),h.generateMipmaps!==void 0&&(a.generateMipmaps=h.generateMipmaps),a.needsUpdate=!0,t&&t(a,h)},n,i),a}}class X6 extends so{constructor(e){super(e)}load(e,t,n,i){const r=new qi,a=new O0(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(l){r.image=l,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class Vd extends jn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new lt(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class TC extends Vd{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(jn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new lt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const N1=new Ot,_U=new Y,xU=new Y;class MC{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ge(512,512),this.mapType=ki,this.map=null,this.mapPass=null,this.matrix=new Ot,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new dm,this._frameExtents=new Ge(1,1),this._viewportCount=1,this._viewports=[new kt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;_U.setFromMatrixPosition(e.matrixWorld),t.position.copy(_U),xU.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(xU),t.updateMatrixWorld(),N1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(N1,t.coordinateSystem,t.reversedDepth),t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(N1)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Y6 extends MC{constructor(){super(new ps(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=im*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class cx extends Vd{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(jn.DEFAULT_UP),this.updateMatrix(),this.target=new jn,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new Y6}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const SU=new Ot,z_=new Y,C1=new Y;class j6 extends MC{constructor(){super(new ps(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ge(4,2),this._viewportCount=6,this._viewports=[new kt(2,1,1,1),new kt(0,1,1,1),new kt(3,1,1,1),new kt(1,1,1,1),new kt(3,0,1,1),new kt(1,0,1,1)],this._cubeDirections=[new Y(1,0,0),new Y(-1,0,0),new Y(0,0,1),new Y(0,0,-1),new Y(0,1,0),new Y(0,-1,0)],this._cubeUps=[new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,0,1),new Y(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),z_.setFromMatrixPosition(e.matrixWorld),n.position.copy(z_),C1.copy(n.position),C1.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(C1),n.updateMatrixWorld(),i.makeTranslation(-z_.x,-z_.y,-z_.z),SU.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(SU,n.coordinateSystem,n.reversedDepth)}}class EC extends Vd{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new j6}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}let gm=class extends ix{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
117phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,l=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=h*this.view.offsetX,a=r+h*this.view.width,l-=p*this.view.offsetY,u=l-p*this.view.height}this.projectionMatrix.makeOrthographic(r,a,l,u,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};class K6 extends MC{constructor(){super(new gm(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class AC extends Vd{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(jn.DEFAULT_UP),this.updateMatrix(),this.target=new jn,this.shadow=new K6}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class RC extends Vd{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class NC extends Vd{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class h3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Y)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*r)),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],1.092548*(n*r)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*r),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],2*.429043*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class CC extends Vd{constructor(e=new h3,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class pE extends so{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,a=new rh(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(l){try{t(r.parse(JSON.parse(l)))}catch(u){i?i(u):console.error(u),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(r){return t[r]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",r),t[r]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new lt().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe
vendor: 16,607 bytes, line 117
117!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const a=e.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=new lt().setHex(a.value);break;case"v2":i.uniforms[r].value=new Ge().fromArray(a.value);break;case"v3":i.uniforms[r].value=new Y().fromArray(a.value);break;case"v4":i.uniforms[r].value=new kt().fromArray(a.value);break;case"m3":i.uniforms[r].value=new pn().fromArray(a.value);break;case"m4":i.uniforms[r].value=new Ot().fromArray(a.value);break;default:i.uniforms[r].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new Ge().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Ge().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return pE.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:uC,SpriteMaterial:ZM,RawShaderMaterial:s3,ShaderMaterial:Kl,PointsMaterial:$M,MeshPhysicalMaterial:cC,MeshStandardMaterial:fE,MeshPhongMaterial:hC,MeshToonMaterial:dC,MeshNormalMaterial:fC,MeshLambertMaterial:pC,MeshDepthMaterial:mC,MeshDistanceMaterial:gC,MeshBasicMaterial:xa,MeshMatcapMaterial:yC,LineDashedMaterial:vC,LineBasicMaterial:jr,Material:hr};return new t[e]}}class kR{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class d3 extends bn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class f3 extends so{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new rh(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(l){try{t(r.parse(JSON.parse(l)))}catch(u){i?i(u):console.error(u),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(_,S){if(t[S]!==void 0)return t[S];const E=_.interleavedBuffers[S],b=r(_,E.buffer),C=ry(E.type,b),w=new sx(C,E.stride);return w.uuid=E.uuid,t[S]=w,w}function r(_,S){if(n[S]!==void 0)return n[S];const E=_.arrayBuffers[S],b=new Uint32Array(E).buffer;return n[S]=b,b}const a=e.isInstancedBufferGeometry?new d3:new bn,l=e.data.index;if(l!==void 0){const _=ry(l.type,l.array);a.setIndex(new ti(_,1))}const u=e.data.attributes;for(const _ in u){const S=u[_];let A;if(S.isInterleavedBufferAttribute){const E=i(e.data,S.data);A=new Dd(E,S.itemSize,S.offset,S.normalized)}else{const E=ry(S.type,S.array),b=S.isInstancedBufferAttribute?nl:ti;A=new b(E,S.itemSize,S.normalized)}S.name!==void 0&&(A.name=S.name),S.usage!==void 0&&A.setUsage(S.usage),a.setAttribute(_,A)}const h=e.data.morphAttributes;if(h)for(const _ in h){const S=h[_],A=[];for(let E=0,b=S.length;E<b;E++){const C=S[E];let w;if(C.isInterleavedBufferAttribute){const D=i(e.data,C.data);w=new Dd(D,C.itemSize,C.offset,C.normalized)}else{const D=ry(C.type,C.array);w=new ti(D,C.itemSize,C.normalized)}C.name!==void 0&&(w.name=C.name),A.push(w)}a.morphAttributes[_]=A}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const g=e.data.groups||e.data.drawcalls||e.data.offsets;if(g!==void 0)for(let _=0,S=g.length;_!==S;++_){const A=g[_];a.addGroup(A.start,A.count,A.materialIndex)}const y=e.data.boundingSphere;return y!==void 0&&(a.boundingSphere=new cr().fromJSON(y)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class Z6 extends so{constructor(e){super(e)}load(e,t,n,i){const r=this,a=this.path===""?kR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const l=new rh(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(u){let h=null;try{h=JSON.parse(u)}catch(g){i!==void 0&&i(g),console.error("THREE:ObjectLoader: Can't parse "+e+".",g.message);return}const p=h.metadata;if(p===void 0||p.type===void 0||p.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}r.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?kR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new rh(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const a=await r.loadAsync(e,t),l=JSON.parse(a),u=l.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(l)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){t!==void 0&&t(h)}),l=this.parseTextures(e.textures,a),u=this.parseMaterials(e.materials,l),h=this.parseObject(e.object,r,u,l,n),p=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,p),this.bindLightTargets(h),t!==void 0){let g=!1;for(const y in a)if(a[y].data instanceof HTMLImageElement){g=!0;break}g===!1&&t(h)}return h}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,r),l=this.parseMaterials(e.materials,a),u=this.parseObject(e.object,i,l,a,t),h=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,h),this.bindLightTargets(u),u}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new Mp().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,a=e.length;r<a;r++){const l=new QM().fromJSON(e[r],i);n[l.uuid]=l}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new f3;for(let r=0,a=e.length;r<a;r++){let l;const u=e[r];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":l=i.parse(u);break;default:u.type in vU?l=vU[u.type].fromJSON(u,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${u.type}"`)}l.uuid=u.uuid,u.name!==void 0&&(l.name=u.name),u.userData!==void 0&&(l.userData=u.userData),n[u.uuid]=l}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const r=new pE;r.setTextures(t);for(let a=0,l=e.length;a<l;a++){const u=e[a];n[u.uuid]===void 0&&(n[u.uuid]=r.parse(u)),i[u.uuid]=n[u.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],r=P0.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function a(u){return n.manager.itemStart(u),r.load(u,function(){n.manager.itemEnd(u)},void 0,function(){n.manager.itemError(u),n.manager.itemEnd(u)})}function l(u){if(typeof u=="string"){const h=u,p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return a(p)}else return u.data?{data:ry(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new bC(t);r=new O0(u),r.setCrossOrigin(this.crossOrigin);for(let h=0,p=e.length;h<p;h++){const g=e[h],y=g.url;if(Array.isArray(y)){const _=[];for(let S=0,A=y.length;S<A;S++){const E=y[S],b=l(E);b!==null&&(b instanceof HTMLImageElement?_.push(b):_.push(new Xl(b.data,b.width,b.height)))}i[g.uuid]=new xd(_)}else{const _=l(g.url);i[g.uuid]=new xd(_)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(a){if(typeof a=="string"){const l=a,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:t.resourcePath+l;return await i.loadAsync(u)}else return a.data?{data:ry(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new O0(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,l=e.length;a<l;a++){const u=e[a],h=u.url;if(Array.isArray(h)){const p=[];for(let g=0,y=h.length;g<y;g++){const _=h[g],S=await r(_);S!==null&&(S instanceof HTMLImageElement?p.push(S):p.push(new Xl(S.data,S.width,S.height)))}n[u.uuid]=new xd(p)}else{const p=await r(u.url);n[u.uuid]=new xd(p)}}}return n}parseTextures(e,t){function n(r,a){return typeof r=="number"?r:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",r),a[r])}const i={};if(e!==void 0)for(let r=0,a=e.length;r<a;r++){const l=e[r];l.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',l.uuid),t[l.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",l.image);const u=t[l.image],h=u.data;let p;Array.isArray(h)?(p=new Id,h.length===6&&(p.needsUpdate=!0)):(h&&h.data?p=new Xl:p=new qi,h&&(p.needsUpdate=!0)),p.source=u,p.uuid=l.uuid,l.name!==void 0&&(p.name=l.name),l.mapping!==void 0&&(p.mapping=n(l.mapping,Q6)),l.channel!==void 0&&(p.channel=l.channel),l.offset!==void 0&&p.offset.fromArray(l.offset),l.repeat!==void 0&&p.repeat.fromArray(l.repeat),l.center!==void 0&&p.center.fromArray(l.center),l.rotation!==void 0&&(p.rotation=l.rotation),l.wrap!==void 0&&(p.wrapS=n(l.wrap[0],bU),p.wrapT=n(l.wrap[1],bU)),l.format!==void 0&&(p.format=l.format),l.internalFormat!==void 0&&(p.internalFormat=l.internalFormat),l.type!==void 0&&(p.type=l.type),l.colorSpace!==void 0&&(p.colorSpace=l.colorSpace),l.minFilter!==void 0&&(p.minFilter=n(l.minFilter,TU)),l.magFilter!==void 0&&(p.magFilter=n(l.magFilter,TU)),l.anisotropy!==void 0&&(p.anisotropy=l.anisotropy),l.flipY!==void 0&&(p.flipY=l.flipY),l.generateMipmaps!==void 0&&(p.generateMipmaps=l.generateMipmaps),l.premultiplyAlpha!==void 0&&(p.premultiplyAlpha=l.premultiplyAlpha),l.unpackAlignment!==void 0&&(p.unpackAlignment=l.unpackAlignment),l.compareFunction!==void 0&&(p.compareFunction=l.compareFunction),l.userData!==void 0&&(p.userData=l.userData),i[l.uuid]=p}return i}parseObject(e,t,n,i,r){let a;function l(y){return t[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",y),t[y]}function u(y){if(y!==void 0){if(Array.isArray(y)){const _=[];for(let S=0,A=y.length;S<A;S++){const E=y[S];n[E]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",E),_.push(n[E])}return _}return n[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",y),n[y]}}function h(y){return i[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",y),i[y]}let p,g;switch(e.type){case"Scene":a=new Jy,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new lt(e.background):a.background=h(e.background)),e.environment!==void 0&&(a.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new KM(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new jM(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new ps(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new gm(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new RC(e.color,e.intensity);break;case"DirectionalLight":a=new AC(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new EC(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new NC(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new cx(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new TC(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new CC().fromJSON(e);break;case"SkinnedMesh":p=l(e.geometry),g=u(e.material),a=new GP(p,g),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":p=l(e.geometry),g=u(e.material),a=new Ri(p,g);break;case"InstancedMesh":p=l(e.geometry),g=u(e.material);const y=e.count,_=e.instanceMatrix,S=e.instanceColor;
vendor: 4,817 bytes, line 117
117a=new HP(p,g,y),a.instanceMatrix=new nl(new Float32Array(_.array),16),S!==void 0&&(a.instanceColor=new nl(new Float32Array(S.array),S.itemSize));break;case"BatchedMesh":p=l(e.geometry),g=u(e.material),a=new kP(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,g),a.geometry=p,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(A=>{let E=null,b=null;return A.boundingBox!==void 0&&(E=new Wr().fromJSON(A.boundingBox)),A.boundingSphere!==void 0&&(b=new cr().fromJSON(A.boundingSphere)),{...A,boundingBox:E,boundingSphere:b}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=h(e.matricesTexture.uuid),a._indirectTexture=h(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=h(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new cr().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new Wr().fromJSON(e.boundingBox));break;case"LOD":a=new zP;break;case"Line":a=new Ud(l(e.geometry),u(e.material));break;case"LineLoop":a=new qP(l(e.geometry),u(e.material));break;case"LineSegments":a=new sc(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new WP(l(e.geometry),u(e.material));break;case"Sprite":a=new VP(u(e.material));break;case"Group":a=new ay;break;case"Bone":a=new eC;break;default:a=new jn}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const y=e.children;for(let _=0;_<y.length;_++)a.add(this.parseObject(y[_],t,n,i,r))}if(e.animations!==void 0){const y=e.animations;for(let _=0;_<y.length;_++){const S=y[_];a.animations.push(r[S])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const y=e.levels;for(let _=0;_<y.length;_++){const S=y[_],A=a.getObjectByProperty("uuid",S.object);A!==void 0&&a.addLevel(A,S.distance,S.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new jn}})}}const Q6={UVMapping:j0,CubeReflectionMapping:Eo,CubeRefractionMapping:sl,EquirectangularReflectionMapping:Cd,EquirectangularRefractionMapping:wd,CubeUVReflectionMapping:nh},bU={RepeatWrapping:ih,ClampToEdgeWrapping:Sa,MirroredRepeatWrapping:sh},TU={NearestFilter:Ai,NearestMipmapNearestFilter:K0,NearestMipmapLinearFilter:ql,LinearFilter:hi,LinearMipmapNearestFilter:Md,LinearMipmapLinearFilter:Mr},w1=new WeakMap;class $6 extends so{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Xu.get(`image-bitmap:${e}`);
vendor: 38,512 bytes, line 117
117if(a!==void 0){if(r.manager.itemStart(e),a.then){a.then(h=>{if(w1.has(a)===!0)i&&i(w1.get(a)),r.manager.itemError(e),r.manager.itemEnd(e);else return t&&t(h),r.manager.itemEnd(e),h});return}return setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a}const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,l.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const u=fetch(e,l).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(h){return Xu.add(`image-bitmap:${e}`,h),t&&t(h),r.manager.itemEnd(e),h}).catch(function(h){i&&i(h),w1.set(u,h),Xu.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});Xu.add(`image-bitmap:${e}`,u),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Hb;class wC{static getContext(){return Hb===void 0&&(Hb=new(window.AudioContext||window.webkitAudioContext)),Hb}static setContext(e){Hb=e}}class J6 extends so{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new rh(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(u){try{const h=u.slice(0);wC.getContext().decodeAudioData(h,function(g){t(g)}).catch(l)}catch(h){l(h)}},n,i);function l(u){i?i(u):console.error(u),r.manager.itemError(e)}}}const MU=new Ot,EU=new Ot,Wf=new Ot;class ek{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ps,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ps,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,Wf.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,a=t.near*Math.tan(Tp*t.fov*.5)/t.zoom;let l,u;EU.elements[12]=-i,MU.elements[12]=i,l=-a*t.aspect+r,u=a*t.aspect+r,Wf.elements[0]=2*t.near/(u-l),Wf.elements[8]=(u+l)/(u-l),this.cameraL.projectionMatrix.copy(Wf),l=-a*t.aspect-r,u=a*t.aspect-r,Wf.elements[0]=2*t.near/(u-l),Wf.elements[8]=(u+l)/(u-l),this.cameraR.projectionMatrix.copy(Wf)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(EU),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(MU)}}class DC extends ps{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class UC{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),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=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}const Xf=new Y,D1=new ba,tk=new Y,Yf=new Y,jf=new Y;class nk extends jn{constructor(){super(),this.type="AudioListener",this.context=wC.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new UC}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;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Xf,D1,tk),Yf.set(0,0,-1).applyQuaternion(D1),jf.set(0,1,0).applyQuaternion(D1),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Xf.x,n),t.positionY.linearRampToValueAtTime(Xf.y,n),t.positionZ.linearRampToValueAtTime(Xf.z,n),t.forwardX.linearRampToValueAtTime(Yf.x,n),t.forwardY.linearRampToValueAtTime(Yf.y,n),t.forwardZ.linearRampToValueAtTime(Yf.z,n),t.upX.linearRampToValueAtTime(jf.x,n),t.upY.linearRampToValueAtTime(jf.y,n),t.upZ.linearRampToValueAtTime(jf.z,n)}else t.setPosition(Xf.x,Xf.y,Xf.z),t.setOrientation(Yf.x,Yf.y,Yf.z,jf.x,jf.y,jf.z)}}class p3 extends jn{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(e=0){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.context.currentTime+e),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;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const Kf=new Y,AU=new ba,ik=new Y,Zf=new Y;class sk extends p3{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Kf,AU,ik),Zf.set(0,0,1).applyQuaternion(AU);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Kf.x,n),t.positionY.linearRampToValueAtTime(Kf.y,n),t.positionZ.linearRampToValueAtTime(Kf.z,n),t.orientationX.linearRampToValueAtTime(Zf.x,n),t.orientationY.linearRampToValueAtTime(Zf.y,n),t.orientationZ.linearRampToValueAtTime(Zf.z,n)}else t.setPosition(Kf.x,Kf.y,Kf.z),t.setOrientation(Zf.x,Zf.y,Zf.z)}}class rk{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class m3{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,a;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let l=0;l!==i;++l)n[r+l]=n[l];a=t}else{a+=t;const l=t/a;this._mixBufferRegion(n,r,0,l,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,l=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let u=t,h=t+t;u!==h;++u)if(n[u]!==n[u+t]){l.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,a=i;r!==a;++r)t[r]=t[i+r%n];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 n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){ba.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const a=this._workIndex*r;ba.multiplyQuaternionsFlat(e,a,e,t,e,n),ba.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){const a=1-i;for(let l=0;l!==r;++l){const u=t+l;e[u]=e[u]*a+e[n+l]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){const l=t+a;e[l]=e[l]+e[n+a]*i}}}const LC="\\[\\]\\.:\\/",ak=new RegExp("["+LC+"]","g"),BC="[^"+LC+"]",ok="[^"+LC.replace("\\.","")+"]",lk=/((?:WC+[\/:])*)/.source.replace("WC",BC),uk=/(WCOD+)?/.source.replace("WCOD",ok),ck=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",BC),hk=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",BC),dk=new RegExp("^"+lk+uk+ck+hk+"$"),fk=["material","materials","bones","map"];class pk{constructor(e,t,n){const i=n||Kn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Kn{constructor(e,t,n){this.path=t,this.parsedPath=n||Kn.parseTrackName(t),this.node=Kn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Kn.Composite(e,t,n):new Kn(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ak,"")}static parseTrackName(e){const t=dk.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);fk.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r){for(let a=0;a<r.length;a++){const l=r[a];if(l.name===t||l.uuid===t)return l;const u=n(l.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=Kn.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let p=0;p<e.length;p++)if(e[p].name===h){h=p;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const a=e[i];if(a===void 0){const h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?l=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}u=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(u=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Kn.Composite=pk;Kn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Kn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Kn.prototype.GetterByBindingType=[Kn.prototype._getValue_direct,Kn.prototype._getValue_array,Kn.prototype._getValue_arrayElement,Kn.prototype._getValue_toArray];Kn.prototype.SetterByBindingTypeAndVersioning=[[Kn.prototype._setValue_direct,Kn.prototype._setValue_direct_setNeedsUpdate,Kn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Kn.prototype._setValue_array,Kn.prototype._setValue_array_setNeedsUpdate,Kn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Kn.prototype._setValue_arrayElement,Kn.prototype._setValue_arrayElement_setNeedsUpdate,Kn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Kn.prototype._setValue_fromArray,Kn.prototype._setValue_fromArray_setNeedsUpdate,Kn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class mk{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Mo(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,a=r.length;let l,u=e.length,h=this.nCachedObjects_;for(let p=0,g=arguments.length;p!==g;++p){const y=arguments[p],_=y.uuid;let S=t[_];if(S===void 0){S=u++,t[_]=S,e.push(y);for(let A=0,E=a;A!==E;++A)r[A].push(new Kn(y,n[A],i[A]))}else if(S<h){l=e[S];const A=--h,E=e[A];t[E.uuid]=S,e[S]=E,t[_]=A,e[A]=y;for(let b=0,C=a;b!==C;++b){const w=r[b],D=w[A];let P=w[S];w[S]=D,P===void 0&&(P=new Kn(y,n[b],i[b])),w[A]=P}}else e[S]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=h}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let a=0,l=arguments.length;a!==l;++a){const u=arguments[a],h=u.uuid,p=t[h];if(p!==void 0&&p>=r){const g=r++,y=e[g];t[y.uuid]=p,e[p]=y,t[h]=g,e[g]=u;for(let _=0,S=i;_!==S;++_){const A=n[_],E=A[g],b=A[p];A[p]=E,A[g]=b}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,a=e.length;for(let l=0,u=arguments.length;l!==u;++l){const h=arguments[l],p=h.uuid,g=t[p];if(g!==void 0)if(delete t[p],g<r){const y=--r,_=e[y],S=--a,A=e[S];t[_.uuid]=g,e[g]=_,t[A.uuid]=y,e[y]=A,e.pop();for(let E=0,b=i;E!==b;++E){const C=n[E],w=C[y],D=C[S];C[g]=w,C[y]=D,C.pop()}}else{const y=--a,_=e[y];y>0&&(t[_.uuid]=g),e[g]=_,e.pop();for(let S=0,A=i;S!==A;++S){const E=n[S];E[g]=E[y],E.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const a=this._paths,l=this._parsedPaths,u=this._objects,h=u.length,p=this.nCachedObjects_,g=new Array(h);i=r.length,n[e]=i,a.push(e),l.push(t),r.push(g);for(let y=p,_=u.length;y!==_;++y){const S=u[y];g[y]=new Kn(S,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,a=this._bindings,l=a.length-1,u=a[l],h=e[l];t[h]=n,a[n]=u,a.pop(),r[n]=r[l],r.pop(),i[n]=i[l],i.pop()}}}class g3{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,a=r.length,l=new Array(a),u={endingStart:hp,endingEnd:hp};for(let h=0;h!==a;++h){const p=r[h].createInterpolant(null);l[h]=p,p.settings=u}this._interpolantSettings=u,this._interpolants=l,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=gP,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,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,r=e._clip.duration,a=r/i,l=i/r;e.warp(1,a,t),this.warp(l,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}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,n){const i=this._mixer,r=i.time,a=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=i._lendControlInterpolant(),this._timeScaleInterpolant=l);const u=l.parameterPositions,h=l.sampleValues;return u[0]=r,u[1]=r+n,h[0]=e/a,h[1]=t/a,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,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const u=(e-r)*n;u<0||n===0?t=0:(this._startTime=null,t=n*u)}t*=this._updateTimeScale(e);const a=this._updateTime(t),l=this._updateWeight(e);if(l>0){const u=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case YN:for(let p=0,g=u.length;p!==g;++p)u[p].evaluate(a),h[p].accumulateAdditive(l);break;case OM:default:for(let p=0,g=u.length;p!==g;++p)u[p].evaluate(a),h[p].accumulate(i,l)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const a=n===yP;if(e===0)return r===-1?i:a&&(r&1)===1?t-i:i;if(n===mP){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,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,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const l=Math.floor(i/t);i-=t*l,r+=Math.abs(l);const u=this.repetitions-r;if(u<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(u===1){const h=e<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=i;if(a&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=dp,i.endingEnd=dp):(e?i.endingStart=this.zeroSlopeAtStart?dp:hp:i.endingStart=N0,t?i.endingEnd=this.zeroSlopeAtEnd?dp:hp:i.endingEnd=N0)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const l=a.parameterPositions,u=a.sampleValues;return l[0]=r,u[0]=t,l[1]=r+e,u[1]=n,this}}const gk=new Float32Array(1);class yk extends Ro{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,l=e._interpolants,u=n.uuid,h=this._bindingsByRootAndName;let p=h[u];p===void 0&&(p={},h[u]=p);for(let g=0;g!==r;++g){const y=i[g],_=y.name;let S=p[_];if(S!==void 0)++S.referenceCount,a[g]=S;else{if(S=a[g],S!==void 0){S._cacheIndex===null&&(++S.referenceCount,this._addInactiveBinding(S,u,_));continue}const A=t&&t._propertyBindings[g].binding.parsedPath;S=new m3(Kn.create(n,_,A),y.ValueTypeName,y.getValueSize()),++S.referenceCount,this._addInactiveBinding(S,u,_),a[g]=S}l[g].resultBuffer=S.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--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<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let a=r[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{const l=a.knownActions;e._byClipCacheIndex=l.length,l.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,a=this._actionsByClip,l=a[r],u=l.knownActions,h=u[u.length-1],p=e._byClipCacheIndex;h._byClipCacheIndex=p,u[p]=h,u.pop(),e._byClipCacheIndex=null;const g=l.actionByRoot,y=(e._localRoot||this._root).uuid;delete g[y],u.length===0&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,l=a[i],u=t[t.length-1],h=e._cacheIndex;u._cacheIndex=h,t[h]=u,t.pop(),delete l[r],Object.keys(l).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new xC(new Float32Array(2),new Float32Array(2),1,gk),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let a=typeof e=="string"?P0.findByName(i,e):e;const l=a!==null?a.uuid:e,u=this._actionsByClip[l];let h=null;if(n===void 0&&(a!==null?n=a.blendMode:n=OM),u!==void 0){const g=u.actionByRoot[r];if(g!==void 0&&g.blendMode===n)return g;h=u.knownActions[0],a===null&&(a=h._clip)}if(a===null)return null;const p=new g3(this,a,t,n);return this._bindAction(p,h),this._addInactiveAction(p,l,r),p}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?P0.findByName(n,e):e,a=r?r.uuid:e,l=this._actionsByClip[a];return l!==void 0&&l.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,r,a);const l=this._bindings,u=this._nActiveBindings;for(let h=0;h!==u;++h)l[h].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const a=r.knownActions;for(let l=0,u=a.length;l!==u;++l){const h=a[l];this._deactivateAction(h);const p=h._cacheIndex,g=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,g._cacheIndex=p,t[p]=g,t.pop(),this._removeInactiveBindingsForAction(h)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const l=n[a].actionByRoot,u=l[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(const a in r){const l=r[a];l.restoreOriginalState(),this._removeInactiveBinding(l)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class vk extends Ql{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new kM(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}let _k=class y3{constructor(e){this.value=e}clone(){return new y3(this.value.clone===void 0?this.value:this.value.clone())}},xk=0,Sk=class extends Ro{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:xk++}),this.name="",this.usage=Py,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const r=Array.isArray(t[n])?t[n]:[t[n]];for(let a=0;a<r.length;a++)this.uniforms.push(r[a].clone())}return this}clone(){return new this.constructor().copy(this)}};class v3 extends sx{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class bk{constructor(e,t,n,i,r,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.normalized=a,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const RU=new Ot;class _3{constructor(e,t,n=0,i=1/0){this.ray=new $y(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Oy,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster:
117Unsupported camera type: "+t.type)}setFromXRController(e){return RU.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(RU),this}intersectObject(e,t=!0,n=[]){return qR(e,this,n,t),n.sort(NU),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)qR(e[i],this,n,t);return n.sort(NU),n}}function NU(s,e){return s.distance-e.distance}function qR(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const r=s.children;for(let a=0,l=r.length;a<l;a++)qR(r[a],e,t,!0)}}class Tk{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Mk.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Mk(){this._document.hidden===!1&&this.reset()}class Ek{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=dn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(dn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Ak{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class hx{constructor(e,t,n,i){hx.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const CU=new Ge;class Rk{constructor(e=new Ge(1/0,1/0),t=new Ge(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=CU.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,CU).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 wU=new Y,kb=new Y,zg=new Y,Gg=new Y,U1=new Y,Nk=new Y,Ck=new Y;class wk{constructor(e=new Y,t=new Y){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){wU.subVectors(e,this.start),kb.subVectors(this.end,this.start);const n=kb.dot(kb);let r=kb.dot(wU)/n;return t&&(r=dn(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
vendor: 5,412 bytes, line 117
117distanceSqToLine3(e,t=Nk,n=Ck){const i=10000000000000001e-32;let r,a;const l=this.start,u=e.start,h=this.end,p=e.end;zg.subVectors(h,l),Gg.subVectors(p,u),U1.subVectors(l,u);const g=zg.dot(zg),y=Gg.dot(Gg),_=Gg.dot(U1);if(g<=i&&y<=i)return t.copy(l),n.copy(u),t.sub(n),t.dot(t);if(g<=i)r=0,a=_/y,a=dn(a,0,1);else{const S=zg.dot(U1);if(y<=i)a=0,r=dn(-S/g,0,1);else{const A=zg.dot(Gg),E=g*y-A*A;E!==0?r=dn((A*_-S*y)/E,0,1):r=0,a=(A*r+_)/y,a<0?(a=0,r=dn(-S/g,0,1)):a>1&&(a=1,r=dn((A-S)/g,0,1))}}return t.copy(l).add(zg.multiplyScalar(r)),n.copy(u).add(Gg.multiplyScalar(a)),t.sub(n),t.dot(t)}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 DU=new Y;class Dk extends jn{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new bn,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,l=1,u=32;a<u;a++,l++){const h=a/u*Math.PI*2,p=l/u*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(p),Math.sin(p),1)}n.setAttribute("position",new It(i,3));const r=new jr({fog:!1,toneMapped:!1});this.cone=new sc(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),DU.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(DU),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const hd=new Y,qb=new Ot,L1=new Ot;class Uk extends sc{constructor(e){const t=x3(e),n=new bn,i=[],r=[];for(let h=0;h<t.length;h++){const p=t[h];p.parent&&p.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(0,0,0),r.push(0,0,0))}n.setAttribute("position",new It(i,3)),n.setAttribute("color",new It(r,3));const a=new jr({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const l=new lt(255),u=new lt(65280);this.setColors(l,u)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");L1.copy(this.root.matrixWorld).invert();for(let r=0,a=0;r<t.length;r++){const l=t[r];l.parent&&l.parent.isBone&&(qb.multiplyMatrices(L1,l.matrixWorld),hd.setFromMatrixPosition(qb),i.setXYZ(a,hd.x,hd.y,hd.z),qb.multiplyMatrices(L1,l.parent.matrixWorld),hd.setFromMatrixPosition(qb),i.setXYZ(a+1,hd.x,hd.y,hd.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let r=0;r<i.count;r+=2)i.setXYZ(r,e.r,e.g,e.b),i.setXYZ(r+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function x3(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push(...x3(s.children[t]));return e}class Lk extends Ri{constructor(e,t,n){const i=new tv(t,4,2),r=new xa({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Bk=new Y,UU=new lt,LU=new lt;class Pk extends jn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new ox(t);i.rotateY(Math.PI*.5),this.material=new xa({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),a=new Float32Array(r.count*3);i.setAttribute("color",new ti(a,3)),this.add(new Ri(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");UU.copy(this.light.color),LU.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?UU:LU;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Bk.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Ok extends sc{constructor(e=10,t=10,n=4473924,i=8947848){n=new lt(n),i=new lt(i);const r=t/2,a=e/t,l=e/2,u=[],h=[];for(let y=0,_=0,S=-l;y<=t;y++,S+=a){u.push(-l,0,S,l,0,S),u.push(S,0,-l,S,0,l);const A=y===r?n:i;A.toArray(h,_),_+=3,A.toArray(h,_),_+=3,A.toArray(h,_),_+=3,A.toArray(h,_),_+=3}const p=new bn;p.setAttribute("position",new It(u,3)),p.setAttribute("color",new It(h,3));const g=new jr({vertexColors:!0,toneMapped:!1});super(p,g),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Ik extends sc{constructor(e=10,t=16,n=8,i=64,r=4473924,a=8947848){r=new lt(r),a=new lt(a);const l=[],u=[];
vendor: 4,236 bytes, line 117
117if(t>1)for(let g=0;g<t;g++){const y=g/t*(Math.PI*2),_=Math.sin(y)*e,S=Math.cos(y)*e;l.push(0,0,0),l.push(_,0,S);const A=g&1?r:a;u.push(A.r,A.g,A.b),u.push(A.r,A.g,A.b)}for(let g=0;g<n;g++){const y=g&1?r:a,_=e-e/n*g;for(let S=0;S<i;S++){let A=S/i*(Math.PI*2),E=Math.sin(A)*_,b=Math.cos(A)*_;l.push(E,0,b),u.push(y.r,y.g,y.b),A=(S+1)/i*(Math.PI*2),E=Math.sin(A)*_,b=Math.cos(A)*_,l.push(E,0,b),u.push(y.r,y.g,y.b)}}const h=new bn;h.setAttribute("position",new It(l,3)),h.setAttribute("color",new It(u,3));const p=new jr({vertexColors:!0,toneMapped:!1});super(h,p),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const BU=new Y,Wb=new Y,PU=new Y;class Fk extends jn{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new bn;i.setAttribute("position",new It([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new jr({fog:!1,toneMapped:!1});this.lightPlane=new Ud(i,r),this.add(this.lightPlane),i=new bn,i.setAttribute("position",new It([0,0,0,0,0,1],3)),this.targetLine=new Ud(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),BU.setFromMatrixPosition(this.light.matrixWorld),Wb.setFromMatrixPosition(this.light.target.matrixWorld),PU.subVectors(Wb,BU),this.lightPlane.lookAt(Wb),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Wb),this.targetLine.scale.z=PU.length()}}const Xb=new Y,ds=new ix;class Vk extends sc{constructor(e){const t=new bn,n=new jr({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],a={};l("n1","n2"),l("n2","n4"),l("n4","n3"),l("n3","n1"),l("f1","f2"),l("f2","f4"),l("f4","f3"),l("f3","f1"),l("n1","f1"),l("n2","f2"),l("n3","f3"),l("n4","f4"),l("p","n1"),l("p","n2"),l("p","n3"),l("p","n4"),l("u1","u2"),l("u2","u3"),l("u3","u1"),l("c","t"),l("p","c"),l("cn1","cn2"),l("cn3","cn4"),l("cf1","cf2"),l("cf3","cf4");function l(S,A){u(S),u(A)}function u(S){i.push(0,0,0),r.push(0,0,0),a[S]===void 0&&(a[S]=[]),a[S].push(i.length/3-1)}t.setAttribute("position",new It(i,3)),t.setAttribute("color",new It(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const h=new lt(16755200),p=new lt(16711680),g=new lt(43775),y=new lt(16777215),_=new lt(3355443);this.setColors(h,p,g,y,_)}setColors(e,t,n,i,r){const l=this.geometry.getAttribute("color");return l.setXYZ(0,e.r,e.g,e.b),l.setXYZ(1,e.r,e.g,e.b),l.setXYZ(2,e.r,e.g,e.b),l.setXYZ(3,e.r,e.g,e.b),l.setXYZ(4,e.r,e.g,e.b),l.setXYZ(5,e.r,e.g,e.b),l.setXYZ(6,e.r,e.g,e.b),l.setXYZ(7,e.r,e.g,e.b),l.setXYZ(8,e.r,e.g,e.b),l.setXYZ(9,e.r,e.g,e.b),l.setXYZ(10,e.r,e.g,e.b),l.setXYZ(11,e.r,e.g,e.b),l.setXYZ(12,e.r,e.g,e.b),l.setXYZ(13,e.r,e.g,e.b),l.setXYZ(14,e.r,e.g,e.b),l.setXYZ(15,e.r,e.g,e.b),l.setXYZ(16,e.r,e.g,e.b),l.setXYZ(17,e.r,e.g,e.b),l.setXYZ(18,e.r,e.g,e.b),l.setXYZ(19,e.r,e.g,e.b),l.setXYZ(20,e.r,e.g,e.b),l.setXYZ(21,e.r,e.g,e.b),l.setXYZ(22,e.r,e.g,e.b),l.setXYZ(23,e.r,e.g,e.b),l.setXYZ(24,t.r,t.g,t.b),l.setXYZ(25,t.r,t.g,t.b),l.setXYZ(26,t.r,t.g,t.b),l.setXYZ(27,t.r,t.g,t.b),l.setXYZ(28,t.r,t.g,t.b),l.setXYZ(29,t.r,t.g,t.b),l.setXYZ(30,t.r,t.g,t.b),l.setXYZ(31,t.r,t.g,t.b),l.setXYZ(32,n.r,n.g,n.b),l.setXYZ(33,n.r,n.g,n.b),l.setXYZ(34,n.r,n.g,n.b),l.setXYZ(35,n.r,n.g,n.b),l.setXYZ(36,n.r,n.g,n.b),l.setXYZ(37,n.r,n.g,n.b),l.setXYZ(38,i.r,i.g,i.b),l.setXYZ(39,i.r,i.g,i.b),l.setXYZ(40,r.r,r.g,r.b),l.setXYZ(41,r.r,r.g,r.b),l.setXYZ(42,r.r,r.g,r.b),l.setXYZ(43,r.r,r.g,r.b),l.setXYZ(44,r.r,r.g,r.b),l.setXYZ(45,r.r,r.g,r.b),l.setXYZ(46,r.r,r.g,r.b),l.setXYZ(47,r.r,r.g,r.b),l.setXYZ(48,r.r,r.g,r.b),l.setXYZ(49,r.r,r.g,r.b),l.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let r,a;
vendor: 10,906 bytes, lines 117-121
117if(ds.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)r=1,a=0;else if(this.camera.coordinateSystem===Er)r=-1,a=1;else if(this.camera.coordinateSystem===rl)r=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Es("c",t,e,ds,0,0,r),Es("t",t,e,ds,0,0,a),Es("n1",t,e,ds,-n,-i,r),Es("n2",t,e,ds,n,-i,r),Es("n3",t,e,ds,-n,i,r),Es("n4",t,e,ds,n,i,r),Es("f1",t,e,ds,-n,-i,a),Es("f2",t,e,ds,n,-i,a),Es("f3",t,e,ds,-n,i,a),Es("f4",t,e,ds,n,i,a),Es("u1",t,e,ds,n*.7,i*1.1,r),Es("u2",t,e,ds,-n*.7,i*1.1,r),Es("u3",t,e,ds,0,i*2,r),Es("cf1",t,e,ds,-n,0,a),Es("cf2",t,e,ds,n,0,a),Es("cf3",t,e,ds,0,-i,a),Es("cf4",t,e,ds,0,i,a),Es("cn1",t,e,ds,-n,0,r),Es("cn2",t,e,ds,n,0,r),Es("cn3",t,e,ds,0,-i,r),Es("cn4",t,e,ds,0,i,r),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Es(s,e,t,n,i,r,a){Xb.set(i,r,a).unproject(n);const l=e[s];if(l!==void 0){const u=t.getAttribute("position");for(let h=0,p=l.length;h<p;h++)u.setXYZ(l[h],Xb.x,Xb.y,Xb.z)}}const Yb=new Wr;class zk extends sc{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new bn;r.setIndex(new ti(n,1)),r.setAttribute("position",new ti(i,3)),super(r,new jr({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&Yb.setFromObject(this.object),Yb.isEmpty())return;const e=Yb.min,t=Yb.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Gk extends sc{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new bn;r.setIndex(new ti(n,1)),r.setAttribute("position",new It(i,3)),super(r,new jr({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class Hk extends Ud{constructor(e,t=1,n=16776960){const i=n,r=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new bn;a.setAttribute("position",new It(r,3)),a.computeBoundingSphere(),super(a,new jr({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const l=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],u=new bn;u.setAttribute("position",new It(l,3)),u.computeBoundingSphere(),this.add(new Ri(u,new xa({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const OU=new Y;let jb,B1;class kk extends jn{constructor(e=new Y(0,0,1),t=new Y(0,0,0),n=1,i=16776960,r=n*.2,a=r*.2){super(),this.type="ArrowHelper",jb===void 0&&(jb=new bn,jb.setAttribute("position",new It([0,0,0,0,1,0],3)),B1=new ax(.5,1,5,1),B1.translate(0,-.5,0)),this.position.copy(t),this.line=new Ud(jb,new jr({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ri(B1,new xa({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{OU.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(OU,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),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 qk extends sc{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new bn;i.setAttribute("position",new It(t,3)),i.setAttribute("color",new It(n,3));const r=new jr({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new lt,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Wk{constructor(){this.type="ShapePath",this.color=new lt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new $T,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(b){const C=[];for(let w=0,D=b.length;w<D;w++){const P=b[w],I=new Mp;I.curves=P.curves,C.push(I)}return C}function n(b,C){const w=C.length;let D=!1;for(let P=w-1,I=0;I<w;P=I++){let F=C[P],z=C[I],B=z.x-F.x,O=z.y-F.y;if(Math.abs(O)>Number.EPSILON){if(O<0&&(F=C[I],B=-B,z=C[P],O=-O),b.y<F.y||b.y>z.y)continue;if(b.y===F.y){if(b.x===F.x)return!0}else{const W=O*(b.x-F.x)-B*(b.y-F.y);if(W===0)return!0;if(W<0)continue;D=!D}}else{if(b.y!==F.y)continue;if(z.x<=b.x&&b.x<=F.x||F.x<=b.x&&b.x<=z.x)return!0}}return D}const i=Wl.isClockWise,r=this.subPaths;if(r.length===0)return[];let a,l,u;const h=[];if(r.length===1)return l=r[0],u=new Mp,u.curves=l.curves,h.push(u),h;let p=!i(r[0].getPoints());p=e?!p:p;const g=[],y=[];let _=[],S=0,A;y[S]=void 0,_[S]=[];for(let b=0,C=r.length;b<C;b++)l=r[b],A=l.getPoints(),a=i(A),a=e?!a:a,a?(!p&&y[S]&&S++,y[S]={s:new Mp,p:A},y[S].s.curves=l.curves,p&&S++,_[S]=[]):_[S].push({h:l,p:A[0]});if(!y[0])return t(r);if(y.length>1){let b=!1,C=0;for(let w=0,D=y.length;w<D;w++)g[w]=[];for(let w=0,D=y.length;w<D;w++){const P=_[w];for(let I=0;I<P.length;I++){const F=P[I];let z=!0;for(let B=0;B<y.length;B++)n(F.p,y[B].p)&&(w!==B&&C++,z?(z=!1,g[B].push(F)):b=!0);z&&g[w].push(F)}}C>0&&b===!1&&(_=g)}let E;for(let b=0,C=y.length;b<C;b++){u=y[b].s,h.push(u),E=_[b];for(let w=0,D=E.length;w<D;w++)u.holes.push(E[w].h)}return h}}class Xk extends Ro{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Yk(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2):(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0),s}function jk(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0):(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2),s}function Kk(s){return s.repeat.x=1,s.repeat.y=1,s.offset.x=0,s.offset.y=0,s}function JT(s,e,t,n){const i=Zk(n);switch(t){case PM:return s*e;case um:return s*e/i.components*i.byteLength;case Od:return s*e/i.components*i.byteLength;case Wu:return s*e*2/i.components*i.byteLength;case cm:return s*e*2/i.components*i.byteLength;case Qy:return s*e*3/i.components*i.byteLength;case Pi:return s*e*4/i.components*i.byteLength;case hm:return s*e*4/i.components*i.byteLength;case Xc:case Yc:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case jc:case Kc:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Uy:case By:return Math.max(s,16)*Math.max(e,8)/4;case Dy:case Ly:return Math.max(s,8)*Math.max(e,8)/2;case Bp:case Pp:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Op:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Ip:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Fp:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case Vp:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case zp:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case Gp:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case Hp:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case kp:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case qp:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case Wp:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case Xp:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case Yp:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case jp:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case Kp:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case Zp:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case Qp:case WT:case XT:return Math.ceil(s/4)*Math.ceil(e/4)*16;case $p:case Jp:return Math.ceil(s/4)*Math.ceil(e/4)*8;case em:case tm:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Zk(s){switch(s){case ki:case Ed:return{byteLength:1,components:1};case $o:case Ad:case As:return{byteLength:2,components:1};case Z0:case Q0:return{byteLength:2,components:4};case gi:case Zs:case Bi:return{byteLength:4,components:1};case $0:case J0:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}class Qk{static contain(e,t){return Yk(e,t)}static cover(e,t){return jk(e,t)}static fill(e){return Kk(e)}static getByteLength(e,t,n,i){return JT(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ky}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ky);/** 118 * @license 119 * Copyright 2010-2025 Three.js Authors 120 * SPDX-License-Identifier: MIT 121 */function S3(){let s=null,e=!1,t=null,n=null;function i(r,a){t(r,a),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)}
vendor: 4,316 bytes, lines 121-180
121,stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function $k(s){const e=new WeakMap;function t(l,u){const h=l.array,p=l.usage,g=h.byteLength,y=s.createBuffer();s.bindBuffer(u,y),s.bufferData(u,h,p),l.onUploadCallback();let _;if(h instanceof Float32Array)_=s.FLOAT;else if(typeof Float16Array<"u"&&h instanceof Float16Array)_=s.HALF_FLOAT;else if(h instanceof Uint16Array)l.isFloat16BufferAttribute?_=s.HALF_FLOAT:_=s.UNSIGNED_SHORT;else if(h instanceof Int16Array)_=s.SHORT;else if(h instanceof Uint32Array)_=s.UNSIGNED_INT;else if(h instanceof Int32Array)_=s.INT;else if(h instanceof Int8Array)_=s.BYTE;else if(h instanceof Uint8Array)_=s.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)_=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:y,type:_,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version,size:g}}function n(l,u,h){const p=u.array,g=u.updateRanges;if(s.bindBuffer(h,l),g.length===0)s.bufferSubData(h,0,p);else{g.sort((_,S)=>_.start-S.start);let y=0;for(let _=1;_<g.length;_++){const S=g[y],A=g[_];A.start<=S.start+S.count+1?S.count=Math.max(S.count,A.start+A.count-S.start):(++y,g[y]=A)}g.length=y+1;for(let _=0,S=g.length;_<S;_++){const A=g[_];s.bufferSubData(h,A.start*p.BYTES_PER_ELEMENT,p,A.start,A.count)}u.clearUpdateRanges()}u.onUploadCallback()}function i(l){return l.isInterleavedBufferAttribute&&(l=l.data),e.get(l)}function r(l){l.isInterleavedBufferAttribute&&(l=l.data);const u=e.get(l);u&&(s.deleteBuffer(u.buffer),e.delete(l))}function a(l,u){if(l.isInterleavedBufferAttribute&&(l=l.data),l.isGLBufferAttribute){const p=e.get(l);(!p||p.version<l.version)&&e.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}const h=e.get(l);if(h===void 0)e.set(l,t(l,u));else if(h.version<l.version){if(h.size!==l.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(h.buffer,l,u),h.version=l.version}}return{get:i,remove:r,update:a}}var Jk=`#ifdef USE_ALPHAHASH 122 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 123#endif`,e8=`#ifdef USE_ALPHAHASH 124 const float ALPHA_HASH_SCALE = 0.05; 125 float hash2D( vec2 value ) { 126 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 127 } 128 float hash3D( vec3 value ) { 129 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 130 } 131 float getAlphaHashThreshold( vec3 position ) { 132 float maxDeriv = max( 133 length( dFdx( position.xyz ) ), 134 length( dFdy( position.xyz ) ) 135 ); 136 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 137 vec2 pixScales = vec2( 138 exp2( floor( log2( pixScale ) ) ), 139 exp2( ceil( log2( pixScale ) ) ) 140 ); 141 vec2 alpha = vec2( 142 hash3D( floor( pixScales.x * position.xyz ) ), 143 hash3D( floor( pixScales.y * position.xyz ) ) 144 ); 145 float lerpFactor = fract( log2( pixScale ) ); 146 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 147 float a = min( lerpFactor, 1.0 - lerpFactor ); 148 vec3 cases = vec3( 149 x * x / ( 2.0 * a * ( 1.0 - a ) ), 150 ( x - 0.5 * a ) / ( 1.0 - a ), 151 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 152 ); 153 float threshold = ( x < ( 1.0 - a ) ) 154 ? ( ( x < a ) ? cases.x : cases.y ) 155 : cases.z; 156 return clamp( threshold , 1.0e-6, 1.0 ); 157 } 158#endif`,t8=`#ifdef USE_ALPHAMAP 159 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 160#endif`,n8=`#ifdef USE_ALPHAMAP 161 uniform sampler2D alphaMap; 162#endif`,i8=`#ifdef USE_ALPHATEST 163 #ifdef ALPHA_TO_COVERAGE 164 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 165 if ( diffuseColor.a == 0.0 ) discard; 166 #else 167 if ( diffuseColor.a < alphaTest ) discard; 168 #endif 169#endif`,s8=`#ifdef USE_ALPHATEST 170 uniform float alphaTest; 171#endif`,r8=`#ifdef USE_AOMAP 172 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 173 reflectedLight.indirectDiffuse *= ambientOcclusion; 174 #if defined( USE_CLEARCOAT ) 175 clearcoatSpecularIndirect *= ambientOcclusion; 176 #endif 177 #if defined( USE_SHEEN ) 178 sheenSpecularIndirect *= ambientOcclusion; 179 #endif 180 #if defined( USE_ENVMAP ) && defined( STANDARD )
181 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 182 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 183 #endif 184#endif`,a8=`#ifdef USE_AOMAP 185 uniform sampler2D aoMap; 186 uniform float aoMapIntensity; 187#endif`,o8=`#ifdef USE_BATCHING 188 #if ! defined( GL_ANGLE_multi_draw ) 189 #define gl_DrawID _gl_DrawID 190 uniform int _gl_DrawID; 191 #endif 192 uniform highp sampler2D batchingTexture; 193 uniform highp usampler2D batchingIdTexture; 194 mat4 getBatchingMatrix( const in float i ) { 195 int size = textureSize( batchingTexture, 0 ).x; 196 int j = int( i ) * 4; 197 int x = j % size; 198 int y = j / size; 199 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 200 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 201 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 202 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 203 return mat4( v1, v2, v3, v4 ); 204 } 205 float getIndirectIndex( const in int i ) { 206 int size = textureSize( batchingIdTexture, 0 ).x; 207 int x = i % size; 208 int y = i / size; 209 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 210 } 211#endif 212#ifdef USE_BATCHING_COLOR 213 uniform sampler2D batchingColorTexture; 214 vec3 getBatchingColor( const in float i ) { 215 int size = textureSize( batchingColorTexture, 0 ).x; 216 int j = int( i ); 217 int x = j % size; 218 int y = j / size; 219 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 220 } 221#endif`,l8=`#ifdef USE_BATCHING 222 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 223#endif`,u8=`vec3 transformed = vec3( position ); 224#ifdef USE_ALPHAHASH 225 vPosition = vec3( position ); 226#endif`,c8=`vec3 objectNormal = vec3( normal ); 227#ifdef USE_TANGENT 228 vec3 objectTangent = vec3( tangent.xyz ); 229#endif`,h8=`float G_BlinnPhong_Implicit( ) { 230 return 0.25; 231} 232float D_BlinnPhong( const in float shininess, const in float dotNH ) { 233 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 234} 235vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 236 vec3 halfDir = normalize( lightDir + viewDir ); 237 float dotNH = saturate( dot( normal, halfDir ) ); 238 float dotVH = saturate( dot( viewDir, halfDir ) ); 239 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 240 float G = G_BlinnPhong_Implicit( ); 241 float D = D_BlinnPhong( shininess, dotNH ); 242 return F * ( G * D ); 243} // validated`,d8=`#ifdef USE_IRIDESCENCE 244 const mat3 XYZ_TO_REC709 = mat3( 245 3.2404542, -0.9692660, 0.0556434, 246 -1.5371385, 1.8760108, -0.2040259, 247 -0.4985314, 0.0415560, 1.0572252 248 ); 249 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 250 vec3 sqrtF0 = sqrt( fresnel0 ); 251 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 252 } 253 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 254 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 255 } 256 float IorToFresnel0( float transmittedIor, float incidentIor ) { 257 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 258 } 259 vec3 evalSensitivity( float OPD, vec3 shift ) { 260 float phase = 2.0 * PI * OPD * 1.0e-9; 261 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 262 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 263 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 264 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 265 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 266 xyz /= 1.0685e-7; 267 vec3 rgb = XYZ_TO_REC709 * xyz; 268 return rgb; 269 } 270 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 271 vec3 I; 272 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 273 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 274 float cosTheta2Sq = 1.0 - sinTheta2Sq; 275 if ( cosTheta2Sq < 0.0 ) { 276 return vec3( 1.0 ); 277 } 278 float cosTheta2 = sqrt( cosTheta2Sq ); 279 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
280 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 281 float T121 = 1.0 - R12; 282 float phi12 = 0.0; 283 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 284 float phi21 = PI - phi12; 285 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 286 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 287 vec3 phi23 = vec3( 0.0 ); 288 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 289 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 290 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 291 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 292 vec3 phi = vec3( phi21 ) + phi23; 293 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 294 vec3 r123 = sqrt( R123 ); 295 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 296 vec3 C0 = R12 + Rs; 297 I = C0; 298 vec3 Cm = Rs - T121; 299 for ( int m = 1; m <= 2; ++ m ) { 300 Cm *= r123; 301 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 302 I += Cm * Sm; 303 } 304 return max( I, vec3( 0.0 ) ); 305 } 306#endif`,f8=`#ifdef USE_BUMPMAP 307 uniform sampler2D bumpMap; 308 uniform float bumpScale; 309 vec2 dHdxy_fwd() { 310 vec2 dSTdx = dFdx( vBumpMapUv ); 311 vec2 dSTdy = dFdy( vBumpMapUv ); 312 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 313 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 314 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 315 return vec2( dBx, dBy ); 316 } 317 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 318 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 319 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 320 vec3 vN = surf_norm; 321 vec3 R1 = cross( vSigmaY, vN ); 322 vec3 R2 = cross( vN, vSigmaX ); 323 float fDet = dot( vSigmaX, R1 ) * faceDirection; 324 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 325 return normalize( abs( fDet ) * surf_norm - vGrad ); 326 } 327#endif`,p8=`#if NUM_CLIPPING_PLANES > 0 328 vec4 plane; 329 #ifdef ALPHA_TO_COVERAGE 330 float distanceToPlane, distanceGradient; 331 float clipOpacity = 1.0; 332 #pragma unroll_loop_start 333 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 334 plane = clippingPlanes[ i ]; 335 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 336 distanceGradient = fwidth( distanceToPlane ) / 2.0; 337 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 338 if ( clipOpacity == 0.0 ) discard; 339 } 340 #pragma unroll_loop_end 341 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 342 float unionClipOpacity = 1.0; 343 #pragma unroll_loop_start 344 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 345 plane = clippingPlanes[ i ]; 346 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 347 distanceGradient = fwidth( distanceToPlane ) / 2.0; 348 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 349 } 350 #pragma unroll_loop_end 351 clipOpacity *= 1.0 - unionClipOpacity; 352 #endif 353 diffuseColor.a *= clipOpacity; 354 if ( diffuseColor.a == 0.0 ) discard; 355 #else 356 #pragma unroll_loop_start 357 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 358 plane = clippingPlanes[ i ]; 359 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 360 } 361 #pragma unroll_loop_end 362 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 363 bool clipped = true; 364 #pragma unroll_loop_start 365 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 366 plane = clippingPlanes[ i ]; 367 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 368 } 369 #pragma unroll_loop_end 370 if ( clipped ) discard; 371 #endif 372 #endif 373#endif`,m8=`#if NUM_CLIPPING_PLANES > 0 374 varying vec3 vClipPosition; 375 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 376#endif`,g8=`#if NUM_CLIPPING_PLANES > 0 377 varying vec3 vClipPosition; 378#endif`,y8=`#if NUM_CLIPPING_PLANES > 0 379 vClipPosition = - mvPosition.xyz; 380#endif`,v8=`#if defined( USE_COLOR_ALPHA ) 381 diffuseColor *= vColor; 382#elif defined( USE_COLOR ) 383 diffuseColor.rgb *= vColor; 384#endif`,_8=`#if defined( USE_COLOR_ALPHA ) 385 varying vec4 vColor; 386#elif defined( USE_COLOR ) 387 varying vec3 vColor; 388#endif`,x8=`#if defined( USE_COLOR_ALPHA ) 389 varying vec4 vColor; 390#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 391 varying vec3 vColor; 392#endif`,S8=`#if defined( USE_COLOR_ALPHA ) 393 vColor = vec4( 1.0 ); 394#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 395 vColor = vec3( 1.0 ); 396#endif 397#ifdef USE_COLOR 398 vColor *= color; 399#endif 400#ifdef USE_INSTANCING_COLOR 401 vColor.xyz *= instanceColor.xyz; 402#endif 403#ifdef USE_BATCHING_COLOR 404 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 405 vColor.xyz *= batchingColor.xyz; 406#endif`,b8=`#define PI 3.141592653589793 407#define PI2 6.283185307179586 408#define PI_HALF 1.5707963267948966 409#define RECIPROCAL_PI 0.3183098861837907 410#define RECIPROCAL_PI2 0.15915494309189535 411#define EPSILON 1e-6 412#ifndef saturate 413#define saturate( a ) clamp( a, 0.0, 1.0 ) 414#endif 415#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 416float pow2( const in float x ) { return x*x; } 417vec3 pow2( const in vec3 x ) { return x*x; } 418float pow3( const in float x ) { return x*x*x; } 419float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 420float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 421float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 422highp float rand( const in vec2 uv ) { 423 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 424 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 425 return fract( sin( sn ) * c ); 426} 427#ifdef HIGH_PRECISION 428 float precisionSafeLength( vec3 v ) { return length( v ); } 429#else 430 float precisionSafeLength( vec3 v ) { 431 float maxComponent = max3( abs( v ) ); 432 return length( v / maxComponent ) * maxComponent; 433 } 434#endif 435struct IncidentLight { 436 vec3 color; 437 vec3 direction; 438 bool visible; 439}; 440struct ReflectedLight { 441 vec3 directDiffuse; 442 vec3 directSpecular; 443 vec3 indirectDiffuse; 444 vec3 indirectSpecular; 445}; 446#ifdef USE_ALPHAHASH 447 varying vec3 vPosition; 448#endif 449vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 450 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 451} 452vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 453 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 454} 455mat3 transposeMat3( const in mat3 m ) { 456 mat3 tmp; 457 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 458 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 459 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 460 return tmp; 461} 462bool isPerspectiveMatrix( mat4 m ) { 463 return m[ 2 ][ 3 ] == - 1.0; 464} 465vec2 equirectUv( in vec3 dir ) { 466 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 467 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 468 return vec2( u, v ); 469}
470vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 471 return RECIPROCAL_PI * diffuseColor; 472} 473vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 474 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 475 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 476} 477float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 478 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 479 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 480} // validated`,T8=`#ifdef ENVMAP_TYPE_CUBE_UV 481 #define cubeUV_minMipLevel 4.0 482 #define cubeUV_minTileSize 16.0 483 float getFace( vec3 direction ) { 484 vec3 absDirection = abs( direction ); 485 float face = - 1.0; 486 if ( absDirection.x > absDirection.z ) { 487 if ( absDirection.x > absDirection.y ) 488 face = direction.x > 0.0 ? 0.0 : 3.0; 489 else 490 face = direction.y > 0.0 ? 1.0 : 4.0; 491 } else { 492 if ( absDirection.z > absDirection.y ) 493 face = direction.z > 0.0 ? 2.0 : 5.0; 494 else 495 face = direction.y > 0.0 ? 1.0 : 4.0; 496 } 497 return face; 498 } 499 vec2 getUV( vec3 direction, float face ) { 500 vec2 uv; 501 if ( face == 0.0 ) { 502 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 503 } else if ( face == 1.0 ) { 504 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 505 } else if ( face == 2.0 ) { 506 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 507 } else if ( face == 3.0 ) { 508 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 509 } else if ( face == 4.0 ) { 510 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 511 } else { 512 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 513 } 514 return 0.5 * ( uv + 1.0 ); 515 } 516 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 517 float face = getFace( direction ); 518 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 519 mipInt = max( mipInt, cubeUV_minMipLevel ); 520 float faceSize = exp2( mipInt ); 521 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 522 if ( face > 2.0 ) { 523 uv.y += faceSize; 524 face -= 3.0; 525 } 526 uv.x += face * faceSize; 527 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 528 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 529 uv.x *= CUBEUV_TEXEL_WIDTH; 530 uv.y *= CUBEUV_TEXEL_HEIGHT; 531 #ifdef texture2DGradEXT 532 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 533 #else 534 return texture2D( envMap, uv ).rgb; 535 #endif 536 } 537 #define cubeUV_r0 1.0 538 #define cubeUV_m0 - 2.0 539 #define cubeUV_r1 0.8 540 #define cubeUV_m1 - 1.0 541 #define cubeUV_r4 0.4 542 #define cubeUV_m4 2.0 543 #define cubeUV_r5 0.305 544 #define cubeUV_m5 3.0 545 #define cubeUV_r6 0.21 546 #define cubeUV_m6 4.0 547 float roughnessToMip( float roughness ) { 548 float mip = 0.0; 549 if ( roughness >= cubeUV_r1 ) { 550 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 551 } else if ( roughness >= cubeUV_r4 ) { 552 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 553 } else if ( roughness >= cubeUV_r5 ) { 554 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 555 } else if ( roughness >= cubeUV_r6 ) { 556 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 557 } else { 558 mip = - 2.0 * log2( 1.16 * roughness ); } 559 return mip; 560 } 561 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 562 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 563 float mipF = fract( mip ); 564 float mipInt = floor( mip ); 565 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 566 if ( mipF == 0.0 ) { 567 return vec4( color0, 1.0 ); 568 } else { 569 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 570 return vec4( mix( color0, color1, mipF ), 1.0 ); 571 } 572 } 573#endif`,M8=`vec3 transformedNormal = objectNormal; 574#ifdef USE_TANGENT 575 vec3 transformedTangent = objectTangent; 576#endif 577#ifdef USE_BATCHING 578 mat3 bm = mat3( batchingMatrix ); 579 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 580 transformedNormal = bm * transformedNormal; 581 #ifdef USE_TANGENT 582 transformedTangent = bm * transformedTangent; 583 #endif 584#endif 585#ifdef USE_INSTANCING 586 mat3 im = mat3( instanceMatrix ); 587 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 588 transformedNormal = im * transformedNormal; 589 #ifdef USE_TANGENT 590 transformedTangent = im * transformedTangent; 591 #endif 592#endif 593transformedNormal = normalMatrix * transformedNormal; 594#ifdef FLIP_SIDED 595 transformedNormal = - transformedNormal; 596#endif 597#ifdef USE_TANGENT 598 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 599 #ifdef FLIP_SIDED 600 transformedTangent = - transformedTangent; 601 #endif 602#endif`,E8=`#ifdef USE_DISPLACEMENTMAP 603 uniform sampler2D displacementMap; 604 uniform float displacementScale; 605 uniform float displacementBias; 606#endif`,A8=`#ifdef USE_DISPLACEMENTMAP 607 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
607placementBias ); 608#endif`,R8=`#ifdef USE_EMISSIVEMAP 609 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 610 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 611 emissiveColor = sRGBTransferEOTF( emissiveColor ); 612 #endif 613 totalEmissiveRadiance *= emissiveColor.rgb; 614#endif`,N8=`#ifdef USE_EMISSIVEMAP 615 uniform sampler2D emissiveMap; 616#endif`,C8="gl_FragColor = linearToOutputTexel( gl_FragColor );",w8=`vec4 LinearTransferOETF( in vec4 value ) { 617 return value; 618} 619vec4 sRGBTransferEOTF( in vec4 value ) { 620 return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); 621} 622vec4 sRGBTransferOETF( in vec4 value ) { 623 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 624}`,D8=`#ifdef USE_ENVMAP 625 #ifdef ENV_WORLDPOS 626 vec3 cameraToFrag; 627 if ( isOrthographic ) { 628 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 629 } else { 630 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 631 } 632 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 633 #ifdef ENVMAP_MODE_REFLECTION 634 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 635 #else 636 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 637 #endif 638 #else 639 vec3 reflectVec = vReflect; 640 #endif 641 #ifdef ENVMAP_TYPE_CUBE 642 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 643 #else 644 vec4 envColor = vec4( 0.0 ); 645 #endif 646 #ifdef ENVMAP_BLENDING_MULTIPLY 647 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 648 #elif defined( ENVMAP_BLENDING_MIX ) 649 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 650 #elif defined( ENVMAP_BLENDING_ADD ) 651 outgoingLight += envColor.xyz * specularStrength * reflectivity; 652 #endif 653#endif`,U8=`#ifdef USE_ENVMAP 654 uniform float envMapIntensity; 655 uniform float flipEnvMap; 656 uniform mat3 envMapRotation; 657 #ifdef ENVMAP_TYPE_CUBE 658 uniform samplerCube envMap; 659 #else 660 uniform sampler2D envMap; 661 #endif 662 663#endif`,L8=`#ifdef USE_ENVMAP 664 uniform float reflectivity; 665 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 666 #define ENV_WORLDPOS 667 #endif 668 #ifdef ENV_WORLDPOS 669 varying vec3 vWorldPosition; 670 uniform float refractionRatio; 671 #else 672 varying vec3 vReflect; 673 #endif 674#endif`,B8=`#ifdef USE_ENVMAP 675 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 676 #define ENV_WORLDPOS 677 #endif 678 #ifdef ENV_WORLDPOS 679 680 varying vec3 vWorldPosition; 681 #else 682 varying vec3 vReflect; 683 uniform float refractionRatio; 684 #endif 685#endif`,P8=`#ifdef USE_ENVMAP 686 #ifdef ENV_WORLDPOS 687 vWorldPosition = worldPosition.xyz; 688 #else 689 vec3 cameraToVertex; 690 if ( isOrthographic ) { 691 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 692 } else {
693 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 694 } 695 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 696 #ifdef ENVMAP_MODE_REFLECTION 697 vReflect = reflect( cameraToVertex, worldNormal ); 698 #else 699 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 700 #endif 701 #endif 702#endif`,O8=`#ifdef USE_FOG 703 vFogDepth = - mvPosition.z; 704#endif`,I8=`#ifdef USE_FOG 705 varying float vFogDepth; 706#endif`,F8=`#ifdef USE_FOG 707 #ifdef FOG_EXP2 708 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 709 #else 710 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 711 #endif 712 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 713#endif`,V8=`#ifdef USE_FOG 714 uniform vec3 fogColor; 715 varying float vFogDepth; 716 #ifdef FOG_EXP2 717 uniform float fogDensity; 718 #else 719 uniform float fogNear; 720 uniform float fogFar; 721 #endif 722#endif`,z8=`#ifdef USE_GRADIENTMAP 723 uniform sampler2D gradientMap; 724#endif 725vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 726 float dotNL = dot( normal, lightDirection ); 727 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 728 #ifdef USE_GRADIENTMAP 729 return vec3( texture2D( gradientMap, coord ).r ); 730 #else 731 vec2 fw = fwidth( coord ) * 0.5; 732 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 733 #endif 734}`,G8=`#ifdef USE_LIGHTMAP 735 uniform sampler2D lightMap; 736 uniform float lightMapIntensity; 737#endif`,H8=`LambertMaterial material; 738material.diffuseColor = diffuseColor.rgb; 739material.specularStrength = specularStrength;`,k8=`varying vec3 vViewPosition; 740struct LambertMaterial { 741 vec3 diffuseColor; 742 float specularStrength; 743}; 744void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 745 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 746 vec3 irradiance = dotNL * directLight.color; 747 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 748} 749void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 750 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 751} 752#define RE_Direct RE_Direct_Lambert 753#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,q8=`uniform bool receiveShadow; 754uniform vec3 ambientLightColor; 755#if defined( USE_LIGHT_PROBES ) 756 uniform vec3 lightProbe[ 9 ]; 757#endif 758vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 759 float x = normal.x, y = normal.y, z = normal.z; 760 vec3 result = shCoefficients[ 0 ] * 0.886227; 761 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 762 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 763 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 764 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 765 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 766 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 767 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 768 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 769 return result; 770} 771vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 772 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 773 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 774 return irradiance; 775} 776vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 777 vec3 irradiance = ambientLightColor; 778 return irradiance; 779} 780float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 781 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 782 if ( cutoffDistance > 0.0 ) { 783 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 784 } 785 return distanceFalloff; 786} 787float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 788 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 789} 790#if NUM_DIR_LIGHTS > 0 791 struct DirectionalLight { 792 vec3 direction; 793 vec3 color; 794 }; 795 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 796 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 797 light.color = directionalLight.color; 798 light.direction = directionalLight.direction; 799 light.visible = true; 800 } 801#endif 802#if NUM_POINT_LIGHTS > 0 803 struct PointLight { 804 vec3 position; 805 vec3 color; 806 float distance; 807 float decay; 808 }; 809 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 810 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 811 vec3 lVector = pointLight.position - geometryPosition; 812 light.direction = normalize( lVector ); 813 float lightDistance = length( lVector ); 814 light.color = pointLight.color; 815 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 816 light.visible = ( light.color != vec3( 0.0 ) ); 817 } 818#endif
819#if NUM_SPOT_LIGHTS > 0 820 struct SpotLight { 821 vec3 position; 822 vec3 direction; 823 vec3 color; 824 float distance; 825 float decay; 826 float coneCos; 827 float penumbraCos; 828 }; 829 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 830 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 831 vec3 lVector = spotLight.position - geometryPosition; 832 light.direction = normalize( lVector ); 833 float angleCos = dot( light.direction, spotLight.direction ); 834 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 835 if ( spotAttenuation > 0.0 ) { 836 float lightDistance = length( lVector ); 837 light.color = spotLight.color * spotAttenuation; 838 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 839 light.visible = ( light.color != vec3( 0.0 ) ); 840 } else { 841 light.color = vec3( 0.0 ); 842 light.visible = false; 843 } 844 } 845#endif 846#if NUM_RECT_AREA_LIGHTS > 0 847 struct RectAreaLight { 848 vec3 color; 849 vec3 position; 850 vec3 halfWidth; 851 vec3 halfHeight; 852 }; 853 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 854 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 855#endif 856#if NUM_HEMI_LIGHTS > 0 857 struct HemisphereLight { 858 vec3 direction; 859 vec3 skyColor; 860 vec3 groundColor; 861 }; 862 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 863 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 864 float dotNL = dot( normal, hemiLight.direction ); 865 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 866 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 867 return irradiance; 868 } 869#endif`,W8=`#ifdef USE_ENVMAP 870 vec3 getIBLIrradiance( const in vec3 normal ) { 871 #ifdef ENVMAP_TYPE_CUBE_UV 872 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 873 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 874 return PI * envMapColor.rgb * envMapIntensity; 875 #else 876 return vec3( 0.0 ); 877 #endif 878 } 879 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 880 #ifdef ENVMAP_TYPE_CUBE_UV 881 vec3 reflectVec = reflect( - viewDir, normal ); 882 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 883 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 884 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 885 return envMapColor.rgb * envMapIntensity; 886 #else 887 return vec3( 0.0 ); 888 #endif 889 } 890 #ifdef USE_ANISOTROPY 891 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 892 #ifdef ENVMAP_TYPE_CUBE_UV 893 vec3 bentNormal = cross( bitangent, viewDir ); 894 bentNormal = normalize( cross( bentNormal, bitangent ) ); 895 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 896 return getIBLRadiance( viewDir, bentNormal, roughness ); 897 #else 898 return vec3( 0.0 ); 899 #endif 900 } 901 #endif 902#endif`,X8=`ToonMaterial material; 903material.diffuseColor = diffuseColor.rgb;`,Y8=`varying vec3 vViewPosition; 904struct ToonMaterial { 905 vec3 diffuseColor; 906}; 907void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 908 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 909 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 910} 911void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 912 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 913} 914#define RE_Direct RE_Direct_Toon 915#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,j8=`BlinnPhongMaterial material; 916material.diffuseColor = diffuseColor.rgb; 917material.specularColor = specular; 918material.specularShininess = shininess; 919material.specularStrength = specularStrength;`,K8=`varying vec3 vViewPosition; 920struct BlinnPhongMaterial { 921 vec3 diffuseColor; 922 vec3 specularColor; 923 float specularShininess; 924 float specularStrength; 925}; 926void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
927 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 928 vec3 irradiance = dotNL * directLight.color; 929 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 930 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 931} 932void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 933 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 934} 935#define RE_Direct RE_Direct_BlinnPhong 936#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Z8=`PhysicalMaterial material; 937material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 938vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 939float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 940material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 941material.roughness = min( material.roughness, 1.0 ); 942#ifdef IOR 943 material.ior = ior; 944 #ifdef USE_SPECULAR 945 float specularIntensityFactor = specularIntensity; 946 vec3 specularColorFactor = specularColor; 947 #ifdef USE_SPECULAR_COLORMAP 948 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 949 #endif 950 #ifdef USE_SPECULAR_INTENSITYMAP 951 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 952 #endif 953 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 954 #else 955 float specularIntensityFactor = 1.0; 956 vec3 specularColorFactor = vec3( 1.0 ); 957 material.specularF90 = 1.0; 958 #endif 959 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 960#else 961 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 962 material.specularF90 = 1.0; 963#endif 964#ifdef USE_CLEARCOAT 965 material.clearcoat = clearcoat; 966 material.clearcoatRoughness = clearcoatRoughness; 967 material.clearcoatF0 = vec3( 0.04 ); 968 material.clearcoatF90 = 1.0; 969 #ifdef USE_CLEARCOATMAP 970 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 971 #endif 972 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 973 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 974 #endif 975 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 976 material.clearcoatRoughness += geometryRoughness; 977 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 978#endif 979#ifdef USE_DISPERSION 980 material.dispersion = dispersion; 981#endif 982#ifdef USE_IRIDESCENCE 983 material.iridescence = iridescence; 984 material.iridescenceIOR = iridescenceIOR; 985 #ifdef USE_IRIDESCENCEMAP 986 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 987 #endif 988 #ifdef USE_IRIDESCENCE_THICKNESSMAP 989 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 990 #else 991 material.iridescenceThickness = iridescenceThicknessMaximum; 992 #endif 993#endif 994#ifdef USE_SHEEN 995 material.sheenColor = sheenColor; 996 #ifdef USE_SHEEN_COLORMAP 997 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 998 #endif 999 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 1000 #ifdef USE_SHEEN_ROUGHNESSMAP 1001 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 1002 #endif 1003#endif 1004#ifdef USE_ANISOTROPY 1005 #ifdef USE_ANISOTROPYMAP 1006 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 1007 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 1008 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 1009 #else 1010 vec2 anisotropyV = anisotropyVector; 1011 #endif 1012 material.anisotropy = length( anisotropyV ); 1013 if( material.anisotropy == 0.0 ) { 1014 anisotropyV = vec2( 1.0, 0.0 ); 1015 } else { 1016 anisotropyV /= material.anisotropy; 1017 material.anisotropy = saturate( material.anisotropy ); 1018 } 1019 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
1020 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 1021 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 1022#endif`,Q8
vendor: 14,687 bytes, lines 1022-1323
1022=`struct PhysicalMaterial { 1023 vec3 diffuseColor; 1024 float roughness; 1025 vec3 specularColor; 1026 float specularF90; 1027 float dispersion; 1028 #ifdef USE_CLEARCOAT 1029 float clearcoat; 1030 float clearcoatRoughness; 1031 vec3 clearcoatF0; 1032 float clearcoatF90; 1033 #endif 1034 #ifdef USE_IRIDESCENCE 1035 float iridescence; 1036 float iridescenceIOR; 1037 float iridescenceThickness; 1038 vec3 iridescenceFresnel; 1039 vec3 iridescenceF0; 1040 #endif 1041 #ifdef USE_SHEEN 1042 vec3 sheenColor; 1043 float sheenRoughness; 1044 #endif 1045 #ifdef IOR 1046 float ior; 1047 #endif 1048 #ifdef USE_TRANSMISSION 1049 float transmission; 1050 float transmissionAlpha; 1051 float thickness; 1052 float attenuationDistance; 1053 vec3 attenuationColor; 1054 #endif 1055 #ifdef USE_ANISOTROPY 1056 float anisotropy; 1057 float alphaT; 1058 vec3 anisotropyT; 1059 vec3 anisotropyB; 1060 #endif 1061}; 1062vec3 clearcoatSpecularDirect = vec3( 0.0 ); 1063vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 1064vec3 sheenSpecularDirect = vec3( 0.0 ); 1065vec3 sheenSpecularIndirect = vec3(0.0 ); 1066vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 1067 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 1068 float x2 = x * x; 1069 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 1070 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 1071} 1072float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1073 float a2 = pow2( alpha ); 1074 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1075 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1076 return 0.5 / max( gv + gl, EPSILON ); 1077} 1078float D_GGX( const in float alpha, const in float dotNH ) { 1079 float a2 = pow2( alpha ); 1080 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1081 return RECIPROCAL_PI * a2 / pow2( denom ); 1082} 1083#ifdef USE_ANISOTROPY 1084 float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { 1085 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1086 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1087 float v = 0.5 / ( gv + gl ); 1088 return saturate(v); 1089 } 1090 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1091 float a2 = alphaT * alphaB; 1092 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1093 highp float v2 = dot( v, v ); 1094 float w2 = a2 / v2; 1095 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1096 } 1097#endif 1098#ifdef USE_CLEARCOAT 1099 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1100 vec3 f0 = material.clearcoatF0; 1101 float f90 = material.clearcoatF90; 1102 float roughness = material.clearcoatRoughness; 1103 float alpha = pow2( roughness ); 1104 vec3 halfDir = normalize( lightDir + viewDir ); 1105 float dotNL = saturate( dot( normal, lightDir ) ); 1106 float dotNV = saturate( dot( normal, viewDir ) ); 1107 float dotNH = saturate( dot( normal, halfDir ) ); 1108 float dotVH = saturate( dot( viewDir, halfDir ) ); 1109 vec3 F = F_Schlick( f0, f90, dotVH ); 1110 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1111 float D = D_GGX( alpha, dotNH ); 1112 return F * ( V * D ); 1113 } 1114#endif 1115vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1116 vec3 f0 = material.specularColor; 1117 float f90 = material.specularF90; 1118 float roughness = material.roughness; 1119 float alpha = pow2( roughness ); 1120 vec3 halfDir = normalize( lightDir + viewDir ); 1121 float dotNL = saturate( dot( normal, lightDir ) ); 1122 float dotNV = saturate( dot( normal, viewDir ) ); 1123 float dotNH = saturate( dot( normal, halfDir ) ); 1124 float dotVH = saturate( dot( viewDir, halfDir ) ); 1125 vec3 F = F_Schlick( f0, f90, dotVH ); 1126 #ifdef USE_IRIDESCENCE 1127 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1128 #endif 1129 #ifdef USE_ANISOTROPY 1130 float dotTL = dot( material.anisotropyT, lightDir ); 1131 float dotTV = dot( material.anisotropyT, viewDir ); 1132 float dotTH = dot( material.anisotropyT, halfDir ); 1133 float dotBL = dot( material.anisotropyB, lightDir ); 1134 float dotBV = dot( material.anisotropyB, viewDir ); 1135 float dotBH = dot( material.anisotropyB, halfDir ); 1136 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1137 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1138 #else 1139 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1140 float D = D_GGX( alpha, dotNH ); 1141 #endif 1142 return F * ( V * D ); 1143} 1144vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1145 const float LUT_SIZE = 64.0; 1146 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1147 const float LUT_BIAS = 0.5 / LUT_SIZE; 1148 float dotNV = saturate( dot( N, V ) ); 1149 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1150 uv = uv * LUT_SCALE + LUT_BIAS; 1151 return uv; 1152} 1153float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1154 float l = length( f ); 1155 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1156} 1157vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1158 float x = dot( v1, v2 ); 1159 float y = abs( x ); 1160 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1161 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1162 float v = a / b; 1163 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1164 return cross( v1, v2 ) * theta_sintheta; 1165} 1166vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1167 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1168 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1169 vec3 lightNormal = cross( v1, v2 ); 1170 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1171 vec3 T1, T2; 1172 T1 = normalize( V - N * dot( V, N ) ); 1173 T2 = - cross( N, T1 ); 1174 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1175 vec3 coords[ 4 ]; 1176 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1177 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1178 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1179 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1180 coords[ 0 ] = normalize( coords[ 0 ] ); 1181 coords[ 1 ] = normalize( coords[ 1 ] ); 1182 coords[ 2 ] = normalize( coords[ 2 ] ); 1183 coords[ 3 ] = normalize( coords[ 3 ] ); 1184 vec3 vectorFormFactor = vec3( 0.0 ); 1185 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1186 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1187 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1188 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1189 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1190 return vec3( result ); 1191} 1192#if defined( USE_SHEEN ) 1193float D_Charlie( float roughness, float dotNH ) { 1194 float alpha = pow2( roughness ); 1195 float invAlpha = 1.0 / alpha; 1196 float cos2h = dotNH * dotNH; 1197 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1198 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1199} 1200float V_Neubelt( float dotNV, float dotNL ) { 1201 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1202} 1203vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1204 vec3 halfDir = normalize( lightDir + viewDir ); 1205 float dotNL = saturate( dot( normal, lightDir ) ); 1206 float dotNV = saturate( dot( normal, viewDir ) ); 1207 float dotNH = saturate( dot( normal, halfDir ) ); 1208 float D = D_Charlie( sheenRoughness, dotNH ); 1209 float V = V_Neubelt( dotNV, dotNL ); 1210 return sheenColor * ( D * V ); 1211} 1212#endif 1213float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1214 float dotNV = saturate( dot( normal, viewDir ) ); 1215 float r2 = roughness * roughness; 1216 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1217 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1218 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1219 return saturate( DG * RECIPROCAL_PI ); 1220} 1221vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1222 float dotNV = saturate( dot( normal, viewDir ) ); 1223 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1224 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1225 vec4 r = roughness * c0 + c1; 1226 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1227 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1228 return fab; 1229} 1230vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1231 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1232 return specularColor * fab.x + specularF90 * fab.y; 1233} 1234#ifdef USE_IRIDESCENCE 1235void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1236#else 1237void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 1238#endif 1239 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1240 #ifdef USE_IRIDESCENCE 1241 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1242 #else 1243 vec3 Fr = specularColor; 1244 #endif 1245 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1246 float Ess = fab.x + fab.y; 1247 float Ems = 1.0 - Ess; 1248 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1249 singleScatter += FssEss; 1250 multiScatter += Fms * Ems; 1251} 1252#if NUM_RECT_AREA_LIGHTS > 0 1253 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1254 vec3 normal = geometryNormal; 1255 vec3 viewDir = geometryViewDir; 1256 vec3 position = geometryPosition; 1257 vec3 lightPos = rectAreaLight.position; 1258 vec3 halfWidth = rectAreaLight.halfWidth; 1259 vec3 halfHeight = rectAreaLight.halfHeight; 1260 vec3 lightColor = rectAreaLight.color; 1261 float roughness = material.roughness; 1262 vec3 rectCoords[ 4 ]; 1263 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1264 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1265 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1266 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1267 vec4 t1 = texture2D( ltc_1, uv ); 1268 vec4 t2 = texture2D( ltc_2, uv ); 1269 mat3 mInv = mat3( 1270 vec3( t1.x, 0, t1.y ), 1271 vec3( 0, 1, 0 ), 1272 vec3( t1.z, 0, t1.w ) 1273 ); 1274 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1275 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1276 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1277 } 1278#endif 1279void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1280 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1281 vec3 irradiance = dotNL * directLight.color; 1282 #ifdef USE_CLEARCOAT 1283 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1284 vec3 ccIrradiance = dotNLcc * directLight.color; 1285 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1286 #endif 1287 #ifdef USE_SHEEN 1288 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1289 #endif 1290 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1291 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1292} 1293void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1294 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1295} 1296void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1297 #ifdef USE_CLEARCOAT 1298 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1299 #endif 1300 #ifdef USE_SHEEN 1301 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1302 #endif 1303 vec3 singleScattering = vec3( 0.0 ); 1304 vec3 multiScattering = vec3( 0.0 ); 1305 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1306 #ifdef USE_IRIDESCENCE 1307 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1308 #else 1309 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1310 #endif 1311 vec3 totalScattering = singleScattering + multiScattering; 1312 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1313 reflectedLight.indirectSpecular += radiance * singleScattering; 1314 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1315 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1316} 1317#define RE_Direct RE_Direct_Physical 1318#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1319#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1320#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1321float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1322 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1323}`,
1323$8=` 1324vec3 geometryPosition = - vViewPosition; 1325vec3 geometryNormal = normal; 1326vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1327vec3 geometryClearcoatNormal = vec3( 0.0 ); 1328#ifdef USE_CLEARCOAT 1329 geometryClearcoatNormal = clearcoatNormal; 1330#endif 1331#ifdef USE_IRIDESCENCE 1332 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1333 if ( material.iridescenceThickness == 0.0 ) { 1334 material.iridescence = 0.0; 1335 } else { 1336 material.iridescence = saturate( material.iridescence ); 1337 } 1338 if ( material.iridescence > 0.0 ) { 1339 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1340 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1341 } 1342#endif 1343IncidentLight directLight; 1344#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1345 PointLight pointLight; 1346 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1347 PointLightShadow pointLightShadow; 1348 #endif 1349 #pragma unroll_loop_start 1350 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1351 pointLight = pointLights[ i ]; 1352 getPointLightInfo( pointLight, geometryPosition, directLight ); 1353 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1354 pointLightShadow = pointLightShadows[ i ]; 1355 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1356 #endif 1357 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1358 } 1359 #pragma unroll_loop_end 1360#endif 1361#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1362 SpotLight spotLight; 1363 vec4 spotColor; 1364 vec3 spotLightCoord; 1365 bool inSpotLightMap; 1366 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1367 SpotLightShadow spotLightShadow; 1368 #endif 1369 #pragma unroll_loop_start 1370 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1371 spotLight = spotLights[ i ]; 1372 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1373 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1374 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1375 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1376 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1377 #else 1378 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1379 #endif 1380 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1381 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1382 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1383 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1384 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1385 #endif 1386 #undef SPOT_LIGHT_MAP_INDEX 1387 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1388 spotLightShadow = spotLightShadows[ i ]; 1389 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1390 #endif 1391 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1392 } 1393 #pragma unroll_loop_end 1394#endif 1395#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1396 DirectionalLight directionalLight; 1397 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1398 DirectionalLightShadow directionalLightShadow; 1399 #endif 1400 #pragma unroll_loop_start 1401 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1402 directionalLight = directionalLights[ i ]; 1403 getDirectionalLightInfo( directionalLight, directLight ); 1404 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1405 directionalLightShadow = directionalLightShadows[ i ]; 1406 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1407 #endif 1408 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1409 } 1410 #pragma unroll_loop_end 1411#endif 1412#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1413 RectAreaLight rectAreaLight; 1414 #pragma unroll_loop_start 1415 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1416 rectAreaLight = rectAreaLights[ i ]; 1417 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1418 } 1419 #pragma unroll_loop_end 1420#endif 1421#if defined( RE_IndirectDiffuse ) 1422 vec3 iblIrradiance = vec3( 0.0 ); 1423 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1424 #if defined( USE_LIGHT_PROBES ) 1425 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1426 #endif 1427 #if ( NUM_HEMI_LIGHTS > 0 ) 1428 #pragma unroll_loop_start 1429 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1430 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1431 } 1432 #pragma unroll_loop_end 1433 #endif 1434#endif 1435#if defined( RE_IndirectSpecular ) 1436 vec3 radiance = vec3( 0.0 ); 1437 vec3 clearcoatRadiance = vec3( 0.0 ); 1438#endif`,J8=`#if defined( RE_IndirectDiffuse ) 1439 #ifdef USE_LIGHTMAP 1440 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1441 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1442 irradiance += lightMapIrradiance; 1443 #endif 1444 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1445 iblIrradiance += getIBLIrradiance( geometryNormal ); 1446 #endif 1447#endif 1448#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1449 #ifdef USE_ANISOTROPY 1450 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1451 #else 1452 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1453 #endif 1454 #ifdef USE_CLEARCOAT 1455 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1456 #endif 1457#endif`,eq=`#if defined( RE_IndirectDiffuse ) 1458 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1459#endif 1460#if defined( RE_IndirectSpecular ) 1461 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1462#endif`,tq=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1463 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1464#endif`,nq=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) 1465 uniform float logDepthBufFC; 1466 varying float vFragDepth; 1467 varying float vIsPerspective; 1468#endif`,iq=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1469 varying float vFragDepth; 1470 varying float vIsPerspective; 1471#endif`,sq=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER 1472 vFragDepth = 1.0 + gl_Position.w; 1473 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1474#endif`,rq=`#ifdef USE_MAP 1475 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1476 #ifdef DECODE_VIDEO_TEXTURE 1477 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1478 #endif 1479 diffuseColor *= sampledDiffuseColor; 1480#endif`,aq=`#ifdef USE_MAP 1481 uniform sampler2D map; 1482#endif`,oq=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1483 #if defined( USE_POINTS_UV ) 1484 vec2 uv = vUv; 1485 #else 1486 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1487 #endif 1488#endif 1489#ifdef USE_MAP 1490 diffuseColor *= texture2D( map, uv ); 1491#endif 1492#ifdef USE_ALPHAMAP 1493 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1494#endif`,lq=`#if defined( USE_POINTS_UV ) 1495 varying vec2 vUv; 1496#else 1497 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1498 uniform mat3 uvTransform; 1499 #endif 1500#endif 1501#ifdef USE_MAP 1502 uniform sampler2D map; 1503#endif 1504#ifdef USE_ALPHAMAP 1505 uniform sampler2D alphaMap; 1506#endif`,uq=`float metalnessFactor = metalness; 1507#ifdef USE_METALNESSMAP 1508 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1509 metalnessFactor *= texelMetalness.b; 1510#endif`,cq=`#ifdef USE_METALNESSMAP 1511 uniform sampler2D metalnessMap; 1512#endif`,hq=`#ifdef USE_INSTANCING_MORPH 1513 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1514 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1515 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1516 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1517 } 1518#endif`,dq=`#if defined( USE_MORPHCOLORS ) 1519 vColor *= morphTargetBaseInfluence; 1520 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1521 #if defined( USE_COLOR_ALPHA ) 1522 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1523 #elif defined( USE_COLOR ) 1524 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1525 #endif 1526 } 1527#endif`,fq=`#ifdef USE_MORPHNORMALS 1528 objectNormal *= morphTargetBaseInfluence; 1529 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1530 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1531 } 1532#endif`,pq=`#ifdef USE_MORPHTARGETS 1533 #ifndef USE_INSTANCING_MORPH 1534 uniform float morphTargetBaseInfluence; 1535 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1536 #endif 1537 uniform sampler2DArray morphTargetsTexture; 1538 uniform ivec2 morphTargetsTextureSize; 1539 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1540 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1541 int y = texelIndex / morphTargetsTextureSize.x; 1542 int x = texelIndex - y * morphTargetsTextureSize.x; 1543 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1544 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1545 } 1546#endif`,mq=`#ifdef USE_MORPHTARGETS 1547 transformed *= morphTargetBaseInfluence; 1548 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1549 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1550 } 1551#endif`,gq=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1552#ifdef FLAT_SHADED 1553 vec3 fdx = dFdx( vViewPosition ); 1554 vec3 fdy = dFdy( vViewPosition ); 1555 vec3 normal = normalize( cross( fdx, fdy ) ); 1556#else 1557 vec3 normal = normalize( vNormal ); 1558 #ifdef DOUBLE_SIDED 1559 normal *= faceDirection; 1560 #endif 1561#endif 1562#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1563 #ifdef USE_TANGENT 1564 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1565 #else 1566 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1567 #if defined( USE_NORMALMAP ) 1568 vNormalMapUv 1569 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1570 vClearcoatNormalMapUv 1571 #else 1572 vUv 1573 #endif 1574 ); 1575 #endif 1576 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1577 tbn[0] *= faceDirection; 1578 tbn[1] *= faceDirection; 1579 #endif 1580#endif 1581#ifdef USE_CLEARCOAT_NORMALMAP 1582 #ifdef USE_TANGENT 1583 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1584 #else 1585 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1586 #endif 1587 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1588 tbn2[0] *= faceDirection; 1589 tbn2[1] *= faceDirection; 1590 #endif 1591#endif 1592vec3 nonPerturbedNormal = normal;`,yq=`#ifdef USE_NORMALMAP_OBJECTSPACE 1593 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1594 #ifdef FLIP_SIDED 1595 normal = - normal; 1596 #endif 1597 #ifdef DOUBLE_SIDED 1598 normal = normal * faceDirection; 1599 #endif 1600 normal = normalize( normalMatrix * normal ); 1601#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1602 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1603 mapN.xy *= normalScale; 1604 normal = normalize( tbn * mapN ); 1605#elif defined( USE_BUMPMAP )
1606 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1607#endif`,vq=`#ifndef FLAT_SHADED 1608 varying vec3 vNormal; 1609 #ifdef USE_TANGENT 1610 varying vec3 vTangent; 1611 varying vec3 vBitangent; 1612 #endif 1613#endif`,_q=`#ifndef FLAT_SHADED 1614 varying vec3 vNormal; 1615 #ifdef USE_TANGENT 1616 varying vec3 vTangent; 1617 varying vec3 vBitangent; 1618 #endif 1619#endif`,xq=`#ifndef FLAT_SHADED 1620 vNormal = normalize( transformedNormal ); 1621 #ifdef USE_TANGENT 1622 vTangent = normalize( transformedTangent ); 1623 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1624 #endif 1625#endif`,Sq=`#ifdef USE_NORMALMAP 1626 uniform sampler2D normalMap; 1627 uniform vec2 normalScale; 1628#endif 1629#ifdef USE_NORMALMAP_OBJECTSPACE 1630 uniform mat3 normalMatrix; 1631#endif 1632#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1633 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1634 vec3 q0 = dFdx( eye_pos.xyz ); 1635 vec3 q1 = dFdy( eye_pos.xyz ); 1636 vec2 st0 = dFdx( uv.st ); 1637 vec2 st1 = dFdy( uv.st ); 1638 vec3 N = surf_norm; 1639 vec3 q1perp = cross( q1, N ); 1640 vec3 q0perp = cross( N, q0 ); 1641 vec3 T = q1perp * st0.x + q0perp * st1.x; 1642 vec3 B = q1perp * st0.y + q0perp * st1.y; 1643 float det = max( dot( T, T ), dot( B, B ) ); 1644 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1645 return mat3( T * scale, B * scale, N ); 1646 } 1647#endif`,bq=`#ifdef USE_CLEARCOAT 1648 vec3 clearcoatNormal = nonPerturbedNormal; 1649#endif`,Tq=`#ifdef USE_CLEARCOAT_NORMALMAP 1650 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1651 clearcoatMapN.xy *= clearcoatNormalScale; 1652 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1653#endif`,Mq=`#ifdef USE_CLEARCOATMAP 1654 uniform sampler2D clearcoatMap; 1655#endif 1656#ifdef USE_CLEARCOAT_NORMALMAP 1657 uniform sampler2D clearcoatNormalMap; 1658 uniform vec2 clearcoatNormalScale; 1659#endif 1660#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1661 uniform sampler2D clearcoatRoughnessMap; 1662#endif`,Eq=`#ifdef USE_IRIDESCENCEMAP 1663 uniform sampler2D iridescenceMap; 1664#endif 1665#ifdef USE_IRIDESCENCE_THICKNESSMAP 1666 uniform sampler2D iridescenceThicknessMap; 1667#endif`,Aq=`#ifdef OPAQUE 1668diffuseColor.a = 1.0; 1669#endif 1670#ifdef USE_TRANSMISSION 1671diffuseColor.a *= material.transmissionAlpha; 1672#endif 1673gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Rq=`vec3 packNormalToRGB( const in vec3 normal ) { 1674 return normalize( normal ) * 0.5 + 0.5; 1675} 1676vec3 unpackRGBToNormal( const in vec3 rgb ) { 1677 return 2.0 * rgb.xyz - 1.0; 1678} 1679const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1680const float Inv255 = 1. / 255.; 1681const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1682const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1683const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1684const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1685vec4 packDepthToRGBA( const in float v ) { 1686 if( v <= 0.0 ) 1687 return vec4( 0., 0., 0., 0. ); 1688 if( v >= 1.0 ) 1689 return vec4( 1., 1., 1., 1. ); 1690 float vuf; 1691 float af = modf( v * PackFactors.a, vuf ); 1692 float bf = modf( vuf * ShiftRight8, vuf ); 1693 float gf = modf( vuf * ShiftRight8, vuf ); 1694 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1695} 1696vec3 packDepthToRGB( const in float v ) { 1697 if( v <= 0.0 ) 1698 return vec3( 0., 0., 0. ); 1699 if( v >= 1.0 ) 1700 return vec3( 1., 1., 1. ); 1701 float vuf; 1702 float bf = modf( v * PackFactors.b, vuf ); 1703 float gf = modf( vuf * ShiftRight8, vuf ); 1704 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1705} 1706vec2 packDepthToRG( const in float v ) { 1707 if( v <= 0.0 ) 1708 return vec2( 0., 0. ); 1709 if( v >= 1.0 ) 1710 return vec2( 1., 1. ); 1711 float vuf; 1712 float gf = modf( v * 256., vuf ); 1713 return vec2( vuf * Inv255, gf ); 1714} 1715float unpackRGBAToDepth( const in vec4 v ) { 1716 return dot( v, UnpackFactors4 ); 1717} 1718float unpackRGBToDepth( const in vec3 v ) { 1719 return dot( v, UnpackFactors3 ); 1720} 1721float unpackRGToDepth( const in vec2 v ) { 1722 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1723} 1724vec4 pack2HalfToRGBA( const in vec2 v ) {
1725 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1726 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1727} 1728vec2 unpackRGBATo2Half( const in vec4 v ) { 1729 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1730} 1731float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1732 return ( viewZ + near ) / ( near - far ); 1733} 1734float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1735 return depth * ( near - far ) - near; 1736} 1737float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1738 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1739} 1740float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1741 return ( near * far ) / ( ( far - near ) * depth - far ); 1742}`,Nq=`#ifdef PREMULTIPLIED_ALPHA 1743 gl_FragColor.rgb *= gl_FragColor.a; 1744#endif`,Cq=`vec4 mvPosition = vec4( transformed, 1.0 ); 1745#ifdef USE_BATCHING 1746 mvPosition = batchingMatrix * mvPosition; 1747#endif 1748#ifdef USE_INSTANCING 1749 mvPosition = instanceMatrix * mvPosition; 1750#endif 1751mvPosition = modelViewMatrix * mvPosition; 1752gl_Position = projectionMatrix * mvPosition;`,wq=`#ifdef DITHERING 1753 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1754#endif`,Dq=`#ifdef DITHERING 1755 vec3 dithering( vec3 color ) { 1756 float grid_position = rand( gl_FragCoord.xy ); 1757 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1758 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1759 return color + dither_shift_RGB; 1760 } 1761#endif`,Uq=`float roughnessFactor = roughness; 1762#ifdef USE_ROUGHNESSMAP 1763 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1764 roughnessFactor *= texelRoughness.g; 1765#endif`,Lq=`#ifdef USE_ROUGHNESSMAP 1766 uniform sampler2D roughnessMap; 1767#endif`,Bq=`#if NUM_SPOT_LIGHT_COORDS > 0 1768 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1769#endif 1770#if NUM_SPOT_LIGHT_MAPS > 0 1771 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1772#endif 1773#ifdef USE_SHADOWMAP 1774 #if NUM_DIR_LIGHT_SHADOWS > 0 1775 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1776 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1777 struct DirectionalLightShadow { 1778 float shadowIntensity; 1779 float shadowBias; 1780 float shadowNormalBias; 1781 float shadowRadius; 1782 vec2 shadowMapSize; 1783 }; 1784 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1785 #endif 1786 #if NUM_SPOT_LIGHT_SHADOWS > 0 1787 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1788 struct SpotLightShadow { 1789 float shadowIntensity; 1790 float shadowBias; 1791 float shadowNormalBias; 1792 float shadowRadius; 1793 vec2 shadowMapSize; 1794 }; 1795 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1796 #endif 1797 #if NUM_POINT_LIGHT_SHADOWS > 0 1798 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1799 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1800 struct PointLightShadow { 1801 float shadowIntensity; 1802 float shadowBias; 1803 float shadowNormalBias; 1804 float shadowRadius; 1805 vec2 shadowMapSize; 1806 float shadowCameraNear; 1807 float shadowCameraFar; 1808 }; 1809 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1810 #endif 1811 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1812 float depth = unpackRGBAToDepth( texture2D( depths, uv ) ); 1813 #ifdef USE_REVERSED_DEPTH_BUFFER 1814 return step( depth, compare ); 1815 #else 1816 return step( compare, depth ); 1817 #endif 1818 } 1819 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1820 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1821 } 1822 float VSMShadow( sampler2D shadow, vec2 uv, float compare ) { 1823 float occlusion = 1.0; 1824 vec2 distribution = texture2DDistribution( shadow, uv ); 1825 #ifdef USE_REVERSED_DEPTH_BUFFER 1826 float hard_shadow = step( distribution.x, compare ); 1827 #else 1828 float hard_shadow = step( compare, distribution.x ); 1829 #endif 1830 if ( hard_shadow != 1.0 ) { 1831 float distance = compare - distribution.x
vendor: 6,963 bytes, lines 1831-1962
1831; 1832 float variance = max( 0.00000, distribution.y * distribution.y ); 1833 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1834 } 1835 return occlusion; 1836 } 1837 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1838 float shadow = 1.0; 1839 shadowCoord.xyz /= shadowCoord.w; 1840 shadowCoord.z += shadowBias; 1841 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1842 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1843 if ( frustumTest ) { 1844 #if defined( SHADOWMAP_TYPE_PCF ) 1845 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1846 float dx0 = - texelSize.x * shadowRadius; 1847 float dy0 = - texelSize.y * shadowRadius; 1848 float dx1 = + texelSize.x * shadowRadius; 1849 float dy1 = + texelSize.y * shadowRadius; 1850 float dx2 = dx0 / 2.0; 1851 float dy2 = dy0 / 2.0; 1852 float dx3 = dx1 / 2.0; 1853 float dy3 = dy1 / 2.0; 1854 shadow = ( 1855 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1856 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1857 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1858 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1859 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1860 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1861 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1862 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1863 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1864 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1865 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1866 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1867 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1868 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1869 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1870 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1871 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1872 ) * ( 1.0 / 17.0 ); 1873 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1874 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1875 float dx = texelSize.x; 1876 float dy = texelSize.y; 1877 vec2 uv = shadowCoord.xy; 1878 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1879 uv -= f * texelSize; 1880 shadow = ( 1881 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1882 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1883 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1884 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1885 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1886 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1887 f.x ) + 1888 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1889 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1890 f.x ) + 1891 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1892 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1893 f.y ) + 1894 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1895 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1896 f.y ) + 1897 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1898 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1899 f.x ), 1900 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1901 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1902 f.x ), 1903 f.y ) 1904 ) * ( 1.0 / 9.0 ); 1905 #elif defined( SHADOWMAP_TYPE_VSM ) 1906 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1907 #else 1908 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1909 #endif 1910 } 1911 return mix( 1.0, shadow, shadowIntensity ); 1912 } 1913 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1914 vec3 absV = abs( v ); 1915 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1916 absV *= scaleToCube; 1917 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1918 vec2 planar = v.xy; 1919 float almostATexel = 1.5 * texelSizeY; 1920 float almostOne = 1.0 - almostATexel; 1921 if ( absV.z >= almostOne ) { 1922 if ( v.z > 0.0 ) 1923 planar.x = 4.0 - v.x; 1924 } else if ( absV.x >= almostOne ) { 1925 float signX = sign( v.x ); 1926 planar.x = v.z * signX + 2.0 * signX; 1927 } else if ( absV.y >= almostOne ) { 1928 float signY = sign( v.y ); 1929 planar.x = v.x + 2.0 * signY + 2.0; 1930 planar.y = v.z * signY - 2.0; 1931 } 1932 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1933 } 1934 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1935 float shadow = 1.0; 1936 vec3 lightToPosition = shadowCoord.xyz; 1937 1938 float lightToPositionLength = length( lightToPosition ); 1939 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1940 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1941 vec3 bd3D = normalize( lightToPosition ); 1942 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1943 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1944 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1945 shadow = ( 1946 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1947 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1948 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1949 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1950 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1951 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1952 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1953 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1954 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1955 ) * ( 1.0 / 9.0 ); 1956 #else 1957 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1958 #endif 1959 } 1960 return mix( 1.0, shadow, shadowIntensity ); 1961 } 1962#endif`,
1962Pq=`#if NUM_SPOT_LIGHT_COORDS > 0 1963 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1964 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1965#endif 1966#ifdef USE_SHADOWMAP 1967 #if NUM_DIR_LIGHT_SHADOWS > 0 1968 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1969 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1970 struct DirectionalLightShadow { 1971 float shadowIntensity; 1972 float shadowBias; 1973 float shadowNormalBias; 1974 float shadowRadius; 1975 vec2 shadowMapSize; 1976 }; 1977 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1978 #endif 1979 #if NUM_SPOT_LIGHT_SHADOWS > 0 1980 struct SpotLightShadow { 1981 float shadowIntensity; 1982 float shadowBias; 1983 float shadowNormalBias; 1984 float shadowRadius; 1985 vec2 shadowMapSize; 1986 }; 1987 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1988 #endif 1989 #if NUM_POINT_LIGHT_SHADOWS > 0 1990 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1991 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1992 struct PointLightShadow { 1993 float shadowIntensity; 1994 float shadowBias; 1995 float shadowNormalBias; 1996 float shadowRadius; 1997 vec2 shadowMapSize; 1998 float shadowCameraNear; 1999 float shadowCameraFar; 2000 }; 2001 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 2002 #endif 2003#endif`,Oq=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 2004 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 2005 vec4 shadowWorldPosition; 2006#endif 2007#if defined( USE_SHADOWMAP ) 2008 #if NUM_DIR_LIGHT_SHADOWS > 0 2009 #pragma unroll_loop_start 2010 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2011 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 2012 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 2013 } 2014 #pragma unroll_loop_end 2015 #endif 2016 #if NUM_POINT_LIGHT_SHADOWS > 0 2017 #pragma unroll_loop_start 2018 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2019 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 2020 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 2021 } 2022 #pragma unroll_loop_end 2023 #endif 2024#endif 2025#if NUM_SPOT_LIGHT_COORDS > 0 2026 #pragma unroll_loop_start 2027 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 2028 shadowWorldPosition = worldPosition; 2029 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 2030 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 2031 #endif 2032 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 2033 } 2034 #pragma unroll_loop_end 2035#endif`,Iq=`float getShadowMask() { 2036 float shadow = 1.0; 2037 #ifdef USE_SHADOWMAP 2038 #if NUM_DIR_LIGHT_SHADOWS > 0 2039 DirectionalLightShadow directionalLight; 2040 #pragma unroll_loop_start 2041 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 2042 directionalLight = directionalLightShadows[ i ]; 2043 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 2044 } 2045 #pragma unroll_loop_end 2046 #endif 2047 #if NUM_SPOT_LIGHT_SHADOWS > 0 2048 SpotLightShadow spotLight; 2049 #pragma unroll_loop_start 2050 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 2051 spotLight = spotLightShadows[ i ]; 2052 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 2053 } 2054 #pragma unroll_loop_end 2055 #endif 2056 #if NUM_POINT_LIGHT_SHADOWS > 0 2057 PointLightShadow pointLight; 2058 #pragma unroll_loop_start 2059 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 2060 pointLight = pointLightShadows[ i ]; 2061 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 2062 } 2063 #pragma unroll_loop_end 2064 #endif 2065 #endif 2066 return shadow; 2067}`,Fq=`#ifdef USE_SKINNING 2068 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 2069 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 2070 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 2071 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 2072#endif`,Vq=`#ifdef USE_SKINNING 2073 uniform mat4 bindMatrix; 2074 uniform mat4 bindMatrixInverse; 2075 uniform highp sampler2D boneTexture; 2076 mat4 getBoneMatrix( const in float i ) { 2077 int size = textureSize( boneTexture, 0 ).x; 2078 int j = int( i ) * 4; 2079 int x = j % size; 2080 int y = j / size; 2081 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2082 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2083 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2084 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2085 return mat4( v1, v2, v3, v4 ); 2086 } 2087#endif`,zq=`#ifdef USE_SKINNING 2088 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2089 vec4 skinned = vec4( 0.0 ); 2090 skinned += boneMatX * skinVertex * skinWeight.x; 2091 skinned += boneMatY * skinVertex * skinWeight.y; 2092 skinned += boneMatZ * skinVertex * skinWeight.z; 2093 skinned += boneMatW * skinVertex * skinWeight.w; 2094 transformed = ( bindMatrixInverse * skinned ).xyz; 2095#endif`,Gq=`#ifdef USE_SKINNING 2096 mat4 skinMatrix = mat4( 0.0 ); 2097 skinMatrix += skinWeight.x * boneMatX; 2098 skinMatrix += skinWeight.y * boneMatY; 2099 skinMatrix += skinWeight.z * boneMatZ; 2100 skinMatrix += skinWeight.w * boneMatW; 2101 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2102 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2103 #ifdef USE_TANGENT 2104 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2105 #endif 2106#endif`,Hq=`float specularStrength; 2107#ifdef USE_SPECULARMAP 2108 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2109 specularStrength = texelSpecular.r; 2110#else 2111 specularStrength = 1.0; 2112#endif`,kq=`#ifdef USE_SPECULARMAP 2113 uniform sampler2D specularMap; 2114#endif`,qq=`#if defined( TONE_MAPPING ) 2115 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2116#endif`,Wq=`#ifndef saturate 2117#define saturate( a ) clamp( a, 0.0, 1.0 ) 2118#endif 2119uniform float toneMappingExposure; 2120vec3 LinearToneMapping( vec3 color ) { 2121 return saturate( toneMappingExposure * color ); 2122} 2123vec3 ReinhardToneMapping( vec3 color ) { 2124 color *= toneMappingExposure; 2125 return saturate( color / ( vec3( 1.0 ) + color ) ); 2126} 2127vec3 CineonToneMapping( vec3 color ) { 2128 color *= toneMappingExposure; 2129 color = max( vec3( 0.0 ), color - 0.004 ); 2130 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2131} 2132vec3 RRTAndODTFit( vec3 v ) { 2133 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2134 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2135 return a / b; 2136} 2137vec3 ACESFilmicToneMapping( vec3 color ) { 2138 const mat3 ACESInputMat = mat3( 2139 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2140 vec3( 0.04823, 0.01566, 0.83777 ) 2141 ); 2142 const mat3 ACESOutputMat = mat3( 2143 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2144 vec3( -0.07367, -0.00605, 1.07602 ) 2145 ); 2146 color *= toneMappingExposure / 0.6; 2147 color = ACESInputMat * color; 2148 color = RRTAndODTFit( color ); 2149 color = ACESOutputMat * color; 2150 return saturate( color ); 2151} 2152const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2153 vec3( 1.6605, - 0.1246, - 0.0182 ), 2154 vec3( - 0.5876, 1.1329, - 0.1006 ), 2155 vec3( - 0.0728, - 0.0083, 1.1187 ) 2156); 2157const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2158 vec3( 0.6274, 0.0691, 0.0164 ), 2159 vec3( 0.3293, 0.9195, 0.0880 ), 2160 vec3( 0.0433, 0.0113, 0.8956 ) 2161); 2162vec3 agxDefaultContrastApprox( vec3 x ) { 2163 vec3 x2 = x * x; 2164 vec3 x4 = x2 * x2; 2165 return + 15.5 * x4 * x2 2166 - 40.14 * x4 * x 2167 + 31.96 * x4 2168 - 6.868 * x2 * x 2169 + 0.4298 * x2 2170 + 0.1191 * x 2171 - 0.00232; 2172} 2173vec3 AgXToneMapping( vec3 color ) { 2174 const mat3 AgXInsetMatrix = mat3( 2175 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2176 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2177 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2178 );
2179 const mat3 AgXOutsetMatrix = mat3( 2180 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2181 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2182 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2183 ); 2184 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2185 color *= toneMappingExposure; 2186 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2187 color = AgXInsetMatrix * color; 2188 color = max( color, 1e-10 ); color = log2( color ); 2189 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2190 color = clamp( color, 0.0, 1.0 ); 2191 color = agxDefaultContrastApprox( color ); 2192 color = AgXOutsetMatrix * color; 2193 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2194 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2195 color = clamp( color, 0.0, 1.0 ); 2196 return color; 2197} 2198vec3 NeutralToneMapping( vec3 color ) { 2199 const float StartCompression = 0.8 - 0.04; 2200 const float Desaturation = 0.15; 2201 color *= toneMappingExposure; 2202 float x = min( color.r, min( color.g, color.b ) ); 2203 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2204 color -= offset; 2205 float peak = max( color.r, max( color.g, color.b ) ); 2206 if ( peak < StartCompression ) return color; 2207 float d = 1. - StartCompression; 2208 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2209 color *= newPeak / peak; 2210 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2211 return mix( color, vec3( newPeak ), g ); 2212} 2213vec3 CustomToneMapping( vec3 color ) { return color; }`,Xq=`#ifdef USE_TRANSMISSION 2214 material.transmission = transmission; 2215 material.transmissionAlpha = 1.0; 2216 material.thickness = thickness; 2217 material.attenuationDistance = attenuationDistance; 2218 material.attenuationColor = attenuationColor; 2219 #ifdef USE_TRANSMISSIONMAP 2220 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2221 #endif 2222 #ifdef USE_THICKNESSMAP 2223 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2224 #endif 2225 vec3 pos = vWorldPosition; 2226 vec3 v = normalize( cameraPosition - pos ); 2227 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2228 vec4 transmitted = getIBLVolumeRefraction( 2229 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2230 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2231 material.attenuationColor, material.attenuationDistance ); 2232 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2233 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2234#endif`,Yq=`#ifdef USE_TRANSMISSION 2235 uniform float transmission; 2236 uniform float thickness; 2237 uniform float attenuationDistance; 2238 uniform vec3 attenuationColor; 2239 #ifdef USE_TRANSMISSIONMAP 2240 uniform sampler2D transmissionMap; 2241 #endif 2242 #ifdef USE_THICKNESSMAP 2243 uniform sampler2D thicknessMap; 2244 #endif 2245 uniform vec2 transmissionSamplerSize; 2246 uniform sampler2D transmissionSamplerMap; 2247 uniform mat4 modelMatrix; 2248 uniform mat4 projectionMatrix; 2249 varying vec3 vWorldPosition; 2250 float w0( float a ) { 2251 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2252 } 2253 float w1( float a ) { 2254 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2255 } 2256 float w2( float a ){ 2257 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2258 } 2259 float w3( float a ) { 2260 return ( 1.0 / 6.0 ) * ( a * a * a ); 2261 } 2262 float g0( float a ) { 2263 return w0( a ) + w1( a ); 2264 } 2265 float g1( float a ) { 2266 return w2( a ) + w3( a ); 2267 } 2268 float h0( float a ) { 2269 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2270 } 2271 float h1( float a ) { 2272 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2273 } 2274 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2275 uv = uv * texelSize.zw + 0.5; 2276 vec2 iuv = floor( uv ); 2277 vec2 fuv = fract( uv ); 2278 float g0x = g0( fuv.x ); 2279 float g1x = g1( fuv.x ); 2280 float h0x = h0( fuv.x ); 2281 float h1x = h1( fuv.x ); 2282 float h0y = h0( fuv.y ); 2283 float h1y = h1( fuv.y ); 2284 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2285 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2286 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2287 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2288 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2289 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2290 } 2291 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2292 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2293 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2294 vec2 fLodSizeInv = 1.0 / fLodSize; 2295 vec2 cLodSizeInv = 1.0 / cLodSize; 2296 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2297 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2298 return mix( fSample, cSample, fract( lod ) ); 2299 } 2300 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2301 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2302 vec3 modelScale; 2303 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2304 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2305 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2306 return normalize( refractionVector ) * thickness * modelScale; 2307 } 2308 float applyIorToRoughness( const in float roughness, const in float ior ) { 2309 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2310 } 2311 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2312 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2313 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2314 } 2315 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2316 if ( isinf( attenuationDistance ) ) { 2317 return vec3( 1.0 ); 2318 } else { 2319 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2320 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2321 } 2322 } 2323 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2324 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2325 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2326 const in vec3 attenuationColor, const in float attenuationDistance ) { 2327 vec4 transmittedLight; 2328 vec3 transmittance; 2329 #ifdef USE_DISPERSION 2330 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2331 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2332 for ( int i = 0; i < 3; i ++ ) { 2333 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2334 vec3 refractedRayExit = position + transmissionRay; 2335 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2336 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2337 refractionCoords += 1.0; 2338 refractionCoords /= 2.0; 2339 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2340 transmittedLight[ i ] = transmissionSample[ i ]; 2341 transmittedLight.a += transmissionSample.a; 2342 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2343 } 2344 transmittedLight.a /= 3.0; 2345 #else 2346 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2347 vec3 refractedRayExit = position + transmissionRay; 2348 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2349 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2350 refractionCoords += 1.0; 2351 refractionCoords /= 2.0; 2352 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2353 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2354 #endif 2355 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2356 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2357 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2358 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2359 } 2360#endif`,jq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2361 varying vec2 vUv; 2362#endif 2363#ifdef USE_MAP 2364 varying vec2 vMapUv; 2365#endif 2366#ifdef USE_ALPHAMAP
2367 varying vec2 vAlphaMapUv; 2368#endif 2369#ifdef USE_LIGHTMAP 2370 varying vec2 vLightMapUv; 2371#endif 2372#ifdef USE_AOMAP 2373 varying vec2 vAoMapUv; 2374#endif 2375#ifdef USE_BUMPMAP 2376 varying vec2 vBumpMapUv; 2377#endif 2378#ifdef USE_NORMALMAP 2379 varying vec2 vNormalMapUv; 2380#endif 2381#ifdef USE_EMISSIVEMAP 2382 varying vec2 vEmissiveMapUv; 2383#endif 2384#ifdef USE_METALNESSMAP 2385 varying vec2 vMetalnessMapUv; 2386#endif 2387#ifdef USE_ROUGHNESSMAP 2388 varying vec2 vRoughnessMapUv; 2389#endif 2390#ifdef USE_ANISOTROPYMAP 2391 varying vec2 vAnisotropyMapUv; 2392#endif 2393#ifdef USE_CLEARCOATMAP 2394 varying vec2 vClearcoatMapUv; 2395#endif 2396#ifdef USE_CLEARCOAT_NORMALMAP 2397 varying vec2 vClearcoatNormalMapUv; 2398#endif 2399#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2400 varying vec2 vClearcoatRoughnessMapUv; 2401#endif 2402#ifdef USE_IRIDESCENCEMAP 2403 varying vec2 vIridescenceMapUv; 2404#endif 2405#ifdef USE_IRIDESCENCE_THICKNESSMAP 2406 varying vec2 vIridescenceThicknessMapUv; 2407#endif 2408#ifdef USE_SHEEN_COLORMAP 2409 varying vec2 vSheenColorMapUv; 2410#endif 2411#ifdef USE_SHEEN_ROUGHNESSMAP 2412 varying vec2 vSheenRoughnessMapUv; 2413#endif 2414#ifdef USE_SPECULARMAP 2415 varying vec2 vSpecularMapUv; 2416#endif 2417#ifdef USE_SPECULAR_COLORMAP 2418 varying vec2 vSpecularColorMapUv; 2419#endif 2420#ifdef USE_SPECULAR_INTENSITYMAP 2421 varying vec2 vSpecularIntensityMapUv; 2422#endif 2423#ifdef USE_TRANSMISSIONMAP 2424 uniform mat3 transmissionMapTransform; 2425 varying vec2 vTransmissionMapUv; 2426#endif 2427#ifdef USE_THICKNESSMAP 2428 uniform mat3 thicknessMapTransform; 2429 varying vec2 vThicknessMapUv; 2430#endif`,Kq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2431 varying vec2 vUv; 2432#endif 2433#ifdef USE_MAP 2434 uniform mat3 mapTransform; 2435 varying vec2 vMapUv; 2436#endif 2437#ifdef USE_ALPHAMAP 2438 uniform mat3 alphaMapTransform; 2439 varying vec2 vAlphaMapUv; 2440#endif 2441#ifdef USE_LIGHTMAP 2442 uniform mat3 lightMapTransform; 2443 varying vec2 vLightMapUv; 2444#endif 2445#ifdef USE_AOMAP 2446 uniform mat3 aoMapTransform; 2447 varying vec2 vAoMapUv; 2448#endif 2449#ifdef USE_BUMPMAP 2450 uniform mat3 bumpMapTransform; 2451 varying vec2 vBumpMapUv; 2452#endif 2453#ifdef USE_NORMALMAP 2454 uniform mat3 normalMapTransform; 2455 varying vec2 vNormalMapUv; 2456#endif 2457#ifdef USE_DISPLACEMENTMAP 2458 uniform mat3 displacementMapTransform; 2459 varying vec2 vDisplacementMapUv; 2460#endif 2461#ifdef USE_EMISSIVEMAP 2462 uniform mat3 emissiveMapTransform; 2463 varying vec2 vEmissiveMapUv; 2464#endif 2465#ifdef USE_METALNESSMAP 2466 uniform mat3 metalnessMapTransform; 2467 varying vec2 vMetalnessMapUv; 2468#endif 2469#ifdef USE_ROUGHNESSMAP 2470 uniform mat3 roughnessMapTransform; 2471 varying vec2 vRoughnessMapUv; 2472#endif 2473#ifdef USE_ANISOTROPYMAP 2474 uniform mat3 anisotropyMapTransform; 2475 varying vec2 vAnisotropyMapUv; 2476#endif 2477#ifdef USE_CLEARCOATMAP 2478 uniform mat3 clearcoatMapTransform; 2479 varying vec2 vClearcoatMapUv; 2480#endif 2481#ifdef USE_CLEARCOAT_NORMALMAP 2482 uniform mat3 clearcoatNormalMapTransform; 2483 varying vec2 vClearcoatNormalMapUv; 2484#endif 2485#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2486 uniform mat3 clearcoatRoughnessMapTransform; 2487 varying vec2 vClearcoatRoughnessMapUv; 2488#endif 2489#ifdef USE_SHEEN_COLORMAP 2490 uniform mat3 sheenColorMapTransform; 2491 varying vec2 vSheenColorMapUv; 2492#endif 2493#ifdef USE_SHEEN_ROUGHNESSMAP 2494 uniform mat3 sheenRoughnessMapTransform; 2495 varying vec2 vSheenRoughnessMapUv; 2496#endif 2497#ifdef USE_IRIDESCENCEMAP 2498 uniform mat3 iridescenceMapTransform; 2499 varying vec2 vIridescenceMapUv; 2500#endif 2501#ifdef USE_IRIDESCENCE_THICKNESSMAP 2502 uniform mat3 iridescenceThicknessMapTransform; 2503 varying vec2 vIridescenceThicknessMapUv; 2504#endif 2505#ifdef USE_SPECULARMAP 2506 uniform mat3 specularMapTransform; 2507 varying vec2 vSpecularMapUv; 2508#endif 2509#ifdef USE_SPECULAR_COLORMAP 2510 uniform mat3 specularColorMapTransform; 2511 varying vec2 vSpecularColorMapUv; 2512#endif 2513#ifdef USE_SPECULAR_INTENSITYMAP 2514 uniform mat3 specularIntensityMapTransform; 2515 varying vec2 vSpecularIntensityMapUv; 2516#endif 2517#ifdef USE_TRANSMISSIONMAP 2518 uniform mat3 transmissionMapTransform; 2519 varying vec2 vTransmissionMapUv; 2520#endif 2521#ifdef USE_THICKNESSMAP 2522 uniform mat3 thicknessMapTransform; 2523 varying vec2 vThicknessMapUv; 2524#endif`,Zq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2525 vUv = vec3( uv, 1 ).xy; 2526#endif 2527#ifdef USE_MAP 2528 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2529#endif 2530#ifdef USE_ALPHAMAP 2531 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2532#endif 2533#ifdef USE_LIGHTMAP 2534 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2535#endif 2536#ifdef USE_AOMAP 2537 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2538#endif 2539#ifdef USE_BUMPMAP 2540 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2541#endif 2542#ifdef USE_NORMALMAP 2543 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2544#endif 2545#ifdef USE_DISPLACEMENTMAP 2546 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2547#endif 2548#ifdef USE_EMISSIVEMAP 2549 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2550#endif 2551#ifdef USE_METALNESSMAP 2552 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2553#endif 2554#ifdef USE_ROUGHNESSMAP 2555 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2556#endif 2557#ifdef USE_ANISOTROPYMAP 2558 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2559#endif 2560#ifdef USE_CLEARCOATMAP 2561 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2562#endif 2563#ifdef USE_CLEARCOAT_NORMALMAP 2564 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2565#endif 2566#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2567 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2568#endif
2569#ifdef USE_IRIDESCENCEMAP 2570 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2571#endif 2572#ifdef USE_IRIDESCENCE_THICKNESSMAP 2573 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2574#endif 2575#ifdef USE_SHEEN_COLORMAP 2576 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2577#endif 2578#ifdef USE_SHEEN_ROUGHNESSMAP 2579 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2580#endif 2581#ifdef USE_SPECULARMAP 2582 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2583#endif 2584#ifdef USE_SPECULAR_COLORMAP 2585 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2586#endif 2587#ifdef USE_SPECULAR_INTENSITYMAP 2588 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2589#endif 2590#ifdef USE_TRANSMISSIONMAP 2591 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2592#endif 2593#ifdef USE_THICKNESSMAP 2594 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2595#endif`,Qq=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2596 vec4 worldPosition = vec4( transformed, 1.0 ); 2597 #ifdef USE_BATCHING 2598 worldPosition = batchingMatrix * worldPosition; 2599 #endif 2600 #ifdef USE_INSTANCING 2601 worldPosition = instanceMatrix * worldPosition; 2602 #endif 2603 worldPosition = modelMatrix * worldPosition; 2604#endif`;const $q=`varying vec2 vUv; 2605uniform mat3 uvTransform; 2606void main() { 2607 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2608 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2609}`,Jq=`uniform sampler2D t2D; 2610uniform float backgroundIntensity; 2611varying vec2 vUv; 2612void main() { 2613 vec4 texColor = texture2D( t2D, vUv ); 2614 #ifdef DECODE_VIDEO_TEXTURE 2615 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 2616 #endif 2617 texColor.rgb *= backgroundIntensity; 2618 gl_FragColor = texColor; 2619 #include <tonemapping_fragment> 2620 #include <colorspace_fragment> 2621}`,eW=`varying vec3 vWorldDirection; 2622#include <common> 2623void main() { 2624 vWorldDirection = transformDirection( position, modelMatrix ); 2625 #include <begin_vertex> 2626 #include <project_vertex> 2627 gl_Position.z = gl_Position.w; 2628}`,tW=`#ifdef ENVMAP_TYPE_CUBE 2629 uniform samplerCube envMap; 2630#elif defined( ENVMAP_TYPE_CUBE_UV ) 2631 uniform sampler2D envMap; 2632#endif 2633uniform float flipEnvMap; 2634uniform float backgroundBlurriness; 2635uniform float backgroundIntensity; 2636uniform mat3 backgroundRotation; 2637varying vec3 vWorldDirection; 2638#include <cube_uv_reflection_fragment> 2639void main() { 2640 #ifdef ENVMAP_TYPE_CUBE 2641 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2642 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2643 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2644 #else 2645 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2646 #endif 2647 texColor.rgb *= backgroundIntensity; 2648 gl_FragColor = texColor; 2649 #include <tonemapping_fragment> 2650 #include <colorspace_fragment> 2651}`,nW=`varying vec3 vWorldDirection; 2652#include <common> 2653void main() { 2654 vWorldDirection = transformDirection( position, modelMatrix ); 2655 #include <begin_vertex> 2656 #include <project_vertex> 2657 gl_Position.z = gl_Position.w; 2658}`,iW=`uniform samplerCube tCube; 2659uniform float tFlip; 2660uniform float opacity; 2661varying vec3 vWorldDirection; 2662void main() { 2663 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2664 gl_FragColor = texColor; 2665 gl_FragColor.a *= opacity; 2666 #include <tonemapping_fragment> 2667 #include <colorspace_fragment> 2668}`,sW=`#include <common> 2669#include <batching_pars_vertex> 2670#include <uv_pars_vertex> 2671#include <displacementmap_pars_vertex> 2672#include <morphtarget_pars_vertex> 2673#include <skinning_pars_vertex> 2674#include <logdepthbuf_pars_vertex> 2675#include <clipping_planes_pars_vertex> 2676varying vec2 vHighPrecisionZW; 2677void main() { 2678 #include <uv_vertex> 2679 #include <batching_vertex> 2680 #include <skinbase_vertex> 2681 #include <morphinstance_vertex> 2682 #ifdef USE_DISPLACEMENTMAP 2683 #include <beginnormal_vertex> 2684 #include <morphnormal_vertex> 2685 #include <skinnormal_vertex> 2686 #endif 2687 #include <begin_vertex> 2688 #include <morphtarget_vertex> 2689 #include <skinning_vertex> 2690 #include <displacementmap_vertex> 2691 #include <project_vertex> 2692 #include <logdepthbuf_vertex> 2693 #include <clipping_planes_vertex> 2694 vHighPrecisionZW = gl_Position.zw; 2695}`,rW=`#if DEPTH_PACKING == 3200 2696 uniform float opacity; 2697#endif 2698#include <common> 2699#include <packing> 2700#include <uv_pars_fragment> 2701#include <map_pars_fragment> 2702#include <alphamap_pars_fragment> 2703#include <alphatest_pars_fragment> 2704#include <alphahash_pars_fragment> 2705#include <logdepthbuf_pars_fragment> 2706#include <clipping_planes_pars_fragment> 2707varying vec2 vHighPrecisionZW; 2708void main() { 2709 vec4 diffuseColor = vec4( 1.0 ); 2710 #include <clipping_planes_fragment> 2711 #if DEPTH_PACKING == 3200 2712 diffuseColor.a = opacity; 2713 #endif 2714 #include <map_fragment> 2715 #include <alphamap_fragment> 2716 #include <alphatest_fragment> 2717 #include <alphahash_fragment> 2718 #include <logdepthbuf_fragment> 2719 #ifdef USE_REVERSED_DEPTH_BUFFER 2720 float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; 2721 #else 2722 float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; 2723 #endif 2724 #if DEPTH_PACKING == 3200 2725 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2726 #elif DEPTH_PACKING == 3201 2727 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2728 #elif DEPTH_PACKING == 3202 2729 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2730 #elif DEPTH_PACKING == 3203 2731 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2732 #endif 2733}`,aW=`#define DISTANCE 2734varying vec3 vWorldPosition; 2735#include <common> 2736#include <batching_pars_vertex> 2737#include <uv_pars_vertex> 2738#include <displacementmap_pars_vertex> 2739#include <morphtarget_pars_vertex> 2740#include <skinning_pars_vertex> 2741#include <clipping_planes_pars_vertex> 2742void main() { 2743 #include <uv_vertex> 2744 #include <batching_vertex> 2745 #include <skinbase_vertex> 2746 #include <morphinstance_vertex> 2747 #ifdef USE_DISPLACEMENTMAP 2748 #include <beginnormal_vertex> 2749 #include <morphnormal_vertex> 2750 #include <skinnormal_vertex> 2751 #endif 2752 #include <begin_vertex> 2753 #include <morphtarget_vertex> 2754 #include <skinning_vertex> 2755 #include <displacementmap_vertex> 2756 #include <project_vertex> 2757 #include <worldpos_vertex> 2758 #include <clipping_planes_vertex> 2759 vWorldPosition = worldPosition.xyz; 2760}`,oW=`#define DISTANCE 2761uniform vec3 referencePosition; 2762uniform float nearDistance; 2763uniform float farDistance; 2764varying vec3 vWorldPosition; 2765#include <common> 2766#include <packing> 2767#include <uv_pars_fragment> 2768#include <map_pars_fragment> 2769#include <alphamap_pars_fragment> 2770#include <alphatest_pars_fragment> 2771#include <alphahash_pars_fragment> 2772#include <clipping_planes_pars_fragment> 2773void main () { 2774 vec4 diffuseColor = vec4( 1.0 ); 2775 #include <clipping_planes_fragment> 2776 #include <map_fragment> 2777 #include <alphamap_fragment> 2778 #include <alphatest_fragment> 2779 #include <alphahash_fragment> 2780 float dist = length( vWorldPosition - referencePosition ); 2781 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2782 dist = saturate( dist ); 2783 gl_FragColor = packDepthToRGBA( dist ); 2784}`,lW=`varying vec3 vWorldDirection; 2785#include <common> 2786void main() { 2787 vWorldDirection = transformDirection( position, modelMatrix ); 2788 #include <begin_vertex> 2789 #include <project_vertex> 2790}`,uW=`uniform sampler2D tEquirect; 2791varying vec3 vWorldDirection; 2792#include <common> 2793void main() { 2794 vec3 direction = normalize( vWorldDirection ); 2795 vec2 sampleUV = equirectUv( direction ); 2796 gl_FragColor = texture2D( tEquirect, sampleUV ); 2797 #include <tonemapping_fragment> 2798 #include <colorspace_fragment> 2799}`,cW=`uniform float scale; 2800attribute float lineDistance; 2801varying float vLineDistance; 2802#include <common> 2803#include <uv_pars_vertex> 2804#include <color_pars_vertex> 2805#include <fog_pars_vertex> 2806#include <morphtarget_pars_vertex> 2807#include <logdepthbuf_pars_vertex> 2808#include <clipping_planes_pars_vertex> 2809void main() { 2810 vLineDistance = scale * lineDistance; 2811 #include <uv_vertex> 2812 #include <color_vertex> 2813 #include <morphinstance_vertex> 2814 #include <morphcolor_vertex> 2815 #include <begin_vertex> 2816 #include <morphtarget_vertex> 2817 #include <project_vertex> 2818 #include <logdepthbuf_vertex> 2819 #include <clipping_planes_vertex> 2820 #include <fog_vertex> 2821}`,hW=`uniform vec3 diffuse; 2822uniform float opacity; 2823uniform float dashSize; 2824uniform float totalSize; 2825varying float vLineDistance; 2826#include <common> 2827#include <color_pars_fragment> 2828#include <uv_pars_fragment> 2829#include <map_pars_fragment> 2830#include <fog_pars_fragment> 2831#include <logdepthbuf_pars_fragment> 2832#include <clipping_planes_pars_fragment> 2833void main() { 2834 vec4 diffuseColor = vec4( diffuse, opacity ); 2835 #include <clipping_planes_fragment> 2836 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2837 discard; 2838 } 2839 vec3 outgoingLight = vec3( 0.0 ); 2840 #include <logdepthbuf_fragment> 2841 #include <map_fragment> 2842 #include <color_fragment> 2843 outgoingLight = diffuseColor.rgb; 2844 #include <opaque_fragment> 2845 #include <tonemapping_fragment> 2846 #include <colorspace_fragment> 2847 #include <fog_fragment> 2848 #include <premultiplied_alpha_fragment> 2849}`,dW=`#include <common> 2850#include <batching_pars_vertex> 2851#include <uv_pars_vertex> 2852#include <envmap_pars_vertex> 2853#include <color_pars_vertex> 2854#include <fog_pars_vertex> 2855#include <morphtarget_pars_vertex> 2856#include <skinning_pars_vertex> 2857#include <logdepthbuf_pars_vertex> 2858#include <clipping_planes_pars_vertex> 2859void main() { 2860 #include <uv_vertex> 2861 #include <color_vertex> 2862 #include <morphinstance_vertex> 2863 #include <morphcolor_vertex> 2864 #include <batching_vertex> 2865 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2866 #include <beginnormal_vertex> 2867 #include <morphnormal_vertex> 2868 #include <skinbase_vertex> 2869 #include <skinnormal_vertex> 2870 #include <defaultnormal_vertex> 2871 #endif 2872 #include <begin_vertex> 2873 #include <morphtarget_vertex> 2874 #include <skinning_vertex> 2875 #include <project_vertex> 2876 #include <logdepthbuf_vertex> 2877 #include <clipping_planes_vertex> 2878 #include <worldpos_vertex> 2879 #include <envmap_vertex> 2880 #include <fog_vertex> 2881}`,fW=`uniform vec3 diffuse; 2882uniform float opacity; 2883#ifndef FLAT_SHADED 2884 varying vec3 vNormal; 2885#endif 2886#include <common> 2887#include <dithering_pars_fragment> 2888#include <color_pars_fragment> 2889#include <uv_pars_fragment> 2890#include <map_pars_fragment> 2891#include <alphamap_pars_fragment> 2892#include <alphatest_pars_fragment> 2893#include <alphahash_pars_fragment> 2894#include <aomap_pars_fragment> 2895#include <lightmap_pars_fragment> 2896#include <envmap_common_pars_fragment> 2897#include <envmap_pars_fragment> 2898#include <fog_pars_fragment> 2899#include <specularmap_pars_fragment> 2900#include <logdepthbuf_pars_fragment> 2901#include <clipping_planes_pars_fragment> 2902void main() { 2903 vec4 diffuseColor = vec4( diffuse, opacity ); 2904 #include <clipping_planes_fragment> 2905 #include <logdepthbuf_fragment> 2906 #include <map_fragment> 2907 #include <color_fragment> 2908 #include <alphamap_fragment> 2909 #include <alphatest_fragment> 2910 #include <alphahash_fragment> 2911 #include <specularmap_fragment> 2912 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2913 #ifdef USE_LIGHTMAP 2914 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2915 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2916 #else 2917 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2918 #endif 2919 #include <aomap_fragment> 2920 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2921 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2922 #include <envmap_fragment> 2923 #include <opaque_fragment> 2924 #include <tonemapping_fragment> 2925 #include <colorspace_fragment> 2926 #include <fog_fragment> 2927 #include <premultiplied_alpha_fragment> 2928 #include <dithering_fragment> 2929}`,pW=`#define LAMBERT 2930varying vec3 vViewPosition; 2931#include <common> 2932#include <batching_pars_vertex> 2933#include <uv_pars_vertex> 2934#include <displacementmap_pars_vertex> 2935#include <envmap_pars_vertex> 2936#include <color_pars_vertex> 2937#include <fog_pars_vertex> 2938#include <normal_pars_vertex> 2939#include <morphtarget_pars_vertex> 2940#include <skinning_pars_vertex> 2941#include <shadowmap_pars_vertex> 2942#include <logdepthbuf_pars_vertex> 2943#include <clipping_planes_pars_vertex> 2944void main() { 2945 #include <uv_vertex> 2946 #include <color_vertex> 2947 #include <morphinstance_vertex> 2948 #include <morphcolor_vertex> 2949 #include <batching_vertex> 2950 #include <beginnormal_vertex> 2951 #include <morphnormal_vertex> 2952 #include <skinbase_vertex> 2953 #include <skinnormal_vertex> 2954 #include <defaultnormal_vertex> 2955 #include <normal_vertex> 2956 #include <begin_vertex> 2957 #include <morphtarget_vertex> 2958 #include <skinning_vertex> 2959 #include <displacementmap_vertex> 2960 #include <project_vertex> 2961 #include <logdepthbuf_vertex> 2962 #include <clipping_planes_vertex> 2963 vViewPosition = - mvPosition.xyz; 2964 #include <worldpos_vertex> 2965 #include <envmap_vertex> 2966 #include <shadowmap_vertex> 2967 #include <fog_vertex> 2968}`,mW=`#define LAMBERT 2969uniform vec3 diffuse; 2970uniform vec3 emissive; 2971uniform float opacity; 2972#include <common> 2973#include <packing> 2974#include <dithering_pars_fragment> 2975#include <color_pars_fragment> 2976#include <uv_pars_fragment> 2977#include <map_pars_fragment> 2978#include <alphamap_pars_fragment> 2979#include <alphatest_pars_fragment> 2980#include <alphahash_pars_fragment> 2981#include <aomap_pars_fragment> 2982#include <lightmap_pars_fragment> 2983#include <emissivemap_pars_fragment> 2984#include <envmap_common_pars_fragment> 2985#include <envmap_pars_fragment> 2986#include <fog_pars_fragment> 2987#include <bsdfs> 2988#include <lights_pars_begin> 2989#include <normal_pars_fragment> 2990#include <lights_lambert_pars_fragment> 2991#include <shadowmap_pars_fragment> 2992#include <bumpmap_pars_fragment> 2993#include <normalmap_pars_fragment> 2994#include <specularmap_pars_fragment> 2995#include <logdepthbuf_pars_fragment> 2996#include <clipping_planes_pars_fragment> 2997void main() { 2998 vec4 diffuseColor = vec4( diffuse, opacity ); 2999 #include <clipping_planes_fragment> 3000 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3001 vec3 totalEmissiveRadiance = emissive; 3002 #include <logdepthbuf_fragment> 3003 #include <map_fragment> 3004 #include <color_fragment> 3005 #include <alphamap_fragment> 3006 #include <alphatest_fragment> 3007 #include <alphahash_fragment> 3008 #include <specularmap_fragment> 3009 #include <normal_fragment_begin> 3010 #include <normal_fragment_maps> 3011 #include <emissivemap_fragment> 3012 #include <lights_lambert_fragment> 3013 #include <lights_fragment_begin> 3014 #include <lights_fragment_maps> 3015 #include <lights_fragment_end> 3016 #include <aomap_fragment> 3017 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3018 #include <envmap_fragment> 3019 #include <opaque_fragment> 3020 #include <tonemapping_fragment> 3021 #include <colorspace_fragment> 3022 #include <fog_fragment> 3023 #include <premultiplied_alpha_fragment> 3024 #include <dithering_fragment> 3025}`,gW=`#define MATCAP 3026varying vec3 vViewPosition; 3027#include <common> 3028#include <batching_pars_vertex> 3029#include <uv_pars_vertex> 3030#include <color_pars_vertex> 3031#include <displacementmap_pars_vertex> 3032#include <fog_pars_vertex> 3033#include <normal_pars_vertex> 3034#include <morphtarget_pars_vertex> 3035#include <skinning_pars_vertex> 3036#include <logdepthbuf_pars_vertex> 3037#include <clipping_planes_pars_vertex> 3038void main() { 3039 #include <uv_vertex> 3040 #include <color_vertex> 3041 #include <morphinstance_vertex> 3042 #include <morphcolor_vertex> 3043 #include <batching_vertex> 3044 #include <beginnormal_vertex> 3045 #include <morphnormal_vertex> 3046 #include <skinbase_vertex> 3047 #include <skinnormal_vertex> 3048 #include <defaultnormal_vertex> 3049 #include <normal_vertex> 3050 #include <begin_vertex> 3051 #include <morphtarget_vertex> 3052 #include <skinning_vertex> 3053 #include <displacementmap_vertex> 3054 #include <project_vertex> 3055 #include <logdepthbuf_vertex> 3056 #include <clipping_planes_vertex> 3057 #include <fog_vertex> 3058 vViewPosition = - mvPosition.xyz; 3059}`,yW=`#define MATCAP 3060uniform vec3 diffuse; 3061uniform float opacity; 3062uniform sampler2D matcap; 3063varying vec3 vViewPosition; 3064#include <common> 3065#include <dithering_pars_fragment> 3066#include <color_pars_fragment> 3067#include <uv_pars_fragment> 3068#include <map_pars_fragment> 3069#include <alphamap_pars_fragment> 3070#include <alphatest_pars_fragment> 3071#include <alphahash_pars_fragment> 3072#include <fog_pars_fragment> 3073#include <normal_pars_fragment> 3074#include <bumpmap_pars_fragment> 3075#include
3075 <normalmap_pars_fragment> 3076#include <logdepthbuf_pars_fragment> 3077#include <clipping_planes_pars_fragment> 3078void main() { 3079 vec4 diffuseColor = vec4( diffuse, opacity ); 3080 #include <clipping_planes_fragment> 3081 #include <logdepthbuf_fragment> 3082 #include <map_fragment> 3083 #include <color_fragment> 3084 #include <alphamap_fragment> 3085 #include <alphatest_fragment> 3086 #include <alphahash_fragment> 3087 #include <normal_fragment_begin> 3088 #include <normal_fragment_maps> 3089 vec3 viewDir = normalize( vViewPosition ); 3090 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3091 vec3 y = cross( viewDir, x ); 3092 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3093 #ifdef USE_MATCAP 3094 vec4 matcapColor = texture2D( matcap, uv ); 3095 #else 3096 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3097 #endif 3098 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3099 #include <opaque_fragment> 3100 #include <tonemapping_fragment> 3101 #include <colorspace_fragment> 3102 #include <fog_fragment> 3103 #include <premultiplied_alpha_fragment> 3104 #include <dithering_fragment> 3105}`,vW=`#define NORMAL 3106#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3107 varying vec3 vViewPosition; 3108#endif 3109#include <common> 3110#include <batching_pars_vertex> 3111#include <uv_pars_vertex> 3112#include <displacementmap_pars_vertex> 3113#include <normal_pars_vertex> 3114#include <morphtarget_pars_vertex> 3115#include <skinning_pars_vertex> 3116#include <logdepthbuf_pars_vertex> 3117#include <clipping_planes_pars_vertex> 3118void main() { 3119 #include <uv_vertex> 3120 #include <batching_vertex> 3121 #include <beginnormal_vertex> 3122 #include <morphinstance_vertex> 3123 #include <morphnormal_vertex> 3124 #include <skinbase_vertex> 3125 #include <skinnormal_vertex> 3126 #include <defaultnormal_vertex> 3127 #include <normal_vertex> 3128 #include <begin_vertex> 3129 #include <morphtarget_vertex> 3130 #include <skinning_vertex> 3131 #include <displacementmap_vertex> 3132 #include <project_vertex> 3133 #include <logdepthbuf_vertex> 3134 #include <clipping_planes_vertex> 3135#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3136 vViewPosition = - mvPosition.xyz; 3137#endif 3138}`,_W=`#define NORMAL 3139uniform float opacity; 3140#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3141 varying vec3 vViewPosition; 3142#endif 3143#include <packing> 3144#include <uv_pars_fragment> 3145#include <normal_pars_fragment> 3146#include <bumpmap_pars_fragment> 3147#include <normalmap_pars_fragment> 3148#include <logdepthbuf_pars_fragment> 3149#include <clipping_planes_pars_fragment> 3150void main() { 3151 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3152 #include <clipping_planes_fragment> 3153 #include <logdepthbuf_fragment> 3154 #include <normal_fragment_begin> 3155 #include <normal_fragment_maps> 3156 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3157 #ifdef OPAQUE 3158 gl_FragColor.a = 1.0; 3159 #endif 3160}`,xW=`#define PHONG 3161varying vec3 vViewPosition; 3162#include <common> 3163#include <batching_pars_vertex> 3164#include <uv_pars_vertex> 3165#include <displacementmap_pars_vertex> 3166#include <envmap_pars_vertex> 3167#include <color_pars_vertex> 3168#include <fog_pars_vertex> 3169#include <normal_pars_vertex> 3170#include <morphtarget_pars_vertex> 3171#include <skinning_pars_vertex> 3172#include <shadowmap_pars_vertex> 3173#include <logdepthbuf_pars_vertex> 3174#include <clipping_planes_pars_vertex> 3175void main() { 3176 #include <uv_vertex> 3177 #include <color_vertex> 3178 #include <morphcolor_vertex> 3179 #include <batching_vertex> 3180 #include <beginnormal_vertex> 3181 #include <morphinstance_vertex> 3182 #include <morphnormal_vertex> 3183 #include <skinbase_vertex> 3184 #include <skinnormal_vertex> 3185 #include <defaultnormal_vertex> 3186 #include <normal_vertex> 3187 #include <begin_vertex> 3188 #include <morphtarget_vertex> 3189 #include <skinning_vertex> 3190 #include <displacementmap_vertex> 3191 #include <project_vertex> 3192 #include <logdepthbuf_vertex> 3193 #include <clipping_planes_vertex> 3194 vViewPosition = - mvPosition.xyz; 3195 #include <worldpos_vertex> 3196 #include <envmap_vertex> 3197 #include <shadowmap_vertex> 3198 #include <fog_vertex> 3199}`,SW=`#define PHONG 3200uniform vec3 diffuse; 3201uniform vec3 emissive; 3202uniform vec3 specular; 3203uniform float shininess; 3204uniform float opacity; 3205#include <common> 3206#include <packing> 3207#include <dithering_pars_fragment> 3208#include <color_pars_fragment> 3209#include <uv_pars_fragment> 3210#include <map_pars_fragment> 3211#include <alphamap_pars_fragment> 3212#include <alphatest_pars_fragment> 3213#include <alphahash_pars_fragment> 3214#include <aomap_pars_fragment> 3215#include <lightmap_pars_fragment> 3216#include <emissivemap_pars_fragment> 3217#include <envmap_common_pars_fragment> 3218#include <envmap_pars_fragment> 3219#include <fog_pars_fragment> 3220#include <bsdfs> 3221#include <lights_pars_begin> 3222#include <normal_pars_fragment> 3223#include <lights_phong_pars_fragment> 3224#include <shadowmap_pars_fragment> 3225#include <bumpmap_pars_fragment> 3226#include <normalmap_pars_fragment> 3227#include <specularmap_pars_fragment> 3228#include <logdepthbuf_pars_fragment> 3229#include <clipping_planes_pars_fragment> 3230void main() { 3231 vec4 diffuseColor = vec4( diffuse, opacity ); 3232 #include <clipping_planes_fragment> 3233 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3234 vec3 totalEmissiveRadiance = emissive; 3235 #include <logdepthbuf_fragment> 3236 #include <map_fragment> 3237 #include <color_fragment> 3238 #include <alphamap_fragment> 3239 #include <alphatest_fragment> 3240 #include <alphahash_fragment> 3241 #include <specularmap_fragment> 3242 #include <normal_fragment_begin> 3243 #include <normal_fragment_maps> 3244 #include <emissivemap_fragment> 3245 #include <lights_phong_fragment> 3246 #include <lights_fragment_begin> 3247 #include <lights_fragment_maps> 3248 #include <lights_fragment_end> 3249 #include <aomap_fragment> 3250 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3251 #include <envmap_fragment> 3252 #include <opaque_fragment> 3253 #include <tonemapping_fragment> 3254 #include <colorspace_fragment> 3255 #include <fog_fragment> 3256 #include <premultiplied_alpha_fragment> 3257 #include <dithering_fragment> 3258}`,bW=`#define STANDARD 3259varying vec3 vViewPosition; 3260#ifdef USE_TRANSMISSION 3261 varying vec3 vWorldPosition; 3262#endif 3263#include <common> 3264#include <batching_pars_vertex> 3265#include <uv_pars_vertex> 3266#include <displacementmap_pars_vertex> 3267#include <color_pars_vertex> 3268#include <fog_pars_vertex> 3269#include <normal_pars_vertex> 3270#include <morphtarget_pars_vertex> 3271#include <skinning_pars_vertex> 3272#include <shadowmap_pars_vertex> 3273#include <logdepthbuf_pars_vertex> 3274#include <clipping_planes_pars_vertex> 3275void main() { 3276 #include <uv_vertex> 3277 #include <color_vertex> 3278 #include <morphinstance_vertex> 3279 #include <morphcolor_vertex> 3280 #include <batching_vertex> 3281 #include <beginnormal_vertex> 3282 #include <morphnormal_vertex> 3283 #include <skinbase_vertex> 3284 #include <skinnormal_vertex> 3285 #include <defaultnormal_vertex> 3286 #include <normal_vertex> 3287 #include <begin_vertex> 3288 #include <morphtarget_vertex> 3289 #include <skinning_vertex> 3290 #include <displacementmap_vertex> 3291 #include <project_vertex> 3292 #include <logdepthbuf_vertex> 3293 #include <clipping_planes_vertex> 3294 vViewPosition = - mvPosition.xyz; 3295 #include <worldpos_vertex> 3296 #include <shadowmap_vertex> 3297 #include <fog_vertex> 3298#ifdef USE_TRANSMISSION 3299 vWorldPosition = worldPosition.xyz; 3300#endif 3301}`,TW=`#define STANDARD 3302#ifdef PHYSICAL 3303 #define IOR 3304 #define USE_SPECULAR 3305#endif 3306uniform vec3 diffuse; 3307uniform vec3 emissive; 3308uniform float roughness; 3309uniform float metalness; 3310uniform float opacity; 3311#ifdef IOR 3312 uniform float ior; 3313#endif 3314#ifdef USE_SPECULAR 3315 uniform float specularIntensity; 3316 uniform vec3 specularColor; 3317 #ifdef USE_SPECULAR_COLORMAP 3318 uniform sampler2D specularColorMap; 3319 #endif 3320 #ifdef USE_SPECULAR_INTENSITYMAP 3321 uniform sampler2D specularIntensityMap; 3322 #endif 3323#endif 3324#ifdef USE_CLEARCOAT 3325 uniform float clearcoat; 3326 uniform float clearcoatRoughness; 3327#endif 3328#ifdef USE_DISPERSION 3329 uniform float dispersion; 3330#endif
3331#ifdef USE_IRIDESCENCE 3332 uniform float iridescence; 3333 uniform float iridescenceIOR; 3334 uniform float iridescenceThicknessMinimum; 3335 uniform float iridescenceThicknessMaximum; 3336#endif 3337#ifdef USE_SHEEN 3338 uniform vec3 sheenColor; 3339 uniform float sheenRoughness; 3340 #ifdef USE_SHEEN_COLORMAP 3341 uniform sampler2D sheenColorMap; 3342 #endif 3343 #ifdef USE_SHEEN_ROUGHNESSMAP 3344 uniform sampler2D sheenRoughnessMap; 3345 #endif 3346#endif 3347#ifdef USE_ANISOTROPY 3348 uniform vec2 anisotropyVector; 3349 #ifdef USE_ANISOTROPYMAP 3350 uniform sampler2D anisotropyMap; 3351 #endif 3352#endif 3353varying vec3 vViewPosition; 3354#include <common> 3355#include <packing> 3356#include <dithering_pars_fragment> 3357#include <color_pars_fragment> 3358#include <uv_pars_fragment> 3359#include <map_pars_fragment> 3360#include <alphamap_pars_fragment> 3361#include <alphatest_pars_fragment> 3362#include <alphahash_pars_fragment> 3363#include <aomap_pars_fragment> 3364#include <lightmap_pars_fragment> 3365#include <emissivemap_pars_fragment> 3366#include <iridescence_fragment> 3367#include <cube_uv_reflection_fragment> 3368#include <envmap_common_pars_fragment> 3369#include <envmap_physical_pars_fragment> 3370#include <fog_pars_fragment> 3371#include <lights_pars_begin> 3372#include <normal_pars_fragment> 3373#include <lights_physical_pars_fragment> 3374#include <transmission_pars_fragment> 3375#include <shadowmap_pars_fragment> 3376#include <bumpmap_pars_fragment> 3377#include <normalmap_pars_fragment> 3378#include <clearcoat_pars_fragment> 3379#include <iridescence_pars_fragment> 3380#include <roughnessmap_pars_fragment> 3381#include <metalnessmap_pars_fragment> 3382#include <logdepthbuf_pars_fragment> 3383#include <clipping_planes_pars_fragment> 3384void main() { 3385 vec4 diffuseColor = vec4( diffuse, opacity ); 3386 #include <clipping_planes_fragment> 3387 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3388 vec3 totalEmissiveRadiance = emissive; 3389 #include <logdepthbuf_fragment> 3390 #include <map_fragment> 3391 #include <color_fragment> 3392 #include <alphamap_fragment> 3393 #include <alphatest_fragment> 3394 #include <alphahash_fragment> 3395 #include <roughnessmap_fragment> 3396 #include <metalnessmap_fragment> 3397 #include <normal_fragment_begin> 3398 #include <normal_fragment_maps> 3399 #include <clearcoat_normal_fragment_begin> 3400 #include <clearcoat_normal_fragment_maps> 3401 #include <emissivemap_fragment> 3402 #include <lights_physical_fragment> 3403 #include <lights_fragment_begin> 3404 #include <lights_fragment_maps> 3405 #include <lights_fragment_end> 3406 #include <aomap_fragment> 3407 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3408 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3409 #include <transmission_fragment> 3410 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3411 #ifdef USE_SHEEN 3412 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3413 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3414 #endif 3415 #ifdef USE_CLEARCOAT 3416 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3417 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3418 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3419 #endif 3420 #include <opaque_fragment> 3421 #include <tonemapping_fragment> 3422 #include <colorspace_fragment> 3423 #include <fog_fragment> 3424 #include <premultiplied_alpha_fragment> 3425 #include <dithering_fragment> 3426}`,MW=`#define TOON 3427varying vec3 vViewPosition; 3428#include <common> 3429#include <batching_pars_vertex> 3430#include <uv_pars_vertex> 3431#include <displacementmap_pars_vertex> 3432#include <color_pars_vertex> 3433#include <fog_pars_vertex> 3434#include <normal_pars_vertex> 3435#include <morphtarget_pars_vertex> 3436#include <skinning_pars_vertex> 3437#include <shadowmap_pars_vertex> 3438#include <logdepthbuf_pars_vertex> 3439#include <clipping_planes_pars_vertex> 3440void main() { 3441 #include <uv_vertex> 3442 #include <color_vertex> 3443 #include <morphinstance_vertex> 3444 #include <morphcolor_vertex> 3445 #include <batching_vertex> 3446 #include <beginnormal_vertex> 3447 #include <morphnormal_vertex> 3448 #include <skinbase_vertex> 3449 #include <skinnormal_vertex> 3450 #include <defaultnormal_vertex> 3451 #include <normal_vertex> 3452 #include <begin_vertex> 3453 #include <morphtarget_vertex> 3454 #include <skinning_vertex> 3455 #include <displacementmap_vertex> 3456 #include <project_vertex> 3457 #include <logdepthbuf_vertex> 3458 #include <clipping_planes_vertex> 3459 vViewPosition = - mvPosition.xyz; 3460 #include <worldpos_vertex> 3461 #include <shadowmap_vertex> 3462 #include <fog_vertex> 3463}`,EW=`#define TOON 3464uniform vec3 diffuse; 3465uniform vec3 emissive; 3466uniform float opacity; 3467#include <common> 3468#include <packing> 3469#include <dithering_pars_fragment> 3470#include <color_pars_fragment> 3471#include <uv_pars_fragment> 3472#include <map_pars_fragment> 3473#include <alphamap_pars_fragment> 3474#include <alphatest_pars_fragment> 3475#include <alphahash_pars_fragment> 3476#include <aomap_pars_fragment> 3477#include <lightmap_pars_fragment> 3478#include <emissivemap_pars_fragment> 3479#include <gradientmap_pars_fragment> 3480#include <fog_pars_fragment> 3481#include <bsdfs> 3482#include <lights_pars_begin> 3483#include <normal_pars_fragment> 3484#include <lights_toon_pars_fragment> 3485#include <shadowmap_pars_fragment> 3486#include <bumpmap_pars_fragment> 3487#include <normalmap_pars_fragment> 3488#include <logdepthbuf_pars_fragment> 3489#include <clipping_planes_pars_fragment> 3490void main() { 3491 vec4 diffuseColor = vec4( diffuse, opacity ); 3492 #include <clipping_planes_fragment> 3493 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3494 vec3 totalEmissiveRadiance = emissive; 3495 #include <logdepthbuf_fragment> 3496 #include <map_fragment> 3497 #include <color_fragment> 3498 #include <alphamap_fragment> 3499 #include <alphatest_fragment> 3500 #include <alphahash_fragment> 3501 #include <normal_fragment_begin> 3502 #include <normal_fragment_maps> 3503 #include <emissivemap_fragment> 3504 #include <lights_toon_fragment> 3505 #include <lights_fragment_begin> 3506 #include <lights_fragment_maps> 3507 #include <lights_fragment_end> 3508 #include <aomap_fragment> 3509 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3510 #include <opaque_fragment> 3511 #include <tonemapping_fragment> 3512 #include <colorspace_fragment> 3513 #include <fog_fragment> 3514 #include <premultiplied_alpha_fragment> 3515 #include <dithering_fragment> 3516}`,AW=`uniform float size; 3517uniform float scale; 3518#include <common> 3519#include <color_pars_vertex> 3520#include <fog_pars_vertex> 3521#include <morphtarget_pars_vertex> 3522#include <logdepthbuf_pars_vertex> 3523#include <clipping_planes_pars_vertex> 3524#ifdef USE_POINTS_UV 3525 varying vec2 vUv; 3526 uniform mat3 uvTransform; 3527#endif 3528void main() { 3529 #ifdef USE_POINTS_UV 3530 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3531 #endif 3532 #include <color_vertex> 3533 #include <morphinstance_vertex> 3534 #include <morphcolor_vertex> 3535 #include <begin_vertex> 3536 #include <morphtarget_vertex> 3537 #include <project_vertex> 3538 gl_PointSize = size; 3539 #ifdef USE_SIZEATTENUATION 3540 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3541 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3542 #endif 3543 #include <logdepthbuf_vertex> 3544 #include <clipping_planes_vertex> 3545 #include <worldpos_vertex> 3546 #include <fog_vertex> 3547}`,RW=`uniform vec3 diffuse; 3548uniform float opacity; 3549#include <common> 3550#include <color_pars_fragment> 3551#include <map_particle_pars_fragment> 3552#include <alphatest_pars_fragment> 3553#include <alphahash_pars_fragment> 3554#include <fog_pars_fragment> 3555#include <logdepthbuf_pars_fragment> 3556#include <clipping_planes_pars_fragment> 3557void main() { 3558 vec4 diffuseColor = vec4( diffuse, opacity ); 3559 #include <clipping_planes_fragment> 3560 vec3 outgoingLight = vec3( 0.0 ); 3561 #include <logdepthbuf_fragment> 3562 #include <map_particle_fragment> 3563 #include <color_fragment> 3564 #include <alphatest_fragment> 3565 #include <alphahash_fragment> 3566 outgoingLight = diffuseColor.rgb; 3567 #include <opaque_fragment> 3568 #include <tonemapping_fragment> 3569 #include <colorspace_fragment> 3570 #include <fog_fragment> 3571 #include <premultiplied_alpha_fragment> 3572}`,NW=`#include <common> 3573#include <batching_pars_vertex> 3574#include <fog_pars_vertex> 3575#include <morphtarget_pars_vertex> 3576#include <skinning_pars_vertex> 3577#include <logdepthbuf_pars_vertex> 3578#include <shadowmap_pars_vertex> 3579void main() { 3580 #include <batching_vertex> 3581 #include <beginnormal_vertex> 3582 #include <morphinstance_vertex> 3583 #include <morphnormal_vertex> 3584 #include <skinbase_vertex> 3585 #include <skinnormal_vertex> 3586 #include <defaultnormal_vertex> 3587 #include <begin_vertex> 3588 #include <morphtarget_vertex> 3589 #include <skinning_vertex> 3590 #include <project_vertex> 3591 #include <logdepthbuf_vertex> 3592 #include <worldpos_vertex> 3593 #include <shadowmap_vertex> 3594 #include <fog_vertex> 3595}`,CW=`uniform vec3 color; 3596uniform float opacity; 3597#include <common> 3598#include <packing> 3599#include <fog_pars_fragment> 3600#include <bsdfs> 3601#include <lights_pars_begin> 3602#include <logdepthbuf_pars_fragment> 3603#include <shadowmap_pars_fragment> 3604#include <shadowmask_pars_fragment> 3605void main() { 3606 #include <logdepthbuf_fragment> 3607 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3608 #include <tonemapping_fragment> 3609 #include <colorspace_fragment> 3610 #include <fog_fragment> 3611}`,wW=`uniform float rotation; 3612uniform vec2 center; 3613#include <common> 3614#include <uv_pars_vertex> 3615#include <fog_pars_vertex> 3616#include <logdepthbuf_pars_vertex> 3617#include <clipping_planes_pars_vertex> 3618void main() { 3619 #include <uv_vertex> 3620 vec4 mvPosition = modelViewMatrix[ 3 ]; 3621 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3622 #ifndef USE_SIZEATTENUATION 3623 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3624 if ( isPerspective ) scale *= - mvPosition.z; 3625 #endif 3626 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3627 vec2 rotatedPosition; 3628 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3629 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3630 mvPosition.xy += rotatedPosition; 3631 gl_Position = projectionMatrix * mvPosition; 3632 #include <logdepthbuf_vertex> 3633 #include <clipping_planes_vertex> 3634 #include <fog_vertex> 3635}`,DW=`uniform vec3 diffuse; 3636uniform float opacity; 3637#include <common> 3638#include <uv_pars_fragment> 3639#include <map_pars_fragment> 3640#include <alphamap_pars_fragment> 3641#include <alphatest_pars_fragment> 3642#include <alphahash_pars_fragment> 3643#include <fog_pars_fragment> 3644#include <logdepthbuf_pars_fragment> 3645#include <clipping_planes_pars_fragment> 3646void main() { 3647 vec4 diffuseColor = vec4( diffuse, opacity ); 3648 #include <clipping_planes_fragment> 3649 vec3 outgoingLight = vec3( 0.0 ); 3650 #include <logdepthbuf_fragment> 3651 #include <map_fragment> 3652 #include <alphamap_fragment> 3653 #include <alphatest_fragment> 3654 #include <alphahash_fragment> 3655 outgoingLight = diffuseColor.rgb; 3656 #include <opaque_fragment> 3657 #include <tonemapping_fragment> 3658 #include <colorspace_fragment> 3659 #include <fog_fragment> 3660}
3660`,Nn={alphahash_fragment:Jk,alphahash_pars_fragment:e8,alphamap_fragment:t8,alphamap_pars_fragment:n8,alphatest_fragment:i8,alphatest_pars_fragment:s8,aomap_fragment:r8,aomap_pars_fragment:a8,batching_pars_vertex:o8,batching_vertex:l8,begin_vertex:u8,beginnormal_vertex:c8,bsdfs:h8,iridescence_fragment:d8,bumpmap_pars_fragment:f8,clipping_planes_fragment:p8,clipping_planes_pars_fragment:m8,clipping_planes_pars_vertex:g8,clipping_planes_vertex:y8,color_fragment:v8,color_pars_fragment:_8,color_pars_vertex:x8,color_vertex:S8,common:b8,cube_uv_reflection_fragment:T8,defaultnormal_vertex:M8,displacementmap_pars_vertex:E8,displacementmap_vertex:A8,emissivemap_fragment:R8,emissivemap_pars_fragment:N8,colorspace_fragment:C8,colorspace_pars_fragment:w8,envmap_fragment:D8,envmap_common_pars_fragment:U8,envmap_pars_fragment:L8,envmap_pars_vertex:B8,envmap_physical_pars_fragment:W8,envmap_vertex:P8,fog_vertex:O8,fog_pars_vertex:I8,fog_fragment:F8,fog_pars_fragment:V8,gradientmap_pars_fragment:z8,lightmap_pars_fragment:G8,lights_lambert_fragment:H8,lights_lambert_pars_fragment:k8,lights_pars_begin:q8,lights_toon_fragment:X8,lights_toon_pars_fragment:Y8,lights_phong_fragment:j8,lights_phong_pars_fragment:K8,lights_physical_fragment:Z8,lights_physical_pars_fragment:Q8,lights_fragment_begin:$8,lights_fragment_maps:J8,lights_fragment_end:eq,logdepthbuf_fragment:tq,logdepthbuf_pars_fragment:nq,logdepthbuf_pars_vertex:iq,logdepthbuf_vertex:sq,map_fragment:rq,map_pars_fragment:aq,map_particle_fragment:oq,map_particle_pars_fragment:lq,metalnessmap_fragment:uq,metalnessmap_pars_fragment:cq,morphinstance_vertex:hq,morphcolor_vertex:dq,morphnormal_vertex:fq,morphtarget_pars_vertex:pq,morphtarget_vertex:mq,normal_fragment_begin:gq,normal_fragment_maps:yq,normal_pars_fragment:vq,normal_pars_vertex:_q,normal_vertex:xq,normalmap_pars_fragment:Sq,clearcoat_normal_fragment_begin:bq,clearcoat_normal_fragment_maps:Tq,clearcoat_pars_fragment:Mq,iridescence_pars_fragment:Eq,opaque_fragment:Aq,packing:Rq,premultiplied_alpha_fragment:Nq,project_vertex:Cq,dithering_fragment:wq,dithering_pars_fragment:Dq,roughnessmap_fragment:Uq,roughnessmap_pars_fragment:Lq,shadowmap_pars_fragment:Bq,shadowmap_pars_vertex:Pq,shadowmap_vertex:Oq,shadowmask_pars_fragment:Iq,skinbase_vertex:Fq,skinning_pars_vertex:Vq,skinning_vertex:zq,skinnormal_vertex:Gq,specularmap_fragment:Hq,specularmap_pars_fragment:kq,tonemapping_fragment:qq,tonemapping_pars_fragment:Wq,transmission_fragment:Xq,transmission_pars_fragment:Yq,uv_pars_fragment:jq,uv_pars_vertex:Kq,uv_vertex:Zq,worldpos_vertex:Qq,background_vert:$q,background_frag:Jq,backgroundCube_vert:eW,backgroundCube_frag:tW,cube_vert:nW,cube_frag:iW,depth_vert:sW,depth_frag:rW,distanceRGBA_vert:aW,distanceRGBA_frag:oW,equirect_vert:lW,equirect_frag:uW,linedashed_vert:cW,linedashed_frag:hW,meshbasic_vert:dW,meshbasic_frag:fW,meshlambert_vert:pW,meshlambert_frag:mW,meshmatcap_vert:gW,meshmatcap_frag:yW,meshnormal_vert:vW,meshnormal_frag:_W,meshphong_vert:xW,meshphong_frag:SW,meshphysical_vert:bW,meshphysical_frag:TW,meshtoon_vert:MW,meshtoon_frag:EW,points_vert:AW,points_frag:RW,shadow_vert:NW,shadow_frag:CW,sprite_vert:wW,sprite_frag:DW},Tt={common:{diffuse:{value:new lt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new pn},alphaMap:{value:null},alphaMapTransform:{value:new pn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new pn}},envmap:{envMap:{value:null},envMapRotation:{value:new pn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new pn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new pn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new pn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new pn},normalScale:{value:new Ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new pn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new pn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new pn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new pn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new lt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new lt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new pn},alphaTest:{value:0},uvTransform:{value:new pn}},sprite:{diffuse:{value:new lt(16777215)},opacity:{value:1},center:{value:new Ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new pn},alphaMap:{value:null},alphaMapTransform:{value:new pn},alphaTest:{value:0}}},kl={basic:{uniforms:ma([Tt.common,Tt.specularmap,Tt.envmap,Tt.aomap,Tt.lightmap,Tt.fog]),vertexShader:Nn.meshbasic_vert,fragmentShader:Nn.meshbasic_frag},lambert:{uniforms:ma([Tt.common,Tt.specularmap,Tt.envmap,Tt.aomap,Tt.lightmap,Tt.emissivemap,Tt.bumpmap,Tt.normalmap,Tt.dis
vendor: 5,130 bytes, line 3660
3660placementmap,Tt.fog,Tt.lights,{emissive:{value:new lt(0)}}]),vertexShader:Nn.meshlambert_vert,fragmentShader:Nn.meshlambert_frag},phong:{uniforms:ma([Tt.common,Tt.specularmap,Tt.envmap,Tt.aomap,Tt.lightmap,Tt.emissivemap,Tt.bumpmap,Tt.normalmap,Tt.displacementmap,Tt.fog,Tt.lights,{emissive:{value:new lt(0)},specular:{value:new lt(1118481)},shininess:{value:30}}]),vertexShader:Nn.meshphong_vert,fragmentShader:Nn.meshphong_frag},standard:{uniforms:ma([Tt.common,Tt.envmap,Tt.aomap,Tt.lightmap,Tt.emissivemap,Tt.bumpmap,Tt.normalmap,Tt.displacementmap,Tt.roughnessmap,Tt.metalnessmap,Tt.fog,Tt.lights,{emissive:{value:new lt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Nn.meshphysical_vert,fragmentShader:Nn.meshphysical_frag},toon:{uniforms:ma([Tt.common,Tt.aomap,Tt.lightmap,Tt.emissivemap,Tt.bumpmap,Tt.normalmap,Tt.displacementmap,Tt.gradientmap,Tt.fog,Tt.lights,{emissive:{value:new lt(0)}}]),vertexShader:Nn.meshtoon_vert,fragmentShader:Nn.meshtoon_frag},matcap:{uniforms:ma([Tt.common,Tt.bumpmap,Tt.normalmap,Tt.displacementmap,Tt.fog,{matcap:{value:null}}]),vertexShader:Nn.meshmatcap_vert,fragmentShader:Nn.meshmatcap_frag},points:{uniforms:ma([Tt.points,Tt.fog]),vertexShader:Nn.points_vert,fragmentShader:Nn.points_frag},dashed:{uniforms:ma([Tt.common,Tt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Nn.linedashed_vert,fragmentShader:Nn.linedashed_frag},depth:{uniforms:ma([Tt.common,Tt.displacementmap]),vertexShader:Nn.depth_vert,fragmentShader:Nn.depth_frag},normal:{uniforms:ma([Tt.common,Tt.bumpmap,Tt.normalmap,Tt.displacementmap,{opacity:{value:1}}]),vertexShader:Nn.meshnormal_vert,fragmentShader:Nn.meshnormal_frag},sprite:{uniforms:ma([Tt.sprite,Tt.fog]),vertexShader:Nn.sprite_vert,fragmentShader:Nn.sprite_frag},background:{uniforms:{uvTransform:{value:new pn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Nn.background_vert,fragmentShader:Nn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new pn}},vertexShader:Nn.backgroundCube_vert,fragmentShader:Nn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Nn.cube_vert,fragmentShader:Nn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Nn.equirect_vert,fragmentShader:Nn.equirect_frag},distanceRGBA:{uniforms:ma([Tt.common,Tt.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Nn.distanceRGBA_vert,fragmentShader:Nn.distanceRGBA_frag},shadow:{uniforms:ma([Tt.lights,Tt.fog,{color:{value:new lt(0)},opacity:{value:1}}]),vertexShader:Nn.shadow_vert,fragmentShader:Nn.shadow_frag}};kl.physical={uniforms:ma([kl.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new pn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new pn},clearcoatNormalScale:{value:new Ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new pn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new pn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new pn},sheen:{value:0},sheenColor:{value:new lt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new pn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new pn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new pn},transmissionSamplerSize:{value:new Ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new pn},attenuationDistance:{value:0},attenuationColor:{value:new lt(0)},specularColor:{value:new lt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new pn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new pn},anisotropyVector:{value:new Ge},anisotropyMap:{value:null},anisotropyMapTransform:{value:new pn}}]),vertexShader:Nn.meshphysical_vert,fragmentShader:Nn.meshphysical_frag};const Kb={r:0,b:0,g:0},Qf=new Ma,UW=new Ot;function LW(s,e,t,n,i,r,a){const l=new lt(0);let u=r===!0?0:1,h,p,g=null,y=0,_=null;function S(w){let D=w.isScene===!0?w.background:null;return D&&D.isTexture&&(D=(w.backgroundBlurriness>0?t:e).get(D)),D}function A(w){let D=!1;const P=S(w);P===null?b(l,u):P&&P.isColor&&(b(P,1),D=!0);const I=s.xr.getEnvironmentBlendMode();I==="additive"?n.buffers.color.setClear(0,0,0,1,a):I==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(s.autoClear||D)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function E(w,D){const P=S(D);P&&(P.isCubeTexture||P.mapping===nh)?(p===void 0&&(p=new Ri(new uh(1,1,1),new Kl({name:"Backgroun
3660dCubeMaterial",uniforms:Iy(kl.backgroundCube.uniforms),vertexShader:kl.backgroundCube.vertexShader,fragmentShader:kl.backgroundCube.fragmentShader,side:yi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(I,F,z){this.matrixWorld.copyPosition(z.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(p)),Qf.copy(D.backgroundRotation),Qf.x*=-1,Qf.y*=-1,Qf.z*=-1,P.isCubeTexture&&P.isRenderTargetTexture===!1&&(Qf.y*=-1,Qf.z*=-1),p.material.uniforms.envMap.value=P,p.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,p.material.uniforms.backgroundBlurriness.value=D.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=D.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(UW.makeRotationFromEuler(Qf)),p.material.toneMapped=Kt.getTransfer(P.colorSpace)!==Et,(g!==P||y!==P.version||_!==s.toneMapping)&&(p.material.needsUpdate=!0,g=P,y=P.ver
vendor: 4,986 bytes, line 3660
3660sion,_=s.toneMapping),p.layers.enableAll(),w.unshift(p,p.geometry,p.material,0,0,null)):P&&P.isTexture&&(h===void 0&&(h=new Ri(new fm(2,2),new Kl({name:"BackgroundMaterial",uniforms:Iy(kl.background.uniforms),vertexShader:kl.background.vertexShader,fragmentShader:kl.background.fragmentShader,side:Za,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(h)),h.material.uniforms.t2D.value=P,h.material.uniforms.backgroundIntensity.value=D.backgroundIntensity,h.material.toneMapped=Kt.getTransfer(P.colorSpace)!==Et,P.matrixAutoUpdate===!0&&P.updateMatrix(),h.material.uniforms.uvTransform.value.copy(P.matrix),(g!==P||y!==P.version||_!==s.toneMapping)&&(h.material.needsUpdate=!0,g=P,y=P.version,_=s.toneMapping),h.layers.enableAll(),w.unshift(h,h.geometry,h.material,0,0,null))}function b(w,D){w.getRGB(Kb,OP(s)),n.buffers.color.setClear(Kb.r,Kb.g,Kb.b,D,a)}function C(){p!==void 0&&(p.geometry.dispose(),p.material.dispose(),p=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(w,D=1){l.set(w),u=D,b(l,u)},getClearAlpha:function(){return u},setClearAlpha:function(w){u=w,b(l,u)},render:A,addToRenderList:E,dispose:C}}function BW(s,e){const t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=y(null);let r=i,a=!1;function l(O,W,ee,se,fe){let pe=!1;const k=g(se,ee,W);r!==k&&(r=k,h(r.object)),pe=_(O,se,ee,fe),pe&&S(O,se,ee,fe),fe!==null&&e.update(fe,s.ELEMENT_ARRAY_BUFFER),(pe||a)&&(a=!1,D(O,W,ee,se),fe!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(fe).buffer))}function u(){return s.createVertexArray()}function h(O){return s.bindVertexArray(O)}function p(O){return s.deleteVertexArray(O)}function g(O,W,ee){const se=ee.wireframe===!0;let fe=n[O.id];fe===void 0&&(fe={},n[O.id]=fe);let pe=fe[W.id];pe===void 0&&(pe={},fe[W.id]=pe);let k=pe[se];return k===void 0&&(k=y(u()),pe[se]=k),k}function y(O){const W=[],ee=[],se=[];for(let fe=0;fe<t;fe++)W[fe]=0,ee[fe]=0,se[fe]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:W,enabledAttributes:ee,attributeDivisors:se,object:O,attributes:{},index:null}}function _(O,W,ee,se){const fe=r.attributes,pe=W.attributes;let k=0;const Q=ee.getAttributes();for(const J in Q)if(Q[J].location>=0){const K=fe[J];let oe=pe[J];if(oe===void 0&&(J==="instanceMatrix"&&O.instanceMatrix&&(oe=O.instanceMatrix),J==="instanceColor"&&O.instanceColor&&(oe=O.instanceColor)),K===void 0||K.attribute!==oe||oe&&K.data!==oe.data)return!0;k++}return r.attributesNum!==k||r.index!==se}function S(O,W,ee,se){const fe={},pe=W.attributes;let k=0;const Q=ee.getAttributes();for(const J in Q)if(Q[J].location>=0){let K=pe[J];K===void 0&&(J==="instanceMatrix"&&O.instanceMatrix&&(K=O.instanceMatrix),J==="instanceColor"&&O.instanceColor&&(K=O.instanceColor));const oe={};oe.attribute=K,K&&K.data&&(oe.data=K.data),fe[J]=oe,k++}r.attributes=fe,r.attributesNum=k,r.index=se}function A(){const O=r.newAttributes;for(let W=0,ee=O.length;W<ee;W++)O[W]=0}function E(O){b(O,0)}function b(O,W){const ee=r.newAttributes,se=r.enabledAttributes,fe=r.attributeDivisors;ee[O]=1,se[O]===0&&(s.enableVertexAttribArray(O),se[O]=1),fe[O]!==W&&(s.vertexAttribDivisor(O,W),fe[O]=W)}function C(){const O=r.newAttributes,W=r.enabledAttributes;for(let ee=0,se=W.length;ee<se;ee++)W[ee]!==O[ee]&&(s.disableVertexAttribArray(ee),W[ee]=0)}function w(O,W,ee,se,fe,pe,k){k===!0?s.vertexAttribIPointer(O,W,ee,fe,pe):s.vertexAttribPointer(O,W,ee,se,fe,pe)}function D(O,W,ee,se){A();const fe=se.attributes,pe=ee.getAttributes(),k=W.defaultAttributeValues;for(const Q in pe){const J=pe[Q];if(J.location>=0){let Se=fe[Q];if(Se===void 0&&(Q==="instanceMatrix"&&O.instanceMatrix&&(Se=O.instanceMatrix),Q==="instanceColor"&&O.instanceColor&&(Se=O.instanceColor)),Se!==void 0){const K=Se.normalized,oe=Se.itemSize,we=e.get(Se);if(we===void 0)continue;const Ie=we.buffer,Ze=we.type,mt=we.bytesPerElement,xe=Ze===s.INT||Ze===s.UNSIGNED_INT||Se.gpuType===Zs;if(Se.isInterleavedBufferAttribute){const Ve=Se.data,tt=Ve.stride,Mt=Se.offset;if(Ve.isInstancedInterleavedBuffer){for(let Ct=0;Ct<J.locationSize;Ct++)b(J.location+Ct,Ve.meshPerAttribute);O.isInstancedMesh!==!0&&se._maxInstanceCount===void 0&&(se._maxInstanceCount=Ve.meshPerAttribute*Ve.count)}else for(let Ct=0;Ct<J.locationSize;Ct++)E(J.location+Ct);s.bindBuffer(s.ARRAY_BUFFER,Ie);for(let Ct=0;Ct<J.locationSize;Ct++)w(J.location+Ct,oe/J.locationSize,Ze,K,tt*mt,(Mt+oe/J.locationSize*Ct)*mt,xe)}else{if(Se.isInstancedBufferAttribute){for(let Ve=0;Ve<J.locationSize;Ve++)b(J.location+Ve,Se.meshPerAttribute);O.isInstancedMesh!==!0&&se._maxInstanceCount===void 0&&(se._maxInstanceCount=Se.meshPerAttribute*Se.count)}else for(let Ve=0;Ve<J.locationSize;Ve++)E(J.location+Ve);s.bindBuffer(s.ARRAY_BUFFER,Ie);for(let Ve=0;Ve<J.locationSize;Ve++)w(J.location+Ve,oe/J.locationSize,Ze,K,oe*mt,oe/J.locationSize*Ve*mt,xe)}}
vendor: 1,448 bytes, line 3660
3660else if(k!==void 0){const K=k[Q];if(K!==void 0)switch(K.length){case 2:s.vertexAttrib2fv(J.location,K);break;case 3:s.vertexAttrib3fv(J.location,K);break;case 4:s.vertexAttrib4fv(J.location,K);break;default:s.vertexAttrib1fv(J.location,K)}}}}C()}function P(){z();for(const O in n){const W=n[O];for(const ee in W){const se=W[ee];for(const fe in se)p(se[fe].object),delete se[fe];delete W[ee]}delete n[O]}}function I(O){if(n[O.id]===void 0)return;const W=n[O.id];for(const ee in W){const se=W[ee];for(const fe in se)p(se[fe].object),delete se[fe];delete W[ee]}delete n[O.id]}function F(O){for(const W in n){const ee=n[W];if(ee[O.id]===void 0)continue;const se=ee[O.id];for(const fe in se)p(se[fe].object),delete se[fe];delete ee[O.id]}}function z(){B(),a=!0,r!==i&&(r=i,h(r.object))}function B(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:l,reset:z,resetDefaultState:B,dispose:P,releaseStatesOfGeometry:I,releaseStatesOfProgram:F,initAttributes:A,enableAttribute:E,disableUnusedAttributes:C}}function PW(s,e,t){let n;function i(h){n=h}function r(h,p){s.drawArrays(n,h,p),t.update(p,n,1)}function a(h,p,g){g!==0&&(s.drawArraysInstanced(n,h,p,g),t.update(p,n,g))}function l(h,p,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,h,0,p,0,g);let _=0;for(let S=0;S<g;S++)_+=p[S];t.update(_,n,1)}function u(h,p,g,y){if(g===0)return;const _=e.get("WEBGL_multi_draw");if(_===null)for(let S=0;S<h.length;S++)a(h[S],p[S],y[S]);
vendor: 12,673 bytes, lines 3660-3735
3660else{_.multiDrawArraysInstancedWEBGL(n,h,0,p,0,y,0,g);let S=0;for(let A=0;A<g;A++)S+=p[A]*y[A];t.update(S,n,1)}}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=l,this.renderMultiDrawInstances=u}function OW(s,e,t,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const F=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(F){return!(F!==Pi&&n.convert(F)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(F){const z=F===As&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==ki&&n.convert(F)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==Bi&&!z)}function u(F){if(F==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const p=u(h);p!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",p,"instead."),h=p);const g=t.logarithmicDepthBuffer===!0,y=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),_=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),S=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),A=s.getParameter(s.MAX_TEXTURE_SIZE),E=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),b=s.getParameter(s.MAX_VERTEX_ATTRIBS),C=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),w=s.getParameter(s.MAX_VARYING_VECTORS),D=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),P=S>0,I=s.getParameter(s.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:u,textureFormatReadable:a,textureTypeReadable:l,precision:h,logarithmicDepthBuffer:g,reversedDepthBuffer:y,maxTextures:_,maxVertexTextures:S,maxTextureSize:A,maxCubemapSize:E,maxAttributes:b,maxVertexUniforms:C,maxVaryings:w,maxFragmentUniforms:D,vertexTextures:P,maxSamples:I}}function IW(s){const e=this;let t=null,n=0,i=!1,r=!1;const a=new Hu,l=new pn,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(g,y){const _=g.length!==0||y||n!==0||i;return i=y,n=g.length,_},this.beginShadows=function(){r=!0,p(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(g,y){t=p(g,y,0)},this.setState=function(g,y,_){const S=g.clippingPlanes,A=g.clipIntersection,E=g.clipShadows,b=s.get(g);if(!i||S===null||S.length===0||r&&!E)r?p(null):h();else{const C=r?0:n,w=C*4;let D=b.clippingState||null;u.value=D,D=p(S,y,w,_);for(let P=0;P!==w;++P)D[P]=t[P];b.clippingState=D,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=C}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,y,_,S){const A=g!==null?g.length:0;let E=null;if(A!==0){if(E=u.value,S!==!0||E===null){const b=_+A*4,C=y.matrixWorldInverse;l.getNormalMatrix(C),(E===null||E.length<b)&&(E=new Float32Array(b));for(let w=0,D=_;w!==A;++w,D+=4)a.copy(g[w]).applyMatrix4(C,l),a.normal.toArray(E,D),E[D+3]=a.constant}u.value=E,u.needsUpdate=!0}return e.numPlanes=A,e.numIntersection=0,E}}function FW(s){let e=new WeakMap;function t(a,l){return l===Cd?a.mapping=Eo:l===wd&&(a.mapping=sl),a}function n(a){if(a&&a.isTexture){const l=a.mapping;if(l===Cd||l===wd)if(e.has(a)){const u=e.get(a).texture;return t(u,a.mapping)}else{const u=a.image;if(u&&u.height>0){const h=new YM(u.height);return h.fromEquirectangularTexture(s,a),e.set(a,h),a.addEventListener("dispose",i),t(h.texture,a.mapping)}else return null}}return a}function i(a){const l=a.target;l.removeEventListener("dispose",i);const u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}const oy=4,IU=[.125,.215,.35,.446,.526,.582],lp=20,P1=new gm,FU=new lt;let O1=null,I1=0,F1=0,V1=!1;const ap=(1+Math.sqrt(5))/2,Hg=1/ap,VU=[new Y(-ap,Hg,0),new Y(ap,Hg,0),new Y(-Hg,0,ap),new Y(Hg,0,ap),new Y(0,ap,-Hg),new Y(0,ap,Hg),new Y(-1,1,-1),new Y(1,1,-1),new Y(-1,1,1),new Y(1,1,1)],VW=new Y;let WR=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100,r={}){const{size:a=256,position:l=VW}=r;O1=this._renderer.getRenderTarget(),I1=this._renderer.getActiveCubeFace(),F1=this._renderer.getActiveMipmapLevel(),V1=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,n,i,u,l),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=HU(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=GU(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(O1,I1,F1),this._renderer.xr.enabled=V1,e.scissorTest=!1,Zb(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Eo||e.mapping===sl?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),O1=this._renderer.getRenderTarget(),I1=this._renderer.getActiveCubeFace(),F1=this._renderer.getActiveMipmapLevel(),V1=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:hi,minFilter:hi,generateMipmaps:!1,type:As,format:Pi,colorSpace:Yl,depthBuffer:!1},i=zU(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=zU(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=zW(r)),this._blurMaterial=GW(r,e,t)}return i}_compileMaterial(e){const t=new Ri(this._lodPlanes[0],e);this._renderer.compile(t,P1)}_sceneToCubeUV(e,t,n,i,r){const u=new ps(90,1,t,n),h=[1,-1,1,1,1,1],p=[1,1,1,-1,-1,-1],g=this._renderer,y=g.autoClear,_=g.toneMapping;g.getClearColor(FU),g.toneMapping=Rr,g.autoClear=!1,g.state.buffers.depth.getReversed()&&(g.setRenderTarget(i),g.clearDepth(),g.setRenderTarget(null));const A=new xa({name:"PMREM.Background",side:yi,depthWrite:!1,depthTest:!1}),E=new Ri(new uh,A);let b=!1;const C=e.background;C?C.isColor&&(A.color.copy(C),e.background=null,b=!0):(A.color.copy(FU),b=!0);for(let w=0;w<6;w++){const D=w%3;D===0?(u.up.set(0,h[w],0),u.position.set(r.x,r.y,r.z),u.lookAt(r.x+p[w],r.y,r.z)):D===1?(u.up.set(0,0,h[w]),u.position.set(r.x,r.y,r.z),u.lookAt(r.x,r.y+p[w],r.z)):(u.up.set(0,h[w],0),u.position.set(r.x,r.y,r.z),u.lookAt(r.x,r.y,r.z+p[w]));const P=this._cubeSize;Zb(i,D*P,w>2?P:0,P,P),g.setRenderTarget(i),b&&g.render(E,u),g.render(e,u)}E.geometry.dispose(),E.material.dispose(),g.toneMapping=_,g.autoClear=y,e.background=C}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Eo||e.mapping===sl;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=HU()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=GU());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Ri(this._lodPlanes[0],r),l=r.uniforms;l.envMap.value=e;const u=this._cubeSize;Zb(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(a,P1)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let r=1;r<i;r++){const a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),l=VU[(i-r-1)%VU.length];this._blur(e,r-1,r,a,l)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,l){const u=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const p=3,g=new Ri(this._lodPlanes[i],h),y=h.uniforms,_=this._sizeLods[n]-1,S=isFinite(r)?Math.PI/(2*_):2*Math.PI/(2*lp-1),A=r/S,E=isFinite(r)?1+Math.floor(p*A):lp;E>lp&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${E} samples when the maximum is set to ${lp}`);const b=[];let C=0;for(let F=0;F<lp;++F){const z=F/A,B=Math.exp(-z*z/2);b.push(B),F===0?C+=B:F<E&&(C+=2*B)}for(let F=0;F<b.length;F++)b[F]=b[F]/C;y.envMap.value=e.texture,y.samples.value=E,y.weights.value=b,y.latitudinal.value=a==="latitudinal",l&&(y.poleAxis.value=l);const{_lodMax:w}=this;y.dTheta.value=S,y.mipInt.value=w-n;const D=this._sizeLods[i],P=3*D*(i>w-oy?i-w+oy:0),I=4*(this._cubeSize-D);Zb(t,P,I,3*D,2*D),u.setRenderTarget(t),u.render(g,P1)}};function zW(s){const e=[],t=[],n=[];let i=s;const r=s-oy+1+IU.length;for(let a=0;a<r;a++){const l=Math.pow(2,i);t.push(l);let u=1/l;a>s-oy?u=IU[a-s+oy-1]:a===0&&(u=0),n.push(u);const h=1/(l-2),p=-h,g=1+h,y=[p,p,g,p,g,g,p,p,g,g,p,g],_=6,S=6,A=3,E=2,b=1,C=new Float32Array(A*S*_),w=new Float32Array(E*S*_),D=new Float32Array(b*S*_);for(let I=0;I<_;I++){const F=I%3*2/3-1,z=I>2?0:-1,B=[F,z,0,F+2/3,z,0,F+2/3,z+1,0,F,z,0,F+2/3,z+1,0,F,z+1,0];C.set(B,A*S*I),w.set(y,E*S*I);const O=[I,I,I,I,I,I];D.set(O,b*S*I)}const P=new bn;P.setAttribute("position",new ti(C,A)),P.setAttribute("uv",new ti(w,E)),P.setAttribute("faceIndex",new ti(D,b)),e.push(P),i>oy&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function zU(s,e,t){const n=new jl(s,e,t);return n.texture.mapping=nh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Zb(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function GW(s,e,t){const n=new Float32Array(lp),i=new Y(0,1,0);return new Kl({name:"SphericalGaussianBlur",defines:{n:lp,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:PC(),fragmentShader:` 3661 3662 precision mediump float; 3663 precision mediump int; 3664 3665 varying vec3 vOutputDirection; 3666 3667 uniform sampler2D envMap; 3668 uniform int samples; 3669 uniform float weights[ n ]; 3670 uniform bool latitudinal; 3671 uniform float dTheta; 3672 uniform float mipInt; 3673 uniform vec3 poleAxis; 3674 3675 #define ENVMAP_TYPE_CUBE_UV 3676 #include <cube_uv_reflection_fragment> 3677 3678 vec3 getSample( float theta, vec3 axis ) { 3679 3680 float cosTheta = cos( theta ); 3681 // Rodrigues' axis-angle rotation 3682 vec3 sampleDirection = vOutputDirection * cosTheta 3683 + cross( axis, vOutputDirection ) * sin( theta ) 3684 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3685 3686 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3687 3688 } 3689 3690 void main() { 3691 3692 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3693 3694 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3695 3696 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3697 3698 } 3699 3700 axis = normalize( axis ); 3701 3702 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3703 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3704 3705 for ( int i = 1; i < n; i++ ) { 3706 3707 if ( i >= samples ) { 3708 3709 break; 3710 3711 } 3712 3713 float theta = dTheta * float( i ); 3714 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3715 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3716 3717 } 3718 3719 } 3720 `,blending:Qa,depthTest:!1,depthWrite:!1})}function GU(){return new Kl({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:PC(),fragmentShader:` 3721 3722 precision mediump float; 3723 precision mediump int; 3724 3725 varying vec3 vOutputDirection; 3726 3727 uniform sampler2D envMap; 3728 3729 #include <common> 3730 3731 void main() { 3732 3733 vec3 outputDirection = normalize( vOutputDirection ); 3734 vec2 uv = equirectUv( outputDirection ); 3735
3736 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3737 3738 } 3739 `,blending:Qa,depthTest:!1,depthWrite:!1})}function HU(){return new Kl({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:PC(),fragmentShader:` 3740 3741 precision mediump float; 3742 precision mediump int; 3743 3744 uniform float flipEnvMap; 3745 3746 varying vec3 vOutputDirection; 3747 3748 uniform samplerCube envMap; 3749 3750 void main() { 3751 3752 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3753 3754 } 3755 `,blending:Qa,depthTest:!1,depthWrite:!1})}function PC(){return` 3756 3757 precision mediump float; 3758 precision mediump int; 3759 3760 attribute float faceIndex; 3761 3762 varying vec3 vOutputDirection; 3763 3764 // RH coordinate system; PMREM face-indexing convention 3765 vec3 getDirection( vec2 uv, float face ) { 3766 3767 uv = 2.0 * uv - 1.0; 3768 3769 vec3 direction = vec3( uv, 1.0 ); 3770 3771 if ( face == 0.0 ) { 3772 3773 direction = direction.zyx; // ( 1, v, u ) pos x 3774 3775 } else if ( face == 1.0 ) { 3776 3777 direction = direction.xzy; 3778 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3779 3780 } else if ( face == 2.0 ) { 3781 3782 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3783 3784 } else if ( face == 3.0 ) { 3785 3786 direction = direction.zyx; 3787 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3788 3789 } else if ( face == 4.0 ) { 3790 3791 direction = direction.xzy; 3792 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3793 3794 } else if ( face == 5.0 ) { 3795 3796 direction.z *= -1.0; // ( u, v, -1 ) neg z 3797 3798 } 3799 3800 return direction; 3801 3802 } 3803 3804 void main() { 3805 3806 vOutputDirection = getDirection( uv, faceIndex ); 3807 gl_Position = vec4( position, 1.0 ); 3808 3809 } 3810 `}function HW(s){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const u=l.mapping,h=u===Cd||u===wd,p=u===Eo||u===sl;if(h||p){let g=e.get(l);const y=g!==void 0?g.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==y)return t===null&&(t=new WR(s)),g=h?t.fromEquirectangular(l,g):t.fromCubemap(l,g),g.texture.pmremVersion=l.pmremVersion,e.set(l,g),g.texture;if(g!==void 0)return g.texture;{const _=l.image;return h&&_&&_.height>0||p&&_&&i(_)?(t===null&&(t=new WR(s)),g=h?t.fromEquirectangular(l):t.fromCubemap(l),g.texture.pmremVersion=l.pmremVersion,e.set(l,g),l.addEventListener("dispose",r),g.texture):null}}}return l}function i(l){let u=0;const h=6;for(let p=0;p<h;p++)l[p]!==void 0&&u++;return u===h}function r(l){const u=l.target;u.removeEventListener("dispose",r);const h=e.get(u);h!==void 0&&(e.delete(u),h.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function kW(s){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=s.getExtension("WEBGL_depth_texture")||s.getExtension("MOZ_WEBGL_depth_texture")||s.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=s.getExtension("WEBGL_compressed_texture_s3tc")||s.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=s.getExtension("WEBGL_compressed_texture_pvrtc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=s.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&qr("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function qW(s,e,t,n){const i={},r=new WeakMap;function a(g){const y=g.target;y.index!==null&&e.remove(y.index);for(const S in y.attributes)e.remove(y.attributes[S]);y.removeEventListener("dispose",a),delete i[y.id];const _=r.get(y);_&&(e.remove(_),r.delete(y)),n.releaseStatesOfGeometry(y),y.isInstancedBufferGeometry===!0&&delete y._maxInstanceCount,t.memory.geometries--}function l(g,y){return i[y.id]===!0||(y.addEventListener("dispose",a),i[y.id]=!0,t.memory.geometries++),y}function u(g){const y=g.attributes;for(const _ in y)e.update(y[_],s.ARRAY_BUFFER)}function h(g){const y=[],_=g.index,S=g.attributes.position;let A=0;if(_!==null){const C=_.array;A=_.version;for(let w=0,D=C.length;w<D;w+=3){const P=C[w+0],I=C[w+1],F=C[w+2];y.push(P,I,I,F,F,P)}}else if(S!==void 0){const C=S.array;A=S.version;for(let w=0,D=C.length/3-1;w<D;w+=3){const P=w+0,I=w+1,F=w+2;y.push(P,I,I,F,F,P)}}else return;const E=new(QN(y)?WM:qM)(y,1);E.version=A;const b=r.get(g);b&&e.remove(b),r.set(g,E)}function p(g){const y=r.get(g);if(y){const _=g.index;_!==null&&y.version<_.version&&h(g)}else h(g);return r.get(g)}return{get:l,update:u,getWireframeAttribute:p}}function WW(s,e,t){let n;function i(y){n=y}let r,a;function l(y){r=y.type,a=y.bytesPerElement}function u(y,_){s.drawElements(n,_,r,y*a),t.update(_,n,1)}function h(y,_,S){S!==0&&(s.drawElementsInstanced(n,_,r,y*a,S),t.update(_,n,S))}function p(y,_,S){if(S===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,_,0,r,y,0,S);let E=0;for(let b=0;b<S;b++)E+=_[b];t.update(E,n,1)}function g(y,_,S,A){if(S===0)return;const E=e.get("WEBGL_multi_draw");if(E===null)for(let b=0;b<y.length;b++)h(y[b]/a,_[b],A[b]);
vendor: 17,449 bytes, lines 3810-3845
3810else{E.multiDrawElementsInstancedWEBGL(n,_,0,r,y,0,A,0,S);let b=0;for(let C=0;C<S;C++)b+=_[C]*A[C];t.update(b,n,1)}}this.setMode=i,this.setIndex=l,this.render=u,this.renderInstances=h,this.renderMultiDraw=p,this.renderMultiDrawInstances=g}function XW(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,l){switch(t.calls++,a){case s.TRIANGLES:t.triangles+=l*(r/3);break;case s.LINES:t.lines+=l*(r/2);break;case s.LINE_STRIP:t.lines+=l*(r-1);break;case s.LINE_LOOP:t.lines+=l*r;break;case s.POINTS:t.points+=l*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function YW(s,e,t){const n=new WeakMap,i=new kt;function r(a,l,u){const h=a.morphTargetInfluences,p=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,g=p!==void 0?p.length:0;let y=n.get(l);if(y===void 0||y.count!==g){let O=function(){z.dispose(),n.delete(l),l.removeEventListener("dispose",O)};var _=O;y!==void 0&&y.texture.dispose();const S=l.morphAttributes.position!==void 0,A=l.morphAttributes.normal!==void 0,E=l.morphAttributes.color!==void 0,b=l.morphAttributes.position||[],C=l.morphAttributes.normal||[],w=l.morphAttributes.color||[];let D=0;S===!0&&(D=1),A===!0&&(D=2),E===!0&&(D=3);let P=l.attributes.position.count*D,I=1;P>e.maxTextureSize&&(I=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);const F=new Float32Array(P*I*4*g),z=new nx(F,P,I,g);z.type=Bi,z.needsUpdate=!0;const B=D*4;for(let W=0;W<g;W++){const ee=b[W],se=C[W],fe=w[W],pe=P*I*4*W;for(let k=0;k<ee.count;k++){const Q=k*B;S===!0&&(i.fromBufferAttribute(ee,k),F[pe+Q+0]=i.x,F[pe+Q+1]=i.y,F[pe+Q+2]=i.z,F[pe+Q+3]=0),A===!0&&(i.fromBufferAttribute(se,k),F[pe+Q+4]=i.x,F[pe+Q+5]=i.y,F[pe+Q+6]=i.z,F[pe+Q+7]=0),E===!0&&(i.fromBufferAttribute(fe,k),F[pe+Q+8]=i.x,F[pe+Q+9]=i.y,F[pe+Q+10]=i.z,F[pe+Q+11]=fe.itemSize===4?i.w:1)}}y={count:g,texture:z,size:new Ge(P,I)},n.set(l,y),l.addEventListener("dispose",O)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)u.getUniforms().setValue(s,"morphTexture",a.morphTexture,t);else{let S=0;for(let E=0;E<h.length;E++)S+=h[E];const A=l.morphTargetsRelative?1:1-S;u.getUniforms().setValue(s,"morphTargetBaseInfluence",A),u.getUniforms().setValue(s,"morphTargetInfluences",h)}u.getUniforms().setValue(s,"morphTargetsTexture",y.texture,t),u.getUniforms().setValue(s,"morphTargetsTextureSize",y.size)}return{update:r}}function jW(s,e,t,n){let i=new WeakMap;function r(u){const h=n.render.frame,p=u.geometry,g=e.get(u,p);if(i.get(g)!==h&&(e.update(g),i.set(g,h)),u.isInstancedMesh&&(u.hasEventListener("dispose",l)===!1&&u.addEventListener("dispose",l),i.get(u)!==h&&(t.update(u.instanceMatrix,s.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,s.ARRAY_BUFFER),i.set(u,h))),u.isSkinnedMesh){const y=u.skeleton;i.get(y)!==h&&(y.update(),i.set(y,h))}return g}function a(){i=new WeakMap}function l(u){const h=u.target;h.removeEventListener("dispose",l),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:r,dispose:a}}const b3=new qi,kU=new Ta(1,1),T3=new nx,M3=new kM,E3=new Id,qU=[],WU=[],XU=new Float32Array(16),YU=new Float32Array(9),jU=new Float32Array(4);function nv(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let r=qU[i];if(r===void 0&&(r=new Float32Array(i),qU[i]=r),e!==0){n.toArray(r,0);for(let a=1,l=0;a!==e;++a)l+=t,s[a].toArray(r,l)}return r}function Qs(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function $s(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function mE(s,e){let t=WU[e];t===void 0&&(t=new Int32Array(e),WU[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function KW(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function ZW(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qs(t,e))return;s.uniform2fv(this.addr,e),$s(t,e)}}function QW(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Qs(t,e))return;s.uniform3fv(this.addr,e),$s(t,e)}}function $W(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Qs(t,e))return;s.uniform4fv(this.addr,e),$s(t,e)}}function JW(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Qs(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),$s(t,e)}else{if(Qs(t,n))return;jU.set(n),s.uniformMatrix2fv(this.addr,!1,jU),$s(t,n)}}function eX(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Qs(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),$s(t,e)}else{if(Qs(t,n))return;YU.set(n),s.uniformMatrix3fv(this.addr,!1,YU),$s(t,n)}}function tX(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Qs(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),$s(t,e)}else{if(Qs(t,n))return;XU.set(n),s.uniformMatrix4fv(this.addr,!1,XU),$s(t,n)}}function nX(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function iX(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qs(t,e))return;s.uniform2iv(this.addr,e),$s(t,e)}}function sX(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Qs(t,e))return;s.uniform3iv(this.addr,e),$s(t,e)}}function rX(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Qs(t,e))return;s.uniform4iv(this.addr,e),$s(t,e)}}function aX(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function oX(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qs(t,e))return;s.uniform2uiv(this.addr,e),$s(t,e)}}function lX(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Qs(t,e))return;s.uniform3uiv(this.addr,e),$s(t,e)}}function uX(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Qs(t,e))return;s.uniform4uiv(this.addr,e),$s(t,e)}}function cX(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let r;this.type===s.SAMPLER_2D_SHADOW?(kU.compareFunction=tx,r=kU):r=b3,t.setTexture2D(e||r,i)}function hX(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||M3,i)}function dX(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||E3,i)}function fX(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||T3,i)}function pX(s){switch(s){case 5126:return KW;case 35664:return ZW;case 35665:return QW;case 35666:return $W;case 35674:return JW;case 35675:return eX;case 35676:return tX;case 5124:case 35670:return nX;case 35667:case 35671:return iX;case 35668:case 35672:return sX;case 35669:case 35673:return rX;case 5125:return aX;case 36294:return oX;case 36295:return lX;case 36296:return uX;case 35678:case 36198:case 36298:case 36306:case 35682:return cX;case 35679:case 36299:case 36307:return hX;case 35680:case 36300:case 36308:case 36293:return dX;case 36289:case 36303:case 36311:case 36292:return fX}}function mX(s,e){s.uniform1fv(this.addr,e)}function gX(s,e){const t=nv(e,this.size,2);s.uniform2fv(this.addr,t)}function yX(s,e){const t=nv(e,this.size,3);s.uniform3fv(this.addr,t)}function vX(s,e){const t=nv(e,this.size,4);s.uniform4fv(this.addr,t)}function _X(s,e){const t=nv(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function xX(s,e){const t=nv(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function SX(s,e){const t=nv(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function bX(s,e){s.uniform1iv(this.addr,e)}function TX(s,e){s.uniform2iv(this.addr,e)}function MX(s,e){s.uniform3iv(this.addr,e)}function EX(s,e){s.uniform4iv(this.addr,e)}function AX(s,e){s.uniform1uiv(this.addr,e)}function RX(s,e){s.uniform2uiv(this.addr,e)}function NX(s,e){s.uniform3uiv(this.addr,e)}function CX(s,e){s.uniform4uiv(this.addr,e)}function wX(s,e,t){const n=this.cache,i=e.length,r=mE(t,i);Qs(n,r)||(s.uniform1iv(this.addr,r),$s(n,r));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||b3,r[a])}function DX(s,e,t){const n=this.cache,i=e.length,r=mE(t,i);Qs(n,r)||(s.uniform1iv(this.addr,r),$s(n,r));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||M3,r[a])}function UX(s,e,t){const n=this.cache,i=e.length,r=mE(t,i);Qs(n,r)||(s.uniform1iv(this.addr,r),$s(n,r));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||E3,r[a])}function LX(s,e,t){const n=this.cache,i=e.length,r=mE(t,i);Qs(n,r)||(s.uniform1iv(this.addr,r),$s(n,r));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||T3,r[a])}function BX(s){switch(s){case 5126:return mX;case 35664:return gX;case 35665:return yX;case 35666:return vX;case 35674:return _X;case 35675:return xX;case 35676:return SX;case 5124:case 35670:return bX;case 35667:case 35671:return TX;case 35668:case 35672:return MX;case 35669:case 35673:return EX;case 5125:return AX;case 36294:return RX;case 36295:return NX;case 36296:return CX;case 35678:case 36198:case 36298:case 36306:case 35682:return wX;case 35679:case 36299:case 36307:return DX;case 35680:case 36300:case 36308:case 36293:return UX;case 36289:case 36303:case 36311:case 36292:return LX}}class PX{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=pX(t.type)}}class OX{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=BX(t.type)}}class IX{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const l=i[r];l.setValue(e,t[l.id],n)}}}const z1=/(\w+)(\])?(\[|\.)?/g;function KU(s,e){s.seq.push(e),s.map[e.id]=e}function FX(s,e,t){const n=s.name,i=n.length;for(z1.lastIndex=0;;){const r=z1.exec(n),a=z1.lastIndex;let l=r[1];const u=r[2]==="]",h=r[3];if(u&&(l=l|0),h===void 0||h==="["&&a+2===i){KU(t,h===void 0?new PX(l,s,e):new OX(l,s,e));break}else{let g=t.map[l];g===void 0&&(g=new IX(l),KU(t,g)),t=g}}}class RT{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const r=e.getActiveUniform(t,i),a=e.getUniformLocation(t,r.name);FX(r,a,this)}}setValue(e,t,n,i){const r=this.map[t];r!==void 0&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const l=t[r],u=n[l.id];u.needsUpdate!==!1&&l.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function ZU(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const VX=37297;let zX=0;function GX(s,e){const t=s.split(` 3811`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=i;a<r;a++){const l=a+1;n.push(`${l===e?">":" "} ${l}: ${t[a]}`)}return n.join(` 3812`)}const QU=new pn;function HX(s){Kt._getMatrix(QU,Kt.workingColorSpace,s);const e=`mat3( ${QU.elements.map(t=>t.toFixed(4))} )`;switch(Kt.getTransfer(s)){case nm:return[e,"LinearTransferOETF"];case Et:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function $U(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),r=(s.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const l=parseInt(a[1]);return t.toUpperCase()+` 3813 3814`+r+` 3815 3816`+GX(s.getShaderSource(e),l)}else return r}function kX(s,e){const t=HX(e);return[`vec4 ${s}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3817`)}function qX(s,e){let t;switch(e){case HN:t="Linear";break;case kN:t="Reinhard";break;case qN:t="Cineon";break;case BM:t="ACESFilmic";break;case WN:t="AgX";break;case XN:t="Neutral";break;case hP:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Qb=new Y;function WX(){Kt.getLuminanceCoefficients(Qb);const s=Qb.x.toFixed(4),e=Qb.y.toFixed(4),t=Qb.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${s}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3818`)}function XX(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(r0).join(` 3819`)}function YX(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3820`)}function jX(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const r=s.getActiveAttrib(e,i),a=r.name;let l=1;r.type===s.FLOAT_MAT2&&(l=2),r.type===s.FLOAT_MAT3&&(l=3),r.type===s.FLOAT_MAT4&&(l=4),t[a]={type:r.type,location:s.getAttribLocation(e,a),locationSize:l}}return t}function r0(s){return s!==""}function JU(s,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function eL(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const KX=/^[ \t]*#include +<([\w\d./]+)>/gm;function XR(s){return s.replace(KX,QX)}const ZX=new Map;function QX(s,e){let t=Nn[e];if(t===void 0){const n=ZX.get(e);if(n!==void 0)t=Nn[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return XR(t)}const $X=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function tL(s){return s.replace($X,JX)}function JX(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function nL(s){let e=`precision ${s.precision} float; 3821 precision ${s.precision} int; 3822 precision ${s.precision} sampler2D; 3823 precision ${s.precision} samplerCube; 3824 precision ${s.precision} sampler3D; 3825 precision ${s.precision} sampler2DArray; 3826 precision ${s.precision} sampler2DShadow; 3827 precision ${s.precision} samplerCubeShadow; 3828 precision ${s.precision} sampler2DArrayShadow; 3829 precision ${s.precision} isampler2D; 3830 precision ${s.precision} isampler3D; 3831 precision ${s.precision} isamplerCube; 3832 precision ${s.precision} isampler2DArray; 3833 precision ${s.precision} usampler2D; 3834 precision ${s.precision} usampler3D; 3835 precision ${s.precision} usamplerCube; 3836 precision ${s.precision} usampler2DArray; 3837 `;return s.precision==="highp"?e+=` 3838#define HIGH_PRECISION`:s.precision==="mediump"?e+=` 3839#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=` 3840#define LOW_PRECISION`),e}function e9(s){let e="SHADOWMAP_TYPE_BASIC";return s.shadowMapType===Y0?e="SHADOWMAP_TYPE_PCF":s.shadowMapType===d0?e="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===ya&&(e="SHADOWMAP_TYPE_VSM"),e}function t9(s){let e="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case Eo:case sl:e="ENVMAP_TYPE_CUBE";break;case nh:e="ENVMAP_TYPE_CUBE_UV";break}return e}function n9(s){let e="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case sl:e="ENVMAP_MODE_REFRACTION";break}return e}function i9(s){let e="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case Zy:e="ENVMAP_BLENDING_MULTIPLY";break;case zN:e="ENVMAP_BLENDING_MIX";break;case GN:e="ENVMAP_BLENDING_ADD";break}return e}function s9(s){const e=s.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function r9(s,e,t,n){const i=s.getContext(),r=t.defines;let a=t.vertexShader,l=t.fragmentShader;const u=e9(t),h=t9(t),p=n9(t),g=i9(t),y=s9(t),_=XX(t),S=YX(r),A=i.createProgram();let E,b,C=t.glslVersion?"#version "+t.glslVersion+` 3841`:"";t.isRawShaderMaterial?(E=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S].filter(r0).join(` 3842`),E.length>0&&(E+=` 3843`),b=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S].filter(r0).join(` 3844`),b.length>0&&(b+=` 3845`)):(E=[nL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.extensionCl
vendor: 6,474 bytes, lines 3845-3847
3845ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3846`].filter(r0).join(` 3847`),b=[nL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3847IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Rr?"#define TONE_MAPPING":"",t.toneMapping!==Rr?Nn.tonemapping_pars_fragment:"",t.toneMapping!==Rr?qX("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Nn.colorspace_pars_fragment,kX("linearToOutputTexel",t.outputColorSpace),WX(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3848`].filter(r0).join(` 3849`)),a=XR(a),a=JU(a,t),a=eL(a,t),l=XR(l),l=JU(l,t),l=eL(l,t),a=tL(a),l=tL(l),t.isRawShaderMaterial!==!0&&(C=`#version 300 es 3850`,E=[_,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3851`)+` 3852`+E,b=["#define varying in",t.glslVersion===FR?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===FR?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` 3853`)+` 3854`+b);const w=C+E+a,D=C+b+l,P=ZU(i,i.VERTEX_SHADER,w),I=ZU(i,i.FRAGMENT_SHADER,D);i.attachShader(A,P),i.attachShader(A,I),t.index0AttributeName!==void 0?i.bindAttribLocation(A,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(A,0,"position"),i.linkProgram(A);function F(W){if(s.debug.checkShaderErrors){const ee=i.getProgramInfoLog(A)||"",se=i.getShaderInfoLog(P)||"",fe=i.getShaderInfoLog(I)||"",pe=ee.trim(),k=se.trim(),Q=fe.trim();let J=!0,Se=!0;if(i.getProgramParameter(A,i.LINK_STATUS)===!1)if(J=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,A,P,I);else{const K=$U(i,P,"vertex"),oe=$U(i,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(A,i.VALIDATE_STATUS)+` 3855 3856Material Name: `+W.name+` 3857Material Type: `+W.type+` 3858 3859Program Info Log: `+pe+` 3860`+K+` 3861`+oe)}else pe!==""?console.warn("THREE.WebGLProgram: Program Info Log:",pe):(k===""||Q==="")&&(Se=!1);Se&&(W.diagnostics={runnable:J,programLog:pe,vertexShader:{log:k,prefix:E},fragmentShader:{log:Q,prefix:b}})}i.deleteShader(P),i.deleteShader(I),z=new RT(i,A),B=jX(i,A)}let z;this.getUniforms=function(){return z===void 0&&F(this),z};let B;this.getAttributes=function(){return B===void 0&&F(this),B};let O=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return O===!1&&(O=i.getProgramParameter(A,VX)),O},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(A),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=zX++,this.cacheKey=e,this.usedTimes=1,this.program=A,this.vertexShader=P,this.fragmentShader=I,this}let a9=0;class o9{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new l9(e),t.set(e,n)),n}}class l9{constructor(e){this.id=a9++,this.code=e,this.usedTimes=0}}function u9(s,e,t,n,i,r,a){const l=new Oy,u=new o9,h=new Set,p=[],g=i.logarithmicDepthBuffer,y=i.vertexTextures;let _=i.precision;const S={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(B){return h.add(B),B===0?"uv":`uv${B}`}function E(B,O,W,ee,se){const fe=ee.fog,pe=se.geometry,k=B.isMeshStandardMaterial?ee.environment:null,Q=(B.isMeshStandardMaterial?t:e).get(B.envMap||k),J=Q&&Q.mapping===nh?Q.image.height:null,Se=S[B.type];B.precision!==null&&(_=i.getMaxPrecision(B.precision),_!==B.precision&&console.warn("THREE.WebGLProgram.getParameters:",B.precision,"not supported, using",_,"instead."));const K=pe.morphAttributes.position||pe.morphAttributes.normal||pe.morphAttributes.color,oe=K!==void 0?K.length:0;let we=0;pe.morphAttributes.position!==void 0&&(we=1),pe.morphAttributes.normal!==void 0&&(we=2),pe.morphAttributes.color!==void 0&&(we=3);let Ie,Ze,mt,xe;if(Se){const Bn=kl[Se];Ie=Bn.vertexShader,Ze=Bn.fragmentShader}else Ie=B.vertexShader,Ze=B.fragmentShader,u.update(B),mt=u.getVertexShaderID(B),xe=u.getFragmentShaderID(B);const Ve=s.getRenderTarget(),tt=s.state.buffers.depth.getReversed(),Mt=se.isInstancedMesh===!0,Ct=se.isBatchedMesh===!0,rn=!!B.map,vn=!!B.matcap,te=!!Q,$e=!!B.aoMap,Ye=!!B.lightMap,qe=!!B.bumpMap,Be=!!B.normalMap,ft=!!B.displacementMap,Je=!!B.emissiveMap,nt=!!B.metalnessMap,qt=!!B.roughnessMap,tn=B.anisotropy>0,Z=B.clearcoat>0,G=B.dispersion>0,ge=B.iridescence>0,De=B.sheen>0,We=B.transmission>0,Ue=tn&&!!B.anisotropyMap,St=Z&&!!B.clearcoatMap,ht=Z&&!!B.clearcoatNormalMap,Dt=Z&&!!B.clearcoatRoughnessMap,Ut=ge&&!!B.iridescenceMap,et=ge&&!!B.iridescenceThicknessMap,gt=De&&!!B.sheenColorMap,Ht=De&&!!B.sheenRoughnessMap,Lt=!!B.specularMap,yt=!!B.specularColorMap,un=!!B.specularIntensityMap,he=We&&!!B.transmissionMap,at=We&&!!B.thicknessMap,dt=!!B.gradientMap,Nt=!!B.alphaMap,it=B.alphaTest>0,Ke=!!B.alphaHash,Bt=!!B.extensions;let nn=Rr;B.toneMapped&&(Ve===null||Ve.isXRRenderTarget===!0)&&(nn=s.toneMapping);const zn={shaderID:Se,shaderType:B.type,shaderName:B.name,vertexShader:Ie,fragmentShader:Ze,defines:B.defines,customVertexShaderID:mt,customFragmentShaderID:xe,isRawShaderMaterial:B.isRawShaderMaterial===!0,glslVersion:B.glslVersion,precision:_,batching:Ct,batchingColor:Ct&&se._colorsTexture!==null,instancing:Mt,instancingColor:Mt&&se.instanceColor!==null,instancingMorph:Mt&&se.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:Ve===null?s.outputColorSpace:Ve.isXRRenderTarget===!0?Ve.texture.colorSpace:Yl,alphaToCoverage:!!B.alphaToCoverage,map:rn,matc
vendor: 1,802 bytes, line 3861
3861ap:vn,envMap:te,envMapMode:te&&Q.mapping,envMapCubeUVHeight:J,aoMap:$e,lightMap:Ye,bumpMap:qe,normalMap:Be,displacementMap:y&&ft,emissiveMap:Je,normalMapObjectSpace:Be&&B.normalMapType===jN,normalMapTangentSpace:Be&&B.normalMapType===ec,metalnessMap:nt,roughnessMap:qt,anisotropy:tn,anisotropyMap:Ue,clearcoat:Z,clearcoatMap:St,clearcoatNormalMap:ht,clearcoatRoughnessMap:Dt,dispersion:G,iridescence:ge,iridescenceMap:Ut,iridescenceThicknessMap:et,sheen:De,sheenColorMap:gt,sheenRoughnessMap:Ht,specularMap:Lt,specularColorMap:yt,specularIntensityMap:un,transmission:We,transmissionMap:he,thicknessMap:at,gradientMap:dt,opaque:B.transparent===!1&&B.blending===$a&&B.alphaToCoverage===!1,alphaMap:Nt,alphaTest:it,alphaHash:Ke,combine:B.combine,mapUv:rn&&A(B.map.channel),aoMapUv:$e&&A(B.aoMap.channel),lightMapUv:Ye&&A(B.lightMap.channel),bumpMapUv:qe&&A(B.bumpMap.channel),normalMapUv:Be&&A(B.normalMap.channel),displacementMapUv:ft&&A(B.displacementMap.channel),emissiveMapUv:Je&&A(B.emissiveMap.channel),metalnessMapUv:nt&&A(B.metalnessMap.channel),roughnessMapUv:qt&&A(B.roughnessMap.channel),anisotropyMapUv:Ue&&A(B.anisotropyMap.channel),clearcoatMapUv:St&&A(B.clearcoatMap.channel),clearcoatNormalMapUv:ht&&A(B.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Dt&&A(B.clearcoatRoughnessMap.channel),iridescenceMapUv:Ut&&A(B.iridescenceMap.channel),iridescenceThicknessMapUv:et&&A(B.iridescenceThicknessMap.channel),sheenColorMapUv:gt&&A(B.sheenColorMap.channel),sheenRoughnessMapUv:Ht&&A(B.sheenRoughnessMap.channel),specularMapUv:Lt&&A(B.specularMap.channel),specularColorMapUv:yt&&A(B.specularColorMap.channel),specularIntensityMapUv:un&&A(B.specularIntensityMap.channel),transmissionMapUv:he&&A(B.transmissionMap.channel),thicknessMapUv:at&&A(B.thicknessMap.channel),alphaMapUv:Nt&&A(B.alph
vendor: 15,859 bytes, lines 3861-3889
3861aMap.channel),vertexTangents:!!pe.attributes.tangent&&(Be||tn),vertexColors:B.vertexColors,vertexAlphas:B.vertexColors===!0&&!!pe.attributes.color&&pe.attributes.color.itemSize===4,pointsUvs:se.isPoints===!0&&!!pe.attributes.uv&&(rn||Nt),fog:!!fe,useFog:B.fog===!0,fogExp2:!!fe&&fe.isFogExp2,flatShading:B.flatShading===!0&&B.wireframe===!1,sizeAttenuation:B.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:tt,skinning:se.isSkinnedMesh===!0,morphTargets:pe.morphAttributes.position!==void 0,morphNormals:pe.morphAttributes.normal!==void 0,morphColors:pe.morphAttributes.color!==void 0,morphTargetsCount:oe,morphTextureStride:we,numDirLights:O.directional.length,numPointLights:O.point.length,numSpotLights:O.spot.length,numSpotLightMaps:O.spotLightMap.length,numRectAreaLights:O.rectArea.length,numHemiLights:O.hemi.length,numDirLightShadows:O.directionalShadowMap.length,numPointLightShadows:O.pointShadowMap.length,numSpotLightShadows:O.spotShadowMap.length,numSpotLightShadowsWithMaps:O.numSpotLightShadowsWithMaps,numLightProbes:O.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:B.dithering,shadowMapEnabled:s.shadowMap.enabled&&W.length>0,shadowMapType:s.shadowMap.type,toneMapping:nn,decodeVideoTexture:rn&&B.map.isVideoTexture===!0&&Kt.getTransfer(B.map.colorSpace)===Et,decodeVideoTextureEmissive:Je&&B.emissiveMap.isVideoTexture===!0&&Kt.getTransfer(B.emissiveMap.colorSpace)===Et,premultipliedAlpha:B.premultipliedAlpha,doubleSided:B.side===br,flipSided:B.side===yi,useDepthPacking:B.depthPacking>=0,depthPacking:B.depthPacking||0,index0AttributeName:B.index0AttributeName,extensionClipCullDistance:Bt&&B.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Bt&&B.extensions.multiDraw===!0||Ct)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:B.customProgramCacheKey()};return zn.vertexUv1s=h.has(1),zn.vertexUv2s=h.has(2),zn.vertexUv3s=h.has(3),h.clear(),zn}function b(B){const O=[];if(B.shaderID?O.push(B.shaderID):(O.push(B.customVertexShaderID),O.push(B.customFragmentShaderID)),B.defines!==void 0)for(const W in B.defines)O.push(W),O.push(B.defines[W]);return B.isRawShaderMaterial===!1&&(C(O,B),w(O,B),O.push(s.outputColorSpace)),O.push(B.customProgramCacheKey),O.join()}function C(B,O){B.push(O.precision),B.push(O.outputColorSpace),B.push(O.envMapMode),B.push(O.envMapCubeUVHeight),B.push(O.mapUv),B.push(O.alphaMapUv),B.push(O.lightMapUv),B.push(O.aoMapUv),B.push(O.bumpMapUv),B.push(O.normalMapUv),B.push(O.displacementMapUv),B.push(O.emissiveMapUv),B.push(O.metalnessMapUv),B.push(O.roughnessMapUv),B.push(O.anisotropyMapUv),B.push(O.clearcoatMapUv),B.push(O.clearcoatNormalMapUv),B.push(O.clearcoatRoughnessMapUv),B.push(O.iridescenceMapUv),B.push(O.iridescenceThicknessMapUv),B.push(O.sheenColorMapUv),B.push(O.sheenRoughnessMapUv),B.push(O.specularMapUv),B.push(O.specularColorMapUv),B.push(O.specularIntensityMapUv),B.push(O.transmissionMapUv),B.push(O.thicknessMapUv),B.push(O.combine),B.push(O.fogExp2),B.push(O.sizeAttenuation),B.push(O.morphTargetsCount),B.push(O.morphAttributeCount),B.push(O.numDirLights),B.push(O.numPointLights),B.push(O.numSpotLights),B.push(O.numSpotLightMaps),B.push(O.numHemiLights),B.push(O.numRectAreaLights),B.push(O.numDirLightShadows),B.push(O.numPointLightShadows),B.push(O.numSpotLightShadows),B.push(O.numSpotLightShadowsWithMaps),B.push(O.numLightProbes),B.push(O.shadowMapType),B.push(O.toneMapping),B.push(O.numClippingPlanes),B.push(O.numClipIntersection),B.push(O.depthPacking)}function w(B,O){l.disableAll(),O.supportsVertexTextures&&l.enable(0),O.instancing&&l.enable(1),O.instancingColor&&l.enable(2),O.instancingMorph&&l.enable(3),O.matcap&&l.enable(4),O.envMap&&l.enable(5),O.normalMapObjectSpace&&l.enable(6),O.normalMapTangentSpace&&l.enable(7),O.clearcoat&&l.enable(8),O.iridescence&&l.enable(9),O.alphaTest&&l.enable(10),O.vertexColors&&l.enable(11),O.vertexAlphas&&l.enable(12),O.vertexUv1s&&l.enable(13),O.vertexUv2s&&l.enable(14),O.vertexUv3s&&l.enable(15),O.vertexTangents&&l.enable(16),O.anisotropy&&l.enable(17),O.alphaHash&&l.enable(18),O.batching&&l.enable(19),O.dispersion&&l.enable(20),O.batchingColor&&l.enable(21),O.gradientMap&&l.enable(22),B.push(l.mask),l.disableAll(),O.fog&&l.enable(0),O.useFog&&l.enable(1),O.flatShading&&l.enable(2),O.logarithmicDepthBuffer&&l.enable(3),O.reversedDepthBuffer&&l.enable(4),O.skinning&&l.enable(5),O.morphTargets&&l.enable(6),O.morphNormals&&l.enable(7),O.morphColors&&l.enable(8),O.premultipliedAlpha&&l.enable(9),O.shadowMapEnabled&&l.enable(10),O.doubleSided&&l.enable(11),O.flipSided&&l.enable(12),O.useDepthPacking&&l.enable(13),O.dithering&&l.enable(14),O.transmission&&l.enable(15),O.sheen&&l.enable(16),O.opaque&&l.enable(17),O.pointsUvs&&l.enable(18),O.decodeVideoTexture&&l.enable(19),O.decodeVideoTextureEmissive&&l.enable(20),O.alphaToCoverage&&l.enable(21),B.push(l.mask)}function D(B){const O=S[B.type];let W;if(O){const ee=kl[O];W=IP.clone(ee.uniforms)}else W=B.uniforms;return W}function P(B,O){let W;for(let ee=0,se=p.length;ee<se;ee++){const fe=p[ee];if(fe.cacheKey===O){W=fe,++W.usedTimes;break}}return W===void 0&&(W=new r9(s,O,B,r),p.push(W)),W}function I(B){if(--B.usedTimes===0){const O=p.indexOf(B);p[O]=p[p.length-1],p.pop(),B.destroy()}}function F(B){u.remove(B)}function z(){u.dispose()}return{getParameters:E,getProgramCacheKey:b,getUniforms:D,acquireProgram:P,releaseProgram:I,releaseShaderCache:F,programs:p,dispose:z}}function c9(){let s=new WeakMap;function e(a){return s.has(a)}function t(a){let l=s.get(a);return l===void 0&&(l={},s.set(a,l)),l}function n(a){s.delete(a)}function i(a,l,u){s.get(a)[l]=u}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function h9(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function iL(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function sL(){const s=[];let e=0;const t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function a(g,y,_,S,A,E){let b=s[e];return b===void 0?(b={id:g.id,object:g,geometry:y,material:_,groupOrder:S,renderOrder:g.renderOrder,z:A,group:E},s[e]=b):(b.id=g.id,b.object=g,b.geometry=y,b.material=_,b.groupOrder=S,b.renderOrder=g.renderOrder,b.z=A,b.group=E),e++,b}function l(g,y,_,S,A,E){const b=a(g,y,_,S,A,E);_.transmission>0?n.push(b):_.transparent===!0?i.push(b):t.push(b)}function u(g,y,_,S,A,E){const b=a(g,y,_,S,A,E);_.transmission>0?n.unshift(b):_.transparent===!0?i.unshift(b):t.unshift(b)}function h(g,y){t.length>1&&t.sort(g||h9),n.length>1&&n.sort(y||iL),i.length>1&&i.sort(y||iL)}function p(){for(let g=e,y=s.length;g<y;g++){const _=s[g];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:l,unshift:u,finish:p,sort:h}}function d9(){let s=new WeakMap;function e(n,i){const r=s.get(n);let a;return r===void 0?(a=new sL,s.set(n,[a])):i>=r.length?(a=new sL,r.push(a)):a=r[i],a}function t(){s=new WeakMap}return{get:e,dispose:t}}function f9(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new Y,color:new lt};break;case"SpotLight":t={position:new Y,direction:new Y,color:new lt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Y,color:new lt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Y,skyColor:new lt,groundColor:new lt};break;case"RectAreaLight":t={color:new lt,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return s[e.id]=t,t}}}function p9(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let m9=0;function g9(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function y9(s){const e=new f9,t=p9(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)n.probe.push(new Y);const i=new Y,r=new Ot,a=new Ot;function l(h){let p=0,g=0,y=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let _=0,S=0,A=0,E=0,b=0,C=0,w=0,D=0,P=0,I=0,F=0;h.sort(g9);for(let B=0,O=h.length;B<O;B++){const W=h[B],ee=W.color,se=W.intensity,fe=W.distance,pe=W.shadow&&W.shadow.map?W.shadow.map.texture:null;if(W.isAmbientLight)p+=ee.r*se,g+=ee.g*se,y+=ee.b*se;else if(W.isLightProbe){for(let k=0;k<9;k++)n.probe[k].addScaledVector(W.sh.coefficients[k],se);F++}else if(W.isDirectionalLight){const k=e.get(W);if(k.color.copy(W.color).multiplyScalar(W.intensity),W.castShadow){const Q=W.shadow,J=t.get(W);J.shadowIntensity=Q.intensity,J.shadowBias=Q.bias,J.shadowNormalBias=Q.normalBias,J.shadowRadius=Q.radius,J.shadowMapSize=Q.mapSize,n.directionalShadow[_]=J,n.directionalShadowMap[_]=pe,n.directionalShadowMatrix[_]=W.shadow.matrix,C++}n.directional[_]=k,_++}else if(W.isSpotLight){const k=e.get(W);k.position.setFromMatrixPosition(W.matrixWorld),k.color.copy(ee).multiplyScalar(se),k.distance=fe,k.coneCos=Math.cos(W.angle),k.penumbraCos=Math.cos(W.angle*(1-W.penumbra)),k.decay=W.decay,n.spot[A]=k;const Q=W.shadow;if(W.map&&(n.spotLightMap[P]=W.map,P++,Q.updateMatrices(W),W.castShadow&&I++),n.spotLightMatrix[A]=Q.matrix,W.castShadow){const J=t.get(W);J.shadowIntensity=Q.intensity,J.shadowBias=Q.bias,J.shadowNormalBias=Q.normalBias,J.shadowRadius=Q.radius,J.shadowMapSize=Q.mapSize,n.spotShadow[A]=J,n.spotShadowMap[A]=pe,D++}A++}else if(W.isRectAreaLight){const k=e.get(W);k.color.copy(ee).multiplyScalar(se),k.halfWidth.set(W.width*.5,0,0),k.halfHeight.set(0,W.height*.5,0),n.rectArea[E]=k,E++}else if(W.isPointLight){const k=e.get(W);if(k.color.copy(W.color).multiplyScalar(W.intensity),k.distance=W.distance,k.decay=W.decay,W.castShadow){const Q=W.shadow,J=t.get(W);J.shadowIntensity=Q.intensity,J.shadowBias=Q.bias,J.shadowNormalBias=Q.normalBias,J.shadowRadius=Q.radius,J.shadowMapSize=Q.mapSize,J.shadowCameraNear=Q.camera.near,J.shadowCameraFar=Q.camera.far,n.pointShadow[S]=J,n.pointShadowMap[S]=pe,n.pointShadowMatrix[S]=W.shadow.matrix,w++}n.point[S]=k,S++}else if(W.isHemisphereLight){const k=e.get(W);k.skyColor.copy(W.color).multiplyScalar(se),k.groundColor.copy(W.groundColor).multiplyScalar(se),n.hemi[b]=k,b++}}E>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Tt.LTC_FLOAT_1,n.rectAreaLTC2=Tt.LTC_FLOAT_2):(n.rectAreaLTC1=Tt.LTC_HALF_1,n.rectAreaLTC2=Tt.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=y;const z=n.hash;(z.directionalLength!==_||z.pointLength!==S||z.spotLength!==A||z.rectAreaLength!==E||z.hemiLength!==b||z.numDirectionalShadows!==C||z.numPointShadows!==w||z.numSpotShadows!==D||z.numSpotMaps!==P||z.numLightProbes!==F)&&(n.directional.length=_,n.spot.length=A,n.rectArea.length=E,n.point.length=S,n.hemi.length=b,n.directionalShadow.length=C,n.directionalShadowMap.length=C,n.pointShadow.length=w,n.pointShadowMap.length=w,n.spotShadow.length=D,n.spotShadowMap.length=D,n.directionalShadowMatrix.length=C,n.pointShadowMatrix.length=w,n.spotLightMatrix.length=D+P-I,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=I,n.numLightProbes=F,z.directionalLength=_,z.pointLength=S,z.spotLength=A,z.rectAreaLength=E,z.hemiLength=b,z.numDirectionalShadows=C,z.numPointShadows=w,z.numSpotShadows=D,z.numSpotMaps=P,z.numLightProbes=F,n.version=m9++)}function u(h,p){let g=0,y=0,_=0,S=0,A=0;const E=p.matrixWorldInverse;for(let b=0,C=h.length;b<C;b++){const w=h[b];if(w.isDirectionalLight){const D=n.directional[g];D.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),D.direction.sub(i),D.direction.transformDirection(E),g++}else if(w.isSpotLight){const D=n.spot[_];D.position.setFromMatrixPosition(w.matrixWorld),D.position.applyMatrix4(E),D.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),D.direction.sub(i),D.direction.transformDirection(E),_++}else if(w.isRectAreaLight){const D=n.rectArea[S];D.position.setFromMatrixPosition(w.matrixWorld),D.position.applyMatrix4(E),a.identity(),r.copy(w.matrixWorld),r.premultiply(E),a.extractRotation(r),D.halfWidth.set(w.width*.5,0,0),D.halfHeight.set(0,w.height*.5,0),D.halfWidth.applyMatrix4(a),D.halfHeight.applyMatrix4(a),S++}else if(w.isPointLight){const D=n.point[y];D.position.setFromMatrixPosition(w.matrixWorld),D.position.applyMatrix4(E),y++}else if(w.isHemisphereLight){const D=n.hemi[A];D.direction.setFromMatrixPosition(w.matrixWorld),D.direction.transformDirection(E),A++}}}return{setup:l,setupView:u,state:n}}function rL(s){const e=new y9(s),t=[],n=[];function i(p){h.camera=p,t.length=0,n.length=0}function r(p){t.push(p)}function a(p){n.push(p)}function l(){e.setup(t)}function u(p){e.setupView(t,p)}const h={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:h,setupLights:l,setupLightsView:u,pushLight:r,pushShadow:a}}function v9(s){let e=new WeakMap;function t(i,r=0){const a=e.get(i);let l;return a===void 0?(l=new rL(s),e.set(i,[l])):r>=a.length?(l=new rL(s),a.push(l)):l=a[r],l}function n(){e=new WeakMap}return{get:t,dispose:n}}const _9=`void main() { 3862 gl_Position = vec4( position, 1.0 ); 3863}`,x9=`uniform sampler2D shadow_pass; 3864uniform vec2 resolution; 3865uniform float radius; 3866#include <packing> 3867void main() { 3868 const float samples = float( VSM_SAMPLES ); 3869 float mean = 0.0; 3870 float squared_mean = 0.0; 3871 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3872 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3873 for ( float i = 0.0; i < samples; i ++ ) { 3874 float uvOffset = uvStart + i * uvStride; 3875 #ifdef HORIZONTAL_PASS 3876 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3877 mean += distribution.x; 3878 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3879 #else 3880 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3881 mean += depth; 3882 squared_mean += depth * depth; 3883 #endif 3884 } 3885 mean = mean / samples; 3886 squared_mean = squared_mean / samples; 3887 float std_dev = sqrt( squared_mean - mean * mean ); 3888 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3889}`;function S9(s,e,t){let n=new dm;const i=new Ge,r=new Ge,a=new kt,l=new mC({depthPacking:_P}),u=new gC,h={},p=t.maxTextureSize,g={[Za]:yi,[yi]:Za,[br]:br},y=new Kl({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ge},radius:{value:4}},vertexShader:_9,fragmentShader:x9}),_=y.clone();_.defines.HORIZONTAL_PASS=1;const S=new bn;S.setAttribute("position",new ti(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const A=new Ri(S,y),E=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Y0;
vendor: 1,474 bytes, line 3889
3889let b=this.type;this.render=function(I,F,z){if(E.enabled===!1||E.autoUpdate===!1&&E.needsUpdate===!1||I.length===0)return;const B=s.getRenderTarget(),O=s.getActiveCubeFace(),W=s.getActiveMipmapLevel(),ee=s.state;ee.setBlending(Qa),ee.buffers.depth.getReversed()===!0?ee.buffers.color.setClear(0,0,0,0):ee.buffers.color.setClear(1,1,1,1),ee.buffers.depth.setTest(!0),ee.setScissorTest(!1);const se=b!==ya&&this.type===ya,fe=b===ya&&this.type!==ya;for(let pe=0,k=I.length;pe<k;pe++){const Q=I[pe],J=Q.shadow;if(J===void 0){console.warn("THREE.WebGLShadowMap:",Q,"has no shadow.");continue}if(J.autoUpdate===!1&&J.needsUpdate===!1)continue;i.copy(J.mapSize);const Se=J.getFrameExtents();if(i.multiply(Se),r.copy(J.mapSize),(i.x>p||i.y>p)&&(i.x>p&&(r.x=Math.floor(p/Se.x),i.x=r.x*Se.x,J.mapSize.x=r.x),i.y>p&&(r.y=Math.floor(p/Se.y),i.y=r.y*Se.y,J.mapSize.y=r.y)),J.map===null||se===!0||fe===!0){const oe=this.type!==ya?{minFilter:Ai,magFilter:Ai}:{};J.map!==null&&J.map.dispose(),J.map=new jl(i.x,i.y,oe),J.map.texture.name=Q.name+".shadowMap",J.camera.updateProjectionMatrix()}s.setRenderTarget(J.map),s.clear();const K=J.getViewportCount();for(let oe=0;oe<K;oe++){const we=J.getViewport(oe);a.set(r.x*we.x,r.y*we.y,r.x*we.z,r.y*we.w),ee.viewport(a),J.updateMatrices(Q,oe),n=J.getFrustum(),D(F,z,J.camera,Q,this.type)}J.isPointLightShadow!==!0&&this.type===ya&&C(J,z),J.needsUpdate=!1}b=this.type,E.needsUpdate=!1,s.setRenderTarget(B,O,W)};function C(I,F){const z=e.update(A);
vendor: 4,208 bytes, line 3889
3889y.defines.VSM_SAMPLES!==I.blurSamples&&(y.defines.VSM_SAMPLES=I.blurSamples,_.defines.VSM_SAMPLES=I.blurSamples,y.needsUpdate=!0,_.needsUpdate=!0),I.mapPass===null&&(I.mapPass=new jl(i.x,i.y)),y.uniforms.shadow_pass.value=I.map.texture,y.uniforms.resolution.value=I.mapSize,y.uniforms.radius.value=I.radius,s.setRenderTarget(I.mapPass),s.clear(),s.renderBufferDirect(F,null,z,y,A,null),_.uniforms.shadow_pass.value=I.mapPass.texture,_.uniforms.resolution.value=I.mapSize,_.uniforms.radius.value=I.radius,s.setRenderTarget(I.map),s.clear(),s.renderBufferDirect(F,null,z,_,A,null)}function w(I,F,z,B){let O=null;const W=z.isPointLight===!0?I.customDistanceMaterial:I.customDepthMaterial;if(W!==void 0)O=W;else if(O=z.isPointLight===!0?u:l,s.localClippingEnabled&&F.clipShadows===!0&&Array.isArray(F.clippingPlanes)&&F.clippingPlanes.length!==0||F.displacementMap&&F.displacementScale!==0||F.alphaMap&&F.alphaTest>0||F.map&&F.alphaTest>0||F.alphaToCoverage===!0){const ee=O.uuid,se=F.uuid;let fe=h[ee];fe===void 0&&(fe={},h[ee]=fe);let pe=fe[se];pe===void 0&&(pe=O.clone(),fe[se]=pe,F.addEventListener("dispose",P)),O=pe}if(O.visible=F.visible,O.wireframe=F.wireframe,B===ya?O.side=F.shadowSide!==null?F.shadowSide:F.side:O.side=F.shadowSide!==null?F.shadowSide:g[F.side],O.alphaMap=F.alphaMap,O.alphaTest=F.alphaToCoverage===!0?.5:F.alphaTest,O.map=F.map,O.clipShadows=F.clipShadows,O.clippingPlanes=F.clippingPlanes,O.clipIntersection=F.clipIntersection,O.displacementMap=F.displacementMap,O.displacementScale=F.displacementScale,O.displacementBias=F.displacementBias,O.wireframeLinewidth=F.wireframeLinewidth,O.linewidth=F.linewidth,z.isPointLight===!0&&O.isMeshDistanceMaterial===!0){const ee=s.properties.get(O);ee.light=z}return O}function D(I,F,z,B,O){if(I.visible===!1)return;if(I.layers.test(F.layers)&&(I.isMesh||I.isLine||I.isPoints)&&(I.castShadow||I.receiveShadow&&O===ya)&&(!I.frustumCulled||n.intersectsObject(I))){I.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,I.matrixWorld);const se=e.update(I),fe=I.material;if(Array.isArray(fe)){const pe=se.groups;for(let k=0,Q=pe.length;k<Q;k++){const J=pe[k],Se=fe[J.materialIndex];if(Se&&Se.visible){const K=w(I,Se,B,O);I.onBeforeShadow(s,I,F,z,se,K,J),s.renderBufferDirect(z,null,se,K,I,J),I.onAfterShadow(s,I,F,z,se,K,J)}}}else if(fe.visible){const pe=w(I,fe,B,O);I.onBeforeShadow(s,I,F,z,se,pe,null),s.renderBufferDirect(z,null,se,pe,I,null),I.onAfterShadow(s,I,F,z,se,pe,null)}}const ee=I.children;for(let se=0,fe=ee.length;se<fe;se++)D(ee[se],F,z,B,O)}function P(I){I.target.removeEventListener("dispose",P);for(const z in h){const B=h[z],O=I.target.uuid;O in B&&(B[O].dispose(),delete B[O])}}}const b9={[My]:Ey,[Ay]:Cy,[Ry]:wy,[th]:Ny,[Ey]:My,[Cy]:Ay,[wy]:Ry,[Ny]:th};function T9(s,e){function t(){let he=!1;const at=new kt;let dt=null;const Nt=new kt(0,0,0,0);return{setMask:function(it){dt!==it&&!he&&(s.colorMask(it,it,it,it),dt=it)},setLocked:function(it){he=it},setClear:function(it,Ke,Bt,nn,zn){zn===!0&&(it*=nn,Ke*=nn,Bt*=nn),at.set(it,Ke,Bt,nn),Nt.equals(at)===!1&&(s.clearColor(it,Ke,Bt,nn),Nt.copy(at))},reset:function(){he=!1,dt=null,Nt.set(-1,0,0,0)}}}function n(){let he=!1,at=!1,dt=null,Nt=null,it=null;return{setReversed:function(Ke){if(at!==Ke){const Bt=e.get("EXT_clip_control");Ke?Bt.clipControlEXT(Bt.LOWER_LEFT_EXT,Bt.ZERO_TO_ONE_EXT):Bt.clipControlEXT(Bt.LOWER_LEFT_EXT,Bt.NEGATIVE_ONE_TO_ONE_EXT),at=Ke;const nn=it;it=null,this.setClear(nn)}},getReversed:function(){return at},setTest:function(Ke){Ke?Ve(s.DEPTH_TEST):tt(s.DEPTH_TEST)},setMask:function(Ke){dt!==Ke&&!he&&(s.depthMask(Ke),dt=Ke)},setFunc:function(Ke){if(at&&(Ke=b9[Ke]),Nt!==Ke){switch(Ke){case My:s.depthFunc(s.NEVER);break;case Ey:s.depthFunc(s.ALWAYS);break;case Ay:s.depthFunc(s.LESS);break;case th:s.depthFunc(s.LEQUAL);break;case Ry:s.depthFunc(s.EQUAL);break;case Ny:s.depthFunc(s.GEQUAL);break;case Cy:s.depthFunc(s.GREATER);break;case wy:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}Nt=Ke}},setLocked:function(Ke){he=Ke},setClear:function(Ke){it!==Ke&&(at&&(Ke=1-Ke),s.clearDepth(Ke),it=Ke)},reset:function(){he=!1,dt=null,Nt=null,it=null,at=!1}}}function i(){let he=!1,at=null,dt=null,Nt=null,it=null,Ke=null,Bt=null,nn=null,z
vendor: 4,315 bytes, line 3889
3889n=null;return{setTest:function(Bn){he||(Bn?Ve(s.STENCIL_TEST):tt(s.STENCIL_TEST))},setMask:function(Bn){at!==Bn&&!he&&(s.stencilMask(Bn),at=Bn)},setFunc:function(Bn,Ea,as){(dt!==Bn||Nt!==Ea||it!==as)&&(s.stencilFunc(Bn,Ea,as),dt=Bn,Nt=Ea,it=as)},setOp:function(Bn,Ea,as){(Ke!==Bn||Bt!==Ea||nn!==as)&&(s.stencilOp(Bn,Ea,as),Ke=Bn,Bt=Ea,nn=as)},setLocked:function(Bn){he=Bn},setClear:function(Bn){zn!==Bn&&(s.clearStencil(Bn),zn=Bn)},reset:function(){he=!1,at=null,dt=null,Nt=null,it=null,Ke=null,Bt=null,nn=null,zn=null}}}const r=new t,a=new n,l=new i,u=new WeakMap,h=new WeakMap;let p={},g={},y=new WeakMap,_=[],S=null,A=!1,E=null,b=null,C=null,w=null,D=null,P=null,I=null,F=new lt(0,0,0),z=0,B=!1,O=null,W=null,ee=null,se=null,fe=null;const pe=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let k=!1,Q=0;const J=s.getParameter(s.VERSION);J.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(J)[1]),k=Q>=1):J.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),k=Q>=2);let Se=null,K={};const oe=s.getParameter(s.SCISSOR_BOX),we=s.getParameter(s.VIEWPORT),Ie=new kt().fromArray(oe),Ze=new kt().fromArray(we);function mt(he,at,dt,Nt){const it=new Uint8Array(4),Ke=s.createTexture();s.bindTexture(he,Ke),s.texParameteri(he,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(he,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let Bt=0;Bt<dt;Bt++)he===s.TEXTURE_3D||he===s.TEXTURE_2D_ARRAY?s.texImage3D(at,0,s.RGBA,1,1,Nt,0,s.RGBA,s.UNSIGNED_BYTE,it):s.texImage2D(at+Bt,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,it);return Ke}const xe={};xe[s.TEXTURE_2D]=mt(s.TEXTURE_2D,s.TEXTURE_2D,1),xe[s.TEXTURE_CUBE_MAP]=mt(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),xe[s.TEXTURE_2D_ARRAY]=mt(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),xe[s.TEXTURE_3D]=mt(s.TEXTURE_3D,s.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),l.setClear(0),Ve(s.DEPTH_TEST),a.setFunc(th),qe(!1),Be(qT),Ve(s.CULL_FACE),$e(Qa);function Ve(he){p[he]!==!0&&(s.enable(he),p[he]=!0)}function tt(he){p[he]!==!1&&(s.disable(he),p[he]=!1)}function Mt(he,at){return g[he]!==at?(s.bindFramebuffer(he,at),g[he]=at,he===s.DRAW_FRAMEBUFFER&&(g[s.FRAMEBUFFER]=at),he===s.FRAMEBUFFER&&(g[s.DRAW_FRAMEBUFFER]=at),!0):!1}function Ct(he,at){let dt=_,Nt=!1;if(he){dt=y.get(at),dt===void 0&&(dt=[],y.set(at,dt));const it=he.textures;if(dt.length!==it.length||dt[0]!==s.COLOR_ATTACHMENT0){for(let Ke=0,Bt=it.length;Ke<Bt;Ke++)dt[Ke]=s.COLOR_ATTACHMENT0+Ke;dt.length=it.length,Nt=!0}}else dt[0]!==s.BACK&&(dt[0]=s.BACK,Nt=!0);Nt&&s.drawBuffers(dt)}function rn(he){return S!==he?(s.useProgram(he),S=he,!0):!1}const vn={[Tr]:s.FUNC_ADD,[MM]:s.FUNC_SUBTRACT,[EM]:s.FUNC_REVERSE_SUBTRACT};vn[FN]=s.MIN,vn[VN]=s.MAX;const te={[Gu]:s.ZERO,[AM]:s.ONE,[RM]:s.SRC_COLOR,[by]:s.SRC_ALPHA,[LM]:s.SRC_ALPHA_SATURATE,[DM]:s.DST_COLOR,[CM]:s.DST_ALPHA,[NM]:s.ONE_MINUS_SRC_COLOR,[Ty]:s.ONE_MINUS_SRC_ALPHA,[UM]:s.ONE_MINUS_DST_COLOR,[wM]:s.ONE_MINUS_DST_ALPHA,[oP]:s.CONSTANT_COLOR,[lP]:s.ONE_MINUS_CONSTANT_COLOR,[uP]:s.CONSTANT_ALPHA,[cP]:s.ONE_MINUS_CONSTANT_ALPHA};function $e(he,at,dt,Nt,it,Ke,Bt,nn,zn,Bn){if(he===Qa){A===!0&&(tt(s.BLEND),A=!1);return}if(A===!1&&(Ve(s.BLEND),A=!0),he!==bp){if(he!==E||Bn!==B){if((b!==Tr||D!==Tr)&&(s.blendEquation(s.FUNC_ADD),b=Tr,D=Tr),Bn)switch(he){case $a:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Dp:s.blendFunc(s.ONE,s.ONE);break;case Up:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case Lp:s.blendFuncSeparate(s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",he);break}else switch(he){case $a:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Dp:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE,s.ONE,s.ONE);break;case Up:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Lp:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",he);break}C=null,w=null,P=null,I=null,F.set(0,0,0),z=0,E=he,B=Bn}return}it=it||at,Ke=Ke||dt,Bt=Bt||Nt,(at!==b||it!==D)&&(s.blendEquationSeparate(vn[at],vn[it]),b=at,D=it),(dt!==C||Nt!==w||Ke!==P||Bt!==I)&&(s.blendFuncSeparate(te[dt],te[Nt],te[Ke],te[Bt]),C=dt,
vendor: 3,574 bytes, line 3889
3889w=Nt,P=Ke,I=Bt),(nn.equals(F)===!1||zn!==z)&&(s.blendColor(nn.r,nn.g,nn.b,zn),F.copy(nn),z=zn),E=he,B=!1}function Ye(he,at){he.side===br?tt(s.CULL_FACE):Ve(s.CULL_FACE);let dt=he.side===yi;at&&(dt=!dt),qe(dt),he.blending===$a&&he.transparent===!1?$e(Qa):$e(he.blending,he.blendEquation,he.blendSrc,he.blendDst,he.blendEquationAlpha,he.blendSrcAlpha,he.blendDstAlpha,he.blendColor,he.blendAlpha,he.premultipliedAlpha),a.setFunc(he.depthFunc),a.setTest(he.depthTest),a.setMask(he.depthWrite),r.setMask(he.colorWrite);const Nt=he.stencilWrite;l.setTest(Nt),Nt&&(l.setMask(he.stencilWriteMask),l.setFunc(he.stencilFunc,he.stencilRef,he.stencilFuncMask),l.setOp(he.stencilFail,he.stencilZFail,he.stencilZPass)),Je(he.polygonOffset,he.polygonOffsetFactor,he.polygonOffsetUnits),he.alphaToCoverage===!0?Ve(s.SAMPLE_ALPHA_TO_COVERAGE):tt(s.SAMPLE_ALPHA_TO_COVERAGE)}function qe(he){O!==he&&(he?s.frontFace(s.CW):s.frontFace(s.CCW),O=he)}function Be(he){he!==PN?(Ve(s.CULL_FACE),he!==W&&(he===qT?s.cullFace(s.BACK):he===ON?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):tt(s.CULL_FACE),W=he}function ft(he){he!==ee&&(k&&s.lineWidth(he),ee=he)}function Je(he,at,dt){he?(Ve(s.POLYGON_OFFSET_FILL),(se!==at||fe!==dt)&&(s.polygonOffset(at,dt),se=at,fe=dt)):tt(s.POLYGON_OFFSET_FILL)}function nt(he){he?Ve(s.SCISSOR_TEST):tt(s.SCISSOR_TEST)}function qt(he){he===void 0&&(he=s.TEXTURE0+pe-1),Se!==he&&(s.activeTexture(he),Se=he)}function tn(he,at,dt){dt===void 0&&(Se===null?dt=s.TEXTURE0+pe-1:dt=Se);let Nt=K[dt];Nt===void 0&&(Nt={type:void 0,texture:void 0},K[dt]=Nt),(Nt.type!==he||Nt.texture!==at)&&(Se!==dt&&(s.activeTexture(dt),Se=dt),s.bindTexture(he,at||xe[he]),Nt.type=he,Nt.texture=at)}function Z(){const he=K[Se];he!==void 0&&he.type!==void 0&&(s.bindTexture(he.type,null),he.type=void 0,he.texture=void 0)}function G(){try{s.compressedTexImage2D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function ge(){try{s.compressedTexImage3D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function De(){try{s.texSubImage2D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function We(){try{s.texSubImage3D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function Ue(){try{s.compressedTexSubImage2D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function St(){try{s.compressedTexSubImage3D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function ht(){try{s.texStorage2D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function Dt(){try{s.texStorage3D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function Ut(){try{s.texImage2D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function et(){try{s.texImage3D(...arguments)}catch(he){console.error("THREE.WebGLState:",he)}}function gt(he){Ie.equals(he)===!1&&(s.scissor(he.x,he.y,he.z,he.w),Ie.copy(he))}function Ht(he){Ze.equals(he)===!1&&(s.viewport(he.x,he.y,he.z,he.w),Ze.copy(he))}function Lt(he,at){let dt=h.get(at);dt===void 0&&(dt=new WeakMap,h.set(at,dt));let Nt=dt.get(he);Nt===void 0&&(Nt=s.getUniformBlockIndex(at,he.name),dt.set(he,Nt))}function yt(he,at){const Nt=h.get(at).get(he);u.get(at)!==Nt&&(s.uniformBlockBinding(at,Nt,he.__bindingPointIndex),u.set(at,Nt))}function un(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor
vendor: 5,840 bytes, line 3889
3889(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),a.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),p={},Se=null,K={},g={},y=new WeakMap,_=[],S=null,A=!1,E=null,b=null,C=null,w=null,D=null,P=null,I=null,F=new lt(0,0,0),z=0,B=!1,O=null,W=null,ee=null,se=null,fe=null,Ie.set(0,0,s.canvas.width,s.canvas.height),Ze.set(0,0,s.canvas.width,s.canvas.height),r.reset(),a.reset(),l.reset()}return{buffers:{color:r,depth:a,stencil:l},enable:Ve,disable:tt,bindFramebuffer:Mt,drawBuffers:Ct,useProgram:rn,setBlending:$e,setMaterial:Ye,setFlipSided:qe,setCullFace:Be,setLineWidth:ft,setPolygonOffset:Je,setScissorTest:nt,activeTexture:qt,bindTexture:tn,unbindTexture:Z,compressedTexImage2D:G,compressedTexImage3D:ge,texImage2D:Ut,texImage3D:et,updateUBOMapping:Lt,uniformBlockBinding:yt,texStorage2D:ht,texStorage3D:Dt,texSubImage2D:De,texSubImage3D:We,compressedTexSubImage2D:Ue,compressedTexSubImage3D:St,scissor:gt,viewport:Ht,reset:un}}function M9(s,e,t,n,i,r,a){const l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new Ge,p=new WeakMap;let g;const y=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(Z,G){return _?new OffscreenCanvas(Z,G):C0("canvas")}function A(Z,G,ge){let De=1;const We=tn(Z);if((We.width>ge||We.height>ge)&&(De=ge/Math.max(We.width,We.height)),De<1)if(typeof HTMLImageElement<"u"&&Z instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Z instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Z instanceof ImageBitmap||typeof VideoFrame<"u"&&Z instanceof VideoFrame){const Ue=Math.floor(De*We.width),St=Math.floor(De*We.height);g===void 0&&(g=S(Ue,St));const ht=G?S(Ue,St):g;return ht.width=Ue,ht.height=St,ht.getContext("2d").drawImage(Z,0,0,Ue,St),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+We.width+"x"+We.height+") to ("+Ue+"x"+St+")."),ht}else return"data"in Z&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+We.width+"x"+We.height+")."),Z;return Z}function E(Z){return Z.generateMipmaps}function b(Z){s.generateMipmap(Z)}function C(Z){return Z.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:Z.isWebGL3DRenderTarget?s.TEXTURE_3D:Z.isWebGLArrayRenderTarget||Z.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function w(Z,G,ge,De,We=!1){if(Z!==null){if(s[Z]!==void 0)return s[Z];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Z+"'")}let Ue=G;if(G===s.RED&&(ge===s.FLOAT&&(Ue=s.R32F),ge===s.HALF_FLOAT&&(Ue=s.R16F),ge===s.UNSIGNED_BYTE&&(Ue=s.R8)),G===s.RED_INTEGER&&(ge===s.UNSIGNED_BYTE&&(Ue=s.R8UI),ge===s.UNSIGNED_SHORT&&(Ue=s.R16UI),ge===s.UNSIGNED_INT&&(Ue=s.R32UI),ge===s.BYTE&&(Ue=s.R8I),ge===s.SHORT&&(Ue=s.R16I),ge===s.INT&&(Ue=s.R32I)),G===s.RG&&(ge===s.FLOAT&&(Ue=s.RG32F),ge===s.HALF_FLOAT&&(Ue=s.RG16F),ge===s.UNSIGNED_BYTE&&(Ue=s.RG8)),G===s.RG_INTEGER&&(ge===s.UNSIGNED_BYTE&&(Ue=s.RG8UI),ge===s.UNSIGNED_SHORT&&(Ue=s.RG16UI),ge===s.UNSIGNED_INT&&(Ue=s.RG32UI),ge===s.BYTE&&(Ue=s.RG8I),ge===s.SHORT&&(Ue=s.RG16I),ge===s.INT&&(Ue=s.RG32I)),G===s.RGB_INTEGER&&(ge===s.UNSIGNED_BYTE&&(Ue=s.RGB8UI),ge===s.UNSIGNED_SHORT&&(Ue=s.RGB16UI),ge===s.UNSIGNED_INT&&(Ue=s.RGB32UI),ge===s.BYTE&&(Ue=s.RGB8I),ge===s.SHORT&&(Ue=s.RGB16I),ge===s.INT&&(Ue=s.RGB32I)),G===s.RGBA_INTEGER&&(ge===s.UNSIGNED_BYTE&&(Ue=s.RGBA8UI),ge===s.UNSIGNED_SHORT&&(Ue=s.RGBA16UI),ge===s.UNSIGNED_INT&&(Ue=s.RGBA32UI),ge===s.BYTE&&(Ue=s.RGBA8I),ge===s.SHORT&&(Ue=s.RGBA16I),ge===s.INT&&(Ue=s.RGBA32I)),G===s.RGB&&(ge===s.UNSIGNED_INT_5_9_9_9_REV&&(Ue=s.RGB9_E5),ge===s.UNSIGNED_INT_10F_11F_11F_REV&&(Ue=s.R11F_G11F_B10F)),G===s.RGBA){const St=We?nm:Kt.getTransfer(De);ge===s.FLOAT&&(Ue=s.RGBA32F),ge===s.HALF_FLOAT&&(Ue=s.RGBA16F),ge===s.UNSIGNED_BYTE&&(Ue=St===Et?s.SRGB8_ALPHA8:s.RGBA8),ge===s.UNSIGNED_SHORT_4_4_4_4&&(Ue=s.RGBA4),ge===s.UNSIGNED_SHORT_5_5_5_1&&(Ue=s.RGB5_A1)}return(Ue===s.R16F||Ue===s.R32F||Ue===s.RG16F||Ue===s.RG32F||Ue===s.RGBA16F||Ue===s.RGBA32F)&&e.get("EXT_color_buffer_float"),Ue}function D(Z,G){let ge;return Z?G===null||G===gi||G===Ja?ge=s.DEPTH24_STENCIL8:G===Bi?ge=s.DEPTH32F_STENCIL8:G===$o&&(ge=s.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):G===null||G===gi||G===Ja?ge=s.DEPTH_COMPONENT24:G===Bi?ge=s.DEPTH_COMPONENT32F:G===$o&&(ge=s.DEPTH_COMPONENT16),ge}function P(Z,G){return E(Z)===!0||Z.isFramebufferTexture&&Z.minFilter!==Ai&&Z.minFilter!==hi?Math.log2(Math.max(G.width,G.height))+1:Z.mipmaps!==void 0&&Z.mipmaps.length>0?Z.mipmaps.length:Z.isCompressedTexture&&Array.isArray(Z.image)?G.mipmaps.length:1}function I(Z){const G=Z.target;G.removeEventListener("dispose",I),z(G),G.isVideoTexture&&p.delete(G)}function F(Z){const G=Z.target;G.removeEventListener("dispose",F),O(G)}function z(Z){const G=n.get(Z);if(G.__webglInit===void 0)return;const ge=Z.source,De=y.get(ge);if(De){const We=De[G.__cacheKey];We.usedTimes--,We.usedTimes===0&&B(Z),Object.keys(De).length===0&&y.delete(ge)}n.remove(Z)}function B(Z){const G=n.get(Z);s.deleteTexture(G.__webglTexture);const ge=Z.source,De=y.get(ge);delete De[G.__cacheKey],a.memory.textures--}function O(Z){const G=n.get(Z);if(Z.depthTexture&&(Z.depthTexture.dispose(),n.remove(Z.depthTexture)),Z.isWebG
vendor: 1,483 bytes, line 3889
3889LCubeRenderTarget)for(let De=0;De<6;De++){if(Array.isArray(G.__webglFramebuffer[De]))for(let We=0;We<G.__webglFramebuffer[De].length;We++)s.deleteFramebuffer(G.__webglFramebuffer[De][We]);else s.deleteFramebuffer(G.__webglFramebuffer[De]);G.__webglDepthbuffer&&s.deleteRenderbuffer(G.__webglDepthbuffer[De])}else{if(Array.isArray(G.__webglFramebuffer))for(let De=0;De<G.__webglFramebuffer.length;De++)s.deleteFramebuffer(G.__webglFramebuffer[De]);else s.deleteFramebuffer(G.__webglFramebuffer);if(G.__webglDepthbuffer&&s.deleteRenderbuffer(G.__webglDepthbuffer),G.__webglMultisampledFramebuffer&&s.deleteFramebuffer(G.__webglMultisampledFramebuffer),G.__webglColorRenderbuffer)for(let De=0;De<G.__webglColorRenderbuffer.length;De++)G.__webglColorRenderbuffer[De]&&s.deleteRenderbuffer(G.__webglColorRenderbuffer[De]);G.__webglDepthRenderbuffer&&s.deleteRenderbuffer(G.__webglDepthRenderbuffer)}const ge=Z.textures;for(let De=0,We=ge.length;De<We;De++){const Ue=n.get(ge[De]);Ue.__webglTexture&&(s.deleteTexture(Ue.__webglTexture),a.memory.textures--),n.remove(ge[De])}n.remove(Z)}let W=0;function ee(){W=0}function se(){const Z=W;return Z>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Z+" texture units while this GPU supports only "+i.maxTextures),W+=1,Z}function fe(Z){const G=[];return G.push(Z.wrapS),G.push(Z.wrapT),G.push(Z.wrapR||0),G.push(Z.magFilter),G.push(Z.minFilter),G.push(Z.anisotropy),G.push(Z.internalFormat),G.push(Z.format),G.push(Z.type),G.pu
vendor: 4,660 bytes, line 3889
3889sh(Z.generateMipmaps),G.push(Z.premultiplyAlpha),G.push(Z.flipY),G.push(Z.unpackAlignment),G.push(Z.colorSpace),G.join()}function pe(Z,G){const ge=n.get(Z);if(Z.isVideoTexture&&nt(Z),Z.isRenderTargetTexture===!1&&Z.isExternalTexture!==!0&&Z.version>0&&ge.__version!==Z.version){const De=Z.image;if(De===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(De.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{xe(ge,Z,G);return}}else Z.isExternalTexture&&(ge.__webglTexture=Z.sourceTexture?Z.sourceTexture:null);t.bindTexture(s.TEXTURE_2D,ge.__webglTexture,s.TEXTURE0+G)}function k(Z,G){const ge=n.get(Z);if(Z.isRenderTargetTexture===!1&&Z.version>0&&ge.__version!==Z.version){xe(ge,Z,G);return}t.bindTexture(s.TEXTURE_2D_ARRAY,ge.__webglTexture,s.TEXTURE0+G)}function Q(Z,G){const ge=n.get(Z);if(Z.isRenderTargetTexture===!1&&Z.version>0&&ge.__version!==Z.version){xe(ge,Z,G);return}t.bindTexture(s.TEXTURE_3D,ge.__webglTexture,s.TEXTURE0+G)}function J(Z,G){const ge=n.get(Z);if(Z.version>0&&ge.__version!==Z.version){Ve(ge,Z,G);return}t.bindTexture(s.TEXTURE_CUBE_MAP,ge.__webglTexture,s.TEXTURE0+G)}const Se={[ih]:s.REPEAT,[Sa]:s.CLAMP_TO_EDGE,[sh]:s.MIRRORED_REPEAT},K={[Ai]:s.NEAREST,[K0]:s.NEAREST_MIPMAP_NEAREST,[ql]:s.NEAREST_MIPMAP_LINEAR,[hi]:s.LINEAR,[Md]:s.LINEAR_MIPMAP_NEAREST,[Mr]:s.LINEAR_MIPMAP_LINEAR},oe={[IM]:s.NEVER,[HM]:s.ALWAYS,[ex]:s.LESS,[tx]:s.LEQUAL,[FM]:s.EQUAL,[GM]:s.GEQUAL,[VM]:s.GREATER,[zM]:s.NOTEQUAL};function we(Z,G){if(G.type===Bi&&e.has("OES_texture_float_linear")===!1&&(G.magFilter===hi||G.magFilter===Md||G.magFilter===ql||G.magFilter===Mr||G.minFilter===hi||G.minFilter===Md||G.minFilter===ql||G.minFilter===Mr)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(Z,s.TEXTURE_WRAP_S,Se[G.wrapS]),s.texParameteri(Z,s.TEXTURE_WRAP_T,Se[G.wrapT]),(Z===s.TEXTURE_3D||Z===s.TEXTURE_2D_ARRAY)&&s.texParameteri(Z,s.TEXTURE_WRAP_R,Se[G.wrapR]),s.texParameteri(Z,s.TEXTURE_MAG_FILTER,K[G.magFilter]),s.texParameteri(Z,s.TEXTURE_MIN_FILTER,K[G.minFilter]),G.compareFunction&&(s.texParameteri(Z,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(Z,s.TEXTURE_COMPARE_FUNC,oe[G.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(G.magFilter===Ai||G.minFilter!==ql&&G.minFilter!==Mr||G.type===Bi&&e.has("OES_texture_float_linear")===!1)return;if(G.anisotropy>1||n.get(G).__currentAnisotropy){const ge=e.get("EXT_texture_filter_anisotropic");s.texParameterf(Z,ge.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(G.anisotropy,i.getMaxAnisotropy())),n.get(G).__currentAnisotropy=G.anisotropy}}}function Ie(Z,G){let ge=!1;Z.__webglInit===void 0&&(Z.__webglInit=!0,G.addEventListener("dispose",I));const De=G.source;let We=y.get(De);We===void 0&&(We={},y.set(De,We));const Ue=fe(G);if(Ue!==Z.__cacheKey){We[Ue]===void 0&&(We[Ue]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,ge=!0),We[Ue].usedTimes++;const St=We[Z.__cacheKey];St!==void 0&&(We[Z.__cacheKey].usedTimes--,St.usedTimes===0&&B(G)),Z.__cacheKey=Ue,Z.__webglTexture=We[Ue].texture}return ge}function Ze(Z,G,ge){return Math.floor(Math.floor(Z/ge)/G)}function mt(Z,G,ge,De){const Ue=Z.updateRanges;if(Ue.length===0)t.texSubImage2D(s.TEXTURE_2D,0,0,0,G.width,G.height,ge,De,G.data);else{Ue.sort((et,gt)=>et.start-gt.start);let St=0;for(let et=1;et<Ue.length;et++){const gt=Ue[St],Ht=Ue[et],Lt=gt.start+gt.count,yt=Ze(Ht.start,G.width,4),un=Ze(gt.start,G.width,4);Ht.start<=Lt+1&&yt===un&&Ze(Ht.start+Ht.count-1,G.width,4)===yt?gt.count=Math.max(gt.count,Ht.start+Ht.count-gt.start):(++St,Ue[St]=Ht)}Ue.length=St+1;const ht=s.getParameter(s.UNPACK_ROW_LENGTH),Dt=s.getParameter(s.UNPACK_SKIP_PIXELS),Ut=s.getParameter(s.UNPACK_SKIP_ROWS);s.pixelStorei(s.UNPACK_ROW_LENGTH,G.width);for(let et=0,gt=Ue.length;et<gt;et++){const Ht=Ue[et],Lt=Math.floor(Ht.start/4),yt=Math.ceil(Ht.count/4),un=Lt%G.width,he=Math.floor(Lt/G.width),at=yt,dt=1;s.pixelStorei(s.UNPACK_SKIP_PIXELS,un),s.pixelStorei(s.UNPACK_SKIP_ROWS,he),t.texSubImage2D(s.TEXTURE_2D,0,un,he,at,dt,ge,De,G.data)}Z.clearUpdateRanges(),s.pixelStorei(s.UNPACK_ROW_LENGTH,ht),s.pixelStorei(s.UNPACK_SKIP_PIXELS,Dt),s.pixelStorei(s.UNPACK_SKIP_ROWS,Ut)}}function xe(Z,G,ge){let De=s.TEXTURE_2D;(G.isDataArrayTexture||G.isCompressedArrayTexture)&&(De=s.TEXTURE_2D_ARRAY),G.isData3DTexture&&(De=s.TEXTURE_3D);const We=Ie(Z,G),Ue=G.source;t.bindTexture(De,Z.__webglTexture,s.TEXTURE0+ge);const St=n.get(Ue);if(Ue.version!==St.__version||We===!0){t.activeTexture(s.TEXTURE0+ge);
vendor: 13,418 bytes, line 3889
3889const ht=Kt.getPrimaries(Kt.workingColorSpace),Dt=G.colorSpace===va?null:Kt.getPrimaries(G.colorSpace),Ut=G.colorSpace===va||ht===Dt?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,G.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,G.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ut);let et=A(G.image,!1,i.maxTextureSize);et=qt(G,et);const gt=r.convert(G.format,G.colorSpace),Ht=r.convert(G.type);let Lt=w(G.internalFormat,gt,Ht,G.colorSpace,G.isVideoTexture);we(De,G);let yt;const un=G.mipmaps,he=G.isVideoTexture!==!0,at=St.__version===void 0||We===!0,dt=Ue.dataReady,Nt=P(G,et);if(G.isDepthTexture)Lt=D(G.format===to,G.type),at&&(he?t.texStorage2D(s.TEXTURE_2D,1,Lt,et.width,et.height):t.texImage2D(s.TEXTURE_2D,0,Lt,et.width,et.height,0,gt,Ht,null));else if(G.isDataTexture)if(un.length>0){he&&at&&t.texStorage2D(s.TEXTURE_2D,Nt,Lt,un[0].width,un[0].height);for(let it=0,Ke=un.length;it<Ke;it++)yt=un[it],he?dt&&t.texSubImage2D(s.TEXTURE_2D,it,0,0,yt.width,yt.height,gt,Ht,yt.data):t.texImage2D(s.TEXTURE_2D,it,Lt,yt.width,yt.height,0,gt,Ht,yt.data);G.generateMipmaps=!1}else he?(at&&t.texStorage2D(s.TEXTURE_2D,Nt,Lt,et.width,et.height),dt&&mt(G,et,gt,Ht)):t.texImage2D(s.TEXTURE_2D,0,Lt,et.width,et.height,0,gt,Ht,et.data);else if(G.isCompressedTexture)if(G.isCompressedArrayTexture){he&&at&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Nt,Lt,un[0].width,un[0].height,et.depth);for(let it=0,Ke=un.length;it<Ke;it++)if(yt=un[it],G.format!==Pi)if(gt!==null)if(he){if(dt)if(G.layerUpdates.size>0){const Bt=JT(yt.width,yt.height,G.format,G.type);for(const nn of G.layerUpdates){const zn=yt.data.subarray(nn*Bt/yt.data.BYTES_PER_ELEMENT,(nn+1)*Bt/yt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,it,0,0,nn,yt.width,yt.height,1,gt,zn)}G.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,it,0,0,0,yt.width,yt.height,et.depth,gt,yt.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,it,Lt,yt.width,yt.height,et.depth,0,yt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else he?dt&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,it,0,0,0,yt.width,yt.height,et.depth,gt,Ht,yt.data):t.texImage3D(s.TEXTURE_2D_ARRAY,it,Lt,yt.width,yt.height,et.depth,0,gt,Ht,yt.data)}else{he&&at&&t.texStorage2D(s.TEXTURE_2D,Nt,Lt,un[0].width,un[0].height);for(let it=0,Ke=un.length;it<Ke;it++)yt=un[it],G.format!==Pi?gt!==null?he?dt&&t.compressedTexSubImage2D(s.TEXTURE_2D,it,0,0,yt.width,yt.height,gt,yt.data):t.compressedTexImage2D(s.TEXTURE_2D,it,Lt,yt.width,yt.height,0,yt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):he?dt&&t.texSubImage2D(s.TEXTURE_2D,it,0,0,yt.width,yt.height,gt,Ht,yt.data):t.texImage2D(s.TEXTURE_2D,it,Lt,yt.width,yt.height,0,gt,Ht,yt.data)}else if(G.isDataArrayTexture)if(he){if(at&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Nt,Lt,et.width,et.height,et.depth),dt)if(G.layerUpdates.size>0){const it=JT(et.width,et.height,G.format,G.type);for(const Ke of G.layerUpdates){const Bt=et.data.subarray(Ke*it/et.data.BYTES_PER_ELEMENT,(Ke+1)*it/et.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,Ke,et.width,et.height,1,gt,Ht,Bt)}G.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,et.width,et.height,et.depth,gt,Ht,et.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,Lt,et.width,et.height,et.depth,0,gt,Ht,et.data);else if(G.isData3DTexture)he?(at&&t.texStorage3D(s.TEXTURE_3D,Nt,Lt,et.width,et.height,et.depth),dt&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,et.width,et.height,et.depth,gt,Ht,et.data)):t.texImage3D(s.TEXTURE_3D,0,Lt,et.width,et.height,et.depth,0,gt,Ht,et.data);else if(G.isFramebufferTexture){if(at)if(he)t.texStorage2D(s.TEXTURE_2D,Nt,Lt,et.width,et.height);else{let it=et.width,Ke=et.height;for(let Bt=0;Bt<Nt;Bt++)t.texImage2D(s.TEXTURE_2D,Bt,Lt,it,Ke,0,gt,Ht,null),it>>=1,Ke>>=1}}else if(un.length>0){if(he&&at){const it=tn(un[0]);t.texStorage2D(s.TEXTURE_2D,Nt,Lt,it.width,it.height)}for(let it=0,Ke=un.length;it<Ke;it++)yt=un[it],he?dt&&t.texSubImage2D(s.TEXTURE_2D,it,0,0,gt,Ht,yt):t.texImage2D(s.TEXTURE_2D,it,Lt,gt,Ht,yt);G.generateMipmaps=!1}else if(he){if(at){const it=tn(et);t.texStorage2D(s.TEXTURE_2D,Nt,Lt,it.width,it.height)}dt&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,gt,Ht,et)}else t.texImage2D(s.TEXTURE_2D,0,Lt,gt,Ht,et);E(G)&&b(De),St.__version=Ue.version,G.onUpdate&&G.onUpdate(G)}Z.__version=G.version}function Ve(Z,G,ge){if(G.image.length!==6)return;const De=Ie(Z,G),We=G.source;t.bindTexture(s.TEXTURE_CUBE_MAP,Z.__webglTexture,s.TEXTURE0+ge);const Ue=n.get(We);if(We.version!==Ue.__version||De===!0){t.activeTexture(s.TEXTURE0+ge);const St=Kt.getPrimaries(Kt.workingColorSpace),ht=G.colorSpace===va?null:Kt.getPrimaries(G.colorSpace),Dt=G.colorSpace===va||St===ht?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,G.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,G.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Dt);const Ut=G.isCompressedTexture||G.image[0].isCompressedTexture,et=G.image[0]&&G.image[0].isDataTexture,gt=[];for(let Ke=0;Ke<6;Ke++)!Ut&&!et?gt[Ke]=A(G.image[Ke],!0,i.maxCubemapSize):gt[Ke]=et?G.image[Ke].image:G.image[Ke],gt[Ke]=qt(G,gt[Ke]);const Ht=gt[0],Lt=r.convert(G.format,G.colorSpace),yt=r.convert(G.type),un=w(G.internalFormat,Lt,yt,G.colorSpace),he=G.isVideoTexture!==!0,at=Ue.__version===void 0||De===!0,dt=We.dataReady;let Nt=P(G,Ht);we(s.TEXTURE_CUBE_MAP,G);let it;if(Ut){he&&at&&t.texStorage2D(s.TEXTURE_CUBE_MAP,Nt,un,Ht.width,Ht.height);for(let Ke=0;Ke<6;Ke++){it=gt[Ke].mipmaps;for(let Bt=0;Bt<it.length;Bt++){const nn=it[Bt];G.format!==Pi?Lt!==null?he?dt&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,Bt,0,0,nn.width,nn.height,Lt,nn.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,Bt,un,nn.width,nn.height,0,nn.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):he?dt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,Bt,0,0,nn.width,nn.height,Lt,yt,nn.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,Bt,un,nn.width,nn.height,0,Lt,yt,nn.data)}}}else{if(it=G.mipmaps,he&&at){it.length>0&&Nt++;const Ke=tn(gt[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,Nt,un,Ke.width,Ke.height)}for(let Ke=0;Ke<6;Ke++)if(et){he?dt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,0,0,0,gt[Ke].width,gt[Ke].height,Lt,yt,gt[Ke].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,0,un,gt[Ke].width,gt[Ke].height,0,Lt,yt,gt[Ke].data);for(let Bt=0;Bt<it.length;Bt++){const zn=it[Bt].image[Ke].image;he?dt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,Bt+1,0,0,zn.width,zn.height,Lt,yt,zn.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,Bt+1,un,zn.width,zn.height,0,Lt,yt,zn.data)}}else{he?dt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,0,0,0,Lt,yt,gt[Ke]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,0,un,Lt,yt,gt[Ke]);for(let Bt=0;Bt<it.length;Bt++){const nn=it[Bt];he?dt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,Bt+1,0,0,Lt,yt,nn.image[Ke]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Ke,Bt+1,un,Lt,yt,nn.image[Ke])}}}E(G)&&b(s.TEXTURE_CUBE_MAP),Ue.__version=We.version,G.onUpdate&&G.onUpdate(G)}Z.__version=G.version}function tt(Z,G,ge,De,We,Ue){const St=r.convert(ge.format,ge.colorSpace),ht=r.convert(ge.type),Dt=w(ge.internalFormat,St,ht,ge.colorSpace),Ut=n.get(G),et=n.get(ge);if(et.__renderTarget=G,!Ut.__hasExternalTextures){const gt=Math.max(1,G.width>>Ue),Ht=Math.max(1,G.height>>Ue);We===s.TEXTURE_3D||We===s.TEXTURE_2D_ARRAY?t.texImage3D(We,Ue,Dt,gt,Ht,G.depth,0,St,ht,null):t.texImage2D(We,Ue,Dt,gt,Ht,0,St,ht,null)}t.bindFramebuffer(s.FRAMEBUFFER,Z),Je(G)?l.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,De,We,et.__webglTexture,0,ft(G)):(We===s.TEXTURE_2D||We>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&We<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,De,We,et.__webglTexture,Ue),t.bindFramebuffer(s.FRAMEBUFFER,null)}function Mt(Z,G,ge){if(s.bindRenderbuffer(s.RENDERBUFFER,Z),G.depthBuffer){const De=G.depthTexture,We=De&&De.isDepthTexture?De.type:null,Ue=D(G.stencilBuffer,We),St=G.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ht=ft(G);Je(G)?l.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,ht,Ue,G.width,G.height):ge?s.renderbufferStorageMultisample(s.RENDERBUFFER,ht,Ue,G.width,G.height):s.renderbufferStorage(s.RENDERBUFFER,Ue,G.width,G.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,St,s.RENDERBUFFER,Z)}else{const De=G.textures;for(let We=0;We<De.length;We++){const Ue=De[We],St=r.convert(Ue.format,Ue.colorSpace),ht=r.convert(Ue.type),Dt=w(Ue.internalFormat,St,ht,Ue.colorSpace),Ut=ft(G);ge&&Je(G)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,Ut,Dt,G.width,G.height):Je(G)?l.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,Ut,Dt,G.width,G.height):s.renderbufferStorage(s.RENDERBUFFER,Dt,G.width,G.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}function Ct(Z,G){if(G&&G.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(s.FRAMEBUFFER,Z),!(G.depthTexture&&G.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const De=n.get(G.depthTexture);De.__renderTarget=G,(!De.__webglTexture||G.depthTexture.image.width!==G.width||G.depthTexture.image.height!==G.height)&&(G.depthTexture.image.width=G.width,G.depthTexture.image.height=G.height,G.depthTexture.needsUpdate=!0),pe(G.depthTexture,0);const We=De.__webglTexture,Ue=ft(G);if(G.depthTexture.format===eo)Je(G)?l.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,We,0,Ue):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,We,0);else if(G.depthTexture.format===to)Je(G)?l.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,We,0,Ue):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,We,0);else throw new Error("Unknown depthTexture format")}function rn(Z){const G=n.get(Z),ge=Z.isWebGLCubeRenderTarget===!0;if(G.__boundDepthTexture!==Z.depthTexture){const De=Z.depthTexture;if(G.__depthDisposeCallback&&G.__depthDisposeCallback(),De){const We=()=>{delete G.__boundDepthTexture,delete G.__depthDisposeCallback,De.removeEventListener("dispose",We)};De.addEventListener("dispose",We),G.__depthDisposeCallback=We}G.__boundDepthTexture=De}if(Z.depthTexture&&!G.__autoAllocateDepthBuffer){if(ge)throw new Error("target.depthTexture not supported in Cube render targets");const De=Z.texture.mipmaps;De&&De.length>0?Ct(G.__webglFramebuffer[0],Z):Ct(G.__webglFramebuffer,Z)}else if(ge){G.__webglDepthbuffer=[];for(let De=0;De<6;De++)if(t.bindFramebuffer(s.FRAMEBUFFER,G.__webglFramebuffer[De]),G.__webglDepthbuffer[De]===void 0)G.__webglDepthbuffer[De]=s.createRenderbuffer(),Mt(G.__webglDepthbuffer[De],Z,!1);else{const We=Z.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Ue=G.__webglDepthbuffer[De];s.bindRenderbuffer(s.RENDERBUFFER,Ue),s.framebufferRenderbuffer(s.FRAMEBUFFER,We,s.RENDERBUFFER,Ue)}}else{const De=Z.texture.mipmaps;if(De&&De.length>0?t.bindFramebuffer(s.FRAMEBUFFER,G.__webglFramebuffer[0]):t.bindFramebuffer(s.FRAMEBUFFER,G.__webglFramebuffer),G.__webglDepthbuffer===void 0)G.__webglDepthbuffer=s.createRenderbuffer(),Mt(G.__webglDepthbuffer,Z,!1);else{const We=Z.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Ue=G.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,Ue),s.framebufferRenderbuffer(s.FRAMEBUFFER,We,s.RENDERBUFFER,Ue)}}t.bindFramebuffer(s.FRAMEBUFFER,null)}function vn(Z,G,ge){const De=n.get(Z);G!==void 0&&tt(De.__webglFramebuffer,Z,Z.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),ge!==void 0&&rn(Z)}function te(Z){const G=Z.texture,ge=n.get(Z),De=n.get(G);Z.addEventListener("dispose",F);const We=Z.textures,Ue=Z.isWebGLCubeRenderTarget===!0,St=We.length>1;if(St||(De.__webglTexture===void 0&&(De.__webglTexture=s.createTexture()),De.__version=G.version,a.memory.textures++),Ue){ge.__webglFramebuffer=[];for(let ht=0;ht<6;ht++)if(G.mipmaps&&G.mipmaps.length>0){ge.__webglFramebuffer[ht]=[];for(let Dt=0;Dt<G.mipmaps.length;Dt++)ge.__webglFramebuffer[ht][Dt]=s.createFramebuffer()}else ge.__webglFramebuffer[ht]=s.createFramebuffer()}else{if(G.mipmaps&&G.mipmaps.length>0){ge.__webglFramebuffer=[];for(let ht=0;ht<G.mipmaps.length;ht++)ge.__webglFramebuffer[ht]=s.createFramebuffer()}else ge.__webglFramebuffer=s.createFramebuffer();if(St)for(let ht=0,Dt=We.length;ht<Dt;ht++){const Ut=n.get(We[ht]);Ut.__webglTexture===void 0&&(Ut.__webglTexture=s.createTexture(),a.memory.textures++)}if(Z.samples>0&&Je(Z)===!1){ge.__webglMultisampledFramebuffer=s.createFramebuffer(),ge.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,ge.__webglMultisampledFramebuffer);for(let ht=0;ht<We.length;ht++){const Dt=We[ht];ge.__webglColorRenderbuffer[ht]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,ge.__webglColorRenderbuffer[ht]);const Ut=r.convert(Dt.format,Dt.colorSpace),et=r.convert(Dt.type),gt=w(Dt.internalFormat,Ut,et,Dt.colorSpace,Z.isXRRenderTarget===!0),Ht=ft(Z);s.renderbufferStorageMultisample(s.RENDERBUFFER,Ht,gt,Z.width,Z.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+ht,s.RENDERBUFFER,ge.__webglColorRen
vendor: 4,399 bytes, line 3889
3889derbuffer[ht])}s.bindRenderbuffer(s.RENDERBUFFER,null),Z.depthBuffer&&(ge.__webglDepthRenderbuffer=s.createRenderbuffer(),Mt(ge.__webglDepthRenderbuffer,Z,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(Ue){t.bindTexture(s.TEXTURE_CUBE_MAP,De.__webglTexture),we(s.TEXTURE_CUBE_MAP,G);for(let ht=0;ht<6;ht++)if(G.mipmaps&&G.mipmaps.length>0)for(let Dt=0;Dt<G.mipmaps.length;Dt++)tt(ge.__webglFramebuffer[ht][Dt],Z,G,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ht,Dt);else tt(ge.__webglFramebuffer[ht],Z,G,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ht,0);E(G)&&b(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(St){for(let ht=0,Dt=We.length;ht<Dt;ht++){const Ut=We[ht],et=n.get(Ut);let gt=s.TEXTURE_2D;(Z.isWebGL3DRenderTarget||Z.isWebGLArrayRenderTarget)&&(gt=Z.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(gt,et.__webglTexture),we(gt,Ut),tt(ge.__webglFramebuffer,Z,Ut,s.COLOR_ATTACHMENT0+ht,gt,0),E(Ut)&&b(gt)}t.unbindTexture()}else{let ht=s.TEXTURE_2D;if((Z.isWebGL3DRenderTarget||Z.isWebGLArrayRenderTarget)&&(ht=Z.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(ht,De.__webglTexture),we(ht,G),G.mipmaps&&G.mipmaps.length>0)for(let Dt=0;Dt<G.mipmaps.length;Dt++)tt(ge.__webglFramebuffer[Dt],Z,G,s.COLOR_ATTACHMENT0,ht,Dt);else tt(ge.__webglFramebuffer,Z,G,s.COLOR_ATTACHMENT0,ht,0);E(G)&&b(ht),t.unbindTexture()}Z.depthBuffer&&rn(Z)}function $e(Z){const G=Z.textures;for(let ge=0,De=G.length;ge<De;ge++){const We=G[ge];if(E(We)){const Ue=C(Z),St=n.get(We).__webglTexture;t.bindTexture(Ue,St),b(Ue),t.unbindTexture()}}}const Ye=[],qe=[];function Be(Z){if(Z.samples>0){if(Je(Z)===!1){const G=Z.textures,ge=Z.width,De=Z.height;let We=s.COLOR_BUFFER_BIT;const Ue=Z.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,St=n.get(Z),ht=G.length>1;if(ht)for(let Ut=0;Ut<G.length;Ut++)t.bindFramebuffer(s.FRAMEBUFFER,St.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+Ut,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,St.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+Ut,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,St.__webglMultisampledFramebuffer);const Dt=Z.texture.mipmaps;Dt&&Dt.length>0?t.bindFramebuffer(s.DRAW_FRAMEBUFFER,St.__webglFramebuffer[0]):t.bindFramebuffer(s.DRAW_FRAMEBUFFER,St.__webglFramebuffer);for(let Ut=0;Ut<G.length;Ut++){if(Z.resolveDepthBuffer&&(Z.depthBuffer&&(We|=s.DEPTH_BUFFER_BIT),Z.stencilBuffer&&Z.resolveStencilBuffer&&(We|=s.STENCIL_BUFFER_BIT)),ht){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,St.__webglColorRenderbuffer[Ut]);const et=n.get(G[Ut]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,et,0)}s.blitFramebuffer(0,0,ge,De,0,0,ge,De,We,s.NEAREST),u===!0&&(Ye.length=0,qe.length=0,Ye.push(s.COLOR_ATTACHMENT0+Ut),Z.depthBuffer&&Z.resolveDepthBuffer===!1&&(Ye.push(Ue),qe.push(Ue),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,qe)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,Ye))}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),ht)for(let Ut=0;Ut<G.length;Ut++){t.bindFramebuffer(s.FRAMEBUFFER,St.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+Ut,s.RENDERBUFFER,St.__webglColorRenderbuffer[Ut]);const et=n.get(G[Ut]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,St.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+Ut,s.TEXTURE_2D,et,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,St.__webglMultisampledFramebuffer)}else if(Z.depthBuffer&&Z.resolveDepthBuffer===!1&&u){const G=Z.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[G])}}}function ft(Z){return Math.min(i.maxSamples,Z.samples)}function Je(Z){const G=n.get(Z);return Z.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&G.__useRenderToTexture!==!1}function nt(Z){const G=a.render.frame;p.get(Z)!==G&&(p.set(Z,G),Z.update())}function qt(Z,G){const ge=Z.colorSpace,De=Z.format,We=Z.type;return Z.isCompressedTexture===!0||Z.isVideoTexture===!0||ge!==Yl&&ge!==va&&(Kt.getTransfer(ge)===Et?(De!==Pi||We!==ki)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ge)),G}
vendor: 4,513 bytes, line 3889
3889function tn(Z){return typeof HTMLImageElement<"u"&&Z instanceof HTMLImageElement?(h.width=Z.naturalWidth||Z.width,h.height=Z.naturalHeight||Z.height):typeof VideoFrame<"u"&&Z instanceof VideoFrame?(h.width=Z.displayWidth,h.height=Z.displayHeight):(h.width=Z.width,h.height=Z.height),h}this.allocateTextureUnit=se,this.resetTextureUnits=ee,this.setTexture2D=pe,this.setTexture2DArray=k,this.setTexture3D=Q,this.setTextureCube=J,this.rebindTextures=vn,this.setupRenderTarget=te,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=Be,this.setupDepthRenderbuffer=rn,this.setupFrameBufferTexture=tt,this.useMultisampledRTT=Je}function A3(s,e){function t(n,i=va){let r;const a=Kt.getTransfer(i);if(n===ki)return s.UNSIGNED_BYTE;if(n===Z0)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Q0)return s.UNSIGNED_SHORT_5_5_5_1;if(n===$0)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===J0)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===Ed)return s.BYTE;if(n===Ad)return s.SHORT;if(n===$o)return s.UNSIGNED_SHORT;if(n===Zs)return s.INT;if(n===gi)return s.UNSIGNED_INT;if(n===Bi)return s.FLOAT;if(n===As)return s.HALF_FLOAT;if(n===PM)return s.ALPHA;if(n===Qy)return s.RGB;if(n===Pi)return s.RGBA;if(n===eo)return s.DEPTH_COMPONENT;if(n===to)return s.DEPTH_STENCIL;if(n===um)return s.RED;if(n===Od)return s.RED_INTEGER;if(n===Wu)return s.RG;if(n===cm)return s.RG_INTEGER;if(n===hm)return s.RGBA_INTEGER;if(n===Xc||n===Yc||n===jc||n===Kc)if(a===Et)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===Xc)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Yc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===jc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Kc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===Xc)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Yc)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===jc)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Kc)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Dy||n===Uy||n===Ly||n===By)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Dy)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Uy)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ly)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===By)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Bp||n===Pp||n===Op)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Bp||n===Pp)return a===Et?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Op)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Ip||n===Fp||n===Vp||n===zp||n===Gp||n===Hp||n===kp||n===qp||n===Wp||n===Xp||n===Yp||n===jp||n===Kp||n===Zp)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===Ip)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Fp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Vp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===zp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Gp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Hp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===kp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===qp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Wp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Xp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Yp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===jp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Kp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Zp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Qp||n===WT||n===XT)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===Qp)return a===Et?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===WT)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===XT)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===$p||n===Jp||n===em||n===tm)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===$p)return r.COMPRESSED_RED_RGT
vendor: 9,914 bytes, lines 3889-3913
3889C1_EXT;if(n===Jp)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===em)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===tm)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ja?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}const E9=` 3890void main() { 3891 3892 gl_Position = vec4( position, 1.0 ); 3893 3894}`,A9=` 3895uniform sampler2DArray depthColor; 3896uniform float depthWidth; 3897uniform float depthHeight; 3898 3899void main() { 3900 3901 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3902 3903 if ( coord.x >= 1.0 ) { 3904 3905 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3906 3907 } else { 3908 3909 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3910 3911 } 3912 3913}`;class R9{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new nC(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Kl({vertexShader:E9,fragmentShader:A9,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ri(new fm(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class N9 extends Ro{constructor(e,t){super();const n=this;let i=null,r=1,a=null,l="local-floor",u=1,h=null,p=null,g=null,y=null,_=null,S=null;const A=typeof XRWebGLBinding<"u",E=new R9,b={},C=t.getContextAttributes();let w=null,D=null;const P=[],I=[],F=new Ge;let z=null;const B=new ps;B.viewport=new kt;const O=new ps;O.viewport=new kt;const W=[B,O],ee=new DC;let se=null,fe=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(xe){let Ve=P[xe];return Ve===void 0&&(Ve=new p0,P[xe]=Ve),Ve.getTargetRaySpace()},this.getControllerGrip=function(xe){let Ve=P[xe];return Ve===void 0&&(Ve=new p0,P[xe]=Ve),Ve.getGripSpace()},this.getHand=function(xe){let Ve=P[xe];return Ve===void 0&&(Ve=new p0,P[xe]=Ve),Ve.getHandSpace()};function pe(xe){const Ve=I.indexOf(xe.inputSource);if(Ve===-1)return;const tt=P[Ve];tt!==void 0&&(tt.update(xe.inputSource,xe.frame,h||a),tt.dispatchEvent({type:xe.type,data:xe.inputSource}))}function k(){i.removeEventListener("select",pe),i.removeEventListener("selectstart",pe),i.removeEventListener("selectend",pe),i.removeEventListener("squeeze",pe),i.removeEventListener("squeezestart",pe),i.removeEventListener("squeezeend",pe),i.removeEventListener("end",k),i.removeEventListener("inputsourceschange",Q);for(let xe=0;xe<P.length;xe++){const Ve=I[xe];Ve!==null&&(I[xe]=null,P[xe].disconnect(Ve))}se=null,fe=null,E.reset();for(const xe in b)delete b[xe];e.setRenderTarget(w),_=null,y=null,g=null,i=null,D=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(z),e.setSize(F.width,F.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(xe){r=xe,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(xe){l=xe,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||a},this.setReferenceSpace=function(xe){h=xe},this.getBaseLayer=function(){return y!==null?y:_},this.getBinding=function(){return g===null&&A&&(g=new XRWebGLBinding(i,t)),g},this.getFrame=function(){return S},this.getSession=function(){return i},this.setSession=async function(xe){if(i=xe,i!==null){if(w=e.getRenderTarget(),i.addEventListener("select",pe),i.addEventListener("selectstart",pe),i.addEventListener("selectend",pe),i.addEventListener("squeeze",pe),i.addEventListener("squeezestart",pe),i.addEventListener("squeezeend",pe),i.addEventListener("end",k),i.addEventListener("inputsourceschange",Q),C.xrCompatible!==!0&&await t.makeXRCompatible(),z=e.getPixelRatio(),e.getSize(F),A&&"createProjectionLayer"in XRWebGLBinding.prototype){let tt=null,Mt=null,Ct=null;C.depth&&(Ct=C.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,tt=C.stencil?to:eo,Mt=C.stencil?Ja:gi);const rn={colorFormat:t.RGBA8,depthFormat:Ct,scaleFactor:r};g=this.getBinding(),y=g.createProjectionLayer(rn),i.updateRenderState({layers:[y]}),e.setPixelRatio(1),e.setSize(y.textureWidth,y.textureHeight,!1),D=new jl(y.textureWidth,y.textureHeight,{format:Pi,type:ki,depthTexture:new Ta(y.textureWidth,y.textureHeight,Mt,void 0,void 0,void 0,void 0,void 0,void 0,tt),stencilBuffer:C.stencil,colorSpace:e.outputColorSpace,samples:C.antialias?4:0,resolveDepthBuffer:y.ignoreDepthValues===!1,resolveStencilBuffer:y.ignoreDepthValues===!1})}else{const tt={antialias:C.antialias,alpha:!0,depth:C.depth,stencil:C.stencil,framebufferScaleFactor:r};_=new XRWebGLLayer(i,t,tt),i.updateRenderState({baseLayer:_}),e.setPixelRatio(1),e.setSize(_.framebufferWidth,_.framebufferHeight,!1),D=new jl(_.framebufferWidth,_.framebufferHeight,{format:Pi,type:ki,colorSpace:e.outputColorSpace,stencilBuffer:C.stencil,resolveDepthBuffer:_.ignoreDepthValues===!1,resolveStencilBuffer:_.ignoreDepthValues===!1})}D.isXRRenderTarget=!0,this.setFoveation(u),h=null,a=await i.requestReferenceSpace(l),mt.setContext(i),mt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return E.getDepthTexture()};function Q(xe){for(let Ve=0;Ve<xe.removed.length;Ve++){const tt=xe.removed[Ve],Mt=I.indexOf(tt);Mt>=0&&(I[Mt]=null,P[Mt].disconnect(tt))}for(let Ve=0;Ve<xe.added.length;Ve++){const tt=xe.added[Ve];let Mt=I.indexOf(tt);if(Mt===-1){for(let rn=0;rn<P.length;rn++)if(rn>=I.length){I.push(tt),Mt=rn;break}else if(I[rn]===null){I[rn]=tt,Mt=rn;break}if(Mt===-1)break}const Ct=P[Mt];Ct&&Ct.connect(tt)}}const J=new Y,Se=new Y;function K(xe,Ve,tt){J.setFromMatrixPosition(Ve.matrixWorld),Se.setFromMatrixPosition(tt.matrixWorld);const Mt=J.distanceTo(Se),Ct=Ve.projectionMatrix.elements,rn=tt.projectionMatrix.elements,vn=Ct[14]/(Ct[10]-1),te=Ct[14]/(Ct[10]+1),$e=(Ct[9]+1)/Ct[5],Ye=(Ct[9]-1)/Ct[5],qe=(Ct[8]-1)/Ct[0],Be=(rn[8]+1)/rn[0],ft=vn*qe,Je=vn*Be,nt=Mt/(-qe+Be),qt=nt*-qe;if(Ve.matrixWorld.decompose(xe.position,xe.quaternion,xe.scale),xe.translateX(qt),xe.translateZ(nt),xe.matrixWorld.compose(xe.position,xe.quaternion,xe.scale),xe.matrixWorldInverse.copy(xe.matrixWorld).invert(),Ct[10]===-1)xe.projectionMatrix.copy(Ve.projectionMatrix),xe.projectionMatrixInverse.copy(Ve.projectionMatrixInverse);else{const tn=vn+nt,Z=te+nt,G=ft-qt,ge=Je+(Mt-qt),De=$e*te/Z*tn,We=Ye*te/Z*tn;xe.projectionMatrix.makePerspective(G,ge,De,We,tn,Z),xe.projectionMatrixInverse.copy(xe.projectionMatrix).invert()}}function oe(xe,Ve){Ve===null?xe.matrixWorld.copy(xe.matrix):xe.matrixWorld.multiplyMatrices(Ve.matrixWorld,xe.matrix),xe.matrixWorldInverse.copy(xe.matrixWorld).invert()}this.updateCamera=function(xe){if(i===null)return;let Ve=xe.near,tt=xe.far;E.texture!==null&&(E.depthNear>0&&(Ve=E.depthNear),E.depthFar>0&&(tt=E.depthFar)),ee.near=O.near=B.near=Ve,ee.far=O.far=B.far=tt,(se!==ee.near||fe!==ee.far)&&(i.updateRenderState({depthNear:ee.near,depthFar:ee.far}),se=ee.near,fe=ee.far),ee.layers.mask=xe.layers.mask|6,B.layers.mask=ee.layers.mask&3,O.layers.mask=ee.layers.mask&5;const Mt=xe.parent,Ct=ee.cameras;oe(ee,Mt);for(let rn=0;rn<Ct.length;rn++)oe(Ct[rn],Mt);Ct.length===2?K(ee,B,O):ee.projectionMatrix.copy(B.projectionMatrix),we(xe,ee,Mt)};function we(xe,Ve,tt){tt===null?xe.matrix.copy(Ve.matrixWorld):(xe.matrix.copy(tt.matrixWorld),xe.matrix.invert(),xe.matrix.multiply(Ve.matrixWorld)),xe.matrix.decompose(xe.position,xe.quaternion,xe.scale),xe.updateMatrixWorld(!0),xe.projectionMatrix.copy(Ve.projectionMatrix),xe.projectionMatrixInverse.copy(Ve.projectionMatrixInverse),xe.isPerspectiveCamera&&(xe.fov=im*2*Math.atan(1/xe.projectionMatrix.elements[5]),xe.zoom=1)}this.getCamera=function(){return ee},this.getFoveation=function(){if(!(y===null&&_===null))return u},this.setFoveation=function(xe){u=xe,y!==null&&(y.fixedFoveation=xe),_!==null&&_.fixedFoveation!==void 0&&(_.fixedFoveation=xe)},this.hasDepthSensing=function(){return E.texture!==null},this.getDepthSensingMesh=function(){return E.getMesh(ee)},this.getCameraTexture=function(xe){return b[xe]};let Ie=null;function Ze(xe,Ve){if(p=Ve.getViewerPose(h||a),S=Ve,p!==null){const tt=p.views;_!==null&&(e.setRenderTargetFramebuffer(D,_.framebuffer),e.setRenderTarget(D));let Mt=!1;tt.length!==ee.cameras.length&&(ee.cameras.length=0,Mt=!0);for(let te=0;te<tt.length;te++){const $e=tt[te];let Ye=null;if(_!==null)Ye=_.getViewport($e);else{const Be=g.getViewSubImage(y,$e);Ye=Be.viewport,te===0&&(e.setRenderTargetTextures(D,Be.colorTexture,Be.depthStencilTexture),e.setRenderTarget(D))}let qe=W[te];qe===void 0&&(qe=new ps,qe.layers.enable(te),qe.viewport=new kt,W[te]=qe),qe.matrix.fromArray($e.transform.matrix),qe.matrix.decompose(qe.position,qe.quaternion,qe.scale),qe.projectionMatrix.fromArray($e.projectionMatrix),qe.projectionMatrixInverse.copy(qe.projectionMatrix).invert(),qe.viewport.set(Ye.x,Ye.y,Ye.width,Ye.height),te===0&&(ee.matrix.copy(qe.matrix),ee.matrix.decompose(ee.position,ee.quaternion,ee.scale)),Mt===!0&&ee.cameras.push(qe)}const Ct=i.enabledFeatures;if(Ct&&Ct.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&A){g=n.getBinding();const te=g.getDepthInformation(tt[0]);te&&te.isValid&&te.texture&&E.init(te,i.renderState)}if(Ct&&Ct.includes("camera-access")&&A){e.state.unbindTexture(),g=n.getBinding();for(let te=0;te<tt.length;te++){const $e=tt[te].camera;if($e){let Ye=b[$e];Ye||(Ye=new nC,b[$e]=Ye);const qe=g.getCameraImage($e);Ye.sourceTexture=qe}}}}for(let tt=0;tt<P.length;tt++){const Mt=I[tt],Ct=P[tt];Mt!==null&&Ct!==void 0&&Ct.update(Mt,Ve,h||a)}Ie&&Ie(xe,Ve),Ve.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Ve}),S=null}const mt=new S3;
vendor: 12,034 bytes, line 3913
3913mt.setAnimationLoop(Ze),this.setAnimationLoop=function(xe){Ie=xe},this.dispose=function(){}}}const $f=new Ma,C9=new Ot;function w9(s,e){function t(E,b){E.matrixAutoUpdate===!0&&E.updateMatrix(),b.value.copy(E.matrix)}function n(E,b){b.color.getRGB(E.fogColor.value,OP(s)),b.isFog?(E.fogNear.value=b.near,E.fogFar.value=b.far):b.isFogExp2&&(E.fogDensity.value=b.density)}function i(E,b,C,w,D){b.isMeshBasicMaterial||b.isMeshLambertMaterial?r(E,b):b.isMeshToonMaterial?(r(E,b),g(E,b)):b.isMeshPhongMaterial?(r(E,b),p(E,b)):b.isMeshStandardMaterial?(r(E,b),y(E,b),b.isMeshPhysicalMaterial&&_(E,b,D)):b.isMeshMatcapMaterial?(r(E,b),S(E,b)):b.isMeshDepthMaterial?r(E,b):b.isMeshDistanceMaterial?(r(E,b),A(E,b)):b.isMeshNormalMaterial?r(E,b):b.isLineBasicMaterial?(a(E,b),b.isLineDashedMaterial&&l(E,b)):b.isPointsMaterial?u(E,b,C,w):b.isSpriteMaterial?h(E,b):b.isShadowMaterial?(E.color.value.copy(b.color),E.opacity.value=b.opacity):b.isShaderMaterial&&(b.uniformsNeedUpdate=!1)}function r(E,b){E.opacity.value=b.opacity,b.color&&E.diffuse.value.copy(b.color),b.emissive&&E.emissive.value.copy(b.emissive).multiplyScalar(b.emissiveIntensity),b.map&&(E.map.value=b.map,t(b.map,E.mapTransform)),b.alphaMap&&(E.alphaMap.value=b.alphaMap,t(b.alphaMap,E.alphaMapTransform)),b.bumpMap&&(E.bumpMap.value=b.bumpMap,t(b.bumpMap,E.bumpMapTransform),E.bumpScale.value=b.bumpScale,b.side===yi&&(E.bumpScale.value*=-1)),b.normalMap&&(E.normalMap.value=b.normalMap,t(b.normalMap,E.normalMapTransform),E.normalScale.value.copy(b.normalScale),b.side===yi&&E.normalScale.value.negate()),b.displacementMap&&(E.displacementMap.value=b.displacementMap,t(b.displacementMap,E.displacementMapTransform),E.displacementScale.value=b.displacementScale,E.displacementBias.value=b.displacementBias),b.emissiveMap&&(E.emissiveMap.value=b.emissiveMap,t(b.emissiveMap,E.emissiveMapTransform)),b.specularMap&&(E.specularMap.value=b.specularMap,t(b.specularMap,E.specularMapTransform)),b.alphaTest>0&&(E.alphaTest.value=b.alphaTest);const C=e.get(b),w=C.envMap,D=C.envMapRotation;w&&(E.envMap.value=w,$f.copy(D),$f.x*=-1,$f.y*=-1,$f.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&($f.y*=-1,$f.z*=-1),E.envMapRotation.value.setFromMatrix4(C9.makeRotationFromEuler($f)),E.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,E.reflectivity.value=b.reflectivity,E.ior.value=b.ior,E.refractionRatio.value=b.refractionRatio),b.lightMap&&(E.lightMap.value=b.lightMap,E.lightMapIntensity.value=b.lightMapIntensity,t(b.lightMap,E.lightMapTransform)),b.aoMap&&(E.aoMap.value=b.aoMap,E.aoMapIntensity.value=b.aoMapIntensity,t(b.aoMap,E.aoMapTransform))}function a(E,b){E.diffuse.value.copy(b.color),E.opacity.value=b.opacity,b.map&&(E.map.value=b.map,t(b.map,E.mapTransform))}function l(E,b){E.dashSize.value=b.dashSize,E.totalSize.value=b.dashSize+b.gapSize,E.scale.value=b.scale}function u(E,b,C,w){E.diffuse.value.copy(b.color),E.opacity.value=b.opacity,E.size.value=b.size*C,E.scale.value=w*.5,b.map&&(E.map.value=b.map,t(b.map,E.uvTransform)),b.alphaMap&&(E.alphaMap.value=b.alphaMap,t(b.alphaMap,E.alphaMapTransform)),b.alphaTest>0&&(E.alphaTest.value=b.alphaTest)}function h(E,b){E.diffuse.value.copy(b.color),E.opacity.value=b.opacity,E.rotation.value=b.rotation,b.map&&(E.map.value=b.map,t(b.map,E.mapTransform)),b.alphaMap&&(E.alphaMap.value=b.alphaMap,t(b.alphaMap,E.alphaMapTransform)),b.alphaTest>0&&(E.alphaTest.value=b.alphaTest)}function p(E,b){E.specular.value.copy(b.specular),E.shininess.value=Math.max(b.shininess,1e-4)}function g(E,b){b.gradientMap&&(E.gradientMap.value=b.gradientMap)}function y(E,b){E.metalness.value=b.metalness,b.metalnessMap&&(E.metalnessMap.value=b.metalnessMap,t(b.metalnessMap,E.metalnessMapTransform)),E.roughness.value=b.roughness,b.roughnessMap&&(E.roughnessMap.value=b.roughnessMap,t(b.roughnessMap,E.roughnessMapTransform)),b.envMap&&(E.envMapIntensity.value=b.envMapIntensity)}function _(E,b,C){E.ior.value=b.ior,b.sheen>0&&(E.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),E.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(E.sheenColorMap.value=b.sheenColorMap,t(b.sheenColorMap,E.sheenColorMapTransform)),b.sheenRoughnessMap&&(E.sheenRoughnessMap.value=b.sheenRoughnessMap,t(b.sheenRoughnessMap,E.sheenRoughnessMapTransform))),b.clearcoat>0&&(E.clearcoat.value=b.clearcoat,E.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(E.clearcoatMap.value=b.clearcoatMap,t(b.clearcoatMap,E.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(E.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,t(b.clearcoatRoughnessMap,E.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(E.clearcoatNormalMap.value=b.clearcoatNormalMap,t(b.clearcoatNormalMap,E.clearcoatNormalMapTransform),E.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===yi&&E.clearcoatNormalScale.value.negate())),b.dispersion>0&&(E.dispersion.value=b.dispersion),b.iridescence>0&&(E.iridescence.value=b.iridescence,E.iridescenceIOR.value=b.iridescenceIOR,E.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],E.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(E.iridescenceMap.value=b.iridescenceMap,t(b.iridescenceMap,E.iridescenceMapTransform)),b.iridescenceThicknessMap&&(E.iridescenceThicknessMap.value=b.iridescenceThicknessMap,t(b.iridescenceThicknessMap,E.iridescenceThicknessMapTransform))),b.transmission>0&&(E.transmission.value=b.transmission,E.transmissionSamplerMap.value=C.texture,E.transmissionSamplerSize.value.set(C.width,C.height),b.transmissionMap&&(E.transmissionMap.value=b.transmissionMap,t(b.transmissionMap,E.transmissionMapTransform)),E.thickness.value=b.thickness,b.thicknessMap&&(E.thicknessMap.value=b.thicknessMap,t(b.thicknessMap,E.thicknessMapTransform)),E.attenuationDistance.value=b.attenuationDistance,E.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(E.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(E.anisotropyMap.value=b.anisotropyMap,t(b.anisotropyMap,E.anisotropyMapTransform))),E.specularIntensity.value=b.specularIntensity,E.specularColor.value.copy(b.specularColor),b.specularColorMap&&(E.specularColorMap.value=b.specularColorMap,t(b.specularColorMap,E.specularColorMapTransform)),b.specularIntensityMap&&(E.specularIntensityMap.value=b.specularIntensityMap,t(b.specularIntensityMap,E.specularIntensityMapTransform))}function S(E,b){b.matcap&&(E.matcap.value=b.matcap)}function A(E,b){const C=e.get(b).light;E.referencePosition.value.setFromMatrixPosition(C.matrixWorld),E.nearDistance.value=C.shadow.camera.near,E.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function D9(s,e,t,n){let i={},r={},a=[];const l=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function u(C,w){const D=w.program;n.uniformBlockBinding(C,D)}function h(C,w){let D=i[C.id];D===void 0&&(S(C),D=p(C),i[C.id]=D,C.addEventListener("dispose",E));const P=w.program;n.updateUBOMapping(C,P);const I=e.render.frame;r[C.id]!==I&&(y(C),r[C.id]=I)}function p(C){const w=g();C.__bindingPointIndex=w;const D=s.createBuffer(),P=C.__size,I=C.usage;return s.bindBuffer(s.UNIFORM_BUFFER,D),s.bufferData(s.UNIFORM_BUFFER,P,I),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,w,D),D}function g(){for(let C=0;C<l;C++)if(a.indexOf(C)===-1)return a.push(C),C;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function y(C){const w=i[C.id],D=C.uniforms,P=C.__cache;s.bindBuffer(s.UNIFORM_BUFFER,w);for(let I=0,F=D.length;I<F;I++){const z=Array.isArray(D[I])?D[I]:[D[I]];for(let B=0,O=z.length;B<O;B++){const W=z[B];if(_(W,I,B,P)===!0){const ee=W.__offset,se=Array.isArray(W.value)?W.value:[W.value];let fe=0;for(let pe=0;pe<se.length;pe++){const k=se[pe],Q=A(k);typeof k=="number"||typeof k=="boolean"?(W.__data[0]=k,s.bufferSubData(s.UNIFORM_BUFFER,ee+fe,W.__data)):k.isMatrix3?(W.__data[0]=k.elements[0],W.__data[1]=k.elements[1],W.__data[2]=k.elements[2],W.__data[3]=0,W.__data[4]=k.elements[3],W.__data[5]=k.elements[4],W.__data[6]=k.elements[5],W.__data[7]=0,W.__data[8]=k.elements[6],W.__data[9]=k.elements[7],W.__data[10]=k.elements[8],W.__data[11]=0):(k.toArray(W.__data,fe),fe+=Q.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,ee,W.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function _(C,w,D,P){const I=C.value,F=w+"_"+D;if(P[F]===void 0)return typeof I=="number"||typeof I=="boolean"?P[F]=I:P[F]=I.clone(),!0;{const z=P[F];if(typeof I=="number"||typeof I=="boolean"){if(z!==I)return P[F]=I,!0}else if(z.equals(I)===!1)return z.copy(I),!0}return!1}function S(C){const w=C.uniforms;let D=0;const P=16;for(let F=0,z=w.length;F<z;F++){const B=Array.isArray(w[F])?w[F]:[w[F]];for(let O=0,W=B.length;O<W;O++){const ee=B[O],se=Array.isArray(ee.value)?ee.value:[ee.value];for(let fe=0,pe=se.length;fe<pe;fe++){const k=se[fe],Q=A(k),J=D%P,Se=J%Q.boundary,K=J+Se;D+=Se,K!==0&&P-K<Q.storage&&(D+=P-K),ee.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),ee.__offset=D,D+=Q.storage}}}const I=D%P;return I>0&&(D+=P-I),C.__size=D,C.__cache={},this}function A(C){const w={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(w.boundary=4,w.storage=4):C.isVector2?(w.boundary=8,w.storage=8):C.isVector3||C.isColor?(w.boundary=16,w.storage=12):C.isVector4?(w.boundary=16,w.storage=16):C.isMatrix3?(w.boundary=48,w.storage=48):C.isMatrix4?(w.boundary=64,w.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),w}function E(C){const w=C.target;w.removeEventListener("dispose",E);const D=a.indexOf(w.__bindingPointIndex);a.splice(D,1),s.deleteBuffer(i[w.id]),delete i[w.id],delete r[w.id]}function b(){for(const C in i)s.deleteBuffer(i[C]);a=[],i={},r={}}return{bind:u,update:h,dispose:b}}class R3{constructor(e={}){const{canvas:t=$N(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:y=!1}=e;this.isWebGLRenderer=!0;let _;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");_=n.getContextAttributes().alpha}else _=a;const S=new Uint32Array(4),A=new Int32Array(4);let E=null,b=null;const C=[],w=[];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.toneMapping=Rr,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const D=this;let P=!1;this._outputColorSpace=lr;let I=0,F=0,z=null,B=-1,O=null;const W=new kt,ee=new kt;let se=null;const fe=new lt(0);let pe=0,k=t.width,Q=t.height,J=1,Se=null,K=null;const oe=new kt(0,0,k,Q),we=new kt(0,0,k,Q);let Ie=!1;const Ze=new dm;let mt=!1,xe=!1;const Ve=new Ot,tt=new Y,Mt=new kt,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let rn=!1;function vn(){return z===null?J:1}let te=n;function $e(q,de){return t.getContext(q,de)}try{const q={alpha:!0,depth:i,stencil:r,antialias:l,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ky}`),t.addEventListener("webglcontextlost",dt,!1),t.addEventListener("webglcontextrestored",Nt,!1),t.addEventListener("webglcontextcreationerror",it,!1),te===null){const de="webgl2";if(te=$e(de,q),te===null)throw $e(de)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let Ye,qe,Be,ft,Je,nt,qt,tn,Z,G,ge,De,We,Ue,St,ht,Dt,Ut,et,gt,Ht,Lt,yt,un;
vendor: 9,614 bytes, line 3913
3913function he(){Ye=new kW(te),Ye.init(),Lt=new A3(te,Ye),qe=new OW(te,Ye,e,Lt),Be=new T9(te,Ye),qe.reversedDepthBuffer&&y&&Be.buffers.depth.setReversed(!0),ft=new XW(te),Je=new c9,nt=new M9(te,Ye,Be,Je,qe,Lt,ft),qt=new FW(D),tn=new HW(D),Z=new $k(te),yt=new BW(te,Z),G=new qW(te,Z,ft,yt),ge=new jW(te,G,Z,ft),et=new YW(te,qe,nt),ht=new IW(Je),De=new u9(D,qt,tn,Ye,qe,yt,ht),We=new w9(D,Je),Ue=new d9,St=new v9(Ye),Ut=new LW(D,qt,tn,Be,ge,_,u),Dt=new S9(D,ge,qe),un=new D9(te,ft,qe,Be),gt=new PW(te,Ye,ft),Ht=new WW(te,Ye,ft),ft.programs=De.programs,D.capabilities=qe,D.extensions=Ye,D.properties=Je,D.renderLists=Ue,D.shadowMap=Dt,D.state=Be,D.info=ft}he();const at=new N9(D,te);this.xr=at,this.getContext=function(){return te},this.getContextAttributes=function(){return te.getContextAttributes()},this.forceContextLoss=function(){const q=Ye.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){const q=Ye.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(q){q!==void 0&&(J=q,this.setSize(k,Q,!1))},this.getSize=function(q){return q.set(k,Q)},this.setSize=function(q,de,Te=!0){if(at.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}k=q,Q=de,t.width=Math.floor(q*J),t.height=Math.floor(de*J),Te===!0&&(t.style.width=q+"px",t.style.height=de+"px"),this.setViewport(0,0,q,de)},this.getDrawingBufferSize=function(q){return q.set(k*J,Q*J).floor()},this.setDrawingBufferSize=function(q,de,Te){k=q,Q=de,J=Te,t.width=Math.floor(q*Te),t.height=Math.floor(de*Te),this.setViewport(0,0,q,de)},this.getCurrentViewport=function(q){return q.copy(W)},this.getViewport=function(q){return q.copy(oe)},this.setViewport=function(q,de,Te,Ne){q.isVector4?oe.set(q.x,q.y,q.z,q.w):oe.set(q,de,Te,Ne),Be.viewport(W.copy(oe).multiplyScalar(J).round())},this.getScissor=function(q){return q.copy(we)},this.setScissor=function(q,de,Te,Ne){q.isVector4?we.set(q.x,q.y,q.z,q.w):we.set(q,de,Te,Ne),Be.scissor(ee.copy(we).multiplyScalar(J).round())},this.getScissorTest=function(){return Ie},this.setScissorTest=function(q){Be.setScissorTest(Ie=q)},this.setOpaqueSort=function(q){Se=q},this.setTransparentSort=function(q){K=q},this.getClearColor=function(q){return q.copy(Ut.getClearColor())},this.setClearColor=function(){Ut.setClearColor(...arguments)},this.getClearAlpha=function(){return Ut.getClearAlpha()},this.setClearAlpha=function(){Ut.setClearAlpha(...arguments)},this.clear=function(q=!0,de=!0,Te=!0){let Ne=0;if(q){let ye=!1;if(z!==null){const st=z.texture.format;ye=st===hm||st===cm||st===Od}if(ye){const st=z.texture.type,pt=st===ki||st===gi||st===$o||st===Ja||st===Z0||st===Q0,wt=Ut.getClearColor(),_t=Ut.getClearAlpha(),Xt=wt.r,$t=wt.g,zt=wt.b;pt?(S[0]=Xt,S[1]=$t,S[2]=zt,S[3]=_t,te.clearBufferuiv(te.COLOR,0,S)):(A[0]=Xt,A[1]=$t,A[2]=zt,A[3]=_t,te.clearBufferiv(te.COLOR,0,A))}else Ne|=te.COLOR_BUFFER_BIT}de&&(Ne|=te.DEPTH_BUFFER_BIT),Te&&(Ne|=te.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),te.clear(Ne)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",dt,!1),t.removeEventListener("webglcontextrestored",Nt,!1),t.removeEventListener("webglcontextcreationerror",it,!1),Ut.dispose(),Ue.dispose(),St.dispose(),Je.dispose(),qt.dispose(),tn.dispose(),ge.dispose(),yt.dispose(),un.dispose(),De.dispose(),at.dispose(),at.removeEventListener("sessionstart",as),at.removeEventListener("sessionend",os),Oi.stop()};function dt(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function Nt(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const q=ft.autoReset,de=Dt.enabled,Te=Dt.autoUpdate,Ne=Dt.needsUpdate,ye=Dt.type;he(),ft.autoReset=q,Dt.enabled=de,Dt.autoUpdate=Te,Dt.needsUpdate=Ne,Dt.type=ye}function it(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function Ke(q){const de=q.target;de.removeEventListener("dispose",Ke),Bt(de)}function Bt(q){nn(q),Je.remove(q)}function nn(q){const de=Je.get(q).programs;de!==void 0&&(de.forEach(function(Te){De.releaseProgram(Te)}),q.isShaderMaterial&&De.releaseShaderCache(q))}this.renderBufferDirect=function(q,de,Te,Ne,ye,st){de===null&&(de=Ct);const pt=ye.isMesh&&ye.matrixWorld.determinant()<0,wt=No(q,de,Te,Ne,ye);Be.setMaterial(Ne,pt);let _t=Te.index,Xt=1;if(Ne.wireframe===!0){if(_t=G.getWireframeAttribute(Te),_t===void 0)return;Xt=2}const $t=Te.drawRange,zt=Te.attributes.position;let Tn=$t.start*Xt,Hn=($t.start+$t.count)*Xt;st!==null&&(Tn=Math.max(Tn,st.start*Xt),Hn=Math.min(Hn,(st.start+st.count)*Xt)),_t!==null?(Tn=Math.max(Tn,0),Hn=Math.min(Hn,_t.count)):zt!=null&&(Tn=Math.max(Tn,0),Hn=Math.min(Hn,zt.count));const Ni=Hn-Tn;if(Ni<0||Ni===1/0)return;yt.setup(ye,Ne,wt,Te,_t);let ni,_n=gt;if(_t!==null&&(ni=Z.get(_t),_n=Ht,_n.setIndex(ni)),ye.isMesh)Ne.wireframe===!0?(Be.setLineWidth(Ne.wireframeLinewidth*vn()),_n.setMode(te.LINES)):_n.setMode(te.TRIANGLES);else if(ye.isLine){let Yt=Ne.linewidth;Yt===void 0&&(Yt=1),Be.setLineWidth(Yt*vn()),ye.isLineSegments?_n.setMode(te.LINES):ye.isLineLoop?_n.setMode(te.LINE_LOOP):_n.setMode(te.LINE_STRIP)}else ye.isPoints?_n.setMode(te.POINTS):ye.isSprite&&_n.setMode(te.TRIANGLES);if(ye.isBatchedMesh)if(ye._multiDrawInstances!==null)qr("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),_n.renderMultiDrawInstances(ye._multiDrawStarts,ye._multiDrawCounts,ye._multiDrawCount,ye._multiDrawInstances);else if(Ye.get("WEBGL_multi_draw"))_n.renderMultiDraw(ye._multiDrawStarts,ye._multiDrawCounts,ye._multiDrawCount);else{const Yt=ye._multiDrawStarts,Ci=ye._multiDrawCounts,Cn=ye._multiDrawCount,Is=_t?Z.get(_t).bytesPerElement:1,Ra=Je.get(Ne).currentProgram.getUniforms();for(let Fs=0;Fs<Cn;Fs++)Ra.setValue(te,"_gl_DrawID",Fs),_n.render(Yt[Fs]/Is,Ci[Fs])}else if(ye.isInstancedMesh)_n.renderInstances(Tn,Ni,ye.count);else if(Te.isInstancedBufferGeometry){const Yt=Te._maxInstanceCount!==void 0?Te._maxInstanceCount:1/0,Ci=Math.min(Te.instanceCount,Yt);_n.renderInstances(Tn,Ni,Ci)}else _n.render(Tn,Ni)};function zn(q,de,Te){q.transparent===!0&&q.side===br&&q.forceSinglePass===!1?(q.side=yi,q.needsUpdate=!0,$r(q,de,Te),q.side=Za,q.needsUpdate=!0,$r(q,de,Te),q.side=br):$r(q,de,Te)}this.compile=function(q,de,Te=null){Te===null&&(Te=q),b=St.get(Te),b.init(de),w.push(b),Te.traverseVisible(function(ye){ye.isLight&&ye.layers.test(de.layers)&&(b.pushLight(ye),ye.castShadow&&b.pushShadow(ye))}),q!==Te&&q.traverseVisible(function(ye){ye.isLight&&ye.layers.test(de.layers)&&(b.pushLight(ye),ye.castShadow&&b.pushShadow(ye))}),b.setupLights();const Ne=new Set;return q.traverse(function(ye){if(!(ye.isMesh||ye.isPoints||ye.isLine||ye.isSprite))return;const st=ye.material;if(st)if(Array.isArray(st))for(let pt=0;pt<st.length;pt++){const wt=st[pt];zn(wt,Te,ye),Ne.add(wt)}else zn(st,Te,ye),Ne.add(st)}),b=w.pop(),Ne},this.compileAsync=function(q,de,Te=null){const Ne=this.compile(q,de,Te);return new Promise(ye=>{function st(){if(Ne.forEach(function(pt){Je.get(pt).currentProgram.isReady()&&Ne.delete(pt)}),Ne.size===0){ye(q);return}setTimeout(st,10)}Ye.get("KHR_parallel_shader_compile")!==null?st():setTimeout(st,10)})};let Bn=null;function Ea(q){Bn&&Bn(q)}function as(){Oi.stop()}function os(){Oi.start()}const Oi=new S3;Oi.setAnimationLoop(Ea),typeof self<"u"&&Oi.setContext(self),this.setAnimationLoop=function(q){Bn=q,at.setAnimationLoop(q),q===null?Oi.stop():Oi.start()},at.addEventListener("sessionstart",as),at.addEventListener("sessionend",os),this.render=function(q,de){if(de!==void 0&&de.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;if(q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),de.parent===null&&de.matrixWorldAutoUpdate===!0&&de.updateMatrixWorld(),at.enabled===!0&&at.isPresenting===!0&&(at.cameraAutoUpdate===!0&&at.updateCamera(de),de=at.getCamera()),q.isScene===!0&&q.onBeforeRender(D,q,de,z),b=St.get(q,w.length),b.init(de),w.push(b),Ve.multiplyMatrices(de.projectionMatrix,de.matrixWorldInverse),Ze.setFromProjectionMatrix(Ve,Er,de.reversedDepth),xe=this.localClippingEnabled,mt=ht.init(this.clippingPlanes,xe),E=Ue.get(q,C.length),E.init(),C.push(E),at.enabled===!0&&at.isPresenting===!0){const st=D.xr.getDepthSensingMesh();st!==null&&Aa(st,de,-1/0,D.sortObjects)}Aa(q,de,0,D.sortObjects),E.finish(),D.sortObjects===!0&&E.sort(Se,K),rn=at.enabled===!1||at.isPresenting===!1||at.hasDepthSensing()===!1,rn&&Ut.addToRenderList(E,q),this.info.render.frame++,mt===!0&&ht.beginShadows();const Te=b.state.shadowsArray;Dt.render(Te,q,de),mt===!0&&ht.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ne=E.opaque,ye=E.transmissive;if(b.setupLights(),de.isArrayCamera){const st=de.cameras;if(ye.length>0)for(let pt=0,wt=st.length;pt<wt;pt++){const _t=st[pt];Xd(Ne,ye,q,_t)}rn&&Ut.render(q);for(let pt=0,wt=st.length;pt<wt;pt++){const _t=st[pt];Kr(E,q,_t,_t.viewport)}}else ye.length>0&&Xd(Ne,ye,q,de),rn&&Ut.render(q),Kr(E,q,de);z!==null&&F===0&&(nt.updateMultisampleRenderTarget(z),nt.updateRenderTargetMipmap(z)),q.isScene===!0&&q.onAfterRender(D,q,de),yt.resetDefaultState(),B=-1,O=null,w.pop(),w.length>0?(b=w[w.length-1],mt===!0&&ht.setGlobalState(D.clippingPlanes,b.state.camera)):b=null,C.pop(),C.length>0?E=C[C.length-1]:E=null};function Aa(q,de,Te,Ne){if(q.visible===!1)return;
vendor: 1,704 bytes, line 3913
3913if(q.layers.test(de.layers)){if(q.isGroup)Te=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(de);else if(q.isLight)b.pushLight(q),q.castShadow&&b.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||Ze.intersectsSprite(q)){Ne&&Mt.setFromMatrixPosition(q.matrixWorld).applyMatrix4(Ve);const pt=ge.update(q),wt=q.material;wt.visible&&E.push(q,pt,wt,Te,Mt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||Ze.intersectsObject(q))){const pt=ge.update(q),wt=q.material;if(Ne&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Mt.copy(q.boundingSphere.center)):(pt.boundingSphere===null&&pt.computeBoundingSphere(),Mt.copy(pt.boundingSphere.center)),Mt.applyMatrix4(q.matrixWorld).applyMatrix4(Ve)),Array.isArray(wt)){const _t=pt.groups;for(let Xt=0,$t=_t.length;Xt<$t;Xt++){const zt=_t[Xt],Tn=wt[zt.materialIndex];Tn&&Tn.visible&&E.push(q,pt,Tn,Te,Mt.z,zt)}}else wt.visible&&E.push(q,pt,wt,Te,Mt.z,null)}}const st=q.children;for(let pt=0,wt=st.length;pt<wt;pt++)Aa(st[pt],de,Te,Ne)}function Kr(q,de,Te,Ne){const ye=q.opaque,st=q.transmissive,pt=q.transparent;b.setupLightsView(Te),mt===!0&&ht.setGlobalState(D.clippingPlanes,Te),Ne&&Be.viewport(W.copy(Ne)),ye.length>0&&Zr(ye,de,Te),st.length>0&&Zr(st,de,Te),pt.length>0&&Zr(pt,de,Te),Be.buffers.depth.setTest(!0),Be.buffers.depth.setMask(!0),Be.buffers.color.setMask(!0),Be.setPolygonOffset(!1)}function Xd(q,de,Te,Ne){if((Te.isScene===!0?Te.overrideMaterial:null)!==null)return;b.state.transmissionRenderTarget[Ne.id]===void 0&&(b.state.transmissionRenderTarget[Ne.id]=new jl(1,1,{generateMipmaps:!0,type:Ye.has("EXT_color_buffer_half_float")||Ye.has("EXT_color_buffer_float")?As:ki,minFilter:Mr,
vendor: 19,337 bytes, line 3913
3913samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace}));const st=b.state.transmissionRenderTarget[Ne.id],pt=Ne.viewport||W;st.setSize(pt.z*D.transmissionResolutionScale,pt.w*D.transmissionResolutionScale);const wt=D.getRenderTarget(),_t=D.getActiveCubeFace(),Xt=D.getActiveMipmapLevel();D.setRenderTarget(st),D.getClearColor(fe),pe=D.getClearAlpha(),pe<1&&D.setClearColor(16777215,.5),D.clear(),rn&&Ut.render(Te);const $t=D.toneMapping;D.toneMapping=Rr;const zt=Ne.viewport;if(Ne.viewport!==void 0&&(Ne.viewport=void 0),b.setupLightsView(Ne),mt===!0&&ht.setGlobalState(D.clippingPlanes,Ne),Zr(q,Te,Ne),nt.updateMultisampleRenderTarget(st),nt.updateRenderTargetMipmap(st),Ye.has("WEBGL_multisampled_render_to_texture")===!1){let Tn=!1;for(let Hn=0,Ni=de.length;Hn<Ni;Hn++){const ni=de[Hn],_n=ni.object,Yt=ni.geometry,Ci=ni.material,Cn=ni.group;if(Ci.side===br&&_n.layers.test(Ne.layers)){const Is=Ci.side;Ci.side=yi,Ci.needsUpdate=!0,Qr(_n,Te,Ne,Yt,Ci,Cn),Ci.side=Is,Ci.needsUpdate=!0,Tn=!0}}Tn===!0&&(nt.updateMultisampleRenderTarget(st),nt.updateRenderTargetMipmap(st))}D.setRenderTarget(wt,_t,Xt),D.setClearColor(fe,pe),zt!==void 0&&(Ne.viewport=zt),D.toneMapping=$t}function Zr(q,de,Te){const Ne=de.isScene===!0?de.overrideMaterial:null;for(let ye=0,st=q.length;ye<st;ye++){const pt=q[ye],wt=pt.object,_t=pt.geometry,Xt=pt.group;let $t=pt.material;$t.allowOverride===!0&&Ne!==null&&($t=Ne),wt.layers.test(Te.layers)&&Qr(wt,de,Te,_t,$t,Xt)}}function Qr(q,de,Te,Ne,ye,st){q.onBeforeRender(D,de,Te,Ne,ye,st),q.modelViewMatrix.multiplyMatrices(Te.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),ye.onBeforeRender(D,de,Te,Ne,q,st),ye.transparent===!0&&ye.side===br&&ye.forceSinglePass===!1?(ye.side=yi,ye.needsUpdate=!0,D.renderBufferDirect(Te,de,Ne,ye,q,st),ye.side=Za,ye.needsUpdate=!0,D.renderBufferDirect(Te,de,Ne,ye,q,st),ye.side=br):D.renderBufferDirect(Te,de,Ne,ye,q,st),q.onAfterRender(D,de,Te,Ne,ye,st)}function $r(q,de,Te){de.isScene!==!0&&(de=Ct);const Ne=Je.get(q),ye=b.state.lights,st=b.state.shadowsArray,pt=ye.state.version,wt=De.getParameters(q,ye.state,st,de,Te),_t=De.getProgramCacheKey(wt);let Xt=Ne.programs;Ne.environment=q.isMeshStandardMaterial?de.environment:null,Ne.fog=de.fog,Ne.envMap=(q.isMeshStandardMaterial?tn:qt).get(q.envMap||Ne.environment),Ne.envMapRotation=Ne.environment!==null&&q.envMap===null?de.environmentRotation:q.envMapRotation,Xt===void 0&&(q.addEventListener("dispose",Ke),Xt=new Map,Ne.programs=Xt);let $t=Xt.get(_t);if($t!==void 0){if(Ne.currentProgram===$t&&Ne.lightsStateVersion===pt)return ro(q,wt),$t}else wt.uniforms=De.getUniforms(q),q.onBeforeCompile(wt,D),$t=De.acquireProgram(wt,_t),Xt.set(_t,$t),Ne.uniforms=wt.uniforms;const zt=Ne.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(zt.clippingPlanes=ht.uniform),ro(q,wt),Ne.needsLights=fl(q),Ne.lightsStateVersion=pt,Ne.needsLights&&(zt.ambientLightColor.value=ye.state.ambient,zt.lightProbe.value=ye.state.probe,zt.directionalLights.value=ye.state.directional,zt.directionalLightShadows.value=ye.state.directionalShadow,zt.spotLights.value=ye.state.spot,zt.spotLightShadows.value=ye.state.spotShadow,zt.rectAreaLights.value=ye.state.rectArea,zt.ltc_1.value=ye.state.rectAreaLTC1,zt.ltc_2.value=ye.state.rectAreaLTC2,zt.pointLights.value=ye.state.point,zt.pointLightShadows.value=ye.state.pointShadow,zt.hemisphereLights.value=ye.state.hemi,zt.directionalShadowMap.value=ye.state.directionalShadowMap,zt.directionalShadowMatrix.value=ye.state.directionalShadowMatrix,zt.spotShadowMap.value=ye.state.spotShadowMap,zt.spotLightMatrix.value=ye.state.spotLightMatrix,zt.spotLightMap.value=ye.state.spotLightMap,zt.pointShadowMap.value=ye.state.pointShadowMap,zt.pointShadowMatrix.value=ye.state.pointShadowMatrix),Ne.currentProgram=$t,Ne.uniformsList=null,$t}function _i(q){if(q.uniformsList===null){const de=q.currentProgram.getUniforms();q.uniformsList=RT.seqWithValue(de.seq,q.uniforms)}return q.uniformsList}function ro(q,de){const Te=Je.get(q);Te.outputColorSpace=de.outputColorSpace,Te.batching=de.batching,Te.batchingColor=de.batchingColor,Te.instancing=de.instancing,Te.instancingColor=de.instancingColor,Te.instancingMorph=de.instancingMorph,Te.skinning=de.skinning,Te.morphTargets=de.morphTargets,Te.morphNormals=de.morphNormals,Te.morphColors=de.morphColors,Te.morphTargetsCount=de.morphTargetsCount,Te.numClippingPlanes=de.numClippingPlanes,Te.numIntersection=de.numClipIntersection,Te.vertexAlphas=de.vertexAlphas,Te.vertexTangents=de.vertexTangents,Te.toneMapping=de.toneMapping}function No(q,de,Te,Ne,ye){de.isScene!==!0&&(de=Ct),nt.resetTextureUnits();const st=de.fog,pt=Ne.isMeshStandardMaterial?de.environment:null,wt=z===null?D.outputColorSpace:z.isXRRenderTarget===!0?z.texture.colorSpace:Yl,_t=(Ne.isMeshStandardMaterial?tn:qt).get(Ne.envMap||pt),Xt=Ne.vertexColors===!0&&!!Te.attributes.color&&Te.attributes.color.itemSize===4,$t=!!Te.attributes.tangent&&(!!Ne.normalMap||Ne.anisotropy>0),zt=!!Te.morphAttributes.position,Tn=!!Te.morphAttributes.normal,Hn=!!Te.morphAttributes.color;let Ni=Rr;Ne.toneMapped&&(z===null||z.isXRRenderTarget===!0)&&(Ni=D.toneMapping);const ni=Te.morphAttributes.position||Te.morphAttributes.normal||Te.morphAttributes.color,_n=ni!==void 0?ni.length:0,Yt=Je.get(Ne),Ci=b.state.lights;if(mt===!0&&(xe===!0||q!==O)){const Fi=q===O&&Ne.id===B;ht.setState(Ne,q,Fi)}let Cn=!1;Ne.version===Yt.__version?(Yt.needsLights&&Yt.lightsStateVersion!==Ci.state.version||Yt.outputColorSpace!==wt||ye.isBatchedMesh&&Yt.batching===!1||!ye.isBatchedMesh&&Yt.batching===!0||ye.isBatchedMesh&&Yt.batchingColor===!0&&ye.colorTexture===null||ye.isBatchedMesh&&Yt.batchingColor===!1&&ye.colorTexture!==null||ye.isInstancedMesh&&Yt.instancing===!1||!ye.isInstancedMesh&&Yt.instancing===!0||ye.isSkinnedMesh&&Yt.skinning===!1||!ye.isSkinnedMesh&&Yt.skinning===!0||ye.isInstancedMesh&&Yt.instancingColor===!0&&ye.instanceColor===null||ye.isInstancedMesh&&Yt.instancingColor===!1&&ye.instanceColor!==null||ye.isInstancedMesh&&Yt.instancingMorph===!0&&ye.morphTexture===null||ye.isInstancedMesh&&Yt.instancingMorph===!1&&ye.morphTexture!==null||Yt.envMap!==_t||Ne.fog===!0&&Yt.fog!==st||Yt.numClippingPlanes!==void 0&&(Yt.numClippingPlanes!==ht.numPlanes||Yt.numIntersection!==ht.numIntersection)||Yt.vertexAlphas!==Xt||Yt.vertexTangents!==$t||Yt.morphTargets!==zt||Yt.morphNormals!==Tn||Yt.morphColors!==Hn||Yt.toneMapping!==Ni||Yt.morphTargetsCount!==_n)&&(Cn=!0):(Cn=!0,Yt.__version=Ne.version);let Is=Yt.currentProgram;Cn===!0&&(Is=$r(Ne,de,ye));let Ra=!1,Fs=!1,_s=!1;const ai=Is.getUniforms(),er=Yt.uniforms;if(Be.useProgram(Is.program)&&(Ra=!0,Fs=!0,_s=!0),Ne.id!==B&&(B=Ne.id,Fs=!0),Ra||O!==q){Be.buffers.depth.getReversed()&&q.reversedDepth!==!0&&(q._reversedDepth=!0,q.updateProjectionMatrix()),ai.setValue(te,"projectionMatrix",q.projectionMatrix),ai.setValue(te,"viewMatrix",q.matrixWorldInverse);const zs=ai.map.cameraPosition;zs!==void 0&&zs.setValue(te,tt.setFromMatrixPosition(q.matrixWorld)),qe.logarithmicDepthBuffer&&ai.setValue(te,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(Ne.isMeshPhongMaterial||Ne.isMeshToonMaterial||Ne.isMeshLambertMaterial||Ne.isMeshBasicMaterial||Ne.isMeshStandardMaterial||Ne.isShaderMaterial)&&ai.setValue(te,"isOrthographic",q.isOrthographicCamera===!0),O!==q&&(O=q,Fs=!0,_s=!0)}if(ye.isSkinnedMesh){ai.setOptional(te,ye,"bindMatrix"),ai.setOptional(te,ye,"bindMatrixInverse");const Fi=ye.skeleton;Fi&&(Fi.boneTexture===null&&Fi.computeBoneTexture(),ai.setValue(te,"boneTexture",Fi.boneTexture,nt))}ye.isBatchedMesh&&(ai.setOptional(te,ye,"batchingTexture"),ai.setValue(te,"batchingTexture",ye._matricesTexture,nt),ai.setOptional(te,ye,"batchingIdTexture"),ai.setValue(te,"batchingIdTexture",ye._indirectTexture,nt),ai.setOptional(te,ye,"batchingColorTexture"),ye._colorsTexture!==null&&ai.setValue(te,"batchingColorTexture",ye._colorsTexture,nt));const Vs=Te.morphAttributes;if((Vs.position!==void 0||Vs.normal!==void 0||Vs.color!==void 0)&&et.update(ye,Te,Is),(Fs||Yt.receiveShadow!==ye.receiveShadow)&&(Yt.receiveShadow=ye.receiveShadow,ai.setValue(te,"receiveShadow",ye.receiveShadow)),Ne.isMeshGouraudMaterial&&Ne.envMap!==null&&(er.envMap.value=_t,er.flipEnvMap.value=_t.isCubeTexture&&_t.isRenderTargetTexture===!1?-1:1),Ne.isMeshStandardMaterial&&Ne.envMap===null&&de.environment!==null&&(er.envMapIntensity.value=de.environmentIntensity),Fs&&(ai.setValue(te,"toneMappingExposure",D.toneMappingExposure),Yt.needsLights&&Jl(er,_s),st&&Ne.fog===!0&&We.refreshFogUniforms(er,st),We.refreshMaterialUniforms(er,Ne,J,Q,b.state.transmissionRenderTarget[q.id]),RT.upload(te,_i(Yt),er,nt)),Ne.isShaderMaterial&&Ne.uniformsNeedUpdate===!0&&(RT.upload(te,_i(Yt),er,nt),Ne.uniformsNeedUpdate=!1),Ne.isSpriteMaterial&&ai.setValue(te,"center",ye.center),ai.setValue(te,"modelViewMatrix",ye.modelViewMatrix),ai.setValue(te,"normalMatrix",ye.normalMatrix),ai.setValue(te,"modelMatrix",ye.matrixWorld),Ne.isShaderMaterial||Ne.isRawShaderMaterial){const Fi=Ne.uniformsGroups;for(let zs=0,lc=Fi.length;zs<lc;zs++){const xs=Fi[zs];un.update(xs,Is),un.bind(xs,Is)}}return Is}function Jl(q,de){q.ambientLightColor.needsUpdate=de,q.lightProbe.needsUpdate=de,q.directionalLights.needsUpdate=de,q.directionalLightShadows.needsUpdate=de,q.pointLights.needsUpdate=de,q.pointLightShadows.needsUpdate=de,q.spotLights.needsUpdate=de,q.spotLightShadows.needsUpdate=de,q.rectAreaLights.needsUpdate=de,q.hemisphereLights.needsUpdate=de}function fl(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return z},this.setRenderTargetTextures=function(q,de,Te){const Ne=Je.get(q);Ne.__autoAllocateDepthBuffer=q.resolveDepthBuffer===!1,Ne.__autoAllocateDepthBuffer===!1&&(Ne.__useRenderToTexture=!1),Je.get(q.texture).__webglTexture=de,Je.get(q.depthTexture).__webglTexture=Ne.__autoAllocateDepthBuffer?void 0:Te,Ne.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(q,de){const Te=Je.get(q);Te.__webglFramebuffer=de,Te.__useDefaultFramebuffer=de===void 0};const ls=te.createFramebuffer();this.setRenderTarget=function(q,de=0,Te=0){z=q,I=de,F=Te;let Ne=!0,ye=null,st=!1,pt=!1;if(q){const _t=Je.get(q);if(_t.__useDefaultFramebuffer!==void 0)Be.bindFramebuffer(te.FRAMEBUFFER,null),Ne=!1;else if(_t.__webglFramebuffer===void 0)nt.setupRenderTarget(q);else if(_t.__hasExternalTextures)nt.rebindTextures(q,Je.get(q.texture).__webglTexture,Je.get(q.depthTexture).__webglTexture);else if(q.depthBuffer){const zt=q.depthTexture;if(_t.__boundDepthTexture!==zt){if(zt!==null&&Je.has(zt)&&(q.width!==zt.image.width||q.height!==zt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");nt.setupDepthRenderbuffer(q)}}const Xt=q.texture;(Xt.isData3DTexture||Xt.isDataArrayTexture||Xt.isCompressedArrayTexture)&&(pt=!0);const $t=Je.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray($t[de])?ye=$t[de][Te]:ye=$t[de],st=!0):q.samples>0&&nt.useMultisampledRTT(q)===!1?ye=Je.get(q).__webglMultisampledFramebuffer:Array.isArray($t)?ye=$t[Te]:ye=$t,W.copy(q.viewport),ee.copy(q.scissor),se=q.scissorTest}else W.copy(oe).multiplyScalar(J).floor(),ee.copy(we).multiplyScalar(J).floor(),se=Ie;if(Te!==0&&(ye=ls),Be.bindFramebuffer(te.FRAMEBUFFER,ye)&&Ne&&Be.drawBuffers(q,ye),Be.viewport(W),Be.scissor(ee),Be.setScissorTest(se),st){const _t=Je.get(q.texture);te.framebufferTexture2D(te.FRAMEBUFFER,te.COLOR_ATTACHMENT0,te.TEXTURE_CUBE_MAP_POSITIVE_X+de,_t.__webglTexture,Te)}else if(pt){const _t=de;for(let Xt=0;Xt<q.textures.length;Xt++){const $t=Je.get(q.textures[Xt]);te.framebufferTextureLayer(te.FRAMEBUFFER,te.COLOR_ATTACHMENT0+Xt,$t.__webglTexture,Te,_t)}}else if(q!==null&&Te!==0){const _t=Je.get(q.texture);te.framebufferTexture2D(te.FRAMEBUFFER,te.COLOR_ATTACHMENT0,te.TEXTURE_2D,_t.__webglTexture,Te)}B=-1},this.readRenderTargetPixels=function(q,de,Te,Ne,ye,st,pt,wt=0){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let _t=Je.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&pt!==void 0&&(_t=_t[pt]),_t){Be.bindFramebuffer(te.FRAMEBUFFER,_t);try{const Xt=q.textures[wt],$t=Xt.format,zt=Xt.type;if(!qe.textureFormatReadable($t)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!qe.textureTypeReadable(zt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}de>=0&&de<=q.width-Ne&&Te>=0&&Te<=q.height-ye&&(q.textures.length>1&&te.readBuffer(te.COLOR_ATTACHMENT0+wt),te.readPixels(de,Te,Ne,ye,Lt.convert($t),Lt.convert(zt),st))}finally{const Xt=z!==null?Je.get(z).__webglFramebuffer:null;Be.bindFramebuffer(te.FRAMEBUFFER,Xt)}}},this.readRenderTargetPixelsAsync=async function(q,de,Te,Ne,ye,st,pt,wt=0){if(!(q&&q.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let _t=Je.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&pt!==void 0&&(_t=_t[pt]),_t)if(de>=0&&de<=q.width-Ne&&Te>=0&&Te<=q.height-ye){Be.bindFramebuffer(te.FRAMEBUFFER,_t);const Xt=q.textures[wt],$t=Xt.format,zt=Xt.type;if(!qe.textureFormatReadable($t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!qe.textureTypeReadable(zt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Tn=te.createBuffer();te.bindBuffer(te.PIXEL_PACK_BUFFER,Tn),te.bufferData(te.PIXEL_PACK_BUFFER,st.byteLength,te.STREAM_READ),q.textures.length>1&&te.readBuffer(te.COLOR_ATTACHMENT0+wt),te.readPixels(de,Te,Ne,ye,Lt.convert($t),Lt.convert(zt),0);const Hn=z!==null?Je.get(z).__webglFramebuffer:null;Be.bindFramebuffer(te.FRAMEBUFFER,Hn);const Ni=te.fenceSync(te.SYNC_GPU_COMMANDS_COMPLETE,0);return te.flush(),await y5(te,Ni,4),te.bindBuffer(te.PIXEL_PACK_BUFFER,Tn),te.getBufferSubData(te.PIXEL_PACK_BUFFER,0,st),te.deleteBuffer(Tn),te.deleteSync(Ni),st}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(q,de=null,Te=0){const Ne=Math.pow(2,-Te),ye=Math.floor(q.image.width*Ne),st=Math.floor(q.image.height*Ne),pt=de!==null?de.x:0,wt=de!==null?de.y:0;nt.setTexture2D(q,0),te.copyTexSubImage2D(te.TEXTURE_2D,Te,0,0,pt,wt,ye,st),Be.unbindTexture()};const dh=te.createFramebuffer(),fh=te.createFramebuffer();this.copyTextureToTexture=function(q,de,Te=null,Ne=null,ye=0,st=null){st===null&&(ye!==0?(qr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),st=ye,ye=0):st=0);let pt,wt,_t,Xt,$t,zt,Tn,Hn,Ni;const ni=q.isCompressedTexture?q.mipmaps[st]:q.image;if(Te!==null)pt=Te.max.x-Te.min.x,wt=Te.max.y-Te.min.y,_t=Te.isBox3?Te.max.z-Te.min.z:1,Xt=Te.min.x,$t=Te.min.y,zt=Te.isBox3?Te.min.z:0;else{const Vs=Math.pow(2,-ye);pt=Math.floor(ni.width*Vs),wt=Math.floor(ni.height*Vs),q.isDataArrayTexture?_t=ni.depth:q.isData3DTexture?_t=Math.floor(ni.depth*Vs):_t=1,Xt=0,$t=0,zt=0}Ne!==null?(Tn=Ne.x,Hn=Ne.y,Ni=Ne.z):(Tn=0,Hn=0,Ni=0);const _n=Lt.convert(de.format),Yt=Lt.convert(de.type);let Ci;de.isData3DTexture?(nt.setTexture3D(de,0),Ci=te.TEXTURE_3D):de.isDataArrayTexture||de.isCompressedArrayTexture?(nt.setTexture2DArray(de,0),Ci=te.TEXTURE_2D_ARRAY):(nt.setTexture2D(de,0),Ci=te.TEXTURE_2D),te.pixelStorei(te.UNPACK_FLIP_Y_WEBGL,de.flipY),te.pixelStorei(te.UNPACK_PREMULTIPLY_ALPHA_WEBGL,de.premultiplyAlpha),te.pixelStorei(te.UNPACK_ALIGNMENT,de.unpackAlignment);const Cn=te.getParameter(te.UNPACK_ROW_LENGTH),Is=te.getParameter(te.UNPACK_IMAGE_HEIGHT),Ra=te.getParameter(te.UNPACK_SKIP_PIXELS),Fs=te.getParameter(te.UNPACK_SKIP_ROWS),_s=te.getParameter(te.UNPACK_SKIP_IMAGES);te.pixelStorei(te.UNPACK_ROW_LENGTH,ni.width),te.pixelStorei(te.UNPACK_IMAGE_HEIGHT,ni.height),te.pixelStorei(te.UNPACK_SKIP_PIXELS,Xt),te.pixelStorei(te.UNPACK_SKIP_ROWS,$t),te.pixelStorei(te.UNPACK_SKIP_IMAGES,zt);const ai=q.isDataArrayTexture||q.isData3DTexture,er=de.isDataArrayTexture||de.isData3DTexture;if(q.isDepthTexture){const Vs=Je.get(q),Fi=Je.get(de),zs=Je.get(Vs.__renderTarget),lc=Je.get(Fi.__renderTarget);Be.bindFramebuffer(te.READ_FRAMEBUFFER,zs.__webglFramebuffer),Be.bindFramebuffer(te.DRAW_FRAMEBUFFER,lc.__webglFramebuffer);for(let xs=0;xs<_t;xs++)ai&&(te.framebufferTextureLayer(te.READ_FRAMEBUFFER,te.COLOR_ATTACHMENT0,Je.get(q).__webglTexture,ye,zt+xs),te.framebufferTextureLayer(te.DRAW_FRAMEBUFFER,te.COLOR_ATTACHMENT0,Je.get(de).__webglTexture,st,Ni+xs)),te.blitFramebuffer(Xt,$t,pt,wt,Tn,Hn,pt,wt,te.DEPTH_BUFFER_BIT,te.NEAREST);Be.bindFramebuffer(te.READ_FRAMEBUFFER,null),Be.bindFramebuffer(te.DRAW_FRAMEBUFFER,null)}else if(ye!==0||q.isRenderTargetTexture||Je.has(q)){const Vs=Je.get(q),Fi=Je.get(de);Be.bindFramebuffer(te.READ_FRAMEBUFFER,dh),Be.bindFramebuffer(te.DRAW_FRAMEBUFFER,fh);for(let zs=0;zs<_t;zs++)ai?te.framebufferTextureLayer(te.READ_FRAMEBUFFER,te.COLOR_ATTACHMENT0,Vs.__webglTexture,ye,zt+zs):te.framebufferTexture2D(te.READ_FRAMEBUFFER,te.COLOR_ATTACHMENT0,te.TEXTURE_2D,Vs.__webglTexture,ye),er?te.framebufferTextureLayer(te.DRAW_FRAMEBUFFER,te.COLOR_ATTACHMENT0,Fi.__webglTexture,st,Ni+zs):te.framebufferTexture2D(te.DRAW_FRAMEBUFFER,te.COLOR_ATTACHMENT0,te.TEXTURE_2D,Fi.__webglTexture,st),ye!==0?te.blitFramebuffer(Xt,$t,pt,wt,Tn,Hn,pt,wt,te.COLOR_BUFFER_BIT,te.NEAREST):er?te.copyTexSubImage3D(Ci,st,Tn,Hn,Ni+zs,Xt,$t,pt,wt):te.copyTexSubImage2D(Ci,st,Tn,Hn,Xt,$t,pt,wt);Be.bindFramebuffer(te.READ_FRAMEBUFFER,null),Be.bindFramebuffer(te.DRAW_FRAMEBUFFER,null)}else er?q.isDataTexture||q.isData3DTexture?te.texSubImage3D(Ci,st,Tn,Hn,Ni,pt,wt,_t,_n,Yt,ni.data):de.isCompressedArrayTexture?te.compressedTexSubImage3D(Ci,st,Tn,Hn,Ni,pt,wt,_t,_n,ni.data):te.texSubImage3D(Ci,st,Tn,Hn,Ni,pt,wt,_t,_n,Yt,ni):q.isDataTexture?te.texSubImage2D(te.TEXTURE_2D,st,Tn,Hn,pt,wt,_n,Yt,ni.data):q.isCompressedTexture?te.compressedTexSubImage2D(te.TEXTURE_2D,st,Tn,Hn,ni.width,ni.height,_n,ni.data):te.texSubImage2D(te.TEXTURE_2D,st,Tn,Hn,pt,wt,_n,Yt,ni);te.pixelStorei(te.UNPACK_ROW_LENGTH,Cn),te.pixelStorei(te.UNPACK_IMAGE_HEIGHT,Is),te.pixelStorei(te.UNPACK_SKIP_PIXELS,Ra),te.pixelStorei(te.UNPACK_SKIP_ROWS,Fs),te.pixelStorei(te.UNPACK_SKIP_IMAGES,_s),st===0&&de.generateMipmaps&&te.generateMipmap(Ci),Be.unbindTexture()},this.initRenderTarget=function(q){Je.get(q).__webglFramebuffer===void 0&&nt.setupRenderTarget(q)},this.initTexture=function(q){q.isCubeTexture?nt.setTextureCube(q,0):q.isData3DTexture?nt.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?nt.setTexture2DArray(q,0):nt.setTexture2D(q,0),Be.unbindTexture()},this.resetState=function(){I=0,F=0,z=null,Be.reset(),yt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Er}get outputColorSpace(){return this._outputColorSpace}
3913set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Kt._getDrawingBufferColorSpace(e),t.unpackColorSpace=Kt._getUnpackColorSpace()}}const U9=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:BM,AddEquation:Tr,AddOperation:GN,AdditiveAnimationBlendMode:YN,AdditiveBlending:Dp,AgXToneMapping:WN,AlphaFormat:PM,AlwaysCompare:HM,AlwaysDepth:Ey,AlwaysStencilFunc:jT,AmbientLight:RC,AnimationAction:g3,AnimationClip:P0,AnimationLoader:H6,AnimationMixer:yk,AnimationObjectGroup:mk,AnimationUtils:F6,ArcCurve:jP,ArrayCamera:DC,ArrowHelper:kk,AttachedBindMode:IR,Audio:p3,AudioAnalyser:rk,AudioContext:wC,AudioListener:nk,AudioLoader:J6,AxesHelper:qk,BackSide:yi,BasicDepthPacking:vP,BasicShadowMap:IN,BatchedMesh:kP,Bone:eC,BooleanKeyframeTrack:pm,Box2:Rk,Box3:Wr,Box3Helper:Gk,BoxGeometry:uh,BoxHelper:zk,BufferAttribute:ti,BufferGeometry:bn,BufferGeometryLoader:f3,ByteType:Ed,Cache:Xu,Camera:ix,CameraHelper:Vk,CanvasTexture:o6,CapsuleGeometry:eE,CatmullRomCurve3:KP,CineonToneMapping:qN,CircleGeometry:tE,ClampToEdgeWrapping:Sa,Clock:UC,Color:lt,ColorKeyframeTrack:SC,ColorManagement:Kt,CompressedArrayTexture:r6,CompressedCubeTexture:a6,CompressedTexture:JM,CompressedTextureLoader:k6,ConeGeometry:ax,ConstantAlphaFactor:uP,ConstantColorFactor:oP,Controls:Xk,CubeCamera:XM,CubeReflectionMapping:Eo,CubeRefractionMapping:sl,CubeTexture:Id,CubeTextureLoader:q6,CubeUVReflectionMapping:nh,CubicBezierCurve:sC,CubicBezierCurve3:ZP,CubicInterpolant:o3,CullFaceBack:qT,CullFaceFront:ON,CullFaceFrontBack:PH,CullFaceNone:PN,Curve:$l,CurvePath:$P,CustomBlending:bp,CustomToneMapping:hP,CylinderGeometry:ev,Cylindrical:Ak,Data3DTexture:kM,DataArrayTexture:nx,DataTexture:Xl,DataTextureLoader:W6,DataUtils:U5,DecrementStencilOp:TP,DecrementWrapStencilOp:EP,DefaultLoadingManager:c3,DepthFormat:eo,DepthStencilFormat:to,DepthTexture:Ta,DetachedBindMode:dP,DirectionalLight:AC,DirectionalLightHelper:Fk,DiscreteInterpolant:l3,DodecahedronGeometry:nE,DoubleSide:br,DstAlphaFactor:CM,DstColorFactor:DM,DynamicCopyUsage:KH,DynamicDrawUsage:fp,DynamicReadUsage:XH,EdgesGeometry:YP,EllipseCurve:iE,EqualCompare:FM,EqualDepth:Ry,EqualStencilFunc:CP,EquirectangularReflectionMapping:Cd,EquirectangularRefractionMapping:wd,Euler:Ma,EventDispatcher:Ro,ExternalTexture:nC,ExtrudeGeometry:sE,FileLoader:rh,Float16BufferAttribute:JN,Float32BufferAttribute:It,FloatType:Bi,Fog:KM,FogExp2:jM,FramebufferTexture:tC,FrontSide:Za,Frustum:dm,FrustumArray:rx,GLBufferAttribute:bk,GLSL1:QH,GLSL3:FR,GreaterCompare:VM,GreaterDepth:Cy,GreaterEqualCompare:GM,GreaterEqualDepth:Ny,GreaterEqualStencilFunc:LP,GreaterStencilFunc:DP,GridHelper:Ok,Group:ay,HalfFloatType:As,HemisphereLight:TC,HemisphereLightHelper:Pk,IcosahedronGeometry:rE,ImageBitmapLoader:$6,ImageLoader:O0,ImageUtils:BP,IncrementStencilOp:bP,IncrementWrapStencilOp:MP,InstancedBufferAttribute:nl,InstancedBufferGeometry:d3,InstancedInterleavedBuffer:v3,InstancedMesh:HP,Int16BufferAttribute:I5,Int32BufferAttribute:F5,Int8BufferAttribute:B5,IntType:Zs,InterleavedBuffer:sx,InterleavedBufferAttribute:Dd,Interpolant:lx,InterpolateDiscrete:R0,InterpolateLinear:YT,InterpolateSmooth:AT,InterpolationSamplingMode:JH,InterpolationSamplingType:$H,InvertStencilOp:AP,KeepStencilOp:fd,KeyframeTrack:cl,LOD:zP,LatheGeometry:aE,Layers:Oy,LessCompare:ex,LessDepth:Ay,LessEqualCompare:tx,LessEqualDepth:th,LessEqualStencilFunc:wP,LessStencilFunc:NP,Light:Vd,LightProbe:CC,Line:Ud,Line3:wk,LineBasicMaterial:jr,LineCurve:rC,LineCurve3:QP,LineDashedMaterial:vC,LineLoop:qP,LineSegments:sc,LinearFilter:hi,LinearInterpolant:xC,LinearMipMapLinearFilter:fP,LinearMipMapNearestFilter:FH,LinearMipmapLinearFilter:Mr,LinearMipmapNearestFilter:Md,LinearSRGBColorSpace:Yl,LinearToneMapping:HN,LinearTransfer:nm,Loader:so,LoaderUtils:kR,LoadingManager:bC,LoopOnce:mP,LoopPingPong:yP,LoopRepeat:gP,MOUSE:LH,Material:hr,MaterialLoader:pE,MathUtils:ZN,Matrix2:hx,Matrix3:pn,Matrix4:Ot,MaxEquation:VN,Mesh:Ri,MeshBasicMaterial:xa,MeshDepthMaterial:mC,MeshDistanceMaterial:gC,MeshLambertMaterial:pC,MeshMatcapMaterial:yC,MeshNormalMaterial:fC,MeshPhongMaterial:hC,MeshPhysicalMaterial:cC,MeshStandardMaterial:fE,MeshToonMaterial:dC,MinEquation:FN,MirroredRepeatWrapping:sh,MixOperation:zN,MultiplyBlending:Lp,MultiplyOperation:Zy,NearestFilter:Ai,NearestMipMapLinearFilter:IH,NearestMipMapNearestFilter:OH,NearestMipmapLinearFilter:ql,NearestMipmapNearestFilter:K0,NeutralToneMapping:XN,NeverCompare:IM,NeverDepth:My,NeverStencilFunc:RP,NoBlending:Qa,NoColorSpace:va,NoToneMapping:Rr,NormalAnimationBlendMode:OM,NormalBlending:$a,NotEqualCompare:zM,NotEqualDepth:wy,NotEqualStencilFunc:UP,NumberKeyframeTrack:L0,Object3D:jn,ObjectLoader:Z6,ObjectSpaceNormalMap:jN,OctahedronGeometry:ox,OneFactor:AM,OneMinusConstantAlphaFactor:cP,OneMinusConstantColorFactor:lP,OneMinusDstAlphaFactor:wM,OneMinusDstColorFactor:UM,OneMinusSrcAlphaFactor:Ty,OneMinusSrcColorFactor:NM,Orthogra
3913phicCamera:gm,PCFShadowMap:Y0,PCFSoftShadowMap:d0,PMREMGenerator:WR,Path:$T,PerspectiveCamera:ps,Plane:Hu,PlaneGeometry:fm,PlaneHelper:Hk,PointLight:EC,PointLightHelper:Lk,Points:WP,PointsMaterial:$M,PolarGridHelper:Ik,PolyhedronGeometry:Fd,PositionalAudio:sk,PropertyBinding:Kn,PropertyMixer:m3,QuadraticBezierCurve:aC,QuadraticBezierCurve3:oC,Quaternion:ba,QuaternionKeyframeTrack:ux,QuaternionLinearInterpolant:u3,RED_GREEN_RGTC2_Format:em,RED_RGTC1_Format:$p,REVISION:Ky,RGBADepthPacking:_P,RGBAFormat:Pi,RGBAIntegerFormat:hm,RGBA_ASTC_10x10_Format:jp,RGBA_ASTC_10x5_Format:Wp,RGBA_ASTC_10x6_Format:Xp,RGBA_ASTC_10x8_Format:Yp,RGBA_ASTC_12x10_Format:Kp,RGBA_ASTC_12x12_Format:Zp,RGBA_ASTC_4x4_Format:Ip,RGBA_ASTC_5x4_Format:Fp,RGBA_ASTC_5x5_Format:Vp,RGBA_ASTC_6x5_Format:zp,RGBA_ASTC_6x6_Format:Gp,RGBA_ASTC_8x5_Format:Hp,RGBA_ASTC_8x6_Format:kp,RGBA_ASTC_8x8_Format:qp,RGBA_BPTC_Format:Qp,RGBA_ETC2_EAC_Format:Op,RGBA_PVRTC_2BPPV1_Format:By,RGBA_PVRTC_4BPPV1_Format:Ly,RGBA_S3TC_DXT1_Format:Yc,RGBA_S3TC_DXT3_Format:jc,RGBA_S3TC_DXT5_Format:Kc,RGBDepthPacking:HH,RGBFormat:Qy,RGBIntegerFormat:pP,RGB_BPTC_SIGNED_Format:WT,RGB_BPTC_UNSIGNED_Format:XT,RGB_ETC1_Format:Bp,RGB_ETC2_Format:Pp,RGB_PVRTC_2BPPV1_Format:Uy,RGB_PVRTC_4BPPV1_Format:Dy,RGB_S3TC_DXT1_Format:Xc,RGDepthPacking:kH,RGFormat:Wu,RGIntegerFormat:cm,RawShaderMaterial:s3,Ray:$y,Raycaster:_3,RectAreaLight:NC,RedFormat:um,RedIntegerFormat:Od,ReinhardToneMapping:kN,RenderTarget:Ql,RenderTarget3D:vk,RepeatWrapping:ih,ReplaceStencilOp:SP,ReverseSubtractEquation:EM,RingGeometry:oE,SIGNED_RED_GREEN_RGTC2_Format:tm,SIGNED_RED_RGTC1_Format:Jp,SRGBColorSpace:lr,SRGBTransfer:Et,Scene:Jy,ShaderChunk:Nn,ShaderLib:kl,ShaderMaterial:Kl,ShadowMaterial:uC,Shape:Mp,ShapeGeometry:lE,ShapePath:Wk,ShapeUtils:Wl,ShortType:Ad,Skeleton:QM,SkeletonHelper:Uk,SkinnedMesh:GP,Source:xd,Sphere:cr,SphereGeometry:tv,Spherical:Ek,SphericalHarmonics3:h3,SplineCurve:lC,SpotLight:cx,SpotLightHelper:Dk,Sprite:VP,SpriteMaterial:ZM,SrcAlphaFactor:by,SrcAlphaSaturateFactor:LM,SrcColorFactor:RM,StaticCopyUsage:jH,StaticDrawUsage:Py,StaticReadUsage:WH,StereoCamera:ek,StreamCopyUsage:ZH,StreamDrawUsage:qH,StreamReadUsage:YH,StringKeyframeTrack:mm,SubtractEquation:MM,SubtractiveBlending:Up,TOUCH:BH,TangentSpaceNormalMap:ec,TetrahedronGeometry:uE,Texture:qi,TextureLoader:X6,TextureUtils:Qk,Timer:Tk,TimestampQuery:pp,TorusGeometry:cE,TorusKnotGeometry:hE,Triangle:Wa,TriangleFanDrawMode:GH,TriangleStripDrawMode:zH,TrianglesDrawMode:VH,TubeGeometry:dE,UVMapping:j0,Uint16BufferAttribute:qM,Uint32BufferAttribute:WM,Uint8BufferAttribute:P5,Uint8ClampedBufferAttribute:O5,Uniform:_k,UniformsGroup:Sk,UniformsLib:Tt,UniformsUtils:IP,UnsignedByteType:ki,UnsignedInt101111Type:J0,UnsignedInt248Type:Ja,UnsignedInt5999Type:$0,UnsignedIntType:gi,UnsignedShort4444Type:Z0,UnsignedShort5551Type:Q0,UnsignedShortType:$o,VSMShadowMap:ya,Vector2:Ge,Vector3:Y,Vector4:kt,VectorKeyframeTrack:B0,VideoFrameTexture:s6,VideoTexture:XP,WebGL3DRenderTarget:b5,WebGLArrayRenderTarget:S5,WebGLCoordinateSystem:Er,WebGLCubeRenderTarget:YM,WebGLRenderTarget:jl,WebGLRenderer:R3,WebGLUtils:A3,WebGPUCoordinateSystem:rl,WebXRController:p0,WireframeGeometry:i3,WrapAroundEnding:N0,ZeroCurvatureEnding:hp,ZeroFactor:Gu,ZeroSlopeEnding:dp,ZeroStencilOp:xP,createCanvasElement:$N},Symbol.toStringTag,{value:"Module"})),aL=s=>{let e;const t=new Set,n=(h,p)=>{const g=typeof h=="function"?h(e):h;if(!Object.is(g,e)){const y=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(_=>_(e,y))}},i=()=>e,l={setState:n,getState:i,getInitialState:()=>u,subscribe:h=>(t.add(h),()=>t.delete(h))},u=e=s(n,i,l);return l},L9=(s=>s?aL(s):aL),{useSyncExternalStoreWithSelector:B9}=Z4,P9=s=>s;function O9(s,e=P9,t){const n=B9(s.subscribe,s.getState,s.getInitialState,e,t);return yy.useDebugValue(n),n}const oL=(s,e)=>{const t=L9(s),n=(i,r=e)=>O9(t,i,r);return Object.assign(n,t),n},I9=((s,e)=>s?oL(s,e):oL);var G1={exports:{}},H1={exports:{}},k1={exports:{}},q1={};/** 3914 * @license React 3915 * scheduler.production.js 3916 * 3917 * Copyright (c) Meta Platforms, Inc. and affiliates. 3918 * 3919 * This source code is licensed under the MIT license found in the 3920 * LICENSE file in the root directory of this source tree. 3921 */var lL;function F9(){return lL||(lL=1,(function(s){function e(k,Q){var J=k.length;
vendor: 4,556 bytes, lines 3921-3929
3921k.push(Q);e:for(;0<J;){var Se=J-1>>>1,K=k[Se];if(0<i(K,Q))k[Se]=Q,k[J]=K,J=Se;else break e}}function t(k){return k.length===0?null:k[0]}function n(k){if(k.length===0)return null;var Q=k[0],J=k.pop();if(J!==Q){k[0]=J;e:for(var Se=0,K=k.length,oe=K>>>1;Se<oe;){var we=2*(Se+1)-1,Ie=k[we],Ze=we+1,mt=k[Ze];if(0>i(Ie,J))Ze<K&&0>i(mt,Ie)?(k[Se]=mt,k[Ze]=J,Se=Ze):(k[Se]=Ie,k[we]=J,Se=we);else if(Ze<K&&0>i(mt,J))k[Se]=mt,k[Ze]=J,Se=Ze;else break e}}return Q}function i(k,Q){var J=k.sortIndex-Q.sortIndex;return J!==0?J:k.id-Q.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;s.unstable_now=function(){return r.now()}}else{var a=Date,l=a.now();s.unstable_now=function(){return a.now()-l}}var u=[],h=[],p=1,g=null,y=3,_=!1,S=!1,A=!1,E=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function w(k){for(var Q=t(h);Q!==null;){if(Q.callback===null)n(h);else if(Q.startTime<=k)n(h),Q.sortIndex=Q.expirationTime,e(u,Q);else break;Q=t(h)}}function D(k){if(A=!1,w(k),!S)if(t(u)!==null)S=!0,fe();else{var Q=t(h);Q!==null&&pe(D,Q.startTime-k)}}var P=!1,I=-1,F=5,z=-1;function B(){return!(s.unstable_now()-z<F)}function O(){if(P){var k=s.unstable_now();z=k;var Q=!0;try{e:{S=!1,A&&(A=!1,b(I),I=-1),_=!0;var J=y;try{t:{for(w(k),g=t(u);g!==null&&!(g.expirationTime>k&&B());){var Se=g.callback;if(typeof Se=="function"){g.callback=null,y=g.priorityLevel;var K=Se(g.expirationTime<=k);if(k=s.unstable_now(),typeof K=="function"){g.callback=K,w(k),Q=!0;break t}g===t(u)&&n(u),w(k)}else n(u);g=t(u)}if(g!==null)Q=!0;else{var oe=t(h);oe!==null&&pe(D,oe.startTime-k),Q=!1}}break e}finally{g=null,y=J,_=!1}Q=void 0}}finally{Q?W():P=!1}}}var W;if(typeof C=="function")W=function(){C(O)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,se=ee.port2;ee.port1.onmessage=O,W=function(){se.postMessage(null)}}else W=function(){E(O,0)};function fe(){P||(P=!0,W())}function pe(k,Q){I=E(function(){k(s.unstable_now())},Q)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(k){k.callback=null},s.unstable_continueExecution=function(){S||_||(S=!0,fe())},s.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<k?Math.floor(1e3/k):5},s.unstable_getCurrentPriorityLevel=function(){return y},s.unstable_getFirstCallbackNode=function(){return t(u)},s.unstable_next=function(k){switch(y){case 1:case 2:case 3:var Q=3;break;default:Q=y}var J=y;y=Q;try{return k()}finally{y=J}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(k,Q){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var J=y;y=k;try{return Q()}finally{y=J}},s.unstable_scheduleCallback=function(k,Q,J){var Se=s.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?Se+J:Se):J=Se,k){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=J+K,k={id:p++,callback:Q,priorityLevel:k,startTime:J,expirationTime:K,sortIndex:-1},J>Se?(k.sortIndex=J,e(h,k),t(u)===null&&k===t(h)&&(A?(b(I),I=-1):A=!0,pe(D,J-Se))):(k.sortIndex=K,e(u,k),S||_||(S=!0,fe())),k},s.unstable_shouldYield=B,s.unstable_wrapCallback=function(k){var Q=y;return function(){var J=y;y=Q;try{return k.apply(this,arguments)}finally{y=J}}}})(q1)),q1}var uL;function N3(){return uL||(uL=1,k1.exports=F9()),k1.exports}/** 3922 * @license React 3923 * react-reconciler.production.js 3924 * 3925 * Copyright (c) Meta Platforms, Inc. and affiliates. 3926 * 3927 * This source code is licensed under the MIT license found in the 3928 * LICENSE file in the root directory of this source tree. 3929 */var cL;function V9(){return cL||(cL=1,(function(s){s.exports=function(e){function t(d,f,x,M){return new Vv(d,f,x,M)}function n(){}function i(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)f+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(d){return d===null||typeof d!="object"?null:(d=Al&&d[Al]||d["@@iterator"],typeof d=="function"?d:null)}
vendor: 10,086 bytes, lines 3929-3936
3929function a(d){if(d==null)return null;if(typeof d=="function")return d.$$typeof===kv?null:d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case mu:return"Fragment";case Da:return"Portal";case qm:return"Profiler";case Sf:return"StrictMode";case Wm:return"Suspense";case Lh:return"SuspenseList"}if(typeof d=="object")switch(d.$$typeof){case lo:return(d.displayName||"Context")+".Provider";case Gv:return(d._context.displayName||"Context")+".Consumer";case Tf:var f=d.render;return d=d.displayName,d||(d=f.displayName||f.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case Xm:return f=d.displayName||null,f!==null?f:a(d.type)||"Memo";case Ua:f=d._payload,d=d._init;try{return a(d(f))}catch{}}return null}function l(d){if(Lo===void 0)try{throw Error()}catch(x){var f=x.stack.trim().match(/\n( *(at )?)/);Lo=f&&f[1]||"",Rl=-1<x.stack.indexOf(` 3930 at`)?" (<anonymous>)":-1<x.stack.indexOf("@")?"@unknown:0:0":""}return` 3931`+Lo+d+Rl}function u(d,f){if(!d||fc)return"";fc=!0;var x=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var M={DetermineComponentFrameRoot:function(){try{if(f){var bt=function(){throw Error()};if(Object.defineProperty(bt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(bt,[])}catch(yn){var At=yn}Reflect.construct(d,[],bt)}else{try{bt.call()}catch(yn){At=yn}d.call(bt.prototype)}}else{try{throw Error()}catch(yn){At=yn}(bt=d())&&typeof bt.catch=="function"&&bt.catch(function(){})}}catch(yn){if(yn&&At&&typeof yn.stack=="string")return[yn.stack,At.stack]}return[null,null]}};M.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var N=Object.getOwnPropertyDescriptor(M.DetermineComponentFrameRoot,"name");N&&N.configurable&&Object.defineProperty(M.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var L=M.DetermineComponentFrameRoot(),X=L[0],ie=L[1];if(X&&ie){var ve=X.split(` 3932`),He=ie.split(` 3933`);for(N=M=0;M<ve.length&&!ve[M].includes("DetermineComponentFrameRoot");)M++;for(;N<He.length&&!He[N].includes("DetermineComponentFrameRoot");)N++;if(M===ve.length||N===He.length)for(M=ve.length-1,N=He.length-1;1<=M&&0<=N&&ve[M]!==He[N];)N--;for(;1<=M&&0<=N;M--,N--)if(ve[M]!==He[N]){if(M!==1||N!==1)do if(M--,N--,0>N||ve[M]!==He[N]){var ut=` 3934`+ve[M].replace(" at new "," at ");return d.displayName&&ut.includes("<anonymous>")&&(ut=ut.replace("<anonymous>",d.displayName)),ut}while(1<=M&&0<=N);break}}}finally{fc=!1,Error.prepareStackTrace=x}return(x=d?d.displayName||d.name:"")?l(x):""}function h(d){switch(d.tag){case 26:case 27:case 5:return l(d.type);case 16:return l("Lazy");case 13:return l("Suspense");case 19:return l("SuspenseList");case 0:case 15:return d=u(d.type,!1),d;case 11:return d=u(d.type.render,!1),d;case 1:return d=u(d.type,!0),d;default:return""}}function p(d){try{var f="";do f+=h(d),d=d.return;while(d);return f}catch(x){return` 3935Error generating stack: `+x.message+` 3936`+x.stack}}function g(d){var f=d,x=d;if(d.alternate)for(;f.return;)f=f.return;else{d=f;do f=d,(f.flags&4098)!==0&&(x=f.return),d=f.return;while(d)}return f.tag===3?x:null}function y(d){if(g(d)!==d)throw Error(i(188))}function _(d){var f=d.alternate;if(!f){if(f=g(d),f===null)throw Error(i(188));return f!==d?null:d}for(var x=d,M=f;;){var N=x.return;if(N===null)break;var L=N.alternate;if(L===null){if(M=N.return,M!==null){x=M;continue}break}if(N.child===L.child){for(L=N.child;L;){if(L===x)return y(N),d;if(L===M)return y(N),f;L=L.sibling}throw Error(i(188))}if(x.return!==M.return)x=N,M=L;else{for(var X=!1,ie=N.child;ie;){if(ie===x){X=!0,x=N,M=L;break}if(ie===M){X=!0,M=N,x=L;break}ie=ie.sibling}if(!X){for(ie=L.child;ie;){if(ie===x){X=!0,x=L,M=N;break}if(ie===M){X=!0,M=L,x=N;break}ie=ie.sibling}if(!X)throw Error(i(189))}}if(x.alternate!==M)throw Error(i(190))}if(x.tag!==3)throw Error(i(188));return x.stateNode.current===x?d:f}function S(d){var f=d.tag;if(f===5||f===26||f===27||f===6)return d;for(d=d.child;d!==null;){if(f=S(d),f!==null)return f;d=d.sibling}return null}function A(d){var f=d.tag;if(f===5||f===26||f===27||f===6)return d;for(d=d.child;d!==null;){if(d.tag!==4&&(f=A(d),f!==null))return f;d=d.sibling}return null}function E(d){return{current:d}}function b(d){0>Dl||(d.current=es[Dl],es[Dl]=null,Dl--)}function C(d,f){Dl++,es[Dl]=d.current,d.current=f}function w(d){return d>>>=0,d===0?32:31-(LS(d)/BS|0)|0}function D(d){var f=d&42;if(f!==0)return f;switch(d&-d){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:return 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 d&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return d&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return d}}function P(d,f){var x=d.pendingLanes;if(x===0)return 0;var M=0,N=d.suspendedLanes,L=d.pingedLanes,X=d.warmLanes;d=d.finishedLanes!==0;var ie=x&134217727;return ie!==0?(x=ie&~N,x!==0?M=D(x):(L&=ie,L!==0?M=D(L):d||(X=ie&~X,X!==0&&(M=D(X))))):(ie=x&~N,ie!==0?M=D(ie):L!==0?M=D(L):d||(X=x&~X,X!==0&&(M=D(X)))),M===0?0:f!==0&&f!==M&&(f&N)===0&&(N=M&-M,X=f&-f,N>=X||N===32&&(X&4194176)!==0)?f:M}function I(d,f){return(d.pendingLanes&~(d.suspendedLanes&~d.pingedLanes)&f)===0}function F(d,f){switch(d){case 1:case 2:case 4:case 8:return f+250;case 16:case 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 f+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function z(){var d=Po;return Po<<=1,(Po&4194176)===0&&(Po=128),d}function B(){var d=gc;return gc<<=1,(gc&62914560)===0&&(gc=4194304),d}function O(d){for(var f=[],x=0;31>x;x++)f.push(d);return f}function W(d,f){d.pendingLanes|=f,f!==268435456&&(d.suspendedLanes=0,d.pingedLanes=0,d.warmLanes=0)}function ee(d,f,x,M,N,L){var X=d.pendingLanes;d.pendingLanes=x,d.suspendedLanes=0,d.pingedLanes=0,d.warmLanes=0,d.expiredLanes&=x,d.entangledLanes&=x,d.errorRecoveryDisabledLanes&=x,d.shellSuspendCounter=0;var ie=d.entanglements,ve=d.expirationTimes,He=d.hiddenUpdates;for(x=X&~x;0<x;){var ut=31-yr(x),bt=1<<ut;ie[ut]=0,ve[ut]=-1;var At=He[ut];if(At!==null)for(He[ut]=null,ut=0;ut<At.length;ut++){var yn=At[ut];yn!==null&&(yn.lane&=-536870913)}x&=~bt}M!==0&&se(d,M,0),L!==0&&N===0&&d.tag!==0&&(d.suspendedLanes|=L&~(X&~f))}function se(d,f,x){d.pendingLanes|=f,d.suspendedLanes&=~f;var M=31-yr(f);d.entangledLanes|=f,d.entanglements[M]=d.entanglements[M]|1073741824|x&4194218}function fe(d,f){var x=d.entangledLanes|=f;for(d=d.entanglements;x;){var M=31-yr(x),N=1<<M;N&f|d[M]&f&&(d[M]|=f),x&=~N}}function pe(d){return d&=-d,2<d?8<d?(d&134217727)!==0?32:268435456:8:2}function k(d){if(Pr&&typeof Pr.onCommitFiberRoot=="function")try{Pr.onCommitFiberRoot(ts,d,void 0,(d.current.flags&128)===128)}catch{}}function Q(d){if(typeof IS=="function"&&Ds(d),Pr&&typeof Pr.setStrictMode=="function")try{Pr.setStrictMode(ts,d)}catch{}}function J(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}function Se(d,f){if(typeof d=="object"&&d!==null){var x=l_.get(d);return x!==void 0?x:(f={value:d,source:f,stack:p(f)},l_.set(d,f),f)}return{value:d,source:f,stack:p(f)}}function K(d,f){yc[vc++]=Hh,yc[vc++]=_c,_c=d,Hh=f}function oe(d,f,x){ia[sa++]=ho,ia[sa++]=fo,ia[sa++]=bu,bu=d;var M=ho;d=fo;var N=32-yr(M)-1;M&=~(1<<N),x+=1;var L=32-yr(f)+N;if(30<L){var X=N-N%5;L=(M&(1<<X)-1).toString(32),M>>=X,N-=X,ho=1<<32-yr(f)+N|x<<N|M,fo=L+d}else ho=1<<L|x<<N|M,fo=d}function we(d){d.return!==null&&(K(d,1),oe(d,1,0))}function Ie(d){for(;d===_c;)_c=yc[--vc],yc[vc]=null,Hh=yc[--vc],yc[vc]=null;for(;d===bu;)bu=ia[--sa],ia[sa]=null,fo=ia[--sa],ia[sa]=null,ho=ia[--sa],ia[sa]=null}function Ze(d,f){C(Oo,f),C(kh,d),C(bs,null),d=$x(f),b(bs),C(bs,d)}function mt(){b(bs),b(kh),b(Oo)}function xe(d){d.memoizedState!==null&&C(xc,d);var f=bs.current,x=Ih(f,d.type);f!==x&&(C(kh,d),C(bs,x))}function Ve(d){kh.current===d&&(b(bs),b(kh)),xc.current===d&&(b(xc),mr?uo._currentValue=yu:uo._currentValue2=yu)}function tt(d){var f=Error(i(418,""));throw te(Se(f,d)),Uf}function Mt(d,f){if(!Xs)throw Error(i(175));TS(d.stateNode,d.type,d.memoizedProps,f,d)||tt(d)}function Ct(d){for(Ys=d.return;Ys;)switch(Ys.tag){case 3:case 27:Us=!0;return;case 5:case 13:Us=!1;return;default:Ys=Ys.return}}function rn(d){if(!Xs||d!==Ys)return!1;if(!Gn)return Ct(d),Gn=!0,!1;var f=!1;if(di?d.tag!==3&&d.tag!==27&&(d.tag!==5||tg(d.type)&&!Sn(d.type,d.memoizedProps))&&(f=!0):d.tag!==3&&(d.tag!==5||tg(d.type)&&!Sn(d.type,d.memoizedProps))&&(f=!0),f&&js&&tt(d),Ct(d),d.tag===13){if(!Xs)throw Error(i(316));if(d=d.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(i(317));js=ES(d)}else js=Ys?s_(d.stateNode):null;return!0}function vn(){Xs&&(js=Ys=null,Gn=!1)}function te(d){Pa===null?Pa=[d]:Pa.push(d)}function $e(){for(var d=Sc,f=po=Sc=0;f<d;){var x=Oa[f];Oa[f++]=null;var M=Oa[f];Oa[f++]=null;var N=Oa[f];Oa[f++]=null;var L=Oa[f];if(Oa[f++]=null,M!==null&&N!==null){var X=M.pending;X===null?N.next=N:(N.next=X.next,X.next=N),M.pending=N}L!==0&&ft(x,N,L)}}function Ye(d,f,x,M){Oa[Sc++]=d,Oa[Sc++]=f,Oa[Sc++]=x,Oa[Sc++]=M,po|=M,d.lanes|=M,d=d.alternate,d!==null&&(d.lanes|=M)}function qe(d,f,x,M){return Ye(d,f,x,M),Je(d)}function Be(d,f){return Ye(d,null,null,f),Je(d)}function ft(d,f,x){d.lanes|=x;var M=d.alternate;M!==null&&(M.lanes|=x);for(var N=!1,L=d.return;L!==null;)L.childLanes|=x,M=L.alternate,M!==null&&(M.childLanes|=x),L.tag===22&&(d=L.stateNode,d===null||d._visibility&1||(N=!0)),d=L,L=L.return;N&&f!==null&&d.tag===3&&(L=d.stateNode,N=31-yr(x),L=L.hiddenUpdates,d=L[N],d===null?L[N]=[f]:d.push(f),f.lane=x|536870912)}function Je(d){if(50<$h)throw $h=0,gg=null,Error(i(185));for(var f=d.return;f!==null;)d=f,f=d.return;return d.tag===3?d.stateNode:null}
vendor: 17,744 bytes, line 3936
3936function nt(d){d!==Ul&&d.next===null&&(Ul===null?Lf=Ul=d:Ul=Ul.next=d),xi=!0,bc||(bc=!0,De(tn))}function qt(d,f){if(!u_&&xi){u_=!0;do for(var x=!1,M=Lf;M!==null;){if(d!==0){var N=M.pendingLanes;if(N===0)var L=0;else{var X=M.suspendedLanes,ie=M.pingedLanes;L=(1<<31-yr(42|d)+1)-1,L&=N&~(X&~ie),L=L&201326677?L&201326677|1:L?L|2:0}L!==0&&(x=!0,ge(M,L))}else L=Pn,L=P(M,M===Jn?L:0),(L&3)===0||I(M,L)||(x=!0,ge(M,L));M=M.next}while(x);u_=!1}}function tn(){xi=bc=!1;var d=0;qh!==0&&(nS()&&(d=qh),qh=0);for(var f=Ba(),x=null,M=Lf;M!==null;){var N=M.next,L=Z(M,f);L===0?(M.next=null,x===null?Lf=N:x.next=N,N===null&&(Ul=x)):(x=M,(d!==0||(L&3)!==0)&&(xi=!0)),M=N}qt(d)}function Z(d,f){for(var x=d.suspendedLanes,M=d.pingedLanes,N=d.expirationTimes,L=d.pendingLanes&-62914561;0<L;){var X=31-yr(L),ie=1<<X,ve=N[X];ve===-1?((ie&x)===0||(ie&M)!==0)&&(N[X]=F(ie,f)):ve<=f&&(d.expiredLanes|=ie),L&=~ie}if(f=Jn,x=Pn,x=P(d,d===f?x:0),M=d.callbackNode,x===0||d===f&&oi===2||d.cancelPendingCommit!==null)return M!==null&&M!==null&&rg(M),d.callbackNode=null,d.callbackPriority=0;if((x&3)===0||I(d,x)){if(f=x&-x,f===d.callbackPriority)return f;switch(M!==null&&rg(M),pe(x)){case 2:case 8:x=OS;break;case 32:x=lg;break;case 268435456:x=lA;break;default:x=lg}return M=G.bind(null,d),x=Df(x,M),d.callbackPriority=f,d.callbackNode=x,f}return M!==null&&M!==null&&rg(M),d.callbackPriority=2,d.callbackNode=null,2}function G(d,f){var x=d.callbackNode;if(oo()&&d.callbackNode!==x)return null;var M=Pn;return M=P(d,d===Jn?M:0),M===0?null:(cu(d,M,f),Z(d,Ba()),d.callbackNode!=null&&d.callbackNode===x?G.bind(null,d):null)}function ge(d,f){if(oo())return null;cu(d,f,!0)}function De(d){jv?wl(function(){(qn&6)!==0?Df(og,d):d()}):Df(og,d)}function We(){return qh===0&&(qh=z()),qh}function Ue(d,f){if(Wh===null){var x=Wh=[];Tc=0,ra=We(),Mc={status:"pending",value:void 0,then:function(M){x.push(M)}}}return Tc++,f.then(St,St),f}function St(){if(--Tc===0&&Wh!==null){Mc!==null&&(Mc.status="fulfilled");var d=Wh;Wh=null,ra=0,Mc=null;for(var f=0;f<d.length;f++)(0,d[f])()}}function ht(d,f){var x=[],M={status:"pending",value:null,reason:null,then:function(N){x.push(N)}};return d.then(function(){M.status="fulfilled",M.value=f;for(var N=0;N<x.length;N++)(0,x[N])(f)},function(N){for(M.status="rejected",M.reason=N,N=0;N<x.length;N++)(0,x[N])(void 0)}),M}function Dt(d){d.updateQueue={baseState:d.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ut(d,f){d=d.updateQueue,f.updateQueue===d&&(f.updateQueue={baseState:d.baseState,firstBaseUpdate:d.firstBaseUpdate,lastBaseUpdate:d.lastBaseUpdate,shared:d.shared,callbacks:null})}function et(d){return{lane:d,tag:0,payload:null,callback:null,next:null}}function gt(d,f,x){var M=d.updateQueue;if(M===null)return null;if(M=M.shared,(qn&2)!==0){var N=M.pending;return N===null?f.next=f:(f.next=N.next,N.next=f),M.pending=f,f=Je(d),ft(d,null,x),f}return Ye(d,M,f,x),Je(d)}function Ht(d,f,x){if(f=f.updateQueue,f!==null&&(f=f.shared,(x&4194176)!==0)){var M=f.lanes;M&=d.pendingLanes,x|=M,f.lanes=x,fe(d,x)}}function Lt(d,f){var x=d.updateQueue,M=d.alternate;if(M!==null&&(M=M.updateQueue,x===M)){var N=null,L=null;if(x=x.firstBaseUpdate,x!==null){do{var X={lane:x.lane,tag:x.tag,payload:x.payload,callback:null,next:null};L===null?N=L=X:L=L.next=X,x=x.next}while(x!==null);L===null?N=L=f:L=L.next=f}else N=L=f;x={baseState:M.baseState,firstBaseUpdate:N,lastBaseUpdate:L,shared:M.shared,callbacks:M.callbacks},d.updateQueue=x;return}d=x.lastBaseUpdate,d===null?x.firstBaseUpdate=f:d.next=f,x.lastBaseUpdate=f}function yt(){if(Ec){var d=Mc;if(d!==null)throw d}}function un(d,f,x,M){Ec=!1;var N=d.updateQueue;Ll=!1;var L=N.firstBaseUpdate,X=N.lastBaseUpdate,ie=N.shared.pending;if(ie!==null){N.shared.pending=null;var ve=ie,He=ve.next;ve.next=null,X===null?L=He:X.next=He,X=ve;var ut=d.alternate;ut!==null&&(ut=ut.updateQueue,ie=ut.lastBaseUpdate,ie!==X&&(ie===null?ut.firstBaseUpdate=He:ie.next=He,ut.lastBaseUpdate=ve))}if(L!==null){var bt=N.baseState;X=0,ut=He=ve=null,ie=L;do{var At=ie.lane&-536870913,yn=At!==ie.lane;if(yn?(Pn&At)===At:(M&At)===At){At!==0&&At===ra&&(Ec=!0),ut!==null&&(ut=ut.next={lane:0,tag:ie.tag,payload:ie.payload,callback:null,next:null});e:{var fa=d,Du=ie;At=f;var Uu=x;switch(Du.tag){case 1:if(fa=Du.payload,typeof fa=="function"){bt=fa.call(Uu,bt,At);break e}bt=fa;break e;case 3:fa.flags=fa.flags&-65537|128;case 0:if(fa=Du.payload,At=typeof fa=="function"?fa.call(Uu,bt,At):fa,At==null)break e;bt=km({},bt,At);break e;case 2:Ll=!0}}At=ie.callback,At!==null&&(d.flags|=64,yn&&(d.flags|=8192),yn=N.callbacks,yn===null?N.callbacks=[At]:yn.push(At))}else yn={lane:At,tag:ie.tag,payload:ie.payload,callback:ie.callback,next:null},ut===null?(He=ut=yn,ve=bt):ut=ut.next=yn,X|=At;if(ie=ie.next,ie===null){if(ie=N.shared.pending,ie===null)break;yn=ie,ie=yn.next,yn.next=null,N.lastBaseUpdate=yn,N.shared.pending=null}}while(!0);ut===null&&(ve=bt),N.baseState=ve,N.firstBaseUpdate=He,N.lastBaseUpdate=ut,L===null&&(N.shared.lanes=0),ha|=X,d.lanes=X,d.memoizedState=bt}}function he(d,f){if(typeof d!="function")throw Error(i(191,d));d.call(f)}function at(d,f){var x=d.callbacks;if(x!==null)for(d.callbacks=null,d=0;d<x.length;d++)he(x[d],f)}function dt(d,f){if(Or(d,f))return!0;if(typeof d!="object"||d===null||typeof f!="object"||f===null)return!1;var x=Object.keys(d),M=Object.keys(f);if(x.length!==M.length)return!1;for(M=0;M<x.length;M++){var N=x[M];if(!Io.call(f,N)||!Or(d[N],f[N]))return!1}return!0}function Nt(d){return d=d.status,d==="fulfilled"||d==="rejected"}function it(){}function Ke(d,f,x){switch(x=d[x],x===void 0?d.push(f):x!==f&&(f.then(it,it),f=x),f.status){case"fulfilled":return f.value;case"rejected":throw d=f.reason,d===Xh?Error(i(483)):d;default:if(typeof f.status=="string")f.then(it,it);else{if(d=Jn,d!==null&&100<d.shellSuspendCounter)throw Error(i(482));d=f,d.status="pending",d.then(function(M){if(f.status==="pending"){var N=f;N.status="fulfilled",N.value=M}},function(M){if(f.status==="pending"){var N=f;N.status="rejected",N.reason=M}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw d=f.reason,d===Xh?Error(i(483)):d}throw Tu=f,Xh}}function Bt(){if(Tu===null)throw Error(i(459));var d=Tu;return Tu=null,d}function nn(d){var f=Eu;return Eu+=1,Mu===null&&(Mu=[]),Ke(Mu,d,f)}function zn(d,f){f=f.props.ref,d.ref=f!==void 0?f:null}function Bn(d,f){throw f.$$typeof===tA?Error(i(525)):(d=Object.prototype.toString.call(f),Error(i(31,d==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":d)))}function Ea(d){var f=d._init;return f(d._payload)}function as(d){function f(Ee,ue){if(d){var Ce=Ee.deletions;Ce===null?(Ee.deletions=[ue],Ee.flags|=16):Ce.push(ue)}}function x(Ee,ue){if(!d)return null;for(;ue!==null;)f(Ee,ue),ue=ue.sibling;return null}function M(Ee){for(var ue=new Map;Ee!==null;)Ee.key!==null?ue.set(Ee.key,Ee):ue.set(Ee.index,Ee),Ee=Ee.sibling;return ue}function N(Ee,ue){return Ee=wa(Ee,ue),Ee.index=0,Ee.sibling=null,Ee}function L(Ee,ue,Ce){return Ee.index=Ce,d?(Ce=Ee.alternate,Ce!==null?(Ce=Ce.index,Ce<ue?(Ee.flags|=33554434,ue):Ce):(Ee.flags|=33554434,ue)):(Ee.flags|=1048576,ue)}function X(Ee){return d&&Ee.alternate===null&&(Ee.flags|=33554434),Ee}function ie(Ee,ue,Ce,ot){return ue===null||ue.tag!==6?(ue=Gm(Ce,Ee.mode,ot),ue.return=Ee,ue):(ue=N(ue,Ce),ue.return=Ee,ue)}function ve(Ee,ue,Ce,ot){var Wt=Ce.type;return Wt===mu?ut(Ee,ue,Ce.props.children,ot,Ce.key):ue!==null&&(ue.elementType===Wt||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===Ua&&Ea(Wt)===ue.type)?(ue=N(ue,Ce.props),zn(ue,Ce),ue.return=Ee,ue):(ue=Uo(Ce.type,Ce.key,Ce.props,null,Ee.mode,ot),zn(ue,Ce),ue.return=Ee,ue)}function He(Ee,ue,Ce,ot){return ue===null||ue.tag!==4||ue.stateNode.containerInfo!==Ce.containerInfo||ue.stateNode.implementation!==Ce.implementation?(ue=zv(Ce,Ee.mode,ot),ue.return=Ee,ue):(ue=N(ue,Ce.children||[]),ue.return=Ee,ue)}function ut(Ee,ue,Ce,ot,Wt){return ue===null||ue.tag!==7?(ue=Xi(Ce,Ee.mode,ot,Wt),ue.return=Ee,ue):(ue=N(ue,Ce),ue.return=Ee,ue)}function bt(Ee,ue,Ce){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return ue=Gm(""+ue,Ee.mode,Ce),ue.return=Ee,ue;if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case xf:return Ce=Uo(ue.type,ue.key,ue.props,null,Ee.mode,Ce),zn(Ce,ue),Ce.return=Ee,Ce;case Da:return ue=zv(ue,Ee.mode,Ce),ue.return=Ee,ue;case Ua:var ot=ue._init;return ue=ot(ue._payload),bt(Ee,ue,Ce)}if(Bh(ue)||r(ue))return ue=Xi(ue,Ee.mode,Ce,null),ue.return=Ee,ue;if(typeof ue.then=="function")return bt(Ee,nn(ue),Ce);if(ue.$$typeof===lo)return bt(Ee,rf(Ee,ue),Ce);Bn(Ee,ue)}return null}function At(Ee,ue,Ce,ot){var Wt=ue!==null?ue.key:null;if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number"||typeof Ce=="bigint")return Wt!==null?null:ie(Ee,ue,""+Ce,ot);if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case xf:return Ce.key===Wt?ve(Ee,ue,Ce,ot):null;case Da:return Ce.key===Wt?He(Ee,ue,Ce,ot):null;case Ua:return Wt=Ce._init,Ce=Wt(Ce._payload),At(Ee,ue,Ce,ot)}if(Bh(Ce)||r(Ce))return Wt!==null?null:ut(Ee,ue,Ce,ot,null);if(typeof Ce.then=="function")return At(Ee,ue,nn(Ce),ot);if(Ce.$$typeof===lo)return At(Ee,ue,rf(Ee,Ce),ot);Bn(Ee,Ce)}return null}function yn(Ee,ue,Ce,ot,Wt){if(typeof ot=="string"&&ot!==""||typeof ot=="number"||typeof ot=="bigint")return Ee=Ee.get(Ce)||null,ie(ue,Ee,""+ot,Wt);if(typeof ot=="object"&&ot!==null){switch(ot.$$typeof){case xf:return Ee=Ee.get(ot.key===null?Ce:ot.key)||null,ve(ue,Ee,ot,Wt);case Da:return Ee=Ee.get(ot.key===null?Ce:ot.key)||null,He(ue,Ee,ot,Wt);case Ua:var Di=ot._init;return ot=Di(ot._payload),yn(Ee,ue,Ce,ot,Wt)}if(Bh(ot)||r(ot))return Ee=Ee.get(Ce)||null,ut(ue,Ee,ot,Wt,null);if(typeof ot.then=="function")return yn(Ee,ue,Ce,nn(ot),Wt);if(ot.$$typeof===lo)return yn(Ee,ue,Ce,rf(ue,ot),Wt);Bn(ue,ot)}return null}function fa(Ee,ue,Ce,ot){for(var Wt=null,Di=null,hn=ue,Xn=ue=0,ns=null;hn!==null&&Xn<Ce.length;Xn++){hn.index>Xn?(ns=hn,hn=null):ns=hn.sibling;var Un=At(Ee,hn,Ce[Xn],ot);if(Un===null){hn===null&&(hn=ns);break}d&&hn&&Un.alternate===null&&f(Ee,hn),ue=L(Un,ue,Xn),Di===null?Wt=Un:Di.sibling=Un,Di=Un,hn=ns}if(Xn===Ce.length)return x(Ee,hn),Gn&&K(Ee,Xn),Wt;if(hn===null){for(;Xn<Ce.length;Xn++)hn=bt(Ee,Ce[Xn],ot),hn!==null&&(ue=L(hn,ue,Xn),Di===null?Wt=hn:Di.sibling=hn,Di=hn);return Gn&&K(Ee,Xn),Wt}for(hn=M(hn);Xn<Ce.length;Xn++)ns=yn(hn,Ee,Xn,Ce[Xn],ot),ns!==null&&(d&&ns.alternate!==null&&hn.delete(ns.key===null?Xn:ns.key),ue=L(ns,ue,Xn),Di===null?Wt=ns:Di.sibling=ns,Di=ns);return d&&hn.forEach(function(Wo){return f(Ee,Wo)}),Gn&&K(Ee,Xn),Wt}function Du(Ee,ue,Ce,ot){if(Ce==null)throw Error(i(151));for(var Wt=null,Di=null,hn=ue,Xn=ue=0,ns=null,Un=Ce.next();hn!==null&&!Un.done;Xn++,Un=Ce.next()){hn.index>Xn?(ns=hn,hn=null):ns=hn.sibling;var Wo=At(Ee,hn,Un.value,ot);if(Wo===null){hn===null&&(hn=ns);break}d&&hn&&Wo.alternate===null&&f(Ee,hn),ue=L(Wo,ue,Xn),Di===null?Wt=Wo:Di.sibling=Wo,Di=Wo,hn=ns}if(Un.done)return x(Ee,hn),Gn&&K(Ee,Xn),Wt;if(hn===null){for(;!Un.done;Xn++,Un=Ce.next())Un=bt(Ee,Un.value,ot),Un!==null&&(ue=L(Un,ue,Xn),Di===null?Wt=Un:Di.sibling=Un,Di=Un);return Gn&&K(Ee,Xn),Wt}for(hn=M(hn);!Un.done;Xn++,Un=Ce.next())Un=yn(hn,Ee,Xn,Un.value,ot),Un!==null&&(d&&Un.alternate!==null&&hn.delete(Un.key===null?Xn:Un.key),ue=L(Un,ue,Xn),Di===null?Wt=Un:Di.sibling=Un,Di=Un);return d&&hn.forEach(function(yg){return f(Ee,yg)}),Gn&&K(Ee,Xn),Wt}function Uu(Ee,ue,Ce,ot){if(typeof Ce=="object"&&Ce!==null&&Ce.type===mu&&Ce.key===null&&(Ce=Ce.props.children),typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case xf:e:{for(var Wt=Ce.key;ue!==null;){if(ue.key===Wt){if(Wt=Ce.type,Wt===mu){if(ue.tag===7){x(Ee,ue.sibling),ot=N(ue,Ce.props.children),ot.return=Ee,Ee=ot;break e}}else if(ue.elementType===Wt||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===Ua&&Ea(Wt)===ue.type){x(Ee,ue.sibling),ot=N(ue,Ce.props),zn(ot,Ce),ot.return=Ee,Ee=ot;break e}x(Ee,ue);break}else f(Ee,ue);ue=ue.sibling}Ce.type===mu?(ot=Xi(Ce.props.children,Ee.mode,ot,Ce.key),ot.return=Ee,Ee=ot):(ot=Uo(Ce.type,Ce.key,Ce.props,null,Ee.mode,ot),zn(ot,Ce),ot.return=Ee,Ee=ot)}return X(Ee);case Da:e:{for(Wt=Ce.key;ue!==null;){if(ue.key===Wt)if(ue.tag===4&&ue.stateNode.containerInfo===Ce.containerInfo&&ue.stateNode.implementation===Ce.implementation){x(Ee,ue.sibling),ot=N(ue,Ce.children||[]),ot.return=Ee,Ee=ot;break e}else{x(Ee,ue);break}else f(Ee,ue);ue=ue.sibling}ot=zv(Ce,Ee.mode,ot),ot.return=Ee,Ee=ot}return X(Ee);case Ua:return Wt=Ce._init,Ce=Wt(Ce._payload),Uu(Ee,ue,Ce,ot)}if(Bh(Ce))return fa(Ee,ue,Ce,ot);if(r(Ce)){if(Wt=r(Ce),typeof Wt!="function")throw Error(i(150));return Ce=Wt.call(Ce),Du(Ee,ue,Ce,ot)}if(typeof Ce.then=="function")return Uu(Ee,ue,nn(Ce),ot);if(Ce.$$typeof===lo)return Uu(Ee,ue,rf(Ee,Ce),ot);Bn(Ee,Ce)}return typeof Ce=="string"&&Ce!==""||typeof Ce=="number"||typeof Ce=="bigint"?(Ce=""+Ce,ue!==null&&ue.tag===6?(x(Ee,ue.sibling),ot=N(ue,Ce),ot.return=Ee,Ee=ot):(x(Ee,ue),ot=Gm(Ce,Ee.mode,ot),ot.return=Ee,Ee=ot),X(Ee)):x(Ee,ue)}return function(Ee,ue,Ce,ot){try{Eu=0;var Wt=Uu(Ee,ue,Ce,ot);return Mu=null,Wt}catch(hn){if(hn===Xh)throw hn;var Di=t(29,hn,null,Ee.mode);return Di.lanes=ot,Di.return=Ee,Di}finally{}}}function os(d,f){d=sr,C(Yh,d),C(Si,f),sr=d|f.baseLanes}function Oi(){C(Yh,sr),C(Si,Si.current)}function Aa(){sr=Yh.current,b(Si),b(Yh)}function Kr(d){var f=d.alternate;C(Ts,Ts.current&1),C(aa,d),fi===null&&(f===null||Si.current!==null||f.memoizedState!==null)&&(fi=d)}function Xd(d){if(d.tag===22){if(C(Ts,Ts.current),C(aa,d),fi===null){var f=d.alternate;f!==null&&f.memoizedState!==null&&(fi=d)}}else Zr()}function Zr(){C(Ts,Ts.current),C(aa,aa.current)}function Qr(d){b(aa),fi===d&&(fi=null),b(Ts)}function $r(d){for(var f=d;f!==null;){if(f.tag===13){var x=f.memoizedState;if(x!==null&&(x=x.dehydrated,x===null||$m(x)||Jm(x)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break;for(;f.sibling===null;){if(f.return===null||f.return===d)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}function _i(){throw Error(i(321))}function ro(d,f){if(f===null)return!1;for(var x=0;x<f.length&&x<d.length;x++)if(!Or(d[x],f[x]))return!1;return!0}function No(d,f,x,M,N,L){return Bl=L,En=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,cn.H=d===null||d.memoizedState===null?Nu:vr,Ru=!1,L=x(M,N),Ru=!1,Ac&&(L=fl(f,x,M,N)),Jl(d),L}function Jl(d){cn.H=Yi;var f=Jt!==null&&Jt.next!==null;if(Bl=0,kn=Jt=En=null,Ia=!1,Rc=0,Ls=null,f)throw Error(i(300));d===null||pi||(d=d.dependencies,d!==null&&sf(d)&&(pi=!0))}function fl(d,f,x,M){En=d;var N=0;do{if(Ac&&(Ls=null),Rc=0,Ac=!1,25<=N)throw Error(i(301));if(N+=1,kn=Jt=null,d.updateQueue!=null){var L=d.updateQueue;L.lastEffect=null,L.events=null,L.stores=null,L.memoCache!=null&&(L.memoCache.index=0)}cn.H=oa,L=f(x,M)}while(Ac);return L}function ls(){var d=cn.H,f=d.useState()[0];return f=typeof f.then=="function"?Ne(f):f,d=d.useState()[0],(Jt!==null?Jt.memoizedState:null)!==d&&(En.flags|=1024),f}function dh(){var d=ug!==0;return ug=0,d}function fh(d,f,x){f.updateQueue=d.updateQueue,f.flags&=-2053,d.lanes&=~x}function q(d){if(Ia){for(d=d.memoizedState;d!==null;){var f=d.queue;f!==null&&(f.pending=null),d=d.next}Ia=!1}Bl=0,kn=Jt=En=null,Ac=!1,Rc=ug=0,Ls=null}function de(){var d={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kn===null?En.memoizedState=kn=d:kn=kn.next=d,kn}function Te(){if(Jt===null){var d=En.alternate;d=d!==null?d.memoizedState:null}else d=Jt.next;var f=kn===null?En.memoizedState:kn.next;if(f!==null)kn=f,Jt=d;else{if(d===null)throw En.alternate===null?Error(i(467)):Error(i(310));Jt=d,d={memoizedState:Jt.memoizedState,baseState:Jt.baseState,baseQueue:Jt.baseQueue,queue:Jt.queue,next:null},kn===null?En.memoizedState=kn=d:kn=kn.next=d}return kn}function Ne(d){var f=Rc;return Rc+=1,Ls===null&&(Ls=[]),d=Ke(Ls,d,f),f=En,(kn===null?f.memoizedState:kn.next)===null&&(f=f.alternate,cn.H=f===null||f.memoizedState===null?Nu:vr),d}function ye(d){if(d!==null&&typeof d=="object"){if(typeof d.then=="function")return Ne(d);if(d.$$typeof===lo)return Hs(d)}throw Error(i(438,String(d)))}function st(d){var f=null,x=En.updateQueue;if(x!==null&&(f=x.memoCache),f==null){var M=En.alternate;M!==null&&(M=M.updateQueue,M!==null&&(M=M.memoCache,M!=null&&(f={data:M.data.map(function(N){return N.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),x===null&&(x=cg(),En.updateQueue=x),x.memoCache=f,x=f.data[f.index],x===void 0)for(x=f.data[f.index]=Array(d),M=0;M<d;M++)x[M]=Qx;return f.index++,x}function pt(d,f){return typeof f=="function"?f(d):f}function wt(d){var f=Te();return _t(f,Jt,d)}function _t(d,f,x){var M=d.queue;if(M===null)throw Error(i(311));M.lastRenderedReducer=x;var N=d.baseQueue,L=M.pending;if(L!==null){if(N!==null){var X=N.next;N.next=L.next,L.next=X}f.baseQueue=N=L,M.pending=null}if(L=d.baseState,N===null)d.memoizedState=L;else{f=N.next;var ie=X=null,ve=null,He=f,ut=!1;do{var bt=He.lane&-536870913;if(bt!==He.lane?(Pn&bt)===bt:(Bl&bt)===bt){var At=He.revertLane;if(At===0)ve!==null&&(ve=ve.next={lane:0,revertLane:0,action:He.action,hasEagerState:He.hasEagerState,eagerState:He.eagerState,next:null}),bt===ra&&(ut=!0);else if((Bl&At)===At){He=He.next,At===ra&&(ut=!0);continue}else bt={lane:0,revertLane:He.revertLane,action:He.action,hasEagerState:He.hasEagerState,eagerState:He.eagerState,next:null},ve===null?(ie=ve=bt,X=L):ve=ve.next=bt,En.lanes|=At,ha|=At;bt=He.action,Ru&&x(L,bt),L=He.hasEagerState?He.eagerState:x(L,bt)}else At={lane:bt,revertLane:He.revertLane,action:He.action,hasEagerState:He.hasEagerState,eagerState:He.eagerState,next:null},ve===null?(ie=ve=At,X=L):ve=ve.next=At,En.lanes|=bt,ha|=bt;He=He.next}while(He!==null&&He!==f);
vendor: 4,122 bytes, line 3936
3936if(ve===null?X=L:ve.next=ie,!Or(L,d.memoizedState)&&(pi=!0,ut&&(x=Mc,x!==null)))throw x;d.memoizedState=L,d.baseState=X,d.baseQueue=ve,M.lastRenderedState=L}return N===null&&(M.lanes=0),[d.memoizedState,M.dispatch]}function Xt(d){var f=Te(),x=f.queue;if(x===null)throw Error(i(311));x.lastRenderedReducer=d;var M=x.dispatch,N=x.pending,L=f.memoizedState;if(N!==null){x.pending=null;var X=N=N.next;do L=d(L,X.action),X=X.next;while(X!==N);Or(L,f.memoizedState)||(pi=!0),f.memoizedState=L,f.baseQueue===null&&(f.baseState=L),x.lastRenderedState=L}return[L,M]}function $t(d,f,x){var M=En,N=Te(),L=Gn;if(L){if(x===void 0)throw Error(i(407));x=x()}else x=f();var X=!Or((Jt||N).memoizedState,x);if(X&&(N.memoizedState=x,pi=!0),N=N.queue,hv(Hn.bind(null,M,N,d),[d]),N.getSnapshot!==f||X||kn!==null&&kn.memoizedState.tag&1){if(M.flags|=2048,xs(9,Tn.bind(null,M,N,x,f),{destroy:void 0},null),Jn===null)throw Error(i(349));L||(Bl&60)!==0||zt(M,f,x)}return x}function zt(d,f,x){d.flags|=16384,d={getSnapshot:f,value:x},f=En.updateQueue,f===null?(f=cg(),En.updateQueue=f,f.stores=[d]):(x=f.stores,x===null?f.stores=[d]:x.push(d))}function Tn(d,f,x,M){f.value=x,f.getSnapshot=M,Ni(f)&&ni(d)}function Hn(d,f,x){return x(function(){Ni(f)&&ni(d)})}function Ni(d){var f=d.getSnapshot;d=d.value;try{var x=f();return!Or(d,x)}catch{return!0}}function ni(d){var f=Be(d,2);f!==null&&ws(f,d,2)}function _n(d){var f=de();if(typeof d=="function"){var x=d;if(d=x(),Ru){Q(!0);try{x()}finally{Q(!1)}}}return f.memoizedState=f.baseState=d,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pt,lastRenderedState:d},f}function Yt(d,f,x,M){return d.baseState=x,_t(d,Jt,typeof M=="function"?M:pt)}function Ci(d,f,x,M,N){if($d(d))throw Error(i(485));if(d=f.action,d!==null){var L={payload:N,action:d,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(X){L.listeners.push(X)}};cn.T!==null?x(!0):L.isTransition=!1,M(L),x=f.pending,x===null?(L.next=f.pending=L,Cn(f,L)):(L.next=x.next,f.pending=x.next=L)}}function Cn(d,f){var x=f.action,M=f.payload,N=d.state;if(f.isTransition){var L=cn.T,X={};cn.T=X;try{var ie=x(N,M),ve=cn.S;ve!==null&&ve(X,ie),Is(d,f,ie)}catch(He){Fs(d,f,He)}finally{cn.T=L}}else try{L=x(N,M),Is(d,f,L)}catch(He){Fs(d,f,He)}}function Is(d,f,x){x!==null&&typeof x=="object"&&typeof x.then=="function"?x.then(function(M){Ra(d,f,M)},function(M){return Fs(d,f,M)}):Ra(d,f,x)}function Ra(d,f,x){f.status="fulfilled",f.value=x,_s(f),d.state=x,f=d.pending,f!==null&&(x=f.next,x===f?d.pending=null:(x=x.next,f.next=x,Cn(d,x)))}function Fs(d,f,x){var M=d.pending;if(d.pending=null,M!==null){M=M.next;do f.status="rejected",f.reason=x,_s(f),f=f.next;while(f!==M)}d.action=null}function _s(d){d=d.listeners;for(var f=0;f<d.length;f++)(0,d[f])()}function ai(d,f){return f}function er(d,f){if(Gn){var x=Jn.formState;if(x!==null){e:{var M=En;if(Gn){if(js){var N=i_(js,Us);if(N){js=s_(N),M=_S(N);break e}}tt(M)}M=!1}M&&(f=x[0])}}x=de(),x.memoizedState=x.baseState=f,M={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ai,lastRenderedState:f},x.queue=M,x=mv.bind(null,En,M),M.dispatch=x,M=_n(!1);var L=gh.bind(null,En,!1,M.queue);return M=de(),N={state:f,dispatch:null,action:d,pending:null},M.queue=N,x=Ci.bind(null,En,N,L,x),N.dispatch=x,M.memoizedState=d,[f,x,!1]}function Vs(d){var f=Te();return Fi(f,Jt,d)}function Fi(d,f,x){f=_t(d,f,ai)[0],d=wt(pt)[0],f=typeof f=="object"&&f!==null&&typeof f.then=="function"?Ne(f):f;var M=Te(),N=M.queue,L=N.dispatch;return x!==M.memoizedState&&(En.flags|=2048,xs(9,zs.bind(null,N,x),{destroy:void 0},null)),[f,L,d]}function zs(d,f){d.action=f}function lc(d){var f=Te(),x=Jt;if(x!==null)return Fi(f,x,d);Te(),f=f.memoizedState,x=Te();var M=x.queue.dispatch;return x.memoizedState=d,[f,M,!1]}function xs(d,f,x,M){return d={tag:d,create:f,inst:x,deps:M,next:null},f=En.updateQueue,f===null&&(f=cg(),En.updateQueue=f),x=f.lastEffect,x===null?f.lastEffect=d.next=d:(M=x.next,x.next=d,d.next=M,f.lastEffect=d),d}function Nx(){return Te().memoizedState}function Yd(d,f,x,M){var N=de();En.flags|=d,N.memoizedState=xs(1|f,x,{destroy:void 0},M===void 0?null:M)}
vendor: 18,284 bytes, line 3936
3936function jd(d,f,x,M){var N=Te();M=M===void 0?null:M;var L=N.memoizedState.inst;Jt!==null&&M!==null&&ro(M,Jt.memoizedState.deps)?N.memoizedState=xs(f,x,L,M):(En.flags|=d,N.memoizedState=xs(1|f,x,L,M))}function Sm(d,f){Yd(8390656,8,d,f)}function hv(d,f){jd(2048,8,d,f)}function Cx(d,f){return jd(4,2,d,f)}function Kd(d,f){return jd(4,4,d,f)}function bm(d,f){if(typeof f=="function"){d=d();var x=f(d);return function(){typeof x=="function"?x():f(null)}}if(f!=null)return d=d(),f.current=d,function(){f.current=null}}function Tm(d,f,x){x=x!=null?x.concat([d]):null,jd(4,4,bm.bind(null,f,d),x)}function eu(){}function uc(d,f){var x=Te();f=f===void 0?null:f;var M=x.memoizedState;return f!==null&&ro(f,M[1])?M[0]:(x.memoizedState=[d,f],d)}function dv(d,f){var x=Te();f=f===void 0?null:f;var M=x.memoizedState;if(f!==null&&ro(f,M[1]))return M[0];if(M=d(),Ru){Q(!0);try{d()}finally{Q(!1)}}return x.memoizedState=[M,f],M}function Zd(d,f,x){return x===void 0||(Bl&1073741824)!==0?d.memoizedState=f:(d.memoizedState=x,d=Bv(),En.lanes|=d,ha|=d,x)}function fv(d,f,x,M){return Or(x,f)?x:Si.current!==null?(d=Zd(d,x,M),Or(d,f)||(pi=!0),d):(Bl&42)===0?(pi=!0,d.memoizedState=x):(d=Bv(),En.lanes|=d,ha|=d,f)}function ph(d,f,x,M,N){var L=Cl();nr(L!==0&&8>L?L:8);var X=cn.T,ie={};cn.T=ie,gh(d,!1,f,x);try{var ve=N(),He=cn.S;if(He!==null&&He(ie,ve),ve!==null&&typeof ve=="object"&&typeof ve.then=="function"){var ut=ht(ve,M);tu(d,f,ut,$i(d))}else tu(d,f,M,$i(d))}catch(bt){tu(d,f,{then:function(){},status:"rejected",reason:bt},$i())}finally{nr(L),cn.T=X}}function Co(d){var f=d.memoizedState;if(f!==null)return f;f={memoizedState:yu,baseState:yu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pt,lastRenderedState:yu},next:null};var x={};return f.next={memoizedState:x,baseState:x,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pt,lastRenderedState:x},next:null},d.memoizedState=f,d=d.alternate,d!==null&&(d.memoizedState=f),f}function Qd(){return Hs(uo)}function mh(){return Te().memoizedState}function pl(){return Te().memoizedState}function pv(d){for(var f=d.return;f!==null;){switch(f.tag){case 24:case 3:var x=$i();d=et(x);var M=gt(f,d,x);M!==null&&(ws(M,f,x),Ht(M,f,x)),f={cache:ru()},d.payload=f;return}f=f.return}}function Mm(d,f,x){var M=$i();x={lane:M,revertLane:0,action:x,hasEagerState:!1,eagerState:null,next:null},$d(d)?dr(f,x):(x=qe(d,f,x,M),x!==null&&(ws(x,d,M),nu(x,f,M)))}function mv(d,f,x){var M=$i();tu(d,f,x,M)}function tu(d,f,x,M){var N={lane:M,revertLane:0,action:x,hasEagerState:!1,eagerState:null,next:null};if($d(d))dr(f,N);else{var L=d.alternate;if(d.lanes===0&&(L===null||L.lanes===0)&&(L=f.lastRenderedReducer,L!==null))try{var X=f.lastRenderedState,ie=L(X,x);if(N.hasEagerState=!0,N.eagerState=ie,Or(ie,X))return Ye(d,f,N,0),Jn===null&&$e(),!1}catch{}finally{}if(x=qe(d,f,N,M),x!==null)return ws(x,d,M),nu(x,f,M),!0}return!1}function gh(d,f,x,M){if(M={lane:2,revertLane:We(),action:M,hasEagerState:!1,eagerState:null,next:null},$d(d)){if(f)throw Error(i(479))}else f=qe(d,x,M,2),f!==null&&ws(f,d,2)}function $d(d){var f=d.alternate;return d===En||f!==null&&f===En}function dr(d,f){Ac=Ia=!0;var x=d.pending;x===null?f.next=f:(f.next=x.next,x.next=f),d.pending=f}function nu(d,f,x){if((x&4194176)!==0){var M=f.lanes;M&=d.pendingLanes,x|=M,f.lanes=x,fe(d,x)}}function yh(d,f,x,M){f=d.memoizedState,x=x(M,f),x=x==null?f:km({},f,x),d.memoizedState=x,d.lanes===0&&(d.updateQueue.baseState=x)}function vh(d,f,x,M,N,L,X){return d=d.stateNode,typeof d.shouldComponentUpdate=="function"?d.shouldComponentUpdate(M,L,X):f.prototype&&f.prototype.isPureReactComponent?!dt(x,M)||!dt(N,L):!0}function wx(d,f,x,M){d=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(x,M),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(x,M),f.state!==d&&Vo.enqueueReplaceState(f,f.state,null)}function ml(d,f){var x=f;if("ref"in f){x={};for(var M in f)M!=="ref"&&(x[M]=f[M])}if(d=d.defaultProps){x===f&&(x=km({},x));for(var N in d)x[N]===void 0&&(x[N]=d[N])}return x}function _h(d,f){try{var x=d.onUncaughtError;x(f.value,{componentStack:f.stack})}catch(M){setTimeout(function(){throw M})}}function xh(d,f,x){try{var M=d.onCaughtError;M(x.value,{componentStack:x.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(N){setTimeout(function(){throw N})}}function Sh(d,f,x){return x=et(x),x.tag=3,x.payload={element:null},x.callback=function(){_h(d,f)},x}function gv(d){return d=et(d),d.tag=3,d}function Dx(d,f,x,M){var N=x.type.getDerivedStateFromError;if(typeof N=="function"){var L=M.value;d.payload=function(){return N(L)},d.callback=function(){xh(f,x,M)}}var X=x.stateNode;X!==null&&typeof X.componentDidCatch=="function"&&(d.callback=function(){xh(f,x,M),typeof N!="function"&&(Cu===null?Cu=new Set([this]):Cu.add(this));var ie=M.stack;this.componentDidCatch(M.value,{componentStack:ie!==null?ie:""})})}function QE(d,f,x,M,N){if(x.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){if(f=x.alternate,f!==null&&nf(f,x,N,!0),x=aa.current,x!==null){switch(x.tag){case 13:return fi===null?Tl():x.alternate===null&&mi===0&&(mi=3),x.flags&=-257,x.flags|=65536,x.lanes=N,M===Pf?x.flags|=16384:(f=x.updateQueue,f===null?x.updateQueue=new Set([M]):f.add(M),dc(d,M,N)),!1;case 22:return x.flags|=65536,M===Pf?x.flags|=16384:(f=x.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([M])},x.updateQueue=f):(x=f.retryQueue,x===null?f.retryQueue=new Set([M]):x.add(M)),dc(d,M,N)),!1}throw Error(i(435,x.tag))}return dc(d,M,N),Tl(),!1}if(Gn)return f=aa.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=N,M!==Uf&&(d=Error(i(422),{cause:M}),te(Se(d,x)))):(M!==Uf&&(f=Error(i(423),{cause:M}),te(Se(f,x))),d=d.current.alternate,d.flags|=65536,N&=-N,d.lanes|=N,M=Se(M,x),N=Sh(d.stateNode,M,N),Lt(d,N),mi!==4&&(mi=2)),!1;var L=Error(i(520),{cause:M});if(L=Se(L,x),Cc===null?Cc=[L]:Cc.push(L),mi!==4&&(mi=2),f===null)return!0;M=Se(M,x),x=f;do{switch(x.tag){case 3:return x.flags|=65536,d=N&-N,x.lanes|=d,d=Sh(x.stateNode,M,d),Lt(x,d),!1;case 1:if(f=x.type,L=x.stateNode,(x.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||L!==null&&typeof L.componentDidCatch=="function"&&(Cu===null||!Cu.has(L))))return x.flags|=65536,N&=-N,x.lanes|=N,N=gv(N),Dx(N,d,x,M),Lt(x,N),!1}x=x.return}while(x!==null);return!1}function Gs(d,f,x,M){f.child=d===null?Fo(f,null,x,M):Au(f,d.child,x,M)}function Em(d,f,x,M,N){x=x.render;var L=f.ref;if("ref"in M){var X={};for(var ie in M)ie!=="ref"&&(X[ie]=M[ie])}else X=M;return su(f),M=No(d,f,x,X,L,N),ie=dh(),d!==null&&!pi?(fh(d,f,N),gl(d,f,N)):(Gn&&ie&&we(f),f.flags|=1,Gs(d,f,M,N),f.child)}function Ux(d,f,x,M,N){if(d===null){var L=x.type;return typeof L=="function"&&!gf(L)&&L.defaultProps===void 0&&x.compare===null?(f.tag=15,f.type=L,Lx(d,f,L,M,N)):(d=Uo(x.type,null,M,f,f.mode,N),d.ref=f.ref,d.return=f,f.child=d)}if(L=d.child,!Sv(d,N)){var X=L.memoizedProps;if(x=x.compare,x=x!==null?x:dt,x(X,M)&&d.ref===f.ref)return gl(d,f,N)}return f.flags|=1,d=wa(L,M),d.ref=f.ref,d.return=f,f.child=d}function Lx(d,f,x,M,N){if(d!==null){var L=d.memoizedProps;if(dt(L,M)&&d.ref===f.ref)if(pi=!1,f.pendingProps=M=L,Sv(d,N))(d.flags&131072)!==0&&(pi=!0);else return f.lanes=d.lanes,gl(d,f,N)}return Am(d,f,x,M,N)}function Bx(d,f,x){var M=f.pendingProps,N=M.children,L=(f.stateNode._pendingVisibility&2)!==0,X=d!==null?d.memoizedState:null;if(Jd(d,f),M.mode==="hidden"||L){if((f.flags&128)!==0){if(M=X!==null?X.baseLanes|x:x,d!==null){for(N=f.child=d.child,L=0;N!==null;)L=L|N.lanes|N.childLanes,N=N.sibling;f.childLanes=L&~M}else f.childLanes=0,f.child=null;return Px(d,f,M,x)}if((x&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},d!==null&&Nm(f,X!==null?X.cachePool:null),X!==null?os(f,X):Oi(),Xd(f);else return f.lanes=f.childLanes=536870912,Px(d,f,X!==null?X.baseLanes|x:x,x)}else X!==null?(Nm(f,X.cachePool),os(f,X),Zr(),f.memoizedState=null):(d!==null&&Nm(f,null),Oi(),Zr());return Gs(d,f,N,x),f.child}function Px(d,f,x,M){var N=Tv();return N=N===null?null:{parent:mr?bi._currentValue:bi._currentValue2,pool:N},f.memoizedState={baseLanes:x,cachePool:N},d!==null&&Nm(f,null),Oi(),Xd(f),d!==null&&nf(d,f,M,!0),null}function Jd(d,f){var x=f.ref;if(x===null)d!==null&&d.ref!==null&&(f.flags|=2097664);else{if(typeof x!="function"&&typeof x!="object")throw Error(i(284));(d===null||d.ref!==x)&&(f.flags|=2097664)}}function Am(d,f,x,M,N){return su(f),x=No(d,f,x,M,void 0,N),M=dh(),d!==null&&!pi?(fh(d,f,N),gl(d,f,N)):(Gn&&M&&we(f),f.flags|=1,Gs(d,f,x,N),f.child)}function Ox(d,f,x,M,N,L){return su(f),f.updateQueue=null,x=fl(f,M,x,N),Jl(d),M=dh(),d!==null&&!pi?(fh(d,f,L),gl(d,f,L)):(Gn&&M&&we(f),f.flags|=1,Gs(d,f,x,L),f.child)}function Ix(d,f,x,M,N){if(su(f),f.stateNode===null){var L=Su,X=x.contextType;typeof X=="object"&&X!==null&&(L=Hs(X)),L=new x(M,L),f.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,L.updater=Vo,f.stateNode=L,L._reactInternals=f,L=f.stateNode,L.props=M,L.state=f.memoizedState,L.refs={},Dt(f),X=x.contextType,L.context=typeof X=="object"&&X!==null?Hs(X):Su,L.state=f.memoizedState,X=x.getDerivedStateFromProps,typeof X=="function"&&(yh(f,x,X,M),L.state=f.memoizedState),typeof x.getDerivedStateFromProps=="function"||typeof L.getSnapshotBeforeUpdate=="function"||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(X=L.state,typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount(),X!==L.state&&Vo.enqueueReplaceState(L,L.state,null),un(f,M,L,N),yt(),L.state=f.memoizedState),typeof L.componentDidMount=="function"&&(f.flags|=4194308),M=!0}else if(d===null){L=f.stateNode;var ie=f.memoizedProps,ve=ml(x,ie);L.props=ve;var He=L.context,ut=x.contextType;X=Su,typeof ut=="object"&&ut!==null&&(X=Hs(ut));var bt=x.getDerivedStateFromProps;ut=typeof bt=="function"||typeof L.getSnapshotBeforeUpdate=="function",ie=f.pendingProps!==ie,ut||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(ie||He!==X)&&wx(f,L,M,X),Ll=!1;var At=f.memoizedState;L.state=At,un(f,M,L,N),yt(),He=f.memoizedState,ie||At!==He||Ll?(typeof bt=="function"&&(yh(f,x,bt,M),He=f.memoizedState),(ve=Ll||vh(f,x,ve,M,At,He,X))?(ut||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount()),typeof L.componentDidMount=="function"&&(f.flags|=4194308)):(typeof L.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=M,f.memoizedState=He),L.props=M,L.state=He,L.context=X,M=ve):(typeof L.componentDidMount=="function"&&(f.flags|=4194308),M=!1)}else{L=f.stateNode,Ut(d,f),X=f.memoizedProps,ut=ml(x,X),L.props=ut,bt=f.pendingProps,At=L.context,He=x.contextType,ve=Su,typeof He=="object"&&He!==null&&(ve=Hs(He)),ie=x.getDerivedStateFromProps,(He=typeof ie=="function"||typeof L.getSnapshotBeforeUpdate=="function")||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(X!==bt||At!==ve)&&wx(f,L,M,ve),Ll=!1,At=f.memoizedState,L.state=At,un(f,M,L,N),yt();var yn=f.memoizedState;X!==bt||At!==yn||Ll||d!==null&&d.dependencies!==null&&sf(d.dependencies)?(typeof ie=="function"&&(yh(f,x,ie,M),yn=f.memoizedState),(ut=Ll||vh(f,x,ut,M,At,yn,ve)||d!==null&&d.dependencies!==null&&sf(d.dependencies))?(He||typeof L.UNSAFE_componentWillUpdate!="function"&&typeof L.componentWillUpdate!="function"||(typeof L.componentWillUpdate=="function"&&L.componentWillUpdate(M,yn,ve),typeof L.UNSAFE_componentWillUpdate=="function"&&L.UNSAFE_componentWillUpdate(M,yn,ve)),typeof L.componentDidUpdate=="function"&&(f.flags|=4),typeof L.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof L.componentDidUpdate!="function"||X===d.memoizedProps&&At===d.memoizedState||(f.flags|=4),typeof L.getSnapshotBeforeUpdate!="function"||X===d.memoizedProps&&At===d.memoizedState||(f.flags|=1024),f.memoizedProps=M,f.memoizedState=yn),L.props=M,L.state=yn,L.context=ve,M=ut):(typeof L.componentDidUpdate!="function"||X===d.memoizedProps&&At===d.memoizedState||(f.flags|=4),typeof L.getSnapshotBeforeUpdate!="function"||X===d.memoizedProps&&At===d.memoizedState||(f.flags|=1024),M=!1)}return L=M,Jd(d,f),M=(f.flags&128)!==0,L||M?(L=f.stateNode,x=M&&typeof x.getDerivedStateFromError!="function"?null:L.render(),f.flags|=1,d!==null&&M?(f.child=Au(f,d.child,null,N),f.child=Au(f,null,x,N)):Gs(d,f,x,N),f.memoizedState=L.state,d=f.child):d=gl(d,f,N),d}function Fx(d,f,x,M){return vn(),f.flags|=256,Gs(d,f,x,M),f.child}function yv(d){return{baseLanes:d,cachePool:Mv()}}function ef(d,f,x){return d=d!==null?d.childLanes&~x:0,f&&(d|=da),d}function Vx(d,f,x){var M=f.pendingProps,N=!1,L=(f.flags&128)!==0,X;if((X=L)||(X=d!==null&&d.memoizedState===null?!1:(Ts.current&2)!==0),X&&(N=!0,f.flags&=-129),X=(f.flags&32)!==0,f.flags&=-33,d===null){if(Gn){if(N?Kr(f):Zr(),Gn){var ie=js,ve;(ve=ie)&&(ie=bS(ie,Us),ie!==null?(f.memoizedState={dehydrated:ie,treeContext:bu!==null?{id:ho,overflow:fo}:null,retryLane:536870912},ve=t(18,null,null,0),ve.stateNode=ie,ve.return=f,f.child=ve,Ys=f,js=null,ve=!0):ve=!1),ve||tt(f)}if(ie=f.memoizedState,ie!==null&&(ie=ie.dehydrated,ie!==null))return Jm(ie)?f.lanes=16:f.lanes=536870912,null;Qr(f)}return ie=M.children,M=M.fallback,N?(Zr(),N=f.mode,ie=_v({mode:"hidden",children:ie},N),M=Xi(M,N,x,null),ie.return=f,M.return=f,ie.sibling=M,f.child=ie,N=f.child,N.memoizedState=yv(x),N.childLanes=ef(d,X,x),f.memoizedState=fg,M):(Kr(f),vv(f,ie))}if(ve=d.memoizedState,ve!==null&&(ie=ve.dehydrated,ie!==null)){if(L)f.flags&256?(Kr(f),f.flags&=-257,f=Rm(d,f,x)):f.memoizedState!==null?(Zr(),f.child=d.child,f.flags|=128,f=null):(Zr(),N=M.fallback,ie=f.mode,M=_v({mode:"visible",children:M.children},ie),N=Xi(N,ie,x,null),N.flags|=2,M.return=f,N.return=f,M.sibling=N,f.child=M,Au(f,d.child,null,x),M=f.child,M.memoizedState=yv(x),M.childLanes=ef(d,X,x),f.memoizedState=fg,f=N);else if(Kr(f),Jm(ie))X=yS(ie).digest,M=Error(i(419)),M.stack="",M.digest=X,te({value:M,source:null,stack:null}),f=Rm(d,f,x);else if(pi||nf(d,f,x,!1),X=(x&d.childLanes)!==0,pi||X){if(X=Jn,X!==null){if(M=x&-x,(M&42)!==0)M=1;else switch(M){case 2:M=1;break;case 8:M=4;break;case 32:M=16;break;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:M=64;break;case 268435456:M=134217728;break;default:M=0}if(M=(M&(X.suspendedLanes|x))!==0?0:M,M!==0&&M!==ve.retryLane)throw ve.retryLane=M,Be(d,M),ws(X,d,M),dg}$m(ie)||Tl(),f=Rm(d,f,x)}else $m(ie)?(f.flags|=128,f.child=d.child,f=Ml.bind(null,d),vS(ie,f),f=null):(d=ve.treeContext,Xs&&(js=SS(ie),Ys=f,Gn=!0,Pa=null,Us=!1,d!==null&&(ia[sa++]=ho,ia[sa++]=fo,ia[sa++]=bu,ho=d.id,fo=d.overflow,bu=f)),f=vv(f,M.children),f.flags|=4096);return f}return N?(Zr(),N=M.fallback,ie=f.mode,ve=d.child,L=ve.sibling,M=wa(ve,{mode:"hidden",children:M.children}),M.subtreeFlags=ve.subtreeFlags&31457280,L!==null?N=wa(L,N):(N=Xi(N,ie,x,null),N.flags|=2),N.return=f,M.return=f,M.sibling=N,f.child=M,M=N,N=f.child,ie=d.child.memoizedState,ie===null?ie=yv(x):(ve=ie.cachePool,ve!==null?(L=mr?bi._currentValue:bi._currentValue2,ve=ve.parent!==L?{parent:L,pool:L}:ve):ve=Mv(),ie={baseLanes:ie.baseLanes|x,cachePool:ve}),N.memoizedState=ie,N.childLanes=ef(d,X,x),f.memoizedState=fg,M):(Kr(f),x=d.child,d=x.sibling,x=wa(x,{mode:"visible",children:M.children}),x.return=f,x.sibling=null,d!==null&&(X=f.deletions,X===null?(f.deletions=[d],f.flags|=16):X.push(d)),f.child=x,f.memoizedState=null,x)}function vv(d,f){return f=_v({mode:"visible",children:f},d.mode),f.return=d,d.child=f}function _v(d,f){return vf(d,f,0,null)}function Rm(d,f,x){return Au(f,d.child,null,x),d=vv(f,f.pendingProps.children),d.flags|=2,f.memoizedState=null,d}function zx(d,f,x){d.lanes|=f;var M=d.alternate;M!==null&&(M.lanes|=f),tf(d.return,f,x)}function xv(d,f,x,M,N){var L=d.memoizedState;L===null?d.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:M,tail:x,tailMode:N}:(L.isBackwards=f,L.rendering=null,L.renderingStartTime=0,L.last=M,L.tail=x,L.tailMode=N)}function Gx(d,f,x){var M=f.pendingProps,N=M.revealOrder,L=M.tail;if(Gs(d,f,M.children,x),M=Ts.current,(M&2)!==0)M=M&1|2,f.flags|=128;else{if(d!==null&&(d.flags&128)!==0)e:for(d=f.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&zx(d,x,f);else if(d.tag===19)zx(d,x,f);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break e;for(;d.sibling===null;){if(d.return===null||d.return===f)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}M&=1}switch(C(Ts,M),N){case"forwards":for(x=f.child,N=null;x!==null;)d=x.alternate,d!==null&&$r(d)===null&&(N=x),x=x.sibling;x=N,x===null?(N=f.child,f.child=null):(N=x.sibling,x.sibling=null),xv(f,!1,N,x,L);break;case"backwards":for(x=null,N=f.child,f.child=null;N!==null;){if(d=N.alternate,d!==null&&$r(d)===null){f.child=N;break}d=N.sibling,N.sibling=x,x=N,N=d}xv(f,!0,x,null,L);break;case"together":xv(f,!1,null,null,void 0);break;default:f.memoizedState=null}return f.child}function gl(d,f,x){if(d!==null&&(f.dependencies=d.dependencies),ha|=f.lanes,(x&f.childLanes)===0)if(d!==null){if(nf(d,f,x,!1),(x&f.childLanes)===0)return null}else return null;if(d!==null&&f.child!==d.child)throw Error(i(153));if(f.child!==null){for(d=f.child,x=wa(d,d.pendingProps),f.child=x,x.return=f;d.sibling!==null;)d=d.sibling,x=x.sibling=wa(d,d.pendingProps),x.return=f;x.sibling=null}return f.child}function Sv(d,f){return(d.lanes&f)!==0?!0:(d=d.dependencies,!!(d!==null&&sf(d)))}function $E(d,f,x){switch(f.tag){case 3:Ze(f,f.stateNode.containerInfo),iu(f,bi,d.memoizedState.cache),vn();break;case 27:case 5:xe(f);break;case 4:Ze(f,f.stateNode.containerInfo);break;case 10:iu(f,f.type,f.memoizedProps.value);break;case 13:var M=f.memoizedState;if(M!==null)return M.dehydrated!==null?(Kr(f),f.flags|=128,null):(x&f.child.childLanes)!==0?Vx(d,f,x):(Kr(f),d=gl(d,f,x),d!==null?d.sibling:null);Kr(f);break;case 19:var N=(d.flags&128)!==0;if(M=(x&f.childLanes)!==0,M||(nf(d,f,x,!1),M=(x&f.childLanes)!==0),N){if
3936(M)return Gx(d,f,x);f.flags|=128}if(N=f.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),C(Ts,Ts.current),M)break;return null;case 22:case 23:return f.lanes=0,Bx(d,f,x);case 24:iu(f,bi,d.memoizedState.cache)}return gl(d,f,x)}function Hx(d,f,x){if(d!==null)if(d.memoizedProps!==f.pendingProps)pi=!0;else{if(!Sv(d,x)&&(f.flags&128)===0)return pi=!1,$E(d,f,x);pi=(d.flags&131072)!==0}else pi=!1,Gn&&(f.flags&1048576)!==0&&oe(f,Hh,f.index);switch(f.lanes=0,f.tag){case 16:e:{d=f.pendingProps;var M=f.elementType,N=M._init;if(M=N(M._payload),f.type=M,typeof M=="function")gf(M)?(d=ml(M,d),f.tag=1,f=Ix(null,f,M,d,x)):(f.tag=0,f=Am(null,f,M,d,x));else{if(M!=null){if(N=M.$$typeof,N===Tf){f.tag=11,f=Em(null,f,M,d,x);break e}else if(N===Xm){f.tag=14,f=Ux(null,f,M,d,x);break e}}throw f=a(M)||M,Error(i(306,f,""))}}return f;case 0:return Am(d,f,f.type,f.pendingProps,x);case 1:return M=f.type,N=ml(M,f.pendingProps),Ix(d,f,M,N,x);case 3:e:{if(Ze(f,f.stateNode.containerInfo),d===null)throw Error(i(387));var L=f.pendingProps;N=f.memoizedState,M=N.element,Ut(d,f),un(f,L,null,x);var X=f.memoizedState;if(L=X.cache,iu(f,bi,L),L!==N.cache&&cc(f,[bi],x,!0),yt(),L=X.element,Xs&&N.isDehydrated)if(N={element:L,isDehydrated:!1,cache:X.cache},f.updateQueue.baseState=N,f.memoizedState=N,f.flags&256){f=Fx(d,f,L,x);break e}else if(L!==M){M=Se(Error(i(424)),f),te(M),f=Fx(d,f,L,x);break e}else for(Xs&&(js=xS(f.stateNode.containerInfo),Ys=f,Gn=!0,Pa=null,Us=!0),x=Fo(f,null,L,x),f.child=x;x;)x.flags=x.flags&-3|4096,x=x.sibling;else{if(vn(),L===M){f=gl(d,f,x);break e}Gs(d,f,L,x)}f=f.child}return f;case 26:if(na)return Jd(d,f),d===null?(x=o_(f.type,null,f.pendingProps,null))?f.memoizedState=x:Gn||(f.stateNode=sg(f.type,f.pendingProps,Oo.current,f)):f.memoizedState=o_(f.type,d.memoizedProps,f.pendingProps,d.memoizedState),null;case 27:if(di)return xe(f),d===null&&di&&Gn&&(M=f.stateNode=co(f.type,f.pendingProps,Oo.current,bs.current,!1),Ys=f,Us=!0,js=eg(M)),M=f.pendingProps.children,d!==null||Gn?Gs(d,f,M,x):f.child=Au(f,null,M,x),Jd(d,f),f.child;case 5:return d===null&&Gn&&(ng(f.type,f.pendingProps,bs.current),(N=M=js)&&(M=rA(M,f.type,f.pendingProps,Us),M!==null?(f.stateNode=M,Ys=f,js=eg(M),Us=!1,N=!0):N=!1),N||tt(f)),xe(f),N=f.type,L=f.pendingProps,X=d!==null?d.memoizedProps:null,M=L.children,Sn(N,L)?M=null:X!==null&&Sn(N,X)&&(f.flags|=32),f.memoizedState!==null&&(N=No(d,f,ls,null,null,x),mr?uo._currentValue=N:uo._currentValue2=N),Jd(d,f),Gs(d,f,M,x),f.child;case 6:return d===null&&Gn&&(RS(f.pendingProps,bs.current),(d=x=js)&&(x=r_(x,f.pendingProps,Us),x!==null?(f.stateNode=x,Ys=f,js=null,d=!0):d=!1),d||tt(f)),null;case 13:return Vx(d,f,x);case 4:return Ze(f,f.stateNode.containerInfo),M=f.pendingProps,d===null?f.child=Au(f,null,M,x):Gs(d,f,M,x),f.child;case 11:return Em(d,f,f.type,f.pendingProps,x);case 7:return Gs(d,f,f.pendingProps,x),f.child;case 8:return Gs(d,f,f.pendingProps.children,x),f.child;case 12:return Gs(d,f,f.pendingProps.children,x),f.child;case 10:return M=f.pendingProps,iu(f,f.type,M.value),Gs(d,f,M.children,x),f.child;case 9:return N=f.type._context,M=f.pendingProps.children,su(f),N=Hs(N),M=M(N),f.flags|=1,Gs(d,f,M,x),f.child;case 14:return Ux(d,f,f.type,f.pendingProps,x);case 15:return Lx(d,f,f.type,f.pendingProps,x);case 19:return Gx(d,f,x);case 22:return Bx(d,f,x);case 24:return su(f),M=Hs(bi),d===null?(N=Tv(),N===null&&(N=Jn,L=ru(),N.pooledCache=L,L.refCount++,L!==null&&(N.pooledCacheLanes|=x),N=L),f.memoizedState={parent:M,cache:N},Dt(f),iu(f,bi,N)):((d.lanes&x)!==0&&(Ut(d,f),un(f,null,null,x),yt()),N=d.memoizedState,L=f.memoizedState,N.parent!==M?(N={parent:M,cache:M},f.memoizedState=N,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=N),iu(f,bi,M)):(M=L.cache,iu(f,bi,M),M!==N.cache&&cc(f,[bi],x,!0))),Gs(d,f,f.pendingProps.children,x),f.child;case 29:throw f.pendingProps}throw Error(i(156,f.tag))}function iu(d,f,x){mr?(C(Pl,f._currentValue),f._currentValue=x):(C(Pl,f._currentValue2),f._currentValue2=x)}function yl(d){var f=Pl.current;mr?d._currentValue=f:d._currentValue2=f,b(Pl)}function tf(d,f,x){for(;d!==null;){var M=d.alternate;if((d.childLanes&f)!==f?(d.childLanes|=f,M!==null&&(M.childLanes|=f)):M!==null&&(M.childLanes&f)!==f&&(M.childLanes|=f),d===x)break;d=d.return}}function cc(d,f,x,M){var N=d.child;for(N!==null&&(N.return=d);N!==null;){var L=N.dependencies;if(L!==null){var X=N.child;L=L.firstContext;e:for(;L!==null;){var ie=L;L=N;for(var ve=0;ve<f.length;ve++)if(ie.context===f[ve]){L.lanes|=x,ie=L.alternate,ie!==null&&(ie.lanes|=x),tf(L.return,x,d),M||(X=null);break e}L=ie.next}}else if(N.tag===18){if(X=N.return,X===null)throw Error(i(341));X.lanes|=x,L=X.alternate,L!==null&&(L.lanes|=x),tf(X,x,d),X=null}else X=N.child;if(X!==null)X.return=N;else for(X=N;X!==null;){if(X===d){X=null;break}if(N=X.sibling,N!==null){N.return=X.return,X=N;break}X=X.return}N=X}}function nf(d,f,x,M){d=null;for(var N=f,L=!1;N!==null;){if(!L){if((N.flags&524288)!==0)L=!0;else if((N.flags&262144)!==0)break}if(N.tag===10){var X=N.alternate;if(X===null)throw Error(i(387));if(X=X.memoizedProps,X!==null){var ie=N.type;Or(N.pendingProps.value,X.value)||(d!==null?d.push(ie):d=[ie])}}else if(N===xc.current){if(X=N.alternate,X===null)throw Error(i(387));X.memoizedState.memoizedState!==N.memoizedState.memoizedState&&(d!==null?d.push(uo):d=[uo])}N=N.return}d!==null&&cc(f,d,x,M),f.flags|=262144}function sf(d){for(d=d.firstContext;d!==null;){var f=d.context;if(!Or(mr?f._currentValue:f._currentValue2,d.memoizedValue))return!0;d=d.next}return!1}function su(d){go=d,la=null,d=d.dependencies,d!==null&&(d.firstContext=null)}function Hs(d){return bv(go,d)}function rf(d,f){return go===null&&su(d),bv(d,f)}function bv(d,f){var x=mr?f._currentValue:f._currentValue2;if(f={context:f,memoizedValue:x,next:null},la===null){if(d===null)throw Error(i(308));la=f,d.dependencies={lanes:0,firstContext:f},d.flags|=524288}else la=la.next=f;return x}function ru(){return{controller:new jh,data:new Map,refCount:0}}function af(d){d.refCount--,d.refCount===0&&FS(VS,function(){d.controller.abort()})}function Tv(){var d=zo.current;return d!==null?d:Jn.pooledCache}function Nm(d,f){f===null?C(zo,zo.current):C(zo,f.pool)}function Mv(){var d=Tv();return d===null?null:{parent:mr?bi._currentValue:bi._currentValue2,pool:d}}function Cr(d){d.flags|=4}function bh(d,f){if(d!==null&&d.child===f.child)return!1;if((f.flags&16)!==0)return!0;for(d=f.child;d!==null;){if((d.flags&13878)!==0||(d.subtreeFlags&13878)!==0)return!0;d=d.sibling}return!1}function hc(d,f,x,M){if(Ss)for(x=f.child;x!==null;){if(x.tag===5||x.tag===6)Ef(d,x.stateNode);else if(!(x.tag===4||di&&x.tag===27)&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===f)break;for(;x.sibling===null;){if(x.return===null||x.return===f)return;x=x.return}x.sibling.return=x.return,x=x.sibling}else if(La)for(var N=f.child;N!==null;){if(N.tag===5){var L=N.stateNode;x&&M&&(L=t_(L,N.type,N.memoizedProps)),Ef(d,L)}else if(N.tag===6)L=N.stateNode,x&&M&&(L=n_(L,N.memoizedProps)),Ef(d,L);else if(N.tag!==4){if(N.tag===22&&N.memoizedState!==null)L=N.child,L!==null&&(L.return=N),hc(d,N,!0,!0);else if(N.child!==null){N.child.return=N,N=N.child;continue}}if(N===f)break;for(;N.sibling===null;){if(N.return===null||N.return===f)return;N=N.return}N.sibling.return=N.return,N=N.sibling}}function kx(d,f,x,M){if(La)for(var N=f.child;N!==null;){if(N.tag===5){var L=N.stateNode;x&&M&&(L=t_(L,N.type,N.memoizedProps)),e_(d,L)}else if(N.tag===6)L=N.stateNode,x&&M&&(L=n_(L,N.memoizedProps)),e_(d,L);else if(N.tag!==4){if(N.tag===22&&N.memoizedState!==null)L=N.child,L!==null&&(L.return=N),kx(d,N,!(N.memoizedProps!==null&&N.memoizedProps.mode==="manual"),!0);else if(N.child!==null){N.child.return=N,N=N.child;continue}}if(N===f)break;for(;N.sibling===null;){if(N.return===null||N.return===f)return;N=N.return}N.sibling.return=N.return,N=N.sibling}}function of(d,f){if(La&&bh(d,f)){d=f.stateNode;var x=d.containerInfo,M=Af();kx(M,f,!1,!1),d.pendingChildren=M,Cr(f),Qm(x,M)}}function Cm(d,f,x,M){if(Ss)d.memoizedProps!==M&&Cr(f);else if(La){var N=d.stateNode,L=d.memoizedProps;if((d=bh(d,f))||L!==M){var X=bs.current;
3936L=Vh(N,x,L,M,!d,null),L===N?f.stateNode=N:(Nl(L,x,M,X)&&Cr(f),f.stateNode=L,d?hc(L,f,!1,!1):Cr(f))}else f.stateNode=N}}function wm(d,f,x){if(Xv(f,x)){if(d.flags|=16777216,!Km(f,x))if(hu())d.flags|=8192;else throw Tu=Pf,Bf}else d.flags&=-16777217}function Dm(d,f){if(wS(f)){if(d.flags|=16777216,!mc(f))if(hu())d.flags|=8192;else throw Tu=Pf,Bf}else d.flags&=-16777217}function Th(d,f){f!==null&&(d.flags|=4),d.flags&16384&&(f=d.tag!==22?B():536870912,d.lanes|=f,ko|=f)}function Mh(d,f){if(!Gn)switch(d.tailMode){case"hidden":f=d.tail;for(var x=null;f!==null;)f.alternate!==null&&(x=f),f=f.sibling;x===null?d.tail=null:x.sibling=null;break;case"collapsed":x=d.tail;for(var M=null;x!==null;)x.alternate!==null&&(M=x),x=x.sibling;M===null?f||d.tail===null?d.tail=null:d.tail.sibling=null:M.sibling=null}}function Ii(d){var f=d.alternate!==null&&d.alternate.child===d.child,x=0,M=0;if(f)for(var N=d.child;N!==null;)x|=N.lanes|N.childLanes,M|=N.subtreeFlags&31457280,M|=N.flags&31457280,N.return=d,N=N.sibling;else for(N=d.child;N!==null;)x|=N.lanes|N.childLanes,M|=N.subtreeFlags,M|=N.flags,N.return=d,N=N.sibling;return d.subtreeFlags|=M,d.childLanes=x,f}function qx(d,f,x){var M=f.pendingProps;switch(Ie(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ii(f),null;case 1:return Ii(f),null;case 3:return x=f.stateNode,M=null,d!==null&&(M=d.memoizedState.cache),f.memoizedState.cache!==M&&(f.flags|=2048),yl(bi),mt(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(d===null||d.child===null)&&(rn(f)?Cr(f):d===null||d.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,Pa!==null&&(pf(Pa),Pa=null))),of(d,f),Ii(f),null;case 26:if(na){x=f.type;var N=f.memoizedState;return d===null?(Cr(f),N!==null?(Ii(f),Dm(f,N)):(Ii(f),wm(f,x,M))):N?N!==d.memoizedState?(Cr(f),Ii(f),Dm(f,N)):(Ii(f),f.flags&=-16777217):(Ss?d.memoizedProps!==M&&Cr(f):Cm(d,f,x,M),Ii(f),wm(f,x,M)),null}case 27:if(di){if(Ve(f),x=Oo.current,N=f.type,d!==null&&f.stateNode!=null)Ss?d.memoizedProps!==M&&Cr(f):Cm(d,f,N,M);else{if(!M){if(f.stateNode===null)throw Error(i(166));return Ii(f),null}d=bs.current,rn(f)?Mt(f,d):(d=co(N,M,x,d,!0),f.stateNode=d,Cr(f))}return Ii(f),null}case 5:if(Ve(f),x=f.type,d!==null&&f.stateNode!=null)Cm(d,f,x,M);else{if(!M){if(f.stateNode===null)throw Error(i(166));return Ii(f),null}d=bs.current,rn(f)?Mt(f,d):(N=Wv(x,M,Oo.current,d,f),hc(N,f,!1,!1),f.stateNode=N,Nl(N,x,M,d)&&Cr(f))}return Ii(f),wm(f,f.type,f.pendingProps),null;case 6:if(d&&f.stateNode!=null)x=d.memoizedProps,Ss?x!==M&&Cr(f):La&&(x!==M?(f.stateNode=ii(M,Oo.current,bs.current,f),Cr(f)):f.stateNode=d.stateNode);else{if(typeof M!="string"&&f.stateNode===null)throw Error(i(166));if(d=Oo.current,x=bs.current,rn(f)){if(!Xs)throw Error(i(176));if(d=f.stateNode,x=f.memoizedProps,M=null,N=Ys,N!==null)switch(N.tag){case 27:case 5:M=N.memoizedProps}a_(d,x,f,M)||tt(f)}else f.stateNode=ii(M,d,x,f)}return Ii(f),null;case 13:if(M=f.memoizedState,d===null||d.memoizedState!==null&&d.memoizedState.dehydrated!==null){if(N=rn(f),M!==null&&M.dehydrated!==null){if(d===null){if(!N)throw Error(i(318));if(!Xs)throw Error(i(344));if(N=f.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(i(317));MS(N,f)}else vn(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;Ii(f),N=!1}else Pa!==null&&(pf(Pa),Pa=null),N=!0;if(!N)return f.flags&256?(Qr(f),f):(Qr(f),null)}if(Qr(f),(f.flags&128)!==0)return f.lanes=x,f;if(x=M!==null,d=d!==null&&d.memoizedState!==null,x){M=f.child,N=null,M.alternate!==null&&M.alternate.memoizedState!==null&&M.alternate.memoizedState.cachePool!==null&&(N=M.alternate.memoizedState.cachePool.pool);var L=null;M.memoizedState!==null&&M.memoizedState.cachePool!==null&&(L=M.memoizedState.cachePool.pool),L!==N&&(M.flags|=2048)}return x!==d&&x&&(f.child.flags|=8192),Th(f,f.updateQueue),Ii(f),null;case 4:return mt(),of(d,f),d===null&&Ji(f.stateNode.containerInfo),Ii(f),null;case 10:return yl(f.type),Ii(f),null;case 19:if(b(Ts),N=f.memoizedState,N===null)return Ii(f),null;if(M=(f.flags&128)!==0,L=N.rendering,L===null)if(M)Mh(N,!1);else{if(mi!==0||d!==null&&(d.flags&128)!==0)for(d=f.child;d!==null;){if(L=$r(d),L!==null){for(f.flags|=128,Mh(N,!1),d=L.updateQueue,f.updateQueue=d,Th(f,d),f.subtreeFlags=0,d=x,x=f.child;x!==null;)yf(x,d),x=x.sibling;return C(Ts,Ts.current&1|2),f.child}d=d.sibling}N.tail!==null&&Ba()>Qh&&(f.flags|=128,M=!0,Mh(N,!1),f.lanes=4194304)}else{if(!M)if(d=$r(L),d!==null){if(f.flags|=128,M=!0,d=d.updateQueue,f.updateQueue=d,Th(f,d),Mh(N,!0),N.tail===null&&N.tailMode==="hidden"&&!L.alternate&&!Gn)return Ii(f),null}else 2*Ba()-N.renderingStartTime>Qh&&x!==536870912&&(f.flags|=128,M=!0,Mh(N,!1),f.lanes=4194304);N.isBackwards?(L.sibling=f.child,f.child=L):(d=N.last,d!==null?d.sibling=L:f.child=L,N.last=L)}return N.tail!==null?(f=N.tail,N.rendering=f,N.tail=f.sibling,N.renderingStartTime=Ba(),f.sibling=null,d=Ts.current,C(Ts,M?d&1|2:d&1),f):(Ii(f),null);case 22:case 23:return Qr(f),Aa(),M=f.memoizedState!==null,d!==null?d.memoizedState!==null!==M&&(f.flags|=8192):M&&(f.flags|=8192),M?(x&536870912)!==0&&(f.flags&128)===0&&(Ii(f),f.subtreeFlags&6&&(f.flags|=8192)):Ii(f),x=f.updateQueue,x!==null&&Th(f,x.retryQueue),x=null,d!==null&&d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),M=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(M=f.memoizedState.cachePool.pool),M!==x&&(f.flags|=2048),d!==null&&b(zo),null;case 24:return x=null,d!==null&&(x=d.memoizedState.cache),f.memoizedState.cache!==x&&(f.flags|=2048),yl(bi),Ii(f),null;case 25:return null}throw Error(i(156,f.tag))}function JE(d,f){switch(Ie(f),f.tag){case 1:return d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;
3936case 3:return yl(bi),mt(),d=f.flags,(d&65536)!==0&&(d&128)===0?(f.flags=d&-65537|128,f):null;case 26:case 27:case 5:return Ve(f),null;case 13:if(Qr(f),d=f.memoizedState,d!==null&&d.dehydrated!==null){if(f.alternate===null)throw Error(i(340));vn()}return d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 19:return b(Ts),null;case 4:return mt(),null;case 10:return yl(f.type),null;case 22:case 23:return Qr(f),Aa(),d!==null&&b(zo),d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 24:return yl(bi),null;case 25:return null;default:return null}}function Wx(d,f){switch(Ie(f),f.tag){case 3:yl(bi),mt();break;case 26:case 27:case 5:Ve(f);break;case 4:mt();break;case 13:Qr(f);break;case 19:b(Ts);break;case 10:yl(f.type);break;case 22:case 23:Qr(f),Aa(),d!==null&&b(zo);break;case 24:yl(bi)}}function lf(d,f){try{var x=f.updateQueue,M=x!==null?x.lastEffect:null;if(M!==null){var N=M.next;x=N;do{if((x.tag&d)===d){M=void 0;var L=x.create,X=x.inst;M=L(),X.destroy=M}x=x.next}while(x!==N)}}catch(ie){Qn(f,f.return,ie)}}function au(d,f,x){try{var M=f.updateQueue,N=M!==null?M.lastEffect:null;if(N!==null){var L=N.next;M=L;do{if((M.tag&d)===d){var X=M.inst,ie=X.destroy;if(ie!==void 0){X.destroy=void 0,N=f;var ve=x;try{ie()}catch(He){Qn(N,ve,He)}}}M=M.next}while(M!==L)}}catch(He){Qn(f,f.return,He)}}function Xx(d){var f=d.updateQueue;if(f!==null){var x=d.stateNode;try{at(f,x)}catch(M){Qn(d,d.return,M)}}}function wr(d,f,x){x.props=ml(d.type,d.memoizedProps),x.state=d.memoizedState;try{x.componentWillUnmount()}catch(M){Qn(d,f,M)}}function ao(d,f){try{var x=d.ref;if(x!==null){var M=d.stateNode;switch(d.tag){case 26:case 27:case 5:var N=Oh(M);break;default:N=M}typeof x=="function"?d.refCleanup=x(N):x.current=N}}catch(L){Qn(d,f,L)}}function Dr(d,f){var x=d.ref,M=d.refCleanup;if(x!==null)if(typeof M=="function")try{M()}catch(N){Qn(d,f,N)}finally{d.refCleanup=null,d=d.alternate,d!=null&&(d.refCleanup=null)}else if(typeof x=="function")try{x(null)}catch(N){Qn(d,f,N)}else x.current=null}function Ev(d){var f=d.type,x=d.memoizedProps,M=d.stateNode;try{iA(M,f,x,d)}catch(N){Qn(d,d.return,N)}}function Av(d,f,x){try{uS(d.stateNode,d.type,x,f,d)}catch(M){Qn(d,d.return,M)}}function Rv(d){return d.tag===5||d.tag===3||(na?d.tag===26:!1)||(di?d.tag===27:!1)||d.tag===4}function uf(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||Rv(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&(!di||d.tag!==27)&&d.tag!==18;){if(d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function Nv(d,f,x){var M=d.tag;if(M===5||M===6)d=d.stateNode,f?hS(x,d,f):Qv(x,d);else if(!(M===4||di&&M===27)&&(d=d.child,d!==null))for(Nv(d,f,x),d=d.sibling;d!==null;)Nv(d,f,x),d=d.sibling}function vl(d,f,x){var M=d.tag;if(M===5||M===6)d=d.stateNode,f?cS(x,d,f):oS(x,d);else if(!(M===4||di&&M===27)&&(d=d.child,d!==null))for(vl(d,f,x),d=d.sibling;d!==null;)vl(d,f,x),d=d.sibling}function Um(d,f,x){d=d.containerInfo;try{zh(d,x)}catch(M){Qn(f,f.return,M)}}function cf(d,f){for(Ym(d.containerInfo),gn=f;gn!==null;)if(d=gn,f=d.child,(d.subtreeFlags&1028)!==0&&f!==null)f.return=d,gn=f;else for(;gn!==null;){d=gn;var x=d.alternate;switch(f=d.flags,d.tag){case 0:break;case 11:case 15:break;case 1:if((f&1024)!==0&&x!==null){f=void 0;var M=d,N=x.memoizedProps;x=x.memoizedState;var L=M.stateNode;try{var X=ml(M.type,N,M.elementType===M.type);f=L.getSnapshotBeforeUpdate(X,x),L.__reactInternalSnapshotBeforeUpdate=f}catch(ie){Qn(M,M.return,ie)}}break;case 3:(f&1024)!==0&&Ss&&gS(d.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((f&1024)!==0)throw Error(i(163))}if(f=d.sibling,f!==null){f.return=d.return,gn=f;break}gn=d.return}return X=wn,wn=!1,X}function Lm(d,f,x){var M=x.flags;switch(x.tag){case 0:case 11:case 15:xl(d,x),M&4&&lf(5,x);break;case 1:if(xl(d,x),M&4)if(d=x.stateNode,f===null)try{d.componentDidMount()}catch(ie){Qn(x,x.return,ie)}else{var N=ml(x.type,f.memoizedProps);f=f.memoizedState;try{d.componentDidUpdate(N,f,d.__reactInternalSnapshotBeforeUpdate)}catch(ie){Qn(x,x.return,ie)}}M&64&&Xx(x),M&512&&ao(x,x.return);break;case 3:if(xl(d,x),M&64&&(M=x.updateQueue,M!==null)){if(d=null,x.
3936child!==null)switch(x.child.tag){case 27:case 5:d=Oh(x.child.stateNode);break;case 1:d=x.child.stateNode}try{at(M,d)}catch(ie){Qn(x,x.return,ie)}}break;case 26:if(na){xl(d,x),M&512&&ao(x,x.return);break}case 27:case 5:xl(d,x),f===null&&M&4&&Ev(x),M&512&&ao(x,x.return);break;case 12:xl(d,x);break;case 13:xl(d,x),M&4&&Bm(d,x);break;case 22:if(N=x.memoizedState!==null||Go,!N){f=f!==null&&f.memoizedState!==null||ji;var L=Go,X=ji;Go=N,(ji=f)&&!X?Sl(d,x,(x.subtreeFlags&8772)!==0):xl(d,x),Go=L,ji=X}M&512&&(x.memoizedProps.mode==="manual"?ao(x,x.return):Dr(x,x.return));break;default:xl(d,x)}}function Cv(d){var f=d.alternate;f!==null&&(d.alternate=null,Cv(f)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(f=d.stateNode,f!==null&&nA(f)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}function ks(d,f,x){for(x=x.child;x!==null;)ou(d,f,x),x=x.sibling}function ou(d,f,x){if(Pr&&typeof Pr.onCommitFiberUnmount=="function")try{Pr.onCommitFiberUnmount(ts,x)}catch{}switch(x.tag){case 26:if(na){ji||Dr(x,f),ks(d,f,x),x.memoizedState?pc(x.memoizedState):x.stateNode&&Gh(x.stateNode);break}case 27:if(di){ji||Dr(x,f);var M=Qt,N=Mn;Qt=x.stateNode,ks(d,f,x),xu(x.stateNode),Qt=M,Mn=N;break}case 5:ji||Dr(x,f);case 6:if(Ss){if(M=Qt,N=Mn,Qt=null,ks(d,f,x),Qt=M,Mn=N,Qt!==null)if(Mn)try{dS(Qt,x.stateNode)}catch(L){Qn(x,f,L)}else try{$v(Qt,x.stateNode)}catch(L){Qn(x,f,L)}}else ks(d,f,x);break;case 18:Ss&&Qt!==null&&(Mn?Rf(Qt,x.stateNode):AS(Qt,x.stateNode));break;case 4:Ss?(M=Qt,N=Mn,Qt=x.stateNode.containerInfo,Mn=!0,ks(d,f,x),Qt=M,Mn=N):(La&&Um(x.stateNode,x,Af()),ks(d,f,x));break;case 0:case 11:case 14:case 15:ji||au(2,x,f),ji||au(4,x,f),ks(d,f,x);break;case 1:ji||(Dr(x,f),M=x.stateNode,typeof M.componentWillUnmount=="function"&&wr(x,f,M)),ks(d,f,x);break;case 21:ks(d,f,x);break;case 22:ji||Dr(x,f),ji=(M=ji)||x.memoizedState!==null,ks(d,f,x),ji=M;break;default:ks(d,f,x)}}function Bm(d,f){if(Xs&&f.memoizedState===null&&(d=f.alternate,d!==null&&(d=d.memoizedState,d!==null&&(d=d.dehydrated,d!==null))))try{oA(d)}catch(x){Qn(f,f.return,x)}}function Yx(d){switch(d.tag){case 13:case 19:var f=d.stateNode;return f===null&&(f=d.stateNode=new $n),f;case 22:return d=d.stateNode,f=d._retryCache,f===null&&(f=d._retryCache=new $n),f;default:throw Error(i(435,d.tag))}}function _l(d,f){var x=Yx(d);f.forEach(function(M){var N=pu.bind(null,d,M);x.has(M)||(x.add(M),M.then(N,N))})}function fr(d,f){var x=f.deletions;if(x!==null)for(var M=0;M<x.length;M++){var N=x[M],L=d,X=f;if(Ss){var ie=X;e:for(;ie!==null;){switch(ie.tag){case 27:case 5:Qt=ie.stateNode,Mn=!1;break e;case 3:Qt=ie.stateNode.containerInfo,Mn=!0;break e;case 4:Qt=ie.stateNode.containerInfo,Mn=!0;break e}ie=ie.return}if(Qt===null)throw Error(i(160));ou(L,X,N),Qt=null,Mn=!1}else ou(L,X,N);L=N.alternate,L!==null&&(L.return=null),N.return=null}if(f.subtreeFlags&13878)for(f=f.child;f!==null;)wv(f,d),f=f.sibling}function wv(d,f){var x=d.alternate,M=d.flags;switch(d.tag){case 0:case 11:case 14:case 15:fr(f,d),Ur(d),M&4&&(au(3,d,d.return),lf(3,d),au(5,d,d.return));break;case 1:fr(f,d),Ur(d),M&512&&(ji||x===null||Dr(x,x.return)),M&64&&Go&&(d=d.updateQueue,d!==null&&(M=d.callbacks,M!==null&&(x=d.shared.hiddenCallbacks,d.shared.hiddenCallbacks=x===null?M:x.concat(M))));break;case 26:if(na){var N=zi;fr(f,d),Ur(d),M&512&&(ji||x===null||Dr(x,x.return)),M&4&&(M=x!==null?x.memoizedState:null,f=d.memoizedState,x===null?f===null?d.stateNode===null?d.stateNode=Cf(N,d.type,d.memoizedProps,d):wf(N,d.type,d.stateNode):d.stateNode=NS(N,f,d.memoizedProps):M!==f?(M===null?x.stateNode!==null&&Gh(x.stateNode):pc(M),f===null?wf(N,d.type,d.stateNode):NS(N,f,d.memoizedProps)):f===null&&d.stateNode!==null&&Av(d,d.memoizedProps,x.memoizedProps));break}case 27:if(di&&M&4&&d.alternate===null){N=d.stateNode;var L=d.memoizedProps;try{_u(N),US(d.type,L,N,d)}catch(ut){Qn(d,d.return,ut)}}case 5:if(fr(f,d),Ur(d),M&512&&(ji||x===null||Dr(x,x.return)),Ss){if(d.flags&32){f=d.stateNode;try{Jv(f)}catch(ut){Qn(d,d.return,ut)}}M&4&&d.stateNode!=null&&(f=d.memoizedProps,Av(d,f,x!==null?x.memoizedProps:f)),M&1024&&(h_=!0)}break;case 6:if(fr(f,d),Ur(d),M&4&&Ss){if(d.stateNode===null)throw Error(i(162));M=d.memoizedProps,x=x!==null?x.memoizedProps:M,f=d.stateNode;try{lS(f,x,M)}catch(ut){Qn(d,d.return,ut)}}break;case 3:if(na?(CS(),N=zi,zi=ig(f.containerInfo),fr(f,d),zi=N):fr(f,d),Ur(d),M&4){if(Ss&&Xs&&x!==null&&x.memoizedState.isDehydrated)try{aA(f.containerInfo)}catch(ut){Qn(d,d.return,ut)}if(La){M=f.containerInfo,x=f.pendingChildren;try{zh(M,x)}catch(ut){Qn(d,d.return,ut)}}}h_&&(h_=!1,jx(d));break;case 4:na?(x=zi,zi=ig(d.stateNode.containerInfo),fr(f,d),Ur(d),zi=x):(fr(f,d),Ur(d)),M&4&&La&&Um(d.stateNode,d,d.stateNode.pendingChildren);break;case 12:fr(f,d),Ur(d);break;case 13:fr(f,d),Ur(d),d.child.flags&8192&&d.memoizedState!==null!=(x!==null&&x.memoizedState!==null)&&(_r=Ba()),M&4&&(M=d.updateQueue,M!==null&&(d.updateQueue=null,_l(d,M)));break;case 22:M&512&&(ji||x===null||Dr(x,x.return)),N=d.memoizedState!==null;var X=x!==null&&x.memoizedState!==null,ie=Go,ve=ji;if(Go=ie||N,ji=ve||X,fr(f,d),ji=ve,Go=ie,Ur(d),f=d.stateNode,f._current=d,f._visibility&=-3,f._visibility|=f._pendingVisibility&2,M&8192&&(f._visibility=N?f._visibility&-2:f._visibility|1,N&&(f=Go||ji,x===null||X||f||Eh(d)),Ss&&(d.memoizedProps===null||d.memoizedProps.mode!=="manual"))){e:if(x=null,Ss)for(f=d;;){if(f.tag===5||na&&f.tag===26||di&&f.tag===27){if(x===null){X=x=f;try{L=X.stateNode,N?fS(L):mS(X.stateNode,X.memoizedProps)}catch(ut){Qn(X,X.return,ut)}}}else if(f.tag===6){if(x===null){X=f;try{var He=X.stateNode;N?pS(He):sA(He,X.memoizedProps)}catch(ut){Qn(X,X.return,ut)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===d)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break e;for(;f.sibling===null;){if(f.return===null||f.return===d)break e;x===f&&(x=null),f=f.return}x===f&&(x=null),f.sibling.return=f.return,f=f.sibling}}M&4&&(M=d.updateQueue,M!==null&&(x=M.retryQueue,x!==null&&(M.retryQueue=null,_l(d,x))));break;case 19:fr(f,d),Ur(d),M&4&&(M=d.updateQueue,M!==null&&(d.updateQueue=null,_l(d,M)));break;case 21:break;default:fr(f,d),Ur(d)}}function Ur(d){var f=d.flags;if(f&2){try{if(Ss&&(!di||d.tag!==27)){e:{for(var x=d.return;x!==null;){if(Rv(x)){var M=x;break e}x=x.return}throw Error(i(160))}switch(M.tag){case 27:if(di){var N=M.stateNode,L=uf(d);vl(d,L,N);break}case 5:var X=M.stateNode;M.flags&32&&(Jv(X),M.flags&=-33);var ie=uf(d);vl(d,ie,X);break;case 3:case 4:var ve=M.stateNode.containerInfo,He=uf(d);Nv(d,He,ve);break;default:throw Error(i(161))}}}catch(ut){Qn(d,d.return,ut)}d.flags&=-3}f&4096&&(d.flags&=-4097)}function jx(d){if(d.subtreeFlags&1024)for(d=d.child;d!==null;){var f=d;jx(f),f.tag===5&&f.flags&1024&&Zm(f.stateNode),d=d.sibling}}function xl(d,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)Lm(d,f.alternate,f),f=f.sibling}function Eh(d){for(d=d.child;d!==null;){var f=d;switch(f.tag){case 0:case 11:case 14:case 15:au(4,f,f.return),Eh(f);break;case 1:Dr(f,f.return);var x=f.stateNode;typeof x.componentWillUnmount=="function"&&wr(f,f.return,x),Eh(f);break;case 26:case 27:case 5:Dr(f,f.return),Eh(f);break;case 22:Dr(f,f.return),f.memoizedState===null&&Eh(f);break;default:Eh(f)}d=d.sibling}}function Sl(d,f,x){for(x=x&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var M=f.alternate,N=d,L=f,X=L.flags;switch(L.tag){case 0:case 11:case 15:Sl(N,L,x),lf(4,L);break;
3936case 1:if(Sl(N,L,x),M=L,N=M.stateNode,typeof N.componentDidMount=="function")try{N.componentDidMount()}catch(He){Qn(M,M.return,He)}if(M=L,N=M.updateQueue,N!==null){var ie=M.stateNode;try{var ve=N.shared.hiddenCallbacks;if(ve!==null)for(N.shared.hiddenCallbacks=null,N=0;N<ve.length;N++)he(ve[N],ie)}catch(He){Qn(M,M.return,He)}}x&&X&64&&Xx(L),ao(L,L.return);break;case 26:case 27:case 5:Sl(N,L,x),x&&M===null&&X&4&&Ev(L),ao(L,L.return);break;case 12:Sl(N,L,x);break;case 13:Sl(N,L,x),x&&X&4&&Bm(N,L);break;case 22:L.memoizedState===null&&Sl(N,L,x),ao(L,L.return);break;default:Sl(N,L,x)}f=f.sibling}}function Pm(d,f){var x=null;d!==null&&d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),d=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(d=f.memoizedState.cachePool.pool),d!==x&&(d!=null&&d.refCount++,x!=null&&af(x))}function hf(d,f){d=null,f.alternate!==null&&(d=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==d&&(f.refCount++,d!=null&&af(d))}function Cs(d,f,x,M){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)Dv(d,f,x,M),f=f.sibling}function Dv(d,f,x,M){var N=f.flags;switch(f.tag){case 0:case 11:case 15:Cs(d,f,x,M),N&2048&&lf(9,f);break;case 3:Cs(d,f,x,M),N&2048&&(d=null,f.alternate!==null&&(d=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==d&&(f.refCount++,d!=null&&af(d)));break;case 12:if(N&2048){Cs(d,f,x,M),d=f.stateNode;try{var L=f.memoizedProps,X=L.id,ie=L.onPostCommit;typeof ie=="function"&&ie(X,f.alternate===null?"mount":"update",d.passiveEffectDuration,-0)}catch(ve){Qn(f,f.return,ve)}}else Cs(d,f,x,M);break;case 23:break;case 22:L=f.stateNode,f.memoizedState!==null?L._visibility&4?Cs(d,f,x,M):tr(d,f):L._visibility&4?Cs(d,f,x,M):(L._visibility|=4,qs(d,f,x,M,(f.subtreeFlags&10256)!==0)),N&2048&&Pm(f.alternate,f);break;case 24:Cs(d,f,x,M),N&2048&&hf(f.alternate,f);break;default:Cs(d,f,x,M)}}function qs(d,f,x,M,N){for(N=N&&(f.subtreeFlags&10256)!==0,f=f.child;f!==null;){var L=d,X=f,ie=x,ve=M,He=X.flags;switch(X.tag){case 0:case 11:case 15:qs(L,X,ie,ve,N),lf(8,X);break;case 23:break;case 22:var ut=X.stateNode;X.memoizedState!==null?ut._visibility&4?qs(L,X,ie,ve,N):tr(L,X):(ut._visibility|=4,qs(L,X,ie,ve,N)),N&&He&2048&&Pm(X.alternate,X);break;case 24:qs(L,X,ie,ve,N),N&&He&2048&&hf(X.alternate,X);break;default:qs(L,X,ie,ve,N)}f=f.sibling}}function tr(d,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var x=d,M=f,N=M.flags;switch(M.tag){case 22:tr(x,M),N&2048&&Pm(M.alternate,M);break;case 24:tr(x,M),N&2048&&hf(M.alternate,M);break;default:tr(x,M)}f=f.sibling}}function Na(d){if(d.subtreeFlags&ua)for(d=d.child;d!==null;)Om(d),d=d.sibling}function Om(d){switch(d.tag){case 26:Na(d),d.flags&ua&&(d.memoizedState!==null?DS(zi,d.memoizedState,d.memoizedProps):gr(d.type,d.memoizedProps));break;case 5:Na(d),d.flags&ua&&gr(d.type,d.memoizedProps);break;case 3:case 4:if(na){var f=zi;zi=ig(d.stateNode.containerInfo),Na(d),zi=f}else Na(d);break;case 22:d.memoizedState===null&&(f=d.alternate,f!==null&&f.memoizedState!==null?(f=ua,ua=16777216,Na(d),ua=f):Na(d));break;default:Na(d)}}function df(d){var f=d.alternate;if(f!==null&&(d=f.child,d!==null)){f.child=null;do f=d.sibling,d.sibling=null,d=f;while(d!==null)}}function lu(d){var f=d.deletions;if((d.flags&16)!==0){if(f!==null)for(var x=0;x<f.length;x++){var M=f[x];gn=M,Uv(M,d)}df(d)}if(d.subtreeFlags&10256)for(d=d.child;d!==null;)Im(d),d=d.sibling}function Im(d){switch(d.tag){case 0:case 11:case 15:lu(d),d.flags&2048&&au(9,d,d.return);break;case 3:lu(d);break;case 12:lu(d);break;case 22:var f=d.stateNode;d.memoizedState!==null&&f._visibility&4&&(d.return===null||d.return.tag!==13)?(f._visibility&=-5,bl(d)):lu(d);break;default:lu(d)}}function bl(d){var f=d.deletions;if((d.flags&16)!==0){if(f!==null)for(var x=0;x<f.length;x++){var M=f[x];gn=M,Uv(M,d)}df(d)}for(d=d.child;d!==null;){switch(f=d,f.tag){case 0:case 11:case 15:au(8,f,f.return),bl(f);break;case 22:x=f.stateNode,x._visibility&4&&(x._visibility&=-5,bl(f));break;default:bl(f)}d=d.sibling}}function Uv(d,f){for(;gn!==null;){var x=gn;switch(x.tag){case 0:case 11:case 15:au(8,x,f);break;case 23:case 22:if(x.memoizedState!==null&&x.memoizedState.cachePool!==null){var M=x.memoizedState.cachePool.pool;M!=null&&M.refCount++}break;case 24:af(x.memoizedState.cache)}if(M=x.child,M!==null)M.return=x,gn=M;else e:for(x=d;gn!==null;){M=gn;var N=M.sibling,L=M.return;if(Cv(M),M===x){gn=null;break e}if(N!==null){N.return=L,gn=N;break e}gn=L}}}function Ah(d){var f=eS(d);if(f!=null){if(typeof f.memoizedProps["data-testname"]!="string")throw Error(i(364));return f}if(d=Kv(d),d===null)throw Error(i(362));return d.stateNode.current}function uu(d,f){var x=d.tag;switch(f.$$typeof){case Zh:if(d.type===f.value)return!0;break;case Fa:e:{for(f=f.value,d=[d,0],x=0;x<d.length;){var M=d[x++],N=M.tag,L=d[x++],X=f[L];if(N!==5&&N!==26&&N!==27||!Fh(M)){for(;X!=null&&uu(M,X);)L++,X=f[L];if(L===f.length){f=!0;break e}else for(M=M.child;M!==null;)d.push(M,L),M=M.sibling}}f=!1}return f;case wi:if((x===5||x===26||x===27)&&sS(d.stateNode,f.value))return!0;break;case Ho:if((x===5||x===6||x===26||x===27)&&(d=iS(d),d!==null&&0<=d.indexOf(f.value)))return!0;break;case yo:if((x===5||x===26||x===27)&&(d=d.memoizedProps["data-testname"],typeof d=="str
3936ing"&&d.toLowerCase()===f.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function Lv(d){switch(d.$$typeof){case Zh:return"<"+(a(d.value)||"Unknown")+">";case Fa:return":has("+(Lv(d)||"")+")";case wi:return'[role="'+d.value+'"]';case Ho:return'"'+d.value+'"';case yo:return'[data-testname="'+d.value+'"]';default:throw Error(i(365))}}function Lr(d,f){var x=[];d=[d,0];for(var M=0;M<d.length;){var N=d[M++],L=N.tag,X=d[M++],ie=f[X];if(L!==5&&L!==26&&L!==27||!Fh(N)){for(;ie!=null&&uu(N,ie);)X++,ie=f[X];if(X===f.length)x.push(N);else for(N=N.child;N!==null;)d.push(N,X),N=N.sibling}}return x}function ff(d,f){if(!vu)throw Error(i(363));d=Ah(d),d=Lr(d,f),f=[],d=Array.from(d);for(var x=0;x<d.length;){var M=d[x++],N=M.tag;if(N===5||N===26||N===27)Fh(M)||f.push(M.stateNode);else for(M=M.child;M!==null;)d.push(M),M=M.sibling}return f}function $i(){if((qn&2)!==0&&Pn!==0)return Pn&-Pn;if(cn.T!==null){var d=ra;return d!==0?d:We()}return tS()}function Bv(){da===0&&(da=(Pn&536870912)===0||Gn?z():536870912);var d=aa.current;return d!==null&&(d.flags|=32),da}function ws(d,f,x){(d===Jn&&oi===2||d.cancelPendingCommit!==null)&&(Ws(d,0),Br(d,Pn,da,!1)),W(d,x),((qn&2)===0||d!==Jn)&&(d===Jn&&((qn&2)===0&&(Ol|=x),mi===4&&Br(d,Pn,da,!1)),nt(d))}function cu(d,f,x){if((qn&6)!==0)throw Error(i(327));var M=!x&&(f&60)===0&&(f&d.expiredLanes)===0||I(d,f),N=M?Ov(d,f):Vm(d,f,!0),L=M;do{if(N===0){ca&&!M&&Br(d,f,0,!1);break}else if(N===6)Br(d,f,0,!za);else{if(x=d.current.alternate,L&&!Rh(x)){N=Vm(d,f,!1),L=!1;continue}if(N===2){if(L=f,d.errorRecoveryDisabledLanes&L)var X=0;else X=d.pendingLanes&-536870913,X=X!==0?X:X&536870912?536870912:0;if(X!==0){f=X;e:{var ie=d;N=Cc;var ve=Xs&&ie.current.memoizedState.isDehydrated;if(ve&&(Ws(ie,X).flags|=256),X=Vm(ie,X,!1),X!==2){if(Ms&&!ve){ie.errorRecoveryDisabledLanes|=L,Ol|=L,N=4;break e}L=Ki,Ki=N,L!==null&&pf(L)}N=X}if(L=!1,N!==2)continue}}if(N===1){Ws(d,0),Br(d,f,0,!0);break}e:{switch(M=d,N){case 0:case 1:throw Error(i(345));case 4:if((f&4194176)===f){Br(M,f,da,!za);break e}break;case 2:Ki=null;break;case 3:case 5:break;default:throw Error(i(329))}if(M.finishedWork=x,M.finishedLanes=f,(f&62914560)===f&&(L=_r+300-Ba(),10<L)){if(Br(M,f,da,!za),P(M,0)!==0)break e;M.timeoutHandle=cs(Fm.bind(null,M,x,Ki,If,pg,f,da,Ol,ko,za,2,-0,0),L);break e}Fm(M,x,Ki,If,pg,f,da,Ol,ko,za,0,-0,0)}}break}while(!0);nt(d)}function pf(d){Ki===null?Ki=d:Ki.push.apply(Ki,d)}function Fm(d,f,x,M,N,L,X,ie,ve,He,ut,bt,At){var yn=f.subtreeFlags;if((yn&8192||(yn&16785408)===16785408)&&(Yv(),Om(f),f=hs(),f!==null)){d.cancelPendingCommit=f(du.bind(null,d,x,M,N,X,ie,ve,1,bt,At)),Br(d,L,X,!He);return}du(d,x,M,N,X,ie,ve,ut,bt,At)}function Rh(d){for(var f=d;;){var x=f.tag;if((x===0||x===11||x===15)&&f.flags&16384&&(x=f.updateQueue,x!==null&&(x=x.stores,x!==null)))for(var M=0;M<x.length;M++){var N=x[M],L=N.getSnapshot;N=N.value;try{if(!Or(L(),N))return!1}catch{return!1}}if(x=f.child,f.subtreeFlags&16384&&x!==null)x.return=f,f=x;else{if(f===d)break;for(;f.sibling===null;){if(f.return===null||f.return===d)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function Br(d,f,x,M){f&=~Of,f&=~Ol,d.suspendedLanes|=f,d.pingedLanes&=~f,M&&(d.warmLanes|=f),M=d.expirationTimes;for(var N=f;0<N;){var L=31-yr(N),X=1<<L;M[L]=-1,N&=~X}x!==0&&se(d,x,f)}function mf(){return(qn&6)===0?(qt(0),!1):!0}function Nh(){if(sn!==null){if(oi===0)var d=sn.return;else d=sn,la=go=null,q(d),Mu=null,Eu=0,d=sn;for(;d!==null;)Wx(d.alternate,d),d=d.return;sn=null}}function Ws(d,f){d.finishedWork=null,d.finishedLanes=0;var x=d.timeoutHandle;x!==gu&&(d.timeoutHandle=gu,jm(x)),x=d.cancelPendingCommit,x!==null&&(d.cancelPendingCommit=null,x()),Nh(),Jn=d,sn=x=wa(d.current,null),Pn=f,oi=0,ir=null,za=!1,ca=I(d,f),Ms=!1,ko=da=Of=Ol=ha=mi=0,Ki=Cc=null,pg=!1,(f&8)!==0&&(f|=f&32);var M=d.entangledLanes;if(M!==0)for(d=d.entanglements,M&=f;0<M;){var N=31-yr(M),L=1<<N;f|=d[N],M&=~L}return sr=f,$e(),x}function Jr(d,f){En=null,cn.H=Yi,f===Xh?(f=Bt(),oi=3):f===Bf?(f=Bt(),oi=4):oi=f===dg?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,ir=f,sn===null&&(mi=1,_h(d,Se(f,d.current)))}function hu(){var d=aa.current;return d===null?!0:(Pn&4194176)===Pn?fi===null:(Pn&62914560)===Pn||(Pn&536870912)!==0?d===fi:!1}function wo(){var d=cn.H;return cn.H=Yi,d===null?Yi:d}function Do(){var d=cn.A;return cn.A=Kh,d}function Tl(){mi=4,za||(Pn&4194176)!==Pn&&aa.current!==null||(ca=!0),(ha&134217727)===0&&(Ol&134217727)===0||Jn===null||Br(Jn,Pn,da,!1)}function Vm(d,f,x){var M=qn;qn|=2;var N=wo(),L=Do();(Jn!==d||Pn!==f)&&(If=null,Ws(d,f)),f=!1;var X=mi;e:do try{if(oi!==0&&sn!==null){var ie=sn,ve=ir;switch(oi){case 8:Nh(),X=6;break e;case 3:case 2:case 6:aa.current===null&&(f=!0);var He=oi;if(oi=0,ir=null,Ca(d,ie,ve,He),x&&ca){X=0;break e}break;default:He=oi,oi=0,ir=null,Ca(d,ie,ve,He)}}Pv(),X=mi;break}catch(ut){Jr(d,ut)}while(!0);return f&&d.shellSuspendCounter++,la=go=null,qn=M,cn.H=N,cn.A=L,sn===null&&(Jn=null,Pn=0,$e()),X}function Pv(){for(;sn!==null;)Vi(sn)}function Ov(d,f){var x=qn;qn|=2;var M=wo(),N=Do();Jn!==d||Pn!==f?(If=null,Qh=Ba()+500,Ws(d,f)):ca=I(d,f);e:do try{if(oi!==0&&sn!==null){f=sn;var L=ir;t:switch(oi){case 1:oi=0,ir=null,Ca(d,f,L,1);break;case 2:if(Nt(L)){oi=0,ir=null,Wn(f);break}f=function(){oi===2&&Jn===d&&(oi=7),nt(d)},L.then(f,f);break e;case 3:oi=7;break e;case 4:oi=5;break e;case 7:Nt(L)?(oi=0,ir=null,Wn(f)):(oi=0,ir=null,Ca(d,f,L,7));break;case 5:var X=null;switch(sn.tag){case 26:X=sn.memoizedState;case 5:case 27:var ie=sn,ve=ie.type,He=ie.pendingProps;if(X?mc(X):Km(ve,He)){oi=0,ir=null;var ut=ie.sibling;if(ut!==null)sn=ut;else{var bt=ie.return;bt!==null?(sn=bt,ea(bt)):sn=null}break t}}oi=0,ir=null,Ca(d,f,L,5);break;case 6:oi=0,ir=null,Ca(d,f,L,6);break;case 8:Nh(),mi=6;break e;default:throw Error(i(462))}}pr();break}catch(At){Jr(d,At)}while(!0);return la=go=null,cn.H=M,cn.A=N,qn=x,sn!==null?0:(Jn=null,Pn=0,$e(),mi)}function pr(){for(;sn!==null&&!PS();)Vi(sn)}function Vi(d){var f=Hx(d.alternate,d,sr);
3936d.memoizedProps=d.pendingProps,f===null?ea(d):sn=f}function Wn(d){var f=d,x=f.alternate;switch(f.tag){case 15:case 0:f=Ox(x,f,f.pendingProps,f.type,void 0,Pn);break;case 11:f=Ox(x,f,f.pendingProps,f.type.render,f.ref,Pn);break;case 5:q(f);default:Wx(x,f),f=sn=yf(f,sr),f=Hx(x,f,sr)}d.memoizedProps=d.pendingProps,f===null?ea(d):sn=f}function Ca(d,f,x,M){la=go=null,q(f),Mu=null,Eu=0;var N=f.return;try{if(QE(d,N,f,x,Pn)){mi=1,_h(d,Se(x,d.current)),sn=null;return}}catch(L){if(N!==null)throw sn=N,L;mi=1,_h(d,Se(x,d.current)),sn=null;return}f.flags&32768?(Gn||M===1?d=!0:ca||(Pn&536870912)!==0?d=!1:(za=d=!0,(M===2||M===3||M===6)&&(M=aa.current,M!==null&&M.tag===13&&(M.flags|=16384))),zm(f,d)):ea(f)}function ea(d){var f=d;do{if((f.flags&32768)!==0){zm(f,za);return}d=f.return;var x=qx(f.alternate,f,sr);if(x!==null){sn=x;return}if(f=f.sibling,f!==null){sn=f;return}sn=f=d}while(f!==null);mi===0&&(mi=5)}function zm(d,f){do{var x=JE(d.alternate,d);if(x!==null){x.flags&=32767,sn=x;return}if(x=d.return,x!==null&&(x.flags|=32768,x.subtreeFlags=0,x.deletions=null),!f&&(d=d.sibling,d!==null)){sn=d;return}sn=d=x}while(d!==null);mi=6,sn=null}function du(d,f,x,M,N,L,X,ie,ve,He){var ut=cn.T,bt=Cl();try{nr(2),cn.T=null,Kx(d,f,x,M,bt,N,L,X,ie,ve,He)}finally{cn.T=ut,nr(bt)}}function Kx(d,f,x,M,N,L,X,ie){do oo();while(qo!==null);if((qn&6)!==0)throw Error(i(327));var ve=d.finishedWork;if(M=d.finishedLanes,ve===null)return null;if(d.finishedWork=null,d.finishedLanes=0,ve===d.current)throw Error(i(177));d.callbackNode=null,d.callbackPriority=0,d.cancelPendingCommit=null;var He=ve.lanes|ve.childLanes;if(He|=po,ee(d,M,He,L,X,ie),d===Jn&&(sn=Jn=null,Pn=0),(ve.subtreeFlags&10256)===0&&(ve.flags&10256)===0||vo||(vo=!0,wu=He,mg=x,El(lg,function(){return oo(),null})),x=(ve.flags&15990)!==0,(ve.subtreeFlags&15990)!==0||x?(x=cn.T,cn.T=null,L=Cl(),nr(2),X=qn,qn|=4,cf(d,ve),wv(ve,d),Jx(d.containerInfo),d.current=ve,Lm(d,ve.alternate,ve),ag(),qn=X,nr(L),cn.T=x):d.current=ve,vo?(vo=!1,qo=d,wc=M):Iv(d,He),He=d.pendingLanes,He===0&&(Cu=null),k(ve.stateNode),nt(d),f!==null)for(N=d.onRecoverableError,ve=0;ve<f.length;ve++)He=f[ve],N(He.value,{componentStack:He.stack});return(wc&3)!==0&&oo(),He=d.pendingLanes,(M&4194218)!==0&&(He&42)!==0?d===gg?$h++:($h=0,gg=d):$h=0,qt(0),null}function Iv(d,f){(d.pooledCacheLanes&=f)===0&&(f=d.pooledCache,f!=null&&(d.pooledCache=null,af(f)))}function oo(){if(qo!==null){var d=qo,f=wu;wu=0;var x=pe(wc),M=32>x?32:x;x=cn.T;var N=Cl();try{if(nr(M),cn.T=null,qo===null)var L=!1;else{M=mg,mg=null;var X=qo,ie=wc;if(qo=null,wc=0,(qn&6)!==0)throw Error(i(331));var ve=qn;if(qn|=4,Im(X.current),Dv(X,X.current,ie,M),qn=ve,qt(0,!1),Pr&&typeof Pr.onPostCommitFiberRoot=="function")try{Pr.onPostCommitFiberRoot(ts,X)}catch{}L=!0}return L}finally{nr(N),cn.T=x,Iv(d,f)}}return!1}function Ch(d,f,x){f=Se(x,f),f=Sh(d.stateNode,f,2),d=gt(d,f,2),d!==null&&(W(d,2),nt(d))}function Qn(d,f,x){if(d.tag===3)Ch(d,d,x);else for(;f!==null;){if(f.tag===3){Ch(f,d,x);break}else if(f.tag===1){var M=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof M.componentDidCatch=="function"&&(Cu===null||!Cu.has(M))){d=Se(x,d),x=gv(2),M=gt(f,x,2),M!==null&&(Dx(x,M,f,d),W(M,2),nt(M));break}}f=f.return}}function dc(d,f,x){var M=d.pingCache;if(M===null){M=d.pingCache=new Va;var N=new Set;M.set(f,N)}else N=M.get(f),N===void 0&&(N=new Set,M.set(f,N));N.has(x)||(Ms=!0,N.add(x),d=Fv.bind(null,d,f,x),f.then(d,d))}function Fv(d,f,x){var M=d.pingCache;M!==null&&M.delete(f),d.pingedLanes|=d.suspendedLanes&x,d.warmLanes&=~x,Jn===d&&(Pn&x)===x&&(mi===4||mi===3&&(Pn&62914560)===Pn&&300>Ba()-_r?(qn&2)===0&&Ws(d,0):Of|=x,ko===Pn&&(ko=0)),nt(d)}function fu(d,f){f===0&&(f=B()),d=Be(d,f),d!==null&&(W(d,f),nt(d))}function Ml(d){var f=d.memoizedState,x=0;f!==null&&(x=f.retryLane),fu(d,x)}function pu(d,f){var x=0;switch(d.tag){case 13:var M=d.stateNode,N=d.memoizedState;N!==null&&(x=N.retryLane);break;case 19:M=d.stateNode;break;case 22:M=d.stateNode._retryCache;break;default:throw Error(i(314))}M!==null&&M.delete(f),fu(d,x)}function El(d,f){return Df(d,f)}function Vv(d,f,x,M){this.tag=d,this.key=x,this.sibling=this.child=this.return=this.stateNode=this.t
3936ype=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=M,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gf(d){return d=d.prototype,!(!d||!d.isReactComponent)}function wa(d,f){var x=d.alternate;return x===null?(x=t(d.tag,f,d.key,d.mode),x.elementType=d.elementType,x.type=d.type,x.stateNode=d.stateNode,x.alternate=d,d.alternate=x):(x.pendingProps=f,x.type=d.type,x.flags=0,x.subtreeFlags=0,x.deletions=null),x.flags=d.flags&31457280,x.childLanes=d.childLanes,x.lanes=d.lanes,x.child=d.child,x.memoizedProps=d.memoizedProps,x.memoizedState=d.memoizedState,x.updateQueue=d.updateQueue,f=d.dependencies,x.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},x.sibling=d.sibling,x.index=d.index,x.ref=d.ref,x.refCleanup=d.refCleanup,x}function yf(d,f){d.flags&=31457282;var x=d.alternate;return x===null?(d.childLanes=0,d.lanes=f,d.child=null,d.subtreeFlags=0,d.memoizedProps=null,d.memoizedState=null,d.updateQueue=null,d.dependencies=null,d.stateNode=null):(d.childLanes=x.childLanes,d.lanes=x.lanes,d.child=x.child,d.subtreeFlags=0,d.deletions=null,d.memoizedProps=x.memoizedProps,d.memoizedState=x.memoizedState,d.updateQueue=x.updateQueue,d.type=x.type,f=x.dependencies,d.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),d}function Uo(d,f,x,M,N,L){var X=0;if(M=d,typeof d=="function")gf(d)&&(X=1);else if(typeof d=="string")X=na&&di?Nf(d,x,bs.current)?26:Bo(d)?27:5:na?Nf(d,x,bs.current)?26:5:di&&Bo(d)?27:5;else e:switch(d){case mu:return Xi(x.children,N,L,f);case Sf:X=8,N|=24;break;case qm:return d=t(12,x,f,N|2),d.elementType=qm,d.lanes=L,d;case Wm:return d=t(13,x,f,N),d.elementType=Wm,d.lanes=L,d;case Lh:return d=t(19,x,f,N),d.elementType=Lh,d.lanes=L,d;case Hv:return vf(x,N,L,f);default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case bf:case lo:X=10;break e;case Gv:X=9;break e;case Tf:X=11;break e;case Xm:X=14;break e;case Ua:X=16,M=null;break e}X=29,x=Error(i(130,d===null?"null":typeof d,"")),M=null}return f=t(X,x,f,N),f.elementType=d,f.type=M,f.lanes=L,f}function Xi(d,f,x,M){return d=t(7,d,M,f),d.lanes=x,d}function vf(d,f,x,M){d=t(22,d,M,f),d.elementType=Hv,d.lanes=x;var N={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var L=N._current;if(L===null)throw Error(i(456));if((N._pendingVisibility&2)===0){var X=Be(L,2);X!==null&&(N._pendingVisibility|=2,ws(X,L,2))}},attach:function(){var L=N._current;if(L===null)throw Error(i(456));if((N._pendingVisibility&2)!==0){var X=Be(L,2);X!==null&&(N._pendingVisibility&=-3,ws(X,L,2))}}};return d.stateNode=N,d}function Gm(d,f,x){return d=t(6,d,null,f),d.lanes=x,d}function zv(d,f,x){return f=t(4,d.children!==null?d.children:[],d.key,f),f.lanes=x,f.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},f}function eA(d,f,x,M,N,L,X,ie){this.tag=1,this.containerInfo=d,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=gu,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=O(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=O(0),this.hiddenUpdates=O(null),this.identifierPrefix=M,this.onUncaughtError=N,this.onCaughtError=L,this.onRecoverableError=X,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ie,this.incompleteTransitions=new Map}function Zx(d,f,x,M,N,L,X,ie,ve,He,ut,bt){return d=new eA(d,f,x,X,ie,ve,He,bt),f=1,L===!0&&(f|=24),L=t(3,null,null,f),d.current=L,L.stateNode=d,f=ru(),f.refCount++,d.pooledCache=f,f.refCount++,L.memoizedState={element:M,isDehydrated:x,cache:f},Dt(L),d}function us(d){return d?(d=Su,d):Su}function Hm(d){var f=d._reactInternals;if(f===void 0)throw typeof d.render=="function"?Error(i(188)):(d=Object.keys(d).join(","),Error(i(268,d)));return d=_(f),d=d!==null?S(d):null,d===null?null:Oh(d.stateNode)}function wh(d,f,x,M,N,L){N=us(N),M.context===null?M.context=N:M.pendingContext=N,M=et(f),M.payload={element:x},L=L===void 0?null:L,L!==null&&(M.callback=L),x=gt(d,M,f),x!==null&&(ws(x,d,f),Ht(x,d,f))}function Dh(d,f){if(d=d.memoizedState,d!==null&&d.dehydrated!==null){var x=d.retryLane;d.retryLane=x!==0&&x<f?x:f}}function _f(d,f){Dh(d,f),(d=d.alternate)&&Dh(d,f)}var xn={},Uh=jy(),ta=N3(),km=Object.assign,tA=Symbol.for("react.element"),xf=Symbol.for("react.transitional.element"),Da=Symbol.for("react.portal"),mu=Symbol.for("react.fragment"),Sf=Symbol.for("react.strict_mode"),qm=Symbol.for("react.profiler"),bf=Symbol.for("react.provider"),Gv=Symbol.for("react.consumer"),lo=Symbol.for("react.context"),Tf=Symbol.for("react.forward_ref"),Wm=Symbol.for("react.suspense"),Lh=Symbol.for("react.suspense_list"),Xm=Symbol.for("react.memo"),Ua=Symbol.for("react.lazy"),Hv=Symbol.for("react.offscreen"),Qx=Symbol.for("react.memo_cache_sentinel"),Al=Symbol.iterator,kv=Symbol.for("react.client.reference"),cn=Uh.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Lo,Rl,fc=!1,Bh=Array.isArray,qv=e.rendererVersion,Mf=e.rendererPackageName,Ph=e.extraDevToolsConfig,Oh=e.getPublicInstance,$x=e.getRootHostContext,Ih=e.getChildHostContext,Ym=e.prepareForCommit,Jx=e.resetAfterCommit,Wv=e.createInstance,Ef=e.appendInitialChild,Nl=e.finalizeInitialChildren,Sn=e.shouldSetTextContent,ii=e.createTextInstance,cs=e.scheduleTimeout,jm=e.cancelTimeout,gu=e.noTimeout,mr=e.isPrimaryRenderer;e.warnsIfNotActing;var Ss=e.supportsMutation,La=e.supportsPersistence,Xs=e.supportsHydration,eS=e.getInstanceFromNode;e.beforeActiveInstanceBlur,e.afterActiveInstanceBlur;var Ji=e.preparePortalMount;
3936e.prepareScopeUpdate,e.getInstanceFromScope;var nr=e.setCurrentUpdatePriority,Cl=e.getCurrentUpdatePriority,tS=e.resolveUpdatePriority;e.resolveEventType,e.resolveEventTimeStamp;var nS=e.shouldAttemptEagerTransition,nA=e.detachDeletedInstance;e.requestPostPaintCallback;var Xv=e.maySuspendCommit,Km=e.preloadInstance,Yv=e.startSuspendingCommit,gr=e.suspendInstance,hs=e.waitForCommitToBeReady,yu=e.NotPendingTransition,uo=e.HostTransitionContext,Zm=e.resetFormInstance;e.bindToConsole;var jv=e.supportsMicrotasks,wl=e.scheduleMicrotask,vu=e.supportsTestSelectors,Kv=e.findFiberRoot,Zv=e.getBoundingRect,iS=e.getTextContent,Fh=e.isHiddenSubtree,sS=e.matchAccessibilityRole,rS=e.setFocusIfFocusable,aS=e.setupIntersectionObserver,oS=e.appendChild,Qv=e.appendChildToContainer,lS=e.commitTextUpdate,iA=e.commitMount,uS=e.commitUpdate,cS=e.insertBefore,hS=e.insertInContainerBefore,$v=e.removeChild,dS=e.removeChildFromContainer,Jv=e.resetTextContent,fS=e.hideInstance,pS=e.hideTextInstance,mS=e.unhideInstance,sA=e.unhideTextInstance,gS=e.clearContainer,Vh=e.cloneInstance,Af=e.createContainerChildSet,e_=e.appendChildToContainerChildSet,Qm=e.finalizeContainerChildren,zh=e.replaceContainerChildren,t_=e.cloneHiddenInstance,n_=e.cloneHiddenTextInstance,$m=e.isSuspenseInstancePending,Jm=e.isSuspenseInstanceFallback,yS=e.getSuspenseInstanceFallbackErrorDetails,vS=e.registerSuspenseInstanceRetry,i_=e.canHydrateFormStateMarker,_S=e.isFormStateMarkerMatching,s_=e.getNextHydratableSibling,eg=e.getFirstHydratableChild,xS=e.getFirstHydratableChildWithinContainer,SS=e.getFirstHydratableChildWithinSuspenseInstance,rA=e.canHydrateInstance,r_=e.canHydrateTextInstance,bS=e.canHydrateSuspenseInstance,TS=e.hydrateInstance,a_=e.hydrateTextInstance,MS=e.hydrateSuspenseInstance,ES=e.getNextHydratableInstanceAfterSuspenseInstance,aA=e.commitHydratedContainer,oA=e.commitHydratedSuspenseInstance,AS=e.clearSuspenseBoundary,Rf=e.clearSuspenseBoundaryFromContainer,tg=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var ng=e.validateHydratableInstance,RS=e.validateHydratableTextInstance,na=e.supportsResources,Nf=e.isHostHoistableType,ig=e.getHoistableRoot,o_=e.getResource,NS=e.acquireResource,pc=e.releaseResource,Cf=e.hydrateHoistable,wf=e.mountHoistable,Gh=e.unmountHoistable,sg=e.createHoistableInstance,CS=e.prepareToCommitHoistables,wS=e.mayResourceSuspendCommit,mc=e.preloadResource,DS=e.suspendResource,di=e.supportsSingletons,co=e.resolveSingletonInstance,_u=e.clearSingleton,US=e.acquireSingletonInstance,xu=e.releaseSingletonInstance,Bo=e.isHostSingletonType,es=[],Dl=-1,Su={},yr=Math.clz32?Math.clz32:w,LS=Math.log,BS=Math.LN2,Po=128,gc=4194304,Df=ta.unstable_scheduleCallback,rg=ta.unstable_cancelCallback,PS=ta.unstable_shouldYield,ag=ta.unstable_requestPaint,Ba=ta.unstable_now,og=ta.unstable_ImmediatePriority,OS=ta.unstable_UserBlockingPriority,lg=ta.unstable_NormalPriority,lA=ta.unstable_IdlePriority,IS=ta.log,Ds=ta.unstable_setDisableYieldValue,ts=null,Pr=null,Or=typeof Object.is=="function"?Object.is:J,l_=new WeakMap,yc=[],vc=0,_c=null,Hh=0,ia=[],sa=0,bu=null,ho=1,fo="",bs=E(null),kh=E(null),Oo=E(null),xc=E(null),Ys=null,js=null,Gn=!1,Pa=null,Us=!1,Uf=Error(i(519)),Oa=[],Sc=0,po=0,Lf=null,Ul=null,bc=!1,xi=!1,u_=!1,qh=0,Wh=null,Tc=0,ra=0,Mc=null,Ll=!1,Ec=!1,Io=Object.prototype.hasOwnProperty,Xh=Error(i(460)),Bf=Error(i(474)),Pf={then:function(){}},Tu=null,Mu=null,Eu=0,Au=as(!0),Fo=as(!1),Si=E(null),Yh=E(0),aa=E(null),fi=null,Ts=E(0),Bl=0,En=null,Jt=null,kn=null,Ia=!1,Ac=!1,Ru=!1,ug=0,Rc=0,Ls=null,mo=0,cg=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},Yi={readContext:Hs,use:ye,useCallback:_i,useContext:_i,useEffect:_i,useImperativeHandle:_i,useLayoutEffect:_i,useInsertionEffect:_i,useMemo:_i,useReducer:_i,useRef:_i,useState:_i,useDebugValue:_i,useDeferredValue:_i,useTransition:_i,useSyncExternalStore:_i,useId:_i};Yi.useCacheRefresh=_i,Yi.useMemoCache=_i,Yi.useHostTransitionStatus=_i,Yi.useFormState=_i,Yi.useActionState=_i,Yi.useOptimistic=_i;var Nu={readContext:Hs,use:ye,useCallback:function(d,f){return de().memoizedState=[d,f===void 0?null:f],d},useContext:Hs,useEffect:Sm,useImperativeHandle:function(d,f,x){x=x!=null?x.concat([d]):null,Yd(4194308,4,bm.bind(null,f,d),x)},useLayoutEffect:function(d,f){return Yd(4194308,4,d,f)},useInsertionEffect:function(d,f){Yd(4,2,d,f)},useMemo:function(d,f){var x=de();f=f===void 0?null:f;var M=d();if(Ru){Q(!0);try{d()}finally{Q(!1)}}return x.memoizedState=[M,f],M},useReducer:function(d,f,x){var M=de();if(x!==void 0){var N=x(f);
3936if(Ru){Q(!0);try{x(f)}finally{Q(!1)}}}else N=f;return M.memoizedState=M.baseState=N,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:N},M.queue=d,d=d.dispatch=Mm.bind(null,En,d),[M.memoizedState,d]},useRef:function(d){var f=de();return d={current:d},f.memoizedState=d},useState:function(d){d=_n(d);var f=d.queue,x=mv.bind(null,En,f);return f.dispatch=x,[d.memoizedState,x]},useDebugValue:eu,useDeferredValue:function(d,f){var x=de();return Zd(x,d,f)},useTransition:function(){var d=_n(!1);return d=ph.bind(null,En,d.queue,!0,!1),de().memoizedState=d,[!1,d]},useSyncExternalStore:function(d,f,x){var M=En,N=de();if(Gn){if(x===void 0)throw Error(i(407));x=x()}else{if(x=f(),Jn===null)throw Error(i(349));(Pn&60)!==0||zt(M,f,x)}N.memoizedState=x;var L={value:x,getSnapshot:f};return N.queue=L,Sm(Hn.bind(null,M,L,d),[d]),M.flags|=2048,xs(9,Tn.bind(null,M,L,x,f),{destroy:void 0},null),x},useId:function(){var d=de(),f=Jn.identifierPrefix;if(Gn){var x=fo,M=ho;x=(M&~(1<<32-yr(M)-1)).toString(32)+x,f=":"+f+"R"+x,x=ug++,0<x&&(f+="H"+x.toString(32)),f+=":"}else x=mo++,f=":"+f+"r"+x.toString(32)+":";return d.memoizedState=f},useCacheRefresh:function(){return de().memoizedState=pv.bind(null,En)}};Nu.useMemoCache=st,Nu.useHostTransitionStatus=Qd,Nu.useFormState=er,Nu.useActionState=er,Nu.useOptimistic=function(d){var f=de();f.memoizedState=f.baseState=d;var x={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=x,f=gh.bind(null,En,!0,x),x.dispatch=f,[d,f]};var vr={readContext:Hs,use:ye,useCallback:uc,useContext:Hs,useEffect:hv,useImperativeHandle:Tm,useInsertionEffect:Cx,useLayoutEffect:Kd,useMemo:dv,useReducer:wt,useRef:Nx,useState:function(){return wt(pt)},useDebugValue:eu,useDeferredValue:function(d,f){var x=Te();return fv(x,Jt.memoizedState,d,f)},useTransition:function(){var d=wt(pt)[0],f=Te().memoizedState;return[typeof d=="boolean"?d:Ne(d),f]},useSyncExternalStore:$t,useId:mh};vr.useCacheRefresh=pl,vr.useMemoCache=st,vr.useHostTransitionStatus=Qd,vr.useFormState=Vs,vr.useActionState=Vs,vr.useOptimistic=function(d,f){var x=Te();return Yt(x,Jt,d,f)};var oa={readContext:Hs,use:ye,useCallback:uc,useContext:Hs,useEffect:hv,useImperativeHandle:Tm,useInsertionEffect:Cx,useLayoutEffect:Kd,useMemo:dv,useReducer:Xt,useRef:Nx,useState:function(){return Xt(pt)},useDebugValue:eu,useDeferredValue:function(d,f){var x=Te();return Jt===null?Zd(x,d,f):fv(x,Jt.memoizedState,d,f)},useTransition:function(){var d=Xt(pt)[0],f=Te().memoizedState;return[typeof d=="boolean"?d:Ne(d),f]},useSyncExternalStore:$t,useId:mh};oa.useCacheRefresh=pl,oa.useMemoCache=st,oa.useHostTransitionStatus=Qd,oa.useFormState=lc,oa.useActionState=lc,oa.useOptimistic=function(d,f){var x=Te();return Jt!==null?Yt(x,Jt,d,f):(x.baseState=d,[d,x.queue.dispatch])};var Vo={isMounted:function(d){return(d=d._reactInternals)?g(d)===d:!1},enqueueSetState:function(d,f,x){d=d._reactInternals;var M=$i(),N=et(M);N.payload=f,x!=null&&(N.callback=x),f=gt(d,N,M),f!==null&&(ws(f,d,M),Ht(f,d,M))},enqueueReplaceState:function(d,f,x){d=d._reactInternals;var M=$i(),N=et(M);N.tag=1,N.payload=f,x!=null&&(N.callback=x),f=gt(d,N,M),f!==null&&(ws(f,d,M),Ht(f,d,M))},enqueueForceUpdate:function(d,f){d=d._reactInternals;var x=$i(),M=et(x);M.tag=2,f!=null&&(M.callback=f),f=gt(d,M,x),f!==null&&(ws(f,d,x),Ht(f,d,x))}},hg=typeof reportError=="function"?reportError:function(d){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof d=="object"&&d!==null&&typeof d.message=="string"?String(d.message):String(d),error:d});if(!window.dispatchEvent(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",d);return}console.error(d)},dg=Error(i(461)),pi=!1,fg={dehydrated:null,treeContext:null,retryLane:0},Pl=E(null),go=null,la=null,jh=typeof AbortController<"u"?AbortController:function(){var d=[],f=this.signal={aborted:!1,addEventListener:function(x,M){d.push(M)}};this.abort=function(){f.aborted=!0,d.forEach(function(x){return x()})}},FS=ta.unstable_scheduleCallback,VS=ta.unstable_NormalPriority,bi={$$typeof:lo,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},c_=cn.S;cn.S=function(d,f){typeof f=="object"&&f!==null&&typeof f.then=="function"&&Ue(d,f),c_!==null&&c_(d,f)};var zo=E(null),Go=!1,ji=!1,h_=!1,$n=typeof WeakSet=="function"?WeakSet:Set,gn=null,wn=!1,Qt=null,Mn=!1,zi=null,ua=8192,Kh={getCacheForType:function(d){var f=Hs(bi),x=f.data.get(d);return x===void 0&&(x=d(),f.data.set(d,x)),x}},Zh=0,Fa=1,wi=2,yo=3,Ho=4;if(typeof Symbol=="function"&&Symbol.for){var Nc=Symbol.for;Zh=Nc("selector.component"),Fa=Nc("selector.has_pseudo_class"),wi=Nc("selector.role"),yo=Nc("selector.test_id"),Ho=Nc("selector.text")}var Va=typeof WeakMap=="function"?WeakMap:Map,qn=0,Jn=null,sn=null,Pn=0,oi=0,ir=null,za=!1,ca=!1,Ms=!1,sr=0,mi=0,ha=0,Ol=0,Of=0,da=0,ko=0,Cc=null,Ki=null,pg=!1,_r=0,Qh=1/0,If=null,Cu=null,vo=!1,qo=null,wc=0,wu=0,mg=null,$h=0,gg=null;return xn.attemptContinuousHydration=function(d){if(d.tag===13){var f=Be(d,67108864);f!==null&&ws(f,d,67108864),_f(d,67108864)}},xn.attemptHydrationAtCurrentPriority=function(d){if(d.tag===13){var f=$i(),x=Be(d,f);x!==null&&ws(x,d,f),_f(d,f)}},xn.attemptSynchronousHydration=function(d){switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var f=D(d.pendingLanes);if(f!==0){for(d.pendingLanes|=2,d.entangledLanes|=2;f;){var x=1<<31-yr(f);d.entanglements[1]|=x,f&=~x}nt(d),(qn&6)===0&&(Qh=Ba()+500,qt(0))}}break;case 13:f=Be(d,2),f!==null&&ws(f,d,2),mf(),_f(d,2)}},xn.batchedUpdates=function(d,f){return d(f)},xn.createComponentSelector=function(d){return{$$typeof:Zh,value:d}},xn.createContainer=function(d,f,x,M,N,L,X,ie,ve,He){return Zx(d,f,!1,null,x,M,L,X,ie,ve,He,null)},xn.createHasPseudoClassSelector=function(d){return{$$typeof:Fa,value:d}},xn.createHydrationContainer=function(d,f,x,M,N,L,X,ie,ve,He,ut,bt,At){return d=Zx(x,M,!0,d,N,L,ie,ve,He,ut,bt,At),d.context=us(null),x=d.current,M=$i(),N=et(M),N.callback=f??null,gt(x,N,M),d.current.lanes=M,W(d,M),nt(d),d},xn.createPortal=function(d,f,x){var M=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Da,key:M==null?null:""+M,children:d,containerInfo:f,implementation:x}},xn.createRoleSelector=function(d){return{$$typeof:wi,value:d}},xn.createTestNameSelector=function(d){return{$$typeof:yo,value:d}},xn.createTextSelector=function(d){return{$$typeof:Ho,value:d}},xn.defaultOnCaughtError=function(d){console.error(d)},xn.defaultOnRecoverableError=function(d){hg(d)},xn.defaultOnUncaughtError=function(d){hg(d)},xn.deferredUpdates=function(d){var f=cn.T,x=Cl();try{return nr(32),cn.T=null,d()}finally{nr(x),cn.T=f}},xn.discreteUpdates=function(d,f,x,M,N){var L=cn.T,X=Cl();try{return nr(2),cn.T=null,d(f,x,M,N)}finally{nr(X),cn.T=L,qn===0&&(Qh=Ba()+500)}},xn.findAllNodes=ff,xn.findBoundingRects=function(d,f){if(!vu)throw Error(i(363));f=ff(d,f),d=[];for(var x=0;x<f.length;x++)d.push(Zv(f[x]));for(f=d.length-1;0<f;f--){x=d[f];for(var M=x.x,N=M+x.width,L=x.y,X=L+x.height,ie=f-1;0<=ie;ie--)if(f!==ie){var ve=d[ie],He=ve.x,ut=He+ve.width,bt=ve.y,At=bt+ve.height;if(M>=He&&L>=bt&&N<=ut&&X<=At){d.splice(f,1);break}else if(M!==He||x.width!==ve.width||At<L||bt>X){if(!(L!==bt||x.height!==ve.height||ut<M||He>N)){He>M&&(ve.width+=He-M,ve.x=M),ut<N&&(ve.width=N-He),d.splice(f,1);break}}else{bt>L&&(ve.height+=bt-L,ve.y=L),At<X&&(ve.height=X-bt),d.splice(f,1);break}}}return d},xn.findHostInstance=Hm,xn.findHostInstanceWithNoPortals=function(d){return d=_(d),d=d!==null?A(d):null,d===null?null:Oh(d.stateNode)},xn.findHostInstanceWithWarning=function(d){return Hm(d)},xn.flushPassiveEffects=oo,xn.flushSyncFromReconciler=function(d){var f=qn;qn|=1;var x=cn.T,M=Cl();try{if(nr(2),cn.T=null,d)return d()}finally{nr(M),cn.T=x,qn=f,(qn&6)===0&&qt(0)}},xn.flushSyncWork=mf,xn.focusWithin=function(d,f){if(!vu)throw Error(i(363));for(d=Ah(d),f=Lr(d,f),f=Array.from(f),d=0;d<f.length;){var x=f[d++],M=x.tag;if(!Fh(x)){if((M===5||M===26||M===27)&&rS(x.stateNode))return!0;for(x=x.child;x!==null;)f.push(x),x=x.sibling}}return!1},xn.getFindAllNodesFailureDescription=function(d,f){if(!vu)throw Error(i(363));var x=0,M=[];d=[Ah(d),0];for(var N=0;N<d.length;){var L=d[N++],X=L.tag,ie=d[N++],ve=f[ie];if((X!==5&&X!==26&&X!==27||!Fh(L))&&(uu(L,ve)&&(M.push(Lv(ve)),ie++,ie>x&&(x=ie)),ie<f.length))for(L=L.child;L!==null;)d.push(L,ie),L=L.sibling}if(x<f.length){for(d=[];x<f.length;x++)d.push(Lv(f[x]));return`findAllNodes was able to match part of the selector: 3937 `+(M.join(" > ")+` 3938 3939No matching component was found for: 3940 `)+d.join(" > ")}return null},xn.getPublicRootInstance=function(d){if(d=d.current,!d.child)return null;switch(d.child.tag){case 27:case 5:return Oh(d.child.stateNode);default:return d.child.stateNode}},xn.injectIntoDevTools=function(){var d={bundleType:0,version:qv,rendererPackageName:Mf,currentDispatcherRef:cn,findFiberByHostInstance:eS,reconcilerVersion:"19.0.0"};if(Ph!==null&&(d.rendererConfig=Ph),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")d=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)d=!0;else{try{ts=f.inject(d),Pr=f}catch{}d=!!f.checkDCE}}return d},xn.isAlreadyRendering=function(){return!1},xn.observeVisibleRects=function(d,f,x,M){if(!vu)throw Error(i(363));d=ff(d,f);var N=aS(d,x,M).disconnect;return{disconnect:function(){N()}}},xn.shouldError=function(){return null},xn.shouldSuspend=function(){return!1},xn.startHostTransition=function(d,f,x,M){if(d.tag!==5)throw Error(i(476));var N=Co(d).queue;ph(d,N,f,yu,x===null?n:function(){var L=Co(d).next.queue;return tu(d,L,{},$i()),x(M)})},xn.updateContainer=function(d,f,x,M){var N=f.current,L=$i();return wh(N,L,d,f,x,M),L},xn.updateContainerSync=function(d,f,x,M){return f.tag===0&&oo(),wh(f.current,2,d,f,x,M),2},xn},s.exports.default=s.exports,Object.defineProperty(s.exports,"__esModule",{value:!0})})(H1)),H1.exports}var hL;function z9(){return hL||(hL=1,G1.exports=V9()),G1.exports}var G9=z9();const H9=_M(G9);var dL=N3();function OC(s,e,t){if(!s)return;if(t(s)===!0)return s;let n=e?s.return:s.child;for(;n;){const i=OC(n,e,t);if(i)return i;n=e?null:n.sibling}}function C3(s){try{return Object.defineProperties(s,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return s}}const IC=C3(ze.createContext(null));class w3 extends ze.Component{render(){return ze.createElement(IC.Provider,{value:this._reactInternals},this.props.children)}}function D3(){const s=ze.useContext(IC);if(s===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=ze.useId();return ze.useMemo(()=>{for(const t of[s,s?.alternate]){if(!t)continue;const n=OC(t,!1,i=>{let r=i.memoizedState;for(;r;){if(r.memoizedState===e)return!0;r=r.next}});if(n)return n}},[s,e])}const k9=Symbol.for("react.context"),q9=s=>s!==null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===k9;function W9(){const s=D3(),[e]=ze.useState(()=>new Map);e.clear();let t=s;for(;t;){const n=t.type;q9(n)&&n!==IC&&!e.has(n)&&e.set(n,ze.use(C3(n))),t=t.return}return e}function X9(){const s=W9();return ze.useMemo(()=>Array.from(s.keys()).reduce((e,t)=>
3940n=>ze.createElement(e,null,ze.createElement(t.Provider,{...n,value:s.get(t)})),e=>ze.createElement(w3,{...e})),[s])}function U3(s){let e=s.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const L3=s=>s&&s.isOrthographicCamera,Y9=s=>s&&s.hasOwnProperty("current"),j9=s=>s!=null&&(typeof s=="string"||typeof s=="number"||s.isColor),dx=((s,e)=>typeof window<"u"&&(((s=window.document)==null?void 0:s.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ze.useLayoutEffect:ze.useEffect;function B3(s){const e=ze.useRef(s);return dx(()=>void(e.current=s),[s]),e}function K9(){const s=D3(),e=X9();return ze.useMemo(()=>({children:t})=>{const i=!!OC(s,!0,r=>r.type===ze.StrictMode)?ze.StrictMode:ze.Fragment;return Xe.jsx(i,{children:Xe.jsx(e,{children:t})})},[s,e])}function Z9({set:s}){return dx(()=>(s(new Promise(()=>null)),()=>s(!1)),[s]),null}const Q9=(s=>(s=class extends ze.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},s.getDerivedStateFromError=()=>({error:!0}),s))();function P3(s){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(s)?Math.min(Math.max(s[0],t),s[1]):s}function kg(s){var e;return(e=s.__r3f)==null?void 0:e.root.getState()}const is={obj:s=>s===Object(s)&&!is.arr(s)&&typeof s!="function",fun:s=>typeof s=="function",str:s=>typeof s=="string",num:s=>typeof s=="number",boo:s=>typeof s=="boolean",und:s=>s===void 0,nul:s=>s===null,arr:s=>Array.isArray(s),equ(s,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof s!=typeof e||!!s!=!!e)return!1;if(is.str(s)||is.num(s)||is.boo(s))return s===e;const r=is.obj(s);if(r&&n==="reference")return s===e;const a=is.arr(s);if(a&&t==="reference")return s===e;if((a||r)&&s===e)return!0;let l;for(l in s)if(!(l in e))return!1;if(r&&t==="shallow"&&n==="shallow"){for(l in i?e:s)if(!is.equ(s[l],e[l],{strict:i,objects:"reference"}))return!1}else for(l in i?e:s)if(s[l]!==e[l])return!1;if(is.und(l)){if(a&&s.length===0&&e.length===0||r&&Object.keys(s).length===0&&Object.keys(e).length===0)return!0;if(s!==e)return!1}return!0}};function $9(s){s.type!=="Scene"&&(s.dispose==null||s.dispose());for(const e in s){const t=s[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const O3=["children","key","ref"];function J9(s){const e={};for(const t in s)O3.includes(t)||(e[t]=s[t]);return e}function eM(s,e,t,n){const i=s;let r=i?.__r3f;return r||(r={root:e,type:t,parent:null,children:[],props:J9(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=r)),r}function I0(s,e){let t=s[e];if(!e.includes("-"))return{root:s,key:e,target:t};t=s;for(const i of e.split("-")){var n;e=i,s=t,t=(n=t)==null?void 0:n[e]}return{root:s,key:e,target:t}}const fL=/-\d+$/;function tM(s,e){if(is.str(e.props.attach)){if(fL.test(e.props.attach)){const i=e.props.attach.replace(fL,""),{root:r,key:a}=I0(s.object,i);Array.isArray(r[a])||(r[a]=[])}const{root:t,key:n}=I0(s.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else is.fun(e.props.attach)&&(e.previousAttach=e.props.attach(s.object,e.object))}function nM(s,e){if(is.str(e.props.attach)){const{root:t,key:n}=I0(s.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(s.object,e.object);delete e.previousAttach}const YR=[...O3,"args","dispose","attach","object","onUpdate","dispose"],pL=new Map;function e7(s){let e=pL.get(s.constructor);try{e||(e=new s.constructor,pL.set(s.constructor,e))}catch{}return e}function t7(s,e){const t={};for(const n in e)if(!YR.includes(n)&&!is.equ(e[n],s.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in s.props){if(YR.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:r}=I0(s.object,n);if(i.constructor&&i.constructor.length===0){const a=e7(i);is.und(a)||(t[r]=a[r])}else t[r]=0}return t}const n7=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],i7=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function md(s,e){var t;const n=s.__r3f,i=n&&U3(n).getState(),r=n?.eventCount;for(const l in e){let u=e[l];if(YR.includes(l))continue;if(n&&i7.test(l)){typeof u=="function"?n.handlers[l]=u:delete n.handlers[l],n.eventCount=Object.keys(n.handlers).length;continue}if(u===void 0)continue;let{root:h,key:p,target:g}=I0(s,l);if(g instanceof Oy&&u instanceof Oy)g.mask=u.mask;else if(g instanceof lt&&j9(u))g.set(u);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&u!=null&&u.constructor&&g.constructor===u.constructor)g.copy(u);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(u))typeof g.fromArray=="function"?g.fromArray(u):g.set(...u);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof u=="number")typeof g.setScalar=="function"?g.setScalar(u):g.set(u);else{var a;
vendor: 9,084 bytes, line 3940
3940h[p]=u,i&&!i.linear&&n7.includes(p)&&(a=h[p])!=null&&a.isTexture&&h[p].format===Pi&&h[p].type===ki&&(h[p].colorSpace=lr)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&r!==n.eventCount){const l=n.object,u=i.internal.interaction.indexOf(l);u>-1&&i.internal.interaction.splice(u,1),n.eventCount&&l.raycast!==null&&i.internal.interaction.push(l)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&iv(n),s}function iv(s){var e;if(!s.parent)return;s.props.onUpdate==null||s.props.onUpdate(s.object);const t=(e=s.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function s7(s,e){s.manual||(L3(s)?(s.left=e.width/-2,s.right=e.width/2,s.top=e.height/2,s.bottom=e.height/-2):s.aspect=e.width/e.height,s.updateProjectionMatrix())}const qa=s=>s?.isObject3D;function $b(s){return(s.eventObject||s.object).uuid+"/"+s.index+s.instanceId}function I3(s,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(s.delete(n),i.target.releasePointerCapture(n)))}function r7(s,e){const{internal:t}=s.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{I3(t.capturedMap,e,n,i)})}function a7(s){function e(u){const{internal:h}=s.getState(),p=u.offsetX-h.initialClick[0],g=u.offsetY-h.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(u){return u.filter(h=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=h.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(u,h){const p=s.getState(),g=new Set,y=[],_=h?h(p.internal.interaction):p.internal.interaction;for(let b=0;b<_.length;b++){const C=kg(_[b]);C&&(C.raycaster.camera=void 0)}p.previousRoot||p.events.compute==null||p.events.compute(u,p);function S(b){const C=kg(b);if(!C||!C.events.enabled||C.raycaster.camera===null)return[];if(C.raycaster.camera===void 0){var w;C.events.compute==null||C.events.compute(u,C,(w=C.previousRoot)==null?void 0:w.getState()),C.raycaster.camera===void 0&&(C.raycaster.camera=null)}return C.raycaster.camera?C.raycaster.intersectObject(b,!0):[]}let A=_.flatMap(S).sort((b,C)=>{const w=kg(b.object),D=kg(C.object);return!w||!D?b.distance-C.distance:D.events.priority-w.events.priority||b.distance-C.distance}).filter(b=>{const C=$b(b);return g.has(C)?!1:(g.add(C),!0)});p.events.filter&&(A=p.events.filter(A,p));for(const b of A){let C=b.object;for(;C;){var E;(E=C.__r3f)!=null&&E.eventCount&&y.push({...b,eventObject:C}),C=C.parent}}if("pointerId"in u&&p.internal.capturedMap.has(u.pointerId))for(let b of p.internal.capturedMap.get(u.pointerId).values())g.has($b(b.intersection))||y.push(b.intersection);return y}function i(u,h,p,g){if(u.length){const y={stopped:!1};for(const _ of u){let S=kg(_.object);if(S||_.object.traverseAncestors(A=>{const E=kg(A);if(E)return S=E,!1}),S){const{raycaster:A,pointer:E,camera:b,internal:C}=S,w=new Y(E.x,E.y,0).unproject(b),D=B=>{var O,W;return(O=(W=C.capturedMap.get(B))==null?void 0:W.has(_.eventObject))!=null?O:!1},P=B=>{const O={intersection:_,target:h.target};C.capturedMap.has(B)?C.capturedMap.get(B).set(_.eventObject,O):C.capturedMap.set(B,new Map([[_.eventObject,O]])),h.target.setPointerCapture(B)},I=B=>{const O=C.capturedMap.get(B);O&&I3(C.capturedMap,_.eventObject,O,B)};let F={};for(let B in h){let O=h[B];typeof O!="function"&&(F[B]=O)}let z={..._,...F,pointer:E,intersections:u,stopped:y.stopped,delta:p,unprojectedPoint:w,ray:A.ray,camera:b,stopPropagation(){const B="pointerId"in h&&C.capturedMap.get(h.pointerId);if((!B||B.has(_.eventObject))&&(z.stopped=y.stopped=!0,C.hovered.size&&Array.from(C.hovered.values()).find(O=>O.eventObject===_.eventObject))){const O=u.slice(0,u.indexOf(_));r([...O,_])}},target:{hasPointerCapture:D,setPointerCapture:P,releasePointerCapture:I},currentTarget:{hasPointerCapture:D,setPointerCapture:P,releasePointerCapture:I},nativeEvent:h};if(g(z),y.stopped===!0)break}}}return u}function r(u){const{internal:h}=s.getState();for(const p of h.hovered.values())if(!u.length||!u.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const y=p.eventObject.__r3f;if(h.hovered.delete($b(p)),y!=null&&y.eventCount){const _=y.handlers,S={...p,intersections:u};_.onPointerOut==null||_.onPointerOut(S),_.onPointerLeave==null||_.onPointerLeave(S)}}}function a(u,h){for(let p=0;p<h.length;p++){const g=h[p].__r3f;g==null||g.handlers.onPointerMissed==null||g.handlers.onPointerMissed(u)}}function l(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>r([]);case"onLostPointerCapture":return h=>{const{internal:p}=s.getState();"pointerId"in h&&p.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(h.pointerId)&&(p.capturedMap.delete(h.pointerId),r([]))})}}return function(p){const{onPointerMissed:g,internal:y}=s.getState();y.lastEvent.current=p;const _=u==="onPointerMove",S=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",E=n(p,_?t:void 0),b=S?e(p):0;u==="onPointerDown"&&(y.initialClick=[p.offsetX,p.offsetY],y.initialHits=E.map(w=>w.eventObject)),S&&!E.length&&b<=2&&(a(p,y.interaction),g&&g(p)),_&&r(E);function C(w){const D=w.eventObject,P=D.__r3f;if(!(P!=null&&P.eventCount))return;const I=P.handlers;if(_){if(I.onPointerOver||I.onPointerEnter||I.onPointerOut||I.onPointerLeave){const F=$b(w),z=y.hovered.get(F);z?z.stopped&&w.stopPropagation():(y.hovered.set(F,w),I.onPointerOver==null||I.onPointerOver(w),I.onPointerEnter==null||I.onPointerEnter(w))}I.onPointerMove==null||I.onPointerMove(w)}else{const F=I[u];F?(!S||y.initialHits.includes(D))&&(a(p,y.interaction.filter(z=>!y.initialHits.includes(z))),F(w)):S&&y.initialHits.includes(D)&&a(p,y.interaction.filter(z=>!y.initialHits.includes(z)))}}i(E,p,b,C)}}return{handlePointer:l}}const mL=s=>!!(s!=null&&s.render),F3=ze.createContext(null),o7=(s,e)=>{const t=I9((l,u)=>{const h=new Y,p=new Y,g=new Y;function y(b=u().camera,C=p,w=u().size){const{width:D,height:P,top:I,left:F}=w,z=D/P;C.isVector3?g.copy(C):g.set(...C);const B=b.getWorldPosition(h).distanceTo(g);if(L3(b))return{width:D/b.zoom,height:P/b.zoom,top:I,left:F,factor:1,distance:B,aspect:z};{const O=b.fov*Math.PI/180,W=2*Math.tan(O/2)*B,ee=W*(D/P);return{width:ee,height:W,top:I,left:F,factor:D/ee,distance:B,aspect:z}}}let _;const S=b=>l(C=>({performance:{...C.performance,current:b}})),A=new Ge;return{set:l,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(b=1)=>s(u(),b),advance:(b,C)=>e(b,C,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new UC,pointer:A,mouse:A,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const b=u();_&&clearTimeout(_),b.performance.current!==b.performance.min&&S(b.performance.min),_=setTimeout(()=>S(u().performance.max),b.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:y},setEvents:b=>l(C=>({...C,events:{...C.events,...b}})),setSize:(b,C,w=0,D=0)=>{const P=u().camera,I={width:b,height:C,top:w,left:D};l(F=>({size:I,viewport:{...F.viewport,...y(P,p,I)}}))},setDpr:b=>l(C=>{const w=P3(b);return{viewport:{...C.viewport,dpr:w,initialDpr:C.viewport.initialDpr||w}}}),setFrameloop:(b="always")=>{const C=u().clock;C.stop(),C.elapsedTime=0,b!=="never"&&(C.start(),C.elapsedTime=0),l(()=>({frameloop:b}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ze.createRef(),active:!1,frames:0,priority:0,subscribe:(b,C,w)=>{const D=u().internal;return D.priority=D.priority+(C>0?1:0),D.subscribers.push({ref:b,priority:C,store:w}),D.subscribers=D.subscribers.sort((P,I)=>P.priority-I.priority),()=>{const P=u().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(C>0?1:0),P.subscribers=P.subscribers.filter(I=>I.ref!==b))}}}}}),n=t.getState();let i=n.size,r=n.viewport.dpr,a=n.camera;return t.subscribe(()=>{const{camera:l,size:u,viewport:h,gl:p,set:g}=t.getState();if(u.width!==i.width||u.height!==i.height||h.dpr!==r){i=u,r=h.dpr,s7(l,u),h.dpr>0&&p.setPixelRatio(h.dpr);const y=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(u.width,u.height,y)}l!==a&&(a=l,g(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(l)}})))}),t.subscribe(l=>s(l)),t};function V3(){const s=ze.useContext(F3);if(!s)throw new Error("R3F: Hooks can only be used within the Canvas component!");return s}function Hr(s=t=>t,e){return V3()(s,e)}function z3(s,e=0){const t=V3(),n=t.getState().internal.subscribe,i=B3(s);return dx(()=>n(i,e,t),[e,n,t]),null}function l7(s){const e=H9(s);return e.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:ze.version}),e}const G3=0,Vy={},u7=/^three(?=[A-Z])/,gE=s=>`${s[0].toUpperCase()}${s.slice(1)}`;let c7=0;const h7=s=>typeof s=="function";
3940function d7(s){if(h7(s)){const e=`${c7++}`;return Vy[e]=s,e}else Object.assign(Vy,s)}function H3(s,e){const t=gE(s),n=Vy[t];if(s!=="primitive"&&!n)throw new Error(`R3F: ${t} 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(s==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function f7(s,e,t){var n;return s=gE(s)in Vy?s:s.replace(u7,""),H3(s,e),s==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,eM(e.object,t,s,e)}function p7(s){if(!s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?nM(s.parent,s):qa(s.object)&&(s.object.visible=!1),s.isHidden=!0,iv(s)}}function k3(s){if(s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?tM(s.parent,s):qa(s.object)&&s.props.visible!==!1&&(s.object.visible=!0),s.isHidden=!1,iv(s)}}function FC(s,e,t){const n=e.root.getState();if(!(!s.parent&&s.object!==n.scene)){if(!e.object){var i,r;const a=Vy[gE(e.type)];e.object=(i=e.props.object)!=null?i:new a(...(r=e.props.args)!=null?r:[]),e.object.__r3f=e}if(md(e.object,e.props),e.props.attach)tM(s,e);else if(qa(e.object)&&qa(s.object)){const a=s.object.children.indexOf(t?.object);if(t&&a!==-1){const l=s.object.children.indexOf(e.object);if(l!==-1){s.object.children.splice(l,1);const u=l<a?a-1:a;s.object.children.splice(u,0,e.object)}else e.object.parent=s.object,s.object.children.splice(a,0,e.object),e.object.dispatchEvent({type:"added"}),s.object.dispatchEvent({type:"childadded",child:e.object})}else s.object.add(e.object)}for(const a of e.children)FC(e,a);iv(e)}}function W1(s,e){e&&(e.parent=s,s.children.push(e),FC(s,e))}function gL(s,e,t){if(!e||!t)return;e.parent=s;const n=s.children.indexOf(t);n!==-1?s.children.splice(n,0,e):s.children.push(e),FC(s,e,t)}function q3(s){if(typeof s.dispose=="function"){const e=()=>{try{s.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():dL.unstable_scheduleCallback(dL.unstable_IdlePriority,e)}}function jR(s,e,t){if(!e)return;e.parent=null;const n=s.children.indexOf(e);n!==-1&&s.children.splice(n,1),e.props.attach?nM(s,e):qa(e.object)&&qa(s.object)&&(s.object.remove(e.object),r7(U3(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let r=e.children.length-1;r>=0;r--){const a=e.children[r];jR(e,a,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&q3(e.object),t===void 0&&iv(e)}function m7(s,e){for(const t of[s,s.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const NT=[];function g7(){for(const[t]of NT){const n=t.parent;if(n){t.props.attach?nM(n,t):qa(t.object)&&qa(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?nM(t,i):qa(i.object)&&qa(t.object)&&t.object.remove(i.object)}t.isHidden&&k3(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&q3(t.object)}for(const[t,n,i]of NT){t.props=n;const r=t.parent;if(r){var s,e;const a=Vy[gE(t.type)];
3940t.object=(s=t.props.object)!=null?s:new a(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,m7(i,t.object),md(t.object,t.props),t.props.attach?tM(r,t):qa(t.object)&&qa(r.object)&&r.object.add(t.object);for(const l of t.children)l.props.attach?tM(t,l):qa(l.object)&&qa(t.object)&&t.object.add(l.object);iv(t)}}NT.length=0}const X1=()=>{},yL={};let Jb=G3;const y7=0,v7=4,KR=l7({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:f7,removeChild:jR,appendChild:W1,appendInitialChild:W1,insertBefore:gL,appendChildToContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||W1(t,e)},removeChildFromContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||jR(t,e)},insertInContainerBefore(s,e,t){const n=s.getState().scene.__r3f;!e||!t||!n||gL(n,e,t)},getRootHostContext:()=>yL,getChildHostContext:()=>yL,commitUpdate(s,e,t,n,i){var r,a,l;H3(e,n);let u=!1;if((s.type==="primitive"&&t.object!==n.object||((r=n.args)==null?void 0:r.length)!==((a=t.args)==null?void 0:a.length)||(l=n.args)!=null&&l.some((p,g)=>{var y;return p!==((y=t.args)==null?void 0:y[g])}))&&(u=!0),u)NT.push([s,{...n},i]);else{const p=t7(s,n);Object.keys(p).length&&(Object.assign(s.props,p),md(s.object,p))}(i.sibling===null||(i.flags&v7)===y7)&&g7()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:s=>s?.object,prepareForCommit:()=>null,preparePortalMount:s=>eM(s.getState().scene,s,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:p7,unhideInstance:k3,createTextInstance:X1,hideTextInstance:X1,unhideTextInstance:X1,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ze.createContext(null),setCurrentUpdatePriority(s){Jb=s},getCurrentUpdatePriority(){return Jb},resolveUpdatePriority(){var s;if(Jb!==G3)return Jb;switch(typeof window<"u"&&((s=window.event)==null?void 0:s.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return ET.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return ET.ContinuousEventPriority;default:return ET.DefaultEventPriority}},resetFormInstance(){}}),rm=new Map,qg={objects:"shallow",strict:!1};function _7(s,e){if(!e&&typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement&&s.parentElement){const{width:t,height:n,top:i,left:r}=s.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:r}}else if(!e&&typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas)return{width:s.width,height:s.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function x7(s){const e=rm.get(s),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,r=n||o7($R,_L),a=t||KR.createContainer(r,ET.ConcurrentRoot,null,!1,null,"",i,i,i,null);e||rm.set(s,{fiber:a,store:r});let l,u,h=!1,p=null;return{async configure(g={}){let y;p=new Promise(oe=>y=oe);let{gl:_,size:S,scene:A,events:E,onCreated:b,shadows:C=!1,linear:w=!1,flat:D=!1,legacy:P=!1,orthographic:I=!1,frameloop:F="always",dpr:z=[1,2],performance:B,raycaster:O,camera:W,onPointerMissed:ee}=g,se=r.getState(),fe=se.gl;if(!se.gl){const oe={canvas:s,powerPreference:"high-performance",antialias:!0,alpha:!0},we=typeof _=="function"?await _(oe):_;mL(we)?fe=we:fe=new R3({...oe,..._}),se.set({gl:fe})}let pe=se.raycaster;pe||se.set({raycaster:pe=new _3});const{params:k,...Q}=O||{};if(is.equ(Q,pe,qg)||md(pe,{...Q}),is.equ(k,pe.params,qg)||md(pe,{params:{...pe.params,...k}}),!se.camera||se.camera===u&&!is.equ(u,W,qg)){u=W;const oe=W?.isCamera,we=oe?W:I?new gm(0,0,0,0,.1,1e3):new ps(75,0,.1,1e3);oe||(we.position.z=5,W&&(md(we,W),we.manual||("aspect"in W||"left"in W||"right"in W||"bottom"in W||"top"in W)&&(we.manual=!0,we.updateProjectionMatrix())),!se.camera&&!(W!=null&&W.rotation)&&we.lookAt(0,0,0)),se.set({camera:we}),pe.camera=we}if(!se.scene){let oe;A!=null&&A.isScene?(oe=A,eM(oe,r,"",{})):(oe=new Jy,eM(oe,r,"",{}),A&&md(oe,A)),se.set({scene:oe})}E&&!se.events.handlers&&se.set({events:E(r)});const J=_7(s,S);if(is.equ(J,se.size,qg)||se.setSize(J.width,J.height,J.top,J.left),z&&se.viewport.dpr!==P3(z)&&se.setDpr(z),se.frameloop!==F&&se.setFrameloop(F
3940),se.onPointerMissed||se.set({onPointerMissed:ee}),B&&!is.equ(B,se.performance,qg)&&se.set(oe=>({performance:{...oe.performance,...B}})),!se.xr){var Se;const oe=(Ze,mt)=>{const xe=r.getState();xe.frameloop!=="never"&&_L(Ze,!0,xe,mt)},we=()=>{const Ze=r.getState();Ze.gl.xr.enabled=Ze.gl.xr.isPresenting,Ze.gl.xr.setAnimationLoop(Ze.gl.xr.isPresenting?oe:null),Ze.gl.xr.isPresenting||$R(Ze)},Ie={connect(){const Ze=r.getState().gl;Ze.xr.addEventListener("sessionstart",we),Ze.xr.addEventListener("sessionend",we)},disconnect(){const Ze=r.getState().gl;Ze.xr.removeEventListener("sessionstart",we),Ze.xr.removeEventListener("sessionend",we)}};typeof((Se=fe.xr)==null?void 0:Se.addEventListener)=="function"&&Ie.connect(),se.set({xr:Ie})}if(fe.shadowMap){const oe=fe.shadowMap.enabled,we=fe.shadowMap.type;if(fe.shadowMap.enabled=!!C,is.boo(C))fe.shadowMap.type=d0;else if(is.str(C)){var K;const Ie={basic:IN,percentage:Y0,soft:d0,variance:ya};fe.shadowMap.type=(K=Ie[C])!=null?K:d0}else is.obj(C)&&Object.assign(fe.shadowMap,C);(oe!==fe.shadowMap.enabled||we!==fe.shadowMap.type)&&(fe.shadowMap.needsUpdate=!0)}return Kt.enabled=!P,h||(fe.outputColorSpace=w?Yl:lr,fe.toneMapping=D?Rr:BM),se.legacy!==P&&se.set(()=>({legacy:P})),se.linear!==w&&se.set(()=>({linear:w})),se.flat!==D&&se.set(()=>({flat:D})),_&&!is.fun(_)&&!mL(_)&&!is.equ(_,fe,qg)&&md(fe,_),l=b,h=!0,y(),this},render(g){return!h&&!p&&this.configure(),p.then(()=>{KR.updateContainer(Xe.jsx(S7,{store:r,children:g,onCreated:l,rootElement:s}),a,null,()=>{})}),r},unmount(){W3(s)}}}function S7({store:s,children:e,onCreated:t,rootElement:n}){return dx(()=>{const i=s.getState();i.set(r=>({internal:{...r.internal,active:!0}})),t&&t(i),s.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),Xe.jsx(F3.Provider,{value:s,children:e})}function W3(s,e){const t=rm.get(s),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),KR.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var r,a,l,u;i.events.disconnect==null||i.events.disconnect(),(r=i.gl)==null||(a=r.renderLists)==null||a.dispose==null||a.dispose(),(l=i.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),(u=i.gl)!=null&&u.xr&&i.xr.disconnect(),$9(i.scene),rm.delete(s)}catch{}},500)})}}function b7(s,e){const t={callback:s};return e.add(t),()=>void e.delete(t)}const T7=new Set,X3=new Set,M7=new Set,E7=s=>b7(s,X3);function Y1(s,e){if(s.size)for(const{callback:t}of s.values())t(e)}function y0(s,e){switch(s){case"before":return Y1(T7,e);case"after":return Y1(X3,e);case"tail":return Y1(M7,e)}}let j1,K1;function ZR(s,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof s=="number"&&(n=s-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=s),j1=e.internal.subscribers;for(let i=0;i<j1.length;i++)K1=j1[i],K1.ref.current(K1.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let iM=!1,QR=!1,Z1,vL,Wg;function Y3(s){vL=requestAnimationFrame(Y3),iM=!0,Z1=0,y0("before",s),QR=!0;for(const t of rm.values()){var e;Wg=t.store.getState(),Wg.internal.active&&(Wg.frameloop==="always"||Wg.internal.frames>0)&&!((e=Wg.gl.xr)!=null&&e.isPresenting)&&(Z1+=ZR(s,Wg))}if(QR=!1,y0("after",s),Z1===0)return y0("tail",s),iM=!1,cancelAnimationFrame(vL)}function $R(s,e=1){var t;if(!s)return rm.forEach(n=>$R(n.store.getState(),e));(t=s.gl.xr)!=null&&t.isPresenting||!s.internal.active||s.frameloop==="never"||(e>1?s.internal.frames=Math.min(60,s.internal.frames+e):QR?s.internal.frames=2:s.internal.frames=1,iM||(iM=!0,requestAnimationFrame(Y3)))}function _L(s,e=!0,t,n){if(e&&y0("before",s),t)ZR(s,t,n);else for(const i of rm.values())ZR(s,i.store.getState());e&&y0("after",s)}const Q1={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 A7(s){const{handlePointer:e}=a7(s);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Q1).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=s.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=s.getState();if(i.disconnect==null||i.disconnect(),n(r=>({events:{...r.events,connected:t}})),i.handlers)for(const r in i.handlers){const a=i.handlers[r],[l,u]=Q1[r];t.addEventListener(l,a,{passive:u})}},disconnect:()=>{const{set:t,events:n}=s.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const r=n.handlers[i],[a]=Q1[i];n.connected.removeEventListener(a,r)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function xL(s,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>s(...n),e)}}function R7({debounce:s,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)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[r,a]=ze.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}
3940),l=ze.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:r,orientationHandler:null}),u=s?typeof s=="number"?s:s.scroll:null,h=s?typeof s=="number"?s:s.resize:null,p=ze.useRef(!1);ze.useEffect(()=>(p.current=!0,()=>void(p.current=!1)));const[g,y,_]=ze.useMemo(()=>{const b=()=>{if(!l.current.element)return;const{left:C,top:w,width:D,height:P,bottom:I,right:F,x:z,y:B}=l.current.element.getBoundingClientRect(),O={left:C,top:w,width:D,height:P,bottom:I,right:F,x:z,y:B};l.current.element instanceof HTMLElement&&n&&(O.height=l.current.element.offsetHeight,O.width=l.current.element.offsetWidth),Object.freeze(O),p.current&&!D7(l.current.lastBounds,O)&&a(l.current.lastBounds=O)};return[b,h?xL(b,h):b,u?xL(b,u):b]},[a,n,u,h]);function S(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(b=>b.removeEventListener("scroll",_,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null),l.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",l.current.orientationHandler))}function A(){l.current.element&&(l.current.resizeObserver=new i(_),l.current.resizeObserver.observe(l.current.element),e&&l.current.scrollContainers&&l.current.scrollContainers.forEach(b=>b.addEventListener("scroll",_,{capture:!0,passive:!0})),l.current.orientationHandler=()=>{_()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",l.current.orientationHandler))}const E=b=>{!b||b===l.current.element||(S(),l.current.element=b,l.current.scrollContainers=j3(b),A())};return C7(_,!!e),N7(y),ze.useEffect(()=>{S(),A()},[e,_,y]),ze.useEffect(()=>S,[]),[E,r,g]}function N7(s){ze.useEffect(()=>{const e=s;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[s])}function C7(s,e){ze.useEffect(()=>{if(e){const t=s;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[s,e])}function j3(s){const e=[];if(!s||s===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(s);return[t,n,i].some(r=>r==="auto"||r==="scroll")&&e.push(s),[...e,...j3(s.parentElement)]}const w7=["x","y","top","bottom","left","right","width","height"],D7=(s,e)=>w7.every(t=>s[t]===e[t]);function U7({ref:s,children:e,fallback:t,resize:n,style:i,gl:r,events:a=A7,eventSource:l,eventPrefix:u,shadows:h,linear:p,flat:g,legacy:y,orthographic:_,frameloop:S,dpr:A,performance:E,raycaster:b,camera:C,scene:w,onPointerMissed:D,onCreated:P,...I}){ze.useMemo(()=>d7(U9),[]);const F=K9(),[z,B]=R7({scroll:!0,debounce:{scroll:50,resize:0},...n}),O=ze.useRef(null),W=ze.useRef(null);ze.useImperativeHandle(s,()=>O.current);const ee=B3(D),[se,fe]=ze.useState(!1),[pe,k]=ze.useState(!1);if(se)throw se;if(pe)throw pe;const Q=ze.useRef(null);dx(()=>{const Se=O.current;if(B.width>0&&B.height>0&&Se){Q.current||(Q.current=x7(Se));async function K(){await Q.current.configure({gl:r,scene:w,events:a,shadows:h,linear:p,flat:g,legacy:y,orthographic:_,frameloop:S,dpr:A,performance:E,raycaster:b,camera:C,size:B,onPointerMissed:(...oe)=>ee.current==null?void 0:ee.current(...oe),onCreated:oe=>{oe.events.connect==null||oe.events.connect(l?Y9(l)?l.current:l:W.current),u&&oe.setEvents({compute:(we,Ie)=>{const Ze=we[u+"X"],mt=we[u+"Y"];Ie.pointer.set(Ze/Ie.size.width*2-1,-(mt/Ie.size.height)*2+1),Ie.raycaster.setFromCamera(Ie.pointer,Ie.camera)}}),P?.(oe)}}),Q.current.render(Xe.jsx(F,{children:Xe.jsx(Q9,{set:k,children:Xe.jsx(ze.Suspense,{fallback:Xe.jsx(Z9,{set:fe}),children:e??null})})}))}K()}}),ze.useEffect(()=>{const Se=O.current;if(Se)return()=>W3(Se)},[]);const J=l?"none":"auto";return Xe.jsx("div",{ref:W,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:J,...i},...I,children:Xe.jsx("div",{ref:z,style:{width:"100%",height:"100%"},children:Xe.jsx("canvas",{ref:O,style:{display:"block"},children:t})})})}function L7(s){return Xe.jsx(w3,{children:Xe.jsx(U7,{...s})})}function JR(){return JR=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},JR.apply(null,arguments)}function B7(s,e,t){const n=Hr(_=>_.size),i=Hr(_=>_.viewport),r=typeof s=="number"?s:n.width*i.dpr,a=n.height*i.dpr,l=(typeof s=="number"?t:s)||{},{samples:u=0,depth:h,...p}=l,g=h??l.depthBuffer,y=ze.useMemo(()=>{const _=new jl(r,a,{minFilter:hi,magFilter:hi,type:As,...p});return g&&(_.depthTexture=new Ta(r,a,Bi)),_.samples=u,_},[]);return ze.useLayoutEffect(()=>{y.setSize(r,a),u&&(y.samples=u)},[u,y,r,a]),ze.useEffect(()=>()=>y.dispose(),[]),y}const P7=s=>typeof s=="function",O7=ze.forwardRef(({envMap:s,resolution:e=256,frames:t=1/0,children:n,makeDefault:i,...r},a)=>{const l=Hr(({set:E})=>E),u=Hr(({camera:E})=>E),h=Hr(({size:E})=>E),p=ze.useRef(null);ze.useImperativeHandle(a,()=>p.current,[]);const g=ze.useRef(null),y=B7(e);ze.useLayoutEffect(()=>{r.manual||p.current.updateProjectionMatrix()},[h,r]),ze.useLayoutEffect(()=>{p.current.updateProjectionMatrix()}),ze.useLayoutEffect(()=>{if(i){const E=u;return l(()=>({camera:p.current})),()=>l(()=>({camera:E}))}},[p,i,l]);let _=0,S=null;const A=P7(n);return z3(E=>{A&&(t===1/0||_<t)&&(g.current.visible=!1,E.gl.setRenderTarget(y),S=E.scene.background,s&&(E.scene.background=s),E.gl.render(E.scene,p.current),E.scene.background=S,E.gl.setRenderTarget(null),g.current.visible=!0,_++)}),ze.createElement(ze.Fragment,null,ze.createElement("orthographicCamera",JR({left:h.width/-2,right:h.width/2,top:h.height/2,bottom:h.height/-2,ref:p},r),!A&&n),ze.createElement("group",{ref:g},A&&n(y.texture)))});class I7{constructor(e,t,n){this.name=e,this.fg=t,this.bg=n,this.gradient=null,this.PR=Math.round(window.devicePixelRatio||1),this.WIDTH=90*this.PR,this.HEIGHT=48*this.PR,this.TEXT_X=3*this.PR,this.TEXT_Y=2*this.PR,this.GRAPH_X=3*this.PR,this.GRAPH_Y=15*this.PR,this.GRAPH_WIDTH=84*this.PR,this.GRAPH_HEIGHT=30*this.PR,this.canvas=document.createElement("canvas"),this.canvas.width=this.WIDTH,this.canvas.height=this.HEIGHT,this.canvas.style.width="90px",this.canvas.style.height="48px",this.canvas.style.position="absolute",this.canvas.style.cssText="width:90px;height:48px",this.context=this.canvas.getContext("2d"),this.initializeCanvas()}createGradient(){if(!this.context)throw new Error("No context");const e=this.context.createLinearGradient(0,this.GRAPH_Y,0,this.GRAPH_Y+this.GRAPH_HEIGHT);let t;const n=this.fg;switch(this.fg.toLowerCase()){case"#0ff":t="#006666";break;case"#0f0":t="#006600";break;case"#ff0":t="#666600";break;case"#e1e1e1":t="#666666";break;default:t=this.bg;break}return e.addColorStop(0,t),e.addColorStop(1,n),e}initializeCanvas(){this.context&&(this.context.font="bold "+9*this.PR+"px Helvetica,Arial,sans-serif",this.context.textBaseline="top",this.gradient=this.createGradient(),this.context.fillStyle=this.bg,this.context.fillRect(0,0,this.WIDTH,this.HEIGHT),this.context.fillStyle=this.fg,this.context.fillText(this.name,this.TEXT_X,this.TEXT_Y),this.context.fillStyle=this.fg,this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT))}update(e,t,n,i,r=0){if(!this.context||!this.gradient)return;const a=Math.min(1/0,e),l=Math.max(n,e);i=Math.max(i,t),this.context.globalAlpha=1,this.context.fillStyle=this.bg,this.context.fillRect(0,0,this.WIDTH,this.GRAPH_Y),this.context.fillStyle=this.fg,this.context.fillText(`${e.toFixed(r)} ${this.name} (${a.toFixed(r)}-${parseFloat(l.toFixed(r))})`,this.TEXT_X,this.TEXT_Y),this.context.drawImage(this.canvas,this.GRAPH_X+this.PR,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT,this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT);const u=this.GRAPH_HEIGHT-(1-t/i)*this.GRAPH_HEIGHT;u>0&&(this.context.globalAlpha=1,this.context.fillStyle=this.gradient,this.context.fillRect(this.GRAPH_X+this.GRAPH_WIDTH-this.PR,this.GRAPH_Y+this.GRAPH_HEIGHT-u,this.PR,u))}}const K3=class ny{constructor({trackGPU:e=!1,logsPerSecond:t=30,samplesLog:n=60,samplesGraph:i=10,precision:r=2,minimal:a=!1,horizontal:l=!0,mode:u=0}={}){this.gl=null,this.ext=null,this.activeQuery=null,this.gpuQueries=[],this.threeRendererPatched=!1,this.frames=0,this.renderCount=0,this.isRunningCPUProfiling=!1,this.totalCpuDuration=0,this.totalGpuDuration=0,this.totalGpuDurationCompute=0,this.totalFps=0,this.gpuPanel=null,this.gpuPanelCompute=null,this.averageFps={logs:[],graph:[]},this.averageCpu={logs:[],graph:[]},this.averageGpu={logs:[],graph:[]},this.averageGpuCompute={logs:[],graph:[]},this.handleClick=h=>{h.preventDefault(),this.showPanel(++this.mode%this.dom.children.length)},this.handleResize=()=>{this.resizePanel(this.fpsPanel,0),this.resizePanel(this.msPanel,1),this.gpuPanel&&this.resizePanel(this.gpuPanel,2),this.gpuPanelCompute&&this.resizePanel(this.gpuPanelCompute,3)},this.mode=u,this.horizontal=l,this.minimal=a,this.trackGPU=e,this.samplesLog=n,this.samplesGraph=i,this.precision=r,this.logsPerSecond=t,this.dom=document.createElement("div"),this.initializeDOM(),this.beginTime=performance.now(),this.prevTime=this.beginTime,this.prevCpuTime=this.beginTime,this.fpsPanel=this.addPanel
3940(new ny.Panel("FPS","#0ff","#002"),0),this.msPanel=this.addPanel(new ny.Panel("CPU","#0f0","#020"),1),this.setupEventListeners()}initializeDOM(){this.dom.style.cssText=` 3941 position: fixed; 3942 top: 0; 3943 left: 0; 3944 opacity: 0.9; 3945 z-index: 10000; 3946 ${this.minimal?"cursor: pointer;":""} 3947 `}setupEventListeners(){this.minimal?(this.dom.addEventListener("click",this.handleClick),this.showPanel(this.mode)):window.addEventListener("resize",this.handleResize)}async init(e){if(!e){console.error('Stats: The "canvas" parameter is undefined.');return}this.handleThreeRenderer(e)||await this.handleWebGPURenderer(e)||this.initializeWebGL(e)}handleThreeRenderer(e){return e.isWebGLRenderer&&!this.threeRendererPatched?(this.patchThreeRenderer(e),this.gl=e.getContext(),this.trackGPU&&this.initializeGPUTracking(),!0):!1}async handleWebGPURenderer(e){return e.isWebGPURenderer?(this.trackGPU&&(e.backend.trackTimestamp=!0,await e.hasFeatureAsync("timestamp-query")&&this.initializeWebGPUPanels()),this.info=e.info,!0):!1}initializeWebGPUPanels(){this.gpuPanel=this.addPanel(new ny.Panel("GPU","#ff0","#220"),2),this.gpuPanelCompute=this.addPanel(new ny.Panel("CPT","#e1e1e1","#212121"),3)}initializeWebGL(e){if(e instanceof WebGL2RenderingContext)this.gl=e;else if(e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas){if(this.gl=e.getContext("webgl2"),!this.gl)return console.error("Stats: Unable to obtain WebGL2 context."),!1}else return console.error("Stats: Invalid input type. Expected WebGL2RenderingContext, HTMLCanvasElement, or OffscreenCanvas."),!1;return!0}initializeGPUTracking(){this.gl&&(this.ext=this.gl.getExtension("EXT_disjoint_timer_query_webgl2"),this.ext&&(this.gpuPanel=this.addPanel(new ny.Panel("GPU","#ff0","#220"),2)))}begin(){this.isRunningCPUProfiling||this.beginProfiling("cpu-started"),!(!this.gl||!this.ext)&&(this.activeQuery&&this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.activeQuery=this.gl.createQuery(),this.activeQuery&&this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,this.activeQuery))}end(){this.renderCount++,this.gl&&this.ext&&this.activeQuery&&(this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.gpuQueries.push({query:this.activeQuery}),this.activeQuery=null)}update(){this.info?this.processWebGPUTimestamps():this.processGpuQueries(),this.endProfiling("cpu-started","cpu-finished","cpu-duration"),this.updateAverages(),this.resetCounters()}processWebGPUTimestamps(){this.totalGpuDuration=this.info.render.timestamp,this.totalGpuDurationCompute=this.info.compute.timestamp,this.addToAverage(this.totalGpuDurationCompute,this.averageGpuCompute)}updateAverages(){this.addToAverage(this.totalCpuDuration,this.averageCpu),this.addToAverage(this.totalGpuDuration,this.averageGpu)}resetCounters(){this.renderCount=0,this.totalCpuDuration===0&&this.beginProfiling("cpu-started"),this.totalCpuDuration=0,this.totalFps=0,this.beginTime=this.endInternal()}resizePanel(e,t){e.canvas.style.position="absolute",this.minimal?e.canvas.style.display="none":(e.canvas.style.display="block",this.horizontal?(e.canvas.style.top="0px",e.canvas.style.left=t*e.WIDTH/e.PR+"px"):(e.canvas.style.left="0px",e.canvas.style.top=t*e.HEIGHT/e.PR+"px"))}addPanel(e,t){return e.canvas&&(this.dom.appendChild(e.canvas),this.resizePanel(e,t)),e}showPanel(e){for(let t=0;t<this.dom.children.length;t++){const n=this.dom.children[t];n.style.display=t===e?"block":"none"}this.mode=e}processGpuQueries(){!this.gl||!this.ext||(this.totalGpuDuration=0,this.gpuQueries.forEach((e,t)=>{if(this.gl){const n=this.gl.getQueryParameter(e.query,this.gl.QUERY_RESULT_AVAILABLE),i=this.gl.getParameter(this.ext.GPU_DISJOINT_EXT);if(n&&!i){const a=this.gl.getQueryParameter(e.query,this.gl.QUERY_RESULT)*1e-6;this.totalGpuDuration+=a,this.gl.deleteQuery(e.query),this.gpuQueries.splice(t,1)}}}))}endInternal(){this.frames++;const e=(performance||Date).now(),t=e-this.prevTime;if(e>=this.prevCpuTime+1e3/this.logsPerSecond){const n=Math.round(this.frames*1e3/t);this.addToAverage(n,this.averageFps),this.updatePanel(this.fpsPanel,this.averageFps,0),this.updatePanel(this.msPanel,this.averageCpu,this.precision),this.updatePanel(this.gpuPanel,this.averageGpu,this.precision),this.gpuPanelCompute&&this.updatePanel(this.gpuPanelCompute,this.averageGpuCompute),this.frames=0,this.prevCpuTime=e,this.prevTime=e}return e}addToAverage(e,t){t.logs.push(e),t.logs.length>this.samplesLog&&t.logs.shift(),t.graph.push(e),t.graph.length>this.samplesGraph&&t.graph.shift()}beginProfiling(e){window.performance&&(window.performance.mark(e),this.isRunningCPUProfiling=!0)}endProfiling(e,t,n){if(window.performance&&t&&this.isRunningCPUProfiling){window.performance.mark(t);const i=performance.measure(n,e,t);this.totalCpuDuration+=i.duration,this.isRunningCPUProfiling=!1}}updatePanel(e,t,n=2){if(t.logs.length>0){let i=0,r=.01;for(let u=0;u<t.logs.length;u++)i+=t.logs[u],t.logs[u]>r&&(r=t.logs[u]);let a=0,l=.01;for(let u=0;u<t.graph.length;u++)a+=t.graph[u],t.graph[u]>l&&(l=t.graph[u]);e&&e.update(i/Math.min(t.logs.length,this.samplesLog),a/Math.min(t.graph.length,this.samplesGraph),r,l,n)}}get domElement(){return this.dom}patchThreeRenderer(e){const t=e.render,n=this;e.render=function(i,r){n.begin(),t.call(this,i,r),n.end()},this.threeRendererPatched=!0}};K3.Panel=I7;let F7=K3;const V7=ze.forwardRef(function({className:e,parent:t,id:n,clearStatsGlStyle:i,...r},a){const l=Hr(h=>h.gl),u=ze.useMemo(()=>{const h=new F7({...r});return h.init(l),h},[l]);return ze.useImperativeHandle(a,()=>u.domElement,[u]),ze.useEffect(()=>{if(u){const h=t&&t.current||document.body;h?.appendChild(u.domElement),u.domElement.querySelectorAll("canvas").forEach(y=>{y.style.removeProperty("position")}),n&&(u.domElement.id=n),i&&u.domElement.removeAttribute("style"),u.domElement.removeAttribute("style");const p=(e??"").split(" ").filter(y=>y);p.length&&u.domElement.classList.add(...p);const g=E7(()=>
3947u.update());return()=>{p.length&&u.domElement.classList.remove(...p),h?.removeChild(u.domElement),g()}}},[t,u,e,n,i]),null});function z7({all:s,scene:e,camera:t}){const n=Hr(({gl:a})=>a),i=Hr(({camera:a})=>a),r=Hr(({scene:a})=>a);return ze.useLayoutEffect(()=>{const a=[];s&&(e||r).traverse(h=>{h.visible===!1&&(a.push(h),h.visible=!0)}),n.compile(e||r,t||i);const l=new YM(128);new XM(.01,1e5,l).update(n,e||r),l.dispose(),a.forEach(h=>h.visible=!1)},[]),null}function G7({pixelated:s}){const e=Hr(a=>a.gl),t=Hr(a=>a.internal.active),n=Hr(a=>a.performance.current),i=Hr(a=>a.viewport.initialDpr),r=Hr(a=>a.setDpr);return ze.useEffect(()=>{const a=e.domElement;return()=>{t&&r(i),s&&a&&(a.style.imageRendering="auto")}},[]),ze.useEffect(()=>{r(n*i),s&&e.domElement&&(e.domElement.style.imageRendering=n===1?"auto":"pixelated")},[n]),null}/** 3948 * @license 3949 * Copyright 2010-2025 Three.js Authors 3950 * SPDX-License-Identifier: MIT 3951 */const H7=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],$1=new WeakMap;class k7{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=H7,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){const t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){const{geometry:n,material:i,object:r}=e;if(t={material:this.getMaterialData(i),geometry:{id:n.id,attributes:this.getAttributesData(n.attributes),indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){const{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const n in e){const i=e[n];t[n]={version:i.version}}return t}containsNode(e){const t=e.material;for(const n in t)if(t[n]&&t[n].isNode)return!0;return e.renderer.overrideNodes.modelViewMatrix!==null||e.renderer.overrideNodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const i=e[n];i!=null&&(typeof i=="object"&&i.clone!==void 0?i.isTexture===!0?t[n]={id:i.id,version:i.version}:t[n]=i.clone():t[n]=i)}return t}equals(e,t){const{object:n,material:i,geometry:r}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(n.matrixWorld)!==!0)return a.worldMatrix.copy(n.matrixWorld),!1;const l=a.material;for(const E in l){const b=l[E],C=i[E];if(b.equals!==void 0){if(b.equals(C)===!1)return b.copy(C),!1}else if(C.isTexture===!0){if(b.id!==C.id||b.version!==C.version)return b.id=C.id,b.version=C.version,!1}else if(b!==C)return l[E]=C,!1}if(l.transmission>0){const{width:E,height:b}=e.context;if(a.bufferWidth!==E||a.bufferHeight!==b)return a.bufferWidth=E,a.bufferHeight=b,!1}const u=a.geometry,h=r.attributes,p=u.attributes,g=Object.keys(p),y=Object.keys(h);if(u.id!==r.id)return u.id=r.id,!1;if(g.length!==y.length)return a.geometry.attributes=this.getAttributesData(h),!1;for(const E of g){const b=p[E],C=h[E];if(C===void 0)return delete p[E],!1;if(b.version!==C.version)return b.version=C.version,!1}const _=r.index,S=u.indexVersion,A=_?_.version:null;if(S!==A)return u.indexVersion=A,!1;
3951if(u.drawRange.start!==r.drawRange.start||u.drawRange.count!==r.drawRange.count)return u.drawRange.start=r.drawRange.start,u.drawRange.count=r.drawRange.count,!1;if(a.morphTargetInfluences){let E=!1;for(let b=0;b<a.morphTargetInfluences.length;b++)a.morphTargetInfluences[b]!==n.morphTargetInfluences[b]&&(E=!0);if(E)return!0}if(a.lights){for(let E=0;E<t.length;E++)if(a.lights[E].map!==t[E].map)return!1}return a.center&&a.center.equals(n.center)===!1?(a.center.copy(n.center),!0):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e){const t=[];for(const n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){if($1.has(e)){const i=$1.get(e);if(i.renderId===t)return i.lightsData}const n=this.getLightsData(e.getLights());return $1.set(e,{renderId:t,lightsData:n}),n}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;const{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;const i=e.object.static===!0,r=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(i||r)return!1;const a=this.getLights(e.lightsNode,n);return this.equals(e,a)!==!0}}function F0(s,e=0){let t=3735928559^e,n=1103547991^e;if(s instanceof Array)for(let i=0,r;i<s.length;i++)r=s[i],t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);else for(let i=0,r;i<s.length;i++)r=s.charCodeAt(i),t=Math.imul(t^r,2654435761),n=Math.imul(n^r,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}const Z3=s=>F0(s),yE=s=>F0(s),sM=(...s)=>F0(s);function Q3(s,e=!1){const t=[];s.isNode===!0&&t.push(s.id);for(const{property:n,childNode:i}of rM(s))t.push(F0(n.slice(0,-4)),i.getCacheKey(e));return F0(t)}function*rM(s,e=!1){for(const t of Object.getOwnPropertyNames(s)){if(t.startsWith("_")===!0)continue;const n=s[t];if(Array.isArray(n)===!0)for(let i=0;i<n.length;i++){const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}else if(n&&n.isNode===!0)yield{property:t,childNode:n};else if(n&&Object.getPrototypeOf(n)===Object.prototype)for(const i in n){if(i.startsWith("_")===!0)continue;const r=n[i];r&&(r.isNode===!0||e&&typeof r.toJSON=="function")&&(yield{property:t,index:i,childNode:r})}}}const q7=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),SL=new WeakMap;function $3(s){return q7.get(s)}function aM(s){if(/[iu]?vec\d/.test(s))return s.startsWith("ivec")?Int32Array:s.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(s)||/float/.test(s))return Float32Array;if(/uint/.test(s))return Uint32Array;if(/int/.test(s))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${s}`)}function J3(s){if(/float|int|uint/.test(s))return 1;if(/vec2/.test(s))return 2;if(/vec3/.test(s))return 3;if(/vec4/.test(s)||/mat2/.test(s))return 4;if(/mat3/.test(s))return 9;if(/mat4/.test(s))return 16;console.error("THREE.TSL: Unsupported type:",s)}function W7(s){if(/float|int|uint/.test(s))return 1;if(/vec2/.test(s))return 2;if(/vec3/.test(s))return 3;if(/vec4/.test(s)||/mat2/.test(s))return 4;if(/mat3/.test(s))return 12;if(/mat4/.test(s))return 16;console.error("THREE.TSL: Unsupported type:",s)}function X7(s){if(/float|int|uint/.test(s))return 4;if(/vec2/.test(s))return 8;if(/vec3/.test(s)||/vec4/.test(s))return 16;if(/mat2/.test(s))return 8;if(/mat3/.test(s))return 48;if(/mat4/.test(s))return 64;console.error("THREE.TSL: Unsupported type:",s)}function Sd(s){if(s==null)return null;const e=typeof s;return s.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":s.isVector2===!0?"vec2":s.isVector3===!0?"vec3":s.isVector4===!0?"vec4":s.isMatrix2===!0?"mat2":s.isMatrix3===!0?"mat3":s.isMatrix4===!0?"mat4":s.isColor===!0?"color":s instanceof ArrayBuffer?"ArrayBuffer":null}function VC(s,...e){const t=s?s.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),s==="color"?new lt(...e):t==="vec2"?new Ge(...e):t==="vec3"?new Y(...e):t==="vec4"?new kt(...e):t==="mat2"?new hx(...e):t==="mat3"?new pn(...e):t==="mat4"?new Ot(...e):s==="bool"?e[0]||!1:s==="float"||s==="int"||s==="uint"?e[0]||0:s==="string"?e[0]||"":s==="ArrayBuffer"?nO(e[0]):null}function eO(s){let e=SL.get(s);return e===void 0&&(e={},SL.set(s,e)),e}function tO(s){let e="";const t=new Uint8Array(s);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function nO(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0)).buffer}const a0={VERTEX:"vertex",FRAGMENT:"fragment"},mn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},Y7={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Ar={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},iO=["fragment","vertex"],eN=["setup","analyze","generate"],tN=[...iO,"compute"],ym=["x","y","z","w"],j7={anal
3951yze:"setup",generate:"analyze"};let K7=0;class Rt extends Ro{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=mn.NONE,this.updateBeforeType=mn.NONE,this.updateAfterType=mn.NONE,this.uuid=ZN.generateUUID(),this.version=0,this.global=!1,this.parents=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:K7++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,mn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,mn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,mn.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of rM(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=sM(Q3(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}getArrayCount(){return null}setup(e){const t=e.getNodeProperties(this);let n=0;for(const i of this.getChildren())t["node"+n++]=i;return t.outputNode||null}analyze(e,t=null){const n=e.increaseUsage(this);if(this.parents===!0){const i=e.getDataFromNode(this,"any");
3951i.stages=i.stages||{},i.stages[e.shaderStage]=i.stages[e.shaderStage]||[],i.stages[e.shaderStage].push(t)}if(n===1){const i=e.getNodeProperties(this);for(const r of Object.values(i))r&&r.isNode===!0&&r.build(e,this)}}generate(e,t){const{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const n=this.getShared(e);if(this!==n)return n.build(e,t);const i=e.getDataFromNode(this);i.buildStages=i.buildStages||{},i.buildStages[e.buildStage]=!0;const r=j7[e.buildStage];if(r&&i.buildStages[r]!==!0){const u=e.getBuildStage();e.setBuildStage(r),this.build(e),e.setBuildStage(u)}e.addNode(this),e.addChain(this);let a=null;const l=e.getBuildStage();if(l==="setup"){this.updateReference(e);const u=e.getNodeProperties(this);if(u.initialized!==!0){u.initialized=!0,u.outputNode=this.setup(e)||u.outputNode||null;for(const h of Object.values(u))if(h&&h.isNode===!0){if(h.parents===!0){const p=e.getNodeProperties(h);p.parents=p.parents||[],p.parents.push(this)}h.build(e)}}a=u.outputNode}else if(l==="analyze")this.analyze(e,t);else if(l==="generate"){if(this.generate.length===1){const h=this.getNodeType(e),p=e.getDataFromNode(this);a=p.snippet,a===void 0?p.generated===void 0?(p.generated=!0,a=this.generate(e)||"",p.snippet=a):(console.warn("THREE.Node: Recursion detected.",this),a="/* Recursion detected. */"):p.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),a=e.format(a,h,t)}else a=this.generate(e,t)||"";a===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(console.error(`THREE.TSL: Invalid generated code, expected a "${t}".`),a=e.generateConst(t))}return e.removeChain(this),e.addSequentialNode(this),a}getSerializeChildren(){return rM(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:i,index:r,childNode:a}of t)r!==void 0?(n[i]===void 0&&(n[i]=Number.isInteger(r)?[]:{}),n[i][r]=a.toJSON(e.meta).uuid):n[i]=a.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const i=[];for(const r of e.inputNodes[n])i.push(t[r]);this[n]=i}else if(typeof e.inputNodes[n]=="object"){const i={};for(const r in e.inputNodes[n]){const a=e.inputNodes[n][r];i[r]=t[a]}this[n]=i}else{const i=e.inputNodes[n];this[n]=t[i]}}}toJSON(e){const{uuid:t,type:n}=this,i=e===void 0||typeof e=="string";i&&(e={textures:{},images:{},nodes:{}});let r=e.nodes[t];r===void 0&&(r={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},i!==!0&&(e.nodes[r.uuid]=r),this.serialize(r),delete r.meta);function a(l){const u=[];for(const h in l){const p=l[h];delete p.metadata,u.push(p)}return u}if(i){const l=a(e.textures),u=a(e.images),h=a(e.nodes);l.length>0&&(r.textures=l),u.length>0&&(r.images=u),h.length>0&&(r.nodes=h)}return r}}class vm extends Rt{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.indexNode.getNodeType(e),n=this.node.build(e),i=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${i} ]`}}class sO extends Rt{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const i of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(i))&&(n=i);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,i=this.getNodeType(e),r=n.build(e,i);return e.format(r,i,t)}}class vs extends Rt{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const i=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(r.propertyName!==void 0)return e.format(r.propertyName,i,t);if(i!=="void"&&t!=="void"&&this.hasDependencies(e)){const a=super.build(e,i),l=e.getVarFromNode(this,null,i),u=e.getPropertyName(l);return e.addLineFlowCode(`${u} = ${a}`,this),r.snippet=a,r.propertyName=u,e.format(r.propertyName,i,t)}}return super.build(e,t)}}class Z7 extends vs{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}
3951getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),i=e.getTypeLength(n),r=this.nodes,a=e.getComponentType(n),l=[];let u=0;for(const p of r){if(u>=i){console.error(`THREE.TSL: Length of parameters exceeds maximum length of function '${n}()' type.`);break}let g=p.getNodeType(e),y=e.getTypeLength(g),_;if(u+y>i&&(console.error(`THREE.TSL: Length of '${n}()' data exceeds maximum length of output type.`),y=i-u,g=e.getTypeFromLength(y)),u+=y,_=p.build(e,g),e.getComponentType(g)!==a){const A=e.getTypeFromLength(y,a);_=e.format(_,g,A)}l.push(_)}const h=`${e.getType(n)}( ${l.join(", ")} )`;return e.format(h,n,t)}}const Q7=ym.join("");class rO extends Rt{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(ym.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){const n=this.node,i=e.getTypeLength(n.getNodeType(e));let r=null;if(i>1){let a=null;this.getVectorLength()>=i&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const u=n.build(e,a);this.components.length===i&&this.components===Q7.slice(0,this.components.length)?r=e.format(u,a,t):r=e.format(`${u}.${this.components}`,this.getNodeType(e),t)}else r=n.build(e,t);return r}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class $7 extends vs{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:i}=this,r=this.getNodeType(e),a=e.getComponentType(i.getNodeType(e)),l=e.getTypeFromLength(n.length,a),u=i.build(e,l),h=t.build(e,r),p=e.getTypeLength(r),g=[];for(let y=0;y<p;y++){const _=ym[y];_===n[0]?(g.push(u),y+=n.length-1):g.push(h+"."+_)}return`${e.getType(r)}( ${g.join(", ")} )`}}class J7 extends vs{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{components:t,sourceNode:n}=this,i=this.getNodeType(e),r=n.build(e),a=e.getVarFromNode(this),l=e.getPropertyName(a);e.addLineFlowCode(l+" = "+r,this);const u=e.getTypeLength(i),h=[];let p=0;for(let g=0;g<u;g++){const y=ym[g];y===t[p]?(h.push("1.0 - "+(l+"."+y)),p++):h.push(l+"."+y)}return`${e.getType(i)}( ${h.join(", ")} )`}}class zC extends Rt{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return this.nodeType===null?Sd(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Sd(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=tO(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?VC(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){console.warn("Abstract function.")}}const bL=/float|u?int/;class hl extends zC{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){const n=this.getNodeType(e);return bL.test(n)&&bL.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}}class eY extends Rt{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}getNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";const n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){console.warn(`THREE.TSL: Member "${this.property}" does not exist in struct.`);const n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}}let Ld=null;const nN=new Map;function Le(s,e){if(nN.has(s)){console.warn(`THREE.TSL: Redefinition of method chaining '${s}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${s} is not a function`);
3951nN.set(s,e),s!=="assign"&&(Rt.prototype[s]=function(...t){return this.isStackNode?this.add(e(...t)):e(this,...t)},Rt.prototype[s+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}const tY=s=>s.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),TL=s=>tY(s).split("").sort().join("");Rt.prototype.assign=function(...s){if(this.isStackNode!==!0)return Ld!==null?Ld.assign(this,...s):console.error("THREE.TSL: No stack defined for assign operation. Make sure the assign is inside a Fn()."),this;{const e=nN.get("assign");return this.add(e(...s))}};Rt.prototype.toVarIntent=function(){return this};Rt.prototype.get=function(s){return new eY(this,s)};const v0={};function eT(s,e,t){v0[s]=v0[e]=v0[t]={get(){this._cache=this._cache||{};let a=this._cache[s];return a===void 0&&(a=new rO(this,s),this._cache[s]=a),a},set(a){this[s].assign(Pe(a))}};const n=s.toUpperCase(),i=e.toUpperCase(),r=t.toUpperCase();Rt.prototype["set"+n]=Rt.prototype["set"+i]=Rt.prototype["set"+r]=function(a){const l=TL(s);return new $7(this,l,Pe(a))},Rt.prototype["flip"+n]=Rt.prototype["flip"+i]=Rt.prototype["flip"+r]=function(){const a=TL(s);return new J7(this,a)}}const Ou=["x","y","z","w"],Iu=["r","g","b","a"],Fu=["s","t","p","q"];for(let s=0;s<4;s++){let e=Ou[s],t=Iu[s],n=Fu[s];eT(e,t,n);for(let i=0;i<4;i++){e=Ou[s]+Ou[i],t=Iu[s]+Iu[i],n=Fu[s]+Fu[i],eT(e,t,n);for(let r=0;r<4;r++){e=Ou[s]+Ou[i]+Ou[r],t=Iu[s]+Iu[i]+Iu[r],n=Fu[s]+Fu[i]+Fu[r],eT(e,t,n);for(let a=0;a<4;a++)e=Ou[s]+Ou[i]+Ou[r]+Ou[a],t=Iu[s]+Iu[i]+Iu[r]+Iu[a],n=Fu[s]+Fu[i]+Fu[r]+Fu[a],eT(e,t,n)}}}for(let s=0;s<32;s++)v0[s]={get(){this._cache=this._cache||{};let e=this._cache[s];return e===void 0&&(e=new vm(this,new hl(s,"uint")),this._cache[s]=e),e},set(e){this[s].assign(Pe(e))}};Object.defineProperties(Rt.prototype,v0);const ML=new WeakMap,nY=function(s,e=null){const t=Sd(s);return t==="node"?s:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Pe(iN(s,e)):t==="shader"?s.isFn?s:le(s):s},iY=function(s,e=null){for(const t in s)s[t]=Pe(s[t],e);return s},sY=function(s,e=null){const t=s.length;for(let n=0;n<t;n++)s[n]=Pe(s[n],e);return s},aO=function(s,e=null,t=null,n=null){function i(p){return n!==null?(p=Pe(Object.assign(p,n)),n.intent===!0&&(p=p.toVarIntent())):p=Pe(p),p}let r,a=e,l,u;function h(p){let g;return a?g=/[a-z]/i.test(a)?a+"()":a:g=s.type,l!==void 0&&p.length<l?(console.error(`THREE.TSL: "${g}" parameter length is less than minimum required.`),p.concat(new Array(l-p.length).fill(0))):u!==void 0&&p.length>u?(console.error(`THREE.TSL: "${g}" parameter length exceeds limit.`),p.slice(0,u)):p}return e===null?r=(...p)=>i(new s(...Ep(h(p)))):t!==null?(t=Pe(t),r=(...p)=>i(new s(e,...Ep(h(p)),t))):r=(...p)=>i(new s(e,...Ep(h(p)))),r.setParameterLength=(...p)=>(p.length===1?l=u=p[0]:p.length===2&&([l,u]=p),r),r.setName=p=>(a=p,r),r},rY=function(s,...e){return Pe(new s(...Ep(e)))};class aY extends Rt{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:n}=this,i=e.getNodeProperties(t),r=e.getClosestSubBuild(t.subBuilds)||"",a=r||"default";if(i[a])return i[a];const l=e.subBuildFn;e.subBuildFn=r;let u=null;if(t.layout){let h=ML.get(e.constructor);h===void 0&&(h=new WeakMap,ML.set(e.constructor,h));let p=h.get(t);p===void 0&&(p=Pe(e.buildFunctionNode(t)),h.set(t,p)),e.addInclude(p);const g=n?oY(n):null;u=Pe(p.call(g))}else{const h=new Proxy(e,{get:(S,A,E)=>{let b;return Symbol.iterator===A?b=function*(){yield void 0}:b=Reflect.get(S,A,E),b}}),p=n?lY(n):null,g=Array.isArray(n)?n.length>0:n!==null,y=t.jsFunc,_=g||y.length>1?y(p,h):y(h);u=Pe(_)}return e.subBuildFn=l,t.once&&(i[a]=u),u}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){const t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null;const i=e.getBuildStage(),r=e.getNodeProperties(this),a=e.getSubBuildOutput(this),l=this.getOutputNode(e);if(i==="setup"){const u=e.getSubBuildProperty("initialized",this);if(r[u]!==!0&&(r[u]=!0,r[a]=this.getOutputNode(e),r[a].build(e),this.shaderNode.subBuilds))for(const h of e.chaining){const p=e.getDataFromNode(h,"any");p.subBuilds=p.subBuilds||new Set;for(const g of this.shaderNode.subBuilds)p.subBuilds.add(g)}n=r[a]}else i==="analyze"?l.build(e,t):i==="generate"&&(n=l.build(e,t)||"");return n}}function oY(s){let e;return xE(s),s[0]&&(s[0].isNode||Object.getPrototypeOf(s[0])!==Object.prototype)?e=[...s]:e=s[0],e}function lY(s){let e=0;return xE(s),new Proxy(s,{get:(t,n,i)=>{let r;if(n==="length")return r=s.length,r;if(Symbol.iterator===n)r=function*(){for(const a of s)yield Pe(a)};else{if(s.length>0)if(Object.getPrototypeOf(s[0])===Object.prototype){const a=s[0];a[n]===void 0?r=a[e++]:r=Reflect.get(a,n,i)}else s[0]instanceof Rt&&(s[n]===void 0?r=s[e++]:r=Reflect.get(s,n,i));else r=Reflect.get(t,n,i);r=Pe(r)}return r}})}class uY extends Rt{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return Pe(new aY(this,e))}setup(){return this.call()}}const cY=[!1,!0],hY=[0,1,2,3],dY=[-1,-2],oO=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],GC=new Map;for(const s of cY)GC.set(s,new hl(s));const HC=new Map;for(const s of hY)HC.set(s,new hl(s,"uint"));const kC=new Map([...HC].map(s=>new hl(s.value,"int")));for(const s of dY)kC.set(s,new hl(s,"int"));const vE=new Map([...kC].map(s=>new hl(s.value)));for(const s of oO)vE.set(s,new hl(s));for(const s of oO)vE.set(-s,new hl(-s));const _E={bool:GC,uint:HC,ints:kC,float:vE},EL=new Map([...GC,...vE]),iN=(s,e)=>EL.has(s)?EL.get(s):s.isNode===!0?s:new hl(s,e),Os=function(s,e=null){return(...t)=>{for(const i of t)if(i===void 0)return console.error(`THREE.TSL: Invalid parameter for the type "${s}".`),Pe(new hl(0,s));if((t.length===0||!["bool","float","int","uint"].includes(s)&&t.every(i=>{const r=typeof i;return r!=="object"&&r!=="function"}))&&(t=[VC(s,...t)]),t.length===1&&e!==null&&e.has(t[0]))return o0(e.get(t[0]));if(t.length===1){const i=iN(t[0],s);return i.nodeType===s?o0(i):o0(new sO(i,s))}const n=t.map(i=>iN(i));return o0(new Z7(n,s))}},V0=s=>typeof s=="object"&&s!==null?s.value:s,lO=s=>s!=null?s.nodeType||s.convertTo||(typeof s=="string"?s:null):null;function ly(s,e){return new uY(s,e)}const Pe=(s,e=null)=>nY(s,e),o0=(s,e=null)=>
3951Pe(s,e).toVarIntent(),xE=(s,e=null)=>new iY(s,e),Ep=(s,e=null)=>new sY(s,e),en=(s,e=null,t=null,n=null)=>new aO(s,e,t,n),ct=(s,...e)=>new rY(s,...e),rt=(s,e=null,t=null,n={})=>new aO(s,e,t,{intent:!0,...n});let fY=0;class pY extends Rt{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:console.error("THREE.TSL: Invalid layout type."),t=null)),this.shaderNode=new ly(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){const n={name:"fn"+fY++,type:t,inputs:[]};for(const i in e)i!=="return"&&n.inputs.push({name:i,type:e[i]});e=n}return this.shaderNode.setLayout(e),this}getNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){const t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){const t=this.getNodeType(e);return console.error('THREE.TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".'),e.generateConst(t)}}function le(s,e=null){const t=new pY(s,e);return new Proxy(()=>{},{apply(n,i,r){return t.call(...r)},get(n,i,r){return Reflect.get(t,i,r)},set(n,i,r,a){return Reflect.set(t,i,r,a)}})}const z0=s=>{Ld=s},SE=()=>Ld,Zt=(...s)=>Ld.If(...s),mY=(...s)=>Ld.Switch(...s);function bE(s){return Ld&&Ld.add(s),s}Le("toStack",bE);const uO=new Os("color"),j=new Os("float",_E.float),$=new Os("int",_E.ints),xt=new Os("uint",_E.uint),al=new Os("bool",_E.bool),Fe=new Os("vec2"),Ks=new Os("ivec2"),cO=new Os("uvec2"),hO=new Os("bvec2"),ae=new Os("vec3"),dO=new Os("ivec3"),sv=new Os("uvec3"),qC=new Os("bvec3"),Gt=new Os("vec4"),fO=new Os("ivec4"),pO=new Os("uvec4"),mO=new Os("bvec4"),TE=new Os("mat2"),Yr=new Os("mat3"),Ap=new Os("mat4"),gY=(s="")=>Pe(new hl(s,"string")),yY=s=>Pe(new hl(s,"ArrayBuffer"));Le("toColor",uO);Le("toFloat",j);Le("toInt",$);Le("toUint",xt);Le("toBool",al);Le("toVec2",Fe);Le("toIVec2",Ks);Le("toUVec2",cO);Le("toBVec2",hO);Le("toVec3",ae);Le("toIVec3",dO);Le("toUVec3",sv);Le("toBVec3",qC);Le("toVec4",Gt);Le("toIVec4",fO);Le("toUVec4",pO);Le("toBVec4",mO);Le("toMat2",TE);Le("toMat3",Yr);Le("toMat4",Ap);const gO=en(vm).setParameterLength(2),yO=(s,e)=>Pe(new sO(Pe(s),e)),vY=(s,e)=>Pe(new rO(Pe(s),e));Le("element",gO);Le("convert",yO);const _Y=s=>(console.warn("THREE.TSL: append() has been renamed to Stack()."),bE(s));Le("append",s=>(console.warn("THREE.TSL: .append() has been renamed to .toStack()."),bE(s)));class ri extends Rt{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0,this.global=!0}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const Qc=(s,e)=>Pe(new ri(s,e)),G0=(s,e)=>Pe(new ri(s,e,!0)),Zn=ct(ri,"vec4","DiffuseColor"),sN=ct(ri,"vec3","EmissiveColor"),ku=ct(ri,"float","Roughness"),H0=ct(ri,"float","Metalness"),oM=ct(ri,"float","Clearcoat"),k0=ct(ri,"float","ClearcoatRoughness"),gp=ct(ri,"vec3","Sheen"),ME=ct(ri,"float","SheenRoughness"),EE=ct(ri,"float","Iridescence"),WC=ct(ri,"float","IridescenceIOR"),XC=ct(ri,"float","IridescenceThickness"),lM=ct(ri,"float","AlphaT"),pd=ct(ri,"float","Anisotropy"),_0=ct(ri,"vec3","AnisotropyT"),Rp=ct(ri,"vec3","AnisotropyB"),ka=ct(ri,"color","SpecularColor"),q0=ct(ri,"float","SpecularF90"),uM=ct(ri,"float","Shininess"),py=ct(ri,"vec4","Output"),CT=ct(ri,"float","dashSize"),rN=ct(ri,"float","gapSize"),xY=ct(ri,"float","pointWidth"),x0=ct(ri,"float","IOR"),cM=ct(ri,"float","Transmission"),YC=ct(ri,"float","Thickness"),jC=ct(ri,"float","AttenuationDistance"),KC=ct(ri,"color","AttenuationColor"),ZC=ct(ri,"float","Dispersion");class vO extends Rt{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.shared=t,this.order=n,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const _O=s=>new vO(s),AE=(s,e=0)=>new vO(s,!0,e),xO=AE("frame"),Pt=AE("render"),QC=_O("object");class fx extends zC{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=QC}setName(e){return this.name=e,this}label(e){return console.warn('THREE.TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}
3951onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{const i=e(n,this);i!==void 0&&(this.value=i)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){const n=this.getNodeType(e),i=this.getUniformHash(e);let r=e.getNodeFromHash(i);r===void 0&&(e.setHashNode(this,i),r=this);const a=r.getInputType(e),l=e.getUniformFromNode(r,a,e.shaderStage,this.name||e.context.nodeName),u=e.getPropertyName(l);e.context.nodeName!==void 0&&delete e.context.nodeName;let h=u;if(n==="bool"){const p=e.getDataFromNode(this);let g=p.propertyName;if(g===void 0){const y=e.getVarFromNode(this,null,"bool");g=e.getPropertyName(y),p.propertyName=g,h=e.format(u,a,n),e.addLineFlowCode(`${g} = ${h}`,this)}h=g}return e.format(h,n,t)}}const Vt=(s,e)=>{const t=lO(e||s);return t===s&&(s=VC(t)),s=s&&s.isNode===!0?s.node&&s.node.value||s.value:s,Pe(new fx(s,t))};class AL extends vs{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}getNodeType(e){return this.nodeType===null&&(this.nodeType=this.values[0].getNodeType(e)),this.nodeType}getElementType(e){return this.getNodeType(e)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const SO=(...s)=>{let e;if(s.length===1){const t=s[0];e=new AL(null,t.length,t)}else{const t=s[0],n=s[1];e=new AL(t,n)}return Pe(e)};Le("toArray",(s,e)=>SO(Array(e).fill(s)));class SY extends vs{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return ym.join("").slice(0,n)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:n}=this,i=t.getScope(),r=e.getNodeProperties(i);r.assign=!0;const a=e.getNodeProperties(this);a.sourceNode=n,a.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:n,sourceNode:i}=e.getNodeProperties(this),r=this.needsSplitAssign(e),a=n.build(e),l=n.getNodeType(e),u=i.build(e,l),h=i.getNodeType(e),p=e.getDataFromNode(this);let g;if(p.initialized===!0)t!=="void"&&(g=a);else if(r){const y=e.getVarFromNode(this,null,l),_=e.getPropertyName(y);e.addLineFlowCode(`${_} = ${u}`,this);const S=n.node,E=S.node.context({assign:!0}).build(e);for(let b=0;b<S.components.length;b++){const C=S.components[b];e.addLineFlowCode(`${E}.${C} = ${_}[ ${b} ]`,this)}t!=="void"&&(g=a)}else g=`${a} = ${u}`,(t==="void"||h==="void")&&(e.addLineFlowCode(g,this),t!=="void"&&(g=a));return p.initialized=!0,e.format(g,l,t)}}const bO=en(SY).setParameterLength(2);Le("assign",bO);class bY extends vs{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){const t=[],n=this.functionNode,i=n.getInputs(e),r=this.parameters,a=(u,h)=>{const p=h.type,g=p==="pointer";let y;return g?y="&"+u.build(e):y=u.build(e,p),y};if(Array.isArray(r)){if(r.length>i.length)console.error("THREE.TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),r.length=i.length;else if(r.length<i.length)for(console.error("THREE.TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");r.length<i.length;)r.push(j(0));for(let u=0;u<r.length;u++)t.push(a(r[u],i[u]))}else for(const u of i){const h=r[u.name];h!==void 0?t.push(a(h,u)):(console.error(`THREE.TSL: Input '${u.name}' not found in 'Fn()'.`),t.push(a(j(0),u)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const TO=(s,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Ep(e):xE(e[0]),Pe(new bY(Pe(s),e)));Le("call",TO);const TY={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class Qi extends vs{static get type(){return"OperatorNode"}constructor(e,t,n,...i){if(super(),i.length>0){let r=new Qi(e,t,n);for(let a=0;a<i.length-1;a++)r=new Qi(e,r,i[a]);t=r,n=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(TY[this.op],t)}getNodeType(e,t=null){const n=this.op,i=this.aNode,r=this.bNode,a=i.getNodeType(e),l=r?r.getNodeType(e):null;if(a==="void"||l==="void")return t||"void";if(n==="%")return a;
3951if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(a);if(n==="!"||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){const u=Math.max(e.getTypeLength(a),e.getTypeLength(l));return u>1?`bvec${u}`:"bool"}else{if(e.isMatrix(a)){if(l==="float")return a;if(e.isVector(l))return e.getVectorFromMatrix(a);if(e.isMatrix(l))return a}else if(e.isMatrix(l)){if(a==="float")return l;if(e.isVector(a))return e.getVectorFromMatrix(l)}return e.getTypeLength(l)>e.getTypeLength(a)?l:a}}generate(e,t){const n=this.op,{aNode:i,bNode:r}=this,a=this.getNodeType(e,t);let l=null,u=null;a!=="void"?(l=i.getNodeType(e),u=r?r.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(l)?u=l:e.isVector(u)?l=u:l!==u&&(l=u="float"):n===">>"||n==="<<"?(l=a,u=e.changeComponentType(u,"uint")):n==="%"?(l=a,u=e.isInteger(l)&&e.isInteger(u)?u:l):e.isMatrix(l)?u==="float"?u="float":e.isVector(u)?u=e.getVectorFromMatrix(l):e.isMatrix(u)||(l=u=a):e.isMatrix(u)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(u):l=u=a:l=u=a):l=u=a;const h=i.build(e,l),p=r?r.build(e,u):null,g=e.getFunctionOperator(n);if(t!=="void"){const y=e.renderer.coordinateSystem===Er;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return y?e.isVector(l)?e.format(`${this.getOperatorMethod(e,t)}( ${h}, ${p} )`,a,t):e.format(`( ${h} ${n} ${p} )`,a,t):e.format(`( ${h} ${n} ${p} )`,a,t);if(n==="%")return e.isInteger(u)?e.format(`( ${h} % ${p} )`,a,t):e.format(`${this.getOperatorMethod(e,a)}( ${h}, ${p} )`,a,t);if(n==="!"||n==="~")return e.format(`(${n}${h})`,l,t);if(g)return e.format(`${g}( ${h}, ${p} )`,a,t);if(e.isMatrix(l)&&u==="float")return e.format(`( ${p} ${n} ${h} )`,a,t);if(l==="float"&&e.isMatrix(u))return e.format(`${h} ${n} ${p}`,a,t);{let _=`( ${h} ${n} ${p} )`;return!y&&a==="bool"&&e.isVector(l)&&e.isVector(u)&&(_=`all${_}`),e.format(_,a,t)}}else if(l!=="void")return g?e.format(`${g}( ${h}, ${p} )`,a,t):e.isMatrix(l)&&u==="float"?e.format(`${p} ${n} ${h}`,a,t):e.format(`${h} ${n} ${p}`,a,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Ns=rt(Qi,"+").setParameterLength(2,1/0).setName("add"),Ln=rt(Qi,"-").setParameterLength(2,1/0).setName("sub"),ln=rt(Qi,"*").setParameterLength(2,1/0).setName("mul"),Ao=rt(Qi,"/").setParameterLength(2,1/0).setName("div"),px=rt(Qi,"%").setParameterLength(2).setName("mod"),$C=rt(Qi,"==").setParameterLength(2).setName("equal"),MO=rt(Qi,"!=").setParameterLength(2).setName("notEqual"),EO=rt(Qi,"<").setParameterLength(2).setName("lessThan"),JC=rt(Qi,">").setParameterLength(2).setName("greaterThan"),AO=rt(Qi,"<=").setParameterLength(2).setName("lessThanEqual"),RO=rt(Qi,">=").setParameterLength(2).setName("greaterThanEqual"),NO=rt(Qi,"&&").setParameterLength(2,1/0).setName("and"),CO=rt(Qi,"||").setParameterLength(2,1/0).setName("or"),wO=rt(Qi,"!").setParameterLength(1).setName("not"),DO=rt(Qi,"^^").setParameterLength(2).setName("xor"),UO=rt(Qi,"&").setParameterLength(2).setName("bitAnd"),LO=rt(Qi,"~").setParameterLength(2).setName("bitNot"),BO=rt(Qi,"|").setParameterLength(2).setName("bitOr"),PO=rt(Qi,"^").setParameterLength(2).setName("bitXor"),OO=rt(Qi,"<<").setParameterLength(2).setName("shiftLeft"),IO=rt(Qi,">>").setParameterLength(2).setName("shiftRight"),FO=le(([s])=>(s.addAssign(1),s)),VO=le(([s])=>(s.subAssign(1),s)),zO=le(([s])=>{const e=$(s).toConst();return s.addAssign(1),e}),GO=le(([s])=>{const e=$(s).toConst();return s.subAssign(1),e});Le("add",Ns);Le("sub",Ln);Le("mul",ln);Le("div",Ao);Le("mod",px);Le("equal",$C);Le("notEqual",MO);Le("lessThan",EO);Le("greaterThan",JC);Le("lessThanEqual",AO);Le("greaterThanEqual",RO);Le("and",NO);Le("or",CO);Le("not",wO);Le("xor",DO);Le("bitAnd",UO);Le("bitNot",LO);Le("bitOr",BO);Le("bitXor",PO);Le("shiftLeft",OO);Le("shiftRight",IO);Le("incrementBefore",FO);Le("decrementBefore",VO);Le("increment",zO);Le("decrement",GO);const HO=(s,e)=>(console.warn('THREE.TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.'),px($(s),$(e)));Le("modInt",HO);class _e extends vs{static get type(){return"MathNode"}constructor(e,t,n=null,i=null){if(super(),(e===_e.MAX||e===_e.MIN)&&arguments.length>3){let r=new _e(e,t,n);for(let a=2;a<arguments.length-1;a++)r=new _e(e,r,arguments[a]);t=r,n=arguments[arguments.length-1],i=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=i,this.isMathNode=!0}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(n)?0:e.getTypeLength(n),l=e.isMatrix(i)?0:e.getTypeLength(i);return r>a&&r>l?t:a>l?n:l>r?i:t}getNodeType(e){const t=this.method;return t===_e.LENGTH||t===_e.DISTANCE||t===_e.DOT?"float":t===_e.CROSS?"vec3":t===_e.ALL||t===_e.ANY?"bool":t===_e.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:n,method:i}=this;let r=null;if(i===_e.ONE_MINUS)r=Ln(1,t);else if(i===_e.RECIPROCAL)r=Ao(1,t);else if(i===_e.DIFFERENCE)r=Li(Ln(t,n));else if(i===_e.TRANSFORM_DIRECTION){let a=t,l=n;e.isMatrix(a.getNodeType(e))?l=Gt(ae(l),0):a=Gt(ae(a),0);const u=ln(a,l).xyz;r=ah(u)}return r!==null?r:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let i=this.method;const r=this.getNodeType(e),a=this.getInputType(e),l=this.aNode,u=this.bNode,h=this.cNode,p=e.renderer.coordinateSystem;if(i===_e.NEGATE)return e.format("( - "+l.build(e,a)+" )",r,t);{const g=[];return i===_e.CROSS?g.push(l.build(e,r),u.build(e,r)):p===Er&&i===_e.STEP?g.push(l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":a),u.build(e,a)):p===Er&&(i===_e.MIN||i===_e.MAX)?g.push(l.build(e,a),u.build(e,e.getTypeLength(u.getNodeType(e))===1?"float":a)):i===_e.REFRACT?g.push(l.build(e,a),u.build(e,a),h.build(e,"float")):i===_e.MIX?g.push(l.build(e,a),u.build(e,a),h.build(e,e.getTypeLength(h.getNodeType(e))===1?"float":a)):(p===rl&&i===_e.ATAN&&u!==null&&(i="atan2"),e.shaderStage!=="fragment"&&(i===_e.DFDX||i===_e.DFDY)&&(console.warn(`THREE.TSL: '${i}' is not supported in the ${e.shaderStage} stage.`),i="/*"+i+"*/"),g.push(l.build(e,a)),u!==null&&g.push(u.build(e,a)),h!==null&&g.push(h.build(e,a))),e.format(`${e.getMethod(i,r)}( ${g.join(", ")} )`,r,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}_e.ALL="all";_e.ANY="any";_e.RADIANS="radians";_e.DEGREES="degrees";_e.EXP="exp";_e.EXP2="exp2";_e.LOG="log";_e.LOG2="log2";_e.SQRT="sqrt";_e.INVERSE_SQRT="inversesqrt";_e.FLOOR="floor";_e.CEIL="ceil";_e.NORMALIZE="normalize";_e.FRACT="fract";_e.SIN="sin";_e.COS="cos";_e.TAN="tan";_e.ASIN="asin";_e.ACOS="acos";_e.ATAN="atan";_e.ABS="abs";_e.SIGN="sign";_e.LENGTH="length";_e.NEGATE="negate";_e.ONE_MINUS="oneMinus";_e.DFDX="dFdx";_e.DFDY="dFdy";_e.ROUND="round";_e.RECIPROCAL="reciprocal";_e.TRUNC="trunc";_e.FWIDTH="fwidth";_e.TRANSPOSE="transpose";_e.DETERMINANT="determinant";_e.INVERSE="inverse";_e.EQUALS="equals";_e.MIN="min";_e.MAX="max";_e.STEP="step";_e.REFLECT="reflect";_e.DISTANCE="distance";_e.DIFFERENCE="difference";_e.DOT="dot";_e.CROSS="cross";_e.POW="pow";_e.TRANSFORM_DIRECTION="transformDirection";_e.MIX="mix";_e.CLAMP="clamp";_e.REFRACT="refract";_e.SMOOTHSTEP="smoothstep";_e.FACEFORWARD="faceforward";
3951const kO=j(1e-6),MY=j(1e6),hM=j(Math.PI),EY=j(Math.PI*2),qO=rt(_e,_e.ALL).setParameterLength(1),WO=rt(_e,_e.ANY).setParameterLength(1),XO=rt(_e,_e.RADIANS).setParameterLength(1),YO=rt(_e,_e.DEGREES).setParameterLength(1),ew=rt(_e,_e.EXP).setParameterLength(1),zy=rt(_e,_e.EXP2).setParameterLength(1),RE=rt(_e,_e.LOG).setParameterLength(1),Yu=rt(_e,_e.LOG2).setParameterLength(1),rc=rt(_e,_e.SQRT).setParameterLength(1),tw=rt(_e,_e.INVERSE_SQRT).setParameterLength(1),ju=rt(_e,_e.FLOOR).setParameterLength(1),NE=rt(_e,_e.CEIL).setParameterLength(1),ah=rt(_e,_e.NORMALIZE).setParameterLength(1),ch=rt(_e,_e.FRACT).setParameterLength(1),To=rt(_e,_e.SIN).setParameterLength(1),zc=rt(_e,_e.COS).setParameterLength(1),jO=rt(_e,_e.TAN).setParameterLength(1),KO=rt(_e,_e.ASIN).setParameterLength(1),nw=rt(_e,_e.ACOS).setParameterLength(1),CE=rt(_e,_e.ATAN).setParameterLength(1,2),Li=rt(_e,_e.ABS).setParameterLength(1),W0=rt(_e,_e.SIGN).setParameterLength(1),Ku=rt(_e,_e.LENGTH).setParameterLength(1),ZO=rt(_e,_e.NEGATE).setParameterLength(1),QO=rt(_e,_e.ONE_MINUS).setParameterLength(1),iw=rt(_e,_e.DFDX).setParameterLength(1),sw=rt(_e,_e.DFDY).setParameterLength(1),$O=rt(_e,_e.ROUND).setParameterLength(1),JO=rt(_e,_e.RECIPROCAL).setParameterLength(1),rw=rt(_e,_e.TRUNC).setParameterLength(1),eI=rt(_e,_e.FWIDTH).setParameterLength(1),tI=rt(_e,_e.TRANSPOSE).setParameterLength(1),nI=rt(_e,_e.DETERMINANT).setParameterLength(1),iI=rt(_e,_e.INVERSE).setParameterLength(1),sI=(s,e)=>(console.warn('THREE.TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"'),$C(s,e)),no=rt(_e,_e.MIN).setParameterLength(2,1/0),rs=rt(_e,_e.MAX).setParameterLength(2,1/0),wE=rt(_e,_e.STEP).setParameterLength(2),rI=rt(_e,_e.REFLECT).setParameterLength(2),aI=rt(_e,_e.DISTANCE).setParameterLength(2),oI=rt(_e,_e.DIFFERENCE).setParameterLength(2),zd=rt(_e,_e.DOT).setParameterLength(2),DE=rt(_e,_e.CROSS).setParameterLength(2),Jo=rt(_e,_e.POW).setParameterLength(2),aw=s=>ln(s,s),lI=s=>ln(s,s,s),uI=s=>ln(s,s,s,s),cI=rt(_e,_e.TRANSFORM_DIRECTION).setParameterLength(2),hI=s=>ln(W0(s),Jo(Li(s),1/3)),ow=s=>zd(s,s),Yn=rt(_e,_e.MIX).setParameterLength(3),ol=(s,e=0,t=1)=>Pe(new _e(_e.CLAMP,Pe(s),Pe(e),Pe(t))),lw=s=>ol(s),uw=rt(_e,_e.REFRACT).setParameterLength(3),tc=rt(_e,_e.SMOOTHSTEP).setParameterLength(3),cw=rt(_e,_e.FACEFORWARD).setParameterLength(3),dI=le(([s])=>{const n=43758.5453,i=zd(s.xy,Fe(12.9898,78.233)),r=px(i,hM);return ch(To(r).mul(n))}),fI=(s,e,t)=>Yn(e,t,s),pI=(s,e,t)=>tc(e,t,s),mI=(s,e)=>wE(e,s),gI=(s,e)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),CE(s,e)),AY=cw,RY=tw;Le("all",qO);Le("any",WO);Le("equals",sI);Le("radians",XO);Le("degrees",YO);Le("exp",ew);Le("exp2",zy);Le("log",RE);Le("log2",Yu);Le("sqrt",rc);Le("inverseSqrt",tw);Le("floor",ju);Le("ceil",NE);Le("normalize",ah);Le("fract",ch);Le("sin",To);Le("cos",zc);Le("tan",jO);Le("asin",KO);Le("acos",nw);Le("atan",CE);Le("abs",Li);Le("sign",W0);Le("length",Ku);Le("lengthSq",ow);Le("negate",ZO);Le("oneMinus",QO);Le("dFdx",iw);Le("dFdy",sw);Le("round",$O);Le("reciprocal",JO);Le("trunc",rw);Le("fwidth",eI);Le("atan2",gI);Le("min",no);Le("max",rs);Le("step",mI);Le("reflect",rI);Le("distance",aI);Le("dot",zd);Le("cross",DE);Le("pow",Jo);Le("pow2",aw);Le("pow3",lI);Le("pow4",uI);Le("transformDirection",cI);Le("mix",fI);Le("clamp",ol);Le("refract",uw);Le("smoothstep",pI);Le("faceForward",cw);Le("difference",oI);Le("saturate",lw);Le("cbrt",hI);Le("transpose",tI);Le("determinant",nI);Le("inverse",iI);Le("rand",dI);class NY extends Rt{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);const i=t.getNodeType(e);if(n!==null){const r=n.getNodeType(e);if(e.getTypeLength(r)>e.getTypeLength(i))return r}return i}setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),i=this.elseNode?this.elseNode.cache():null,r=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=r,i!==null&&(e.getDataFromNode(i).parentNodeBlock=r);const a=e.context.uniformFlow,l=e.getNodeProperties(this);l.condNode=t,l.ifNode=a?n:n.context({nodeBlock:n}),l.elseNode=i?a?i:i.context({nodeBlock:i}):null}generate(e,t){const n=this.getNodeType(e),i=e.getDataFromNode(this);if(i.nodeProperty!==void 0)return i.nodeProperty;const{condNode:r,ifNode:a,elseNode:l}=e.getNodeProperties(this),u=e.currentFunctionNode,h=t!=="void",p=h?Qc(n).build(e):"";i.nodeProperty=p;const g=r.build(e,"bool");if(e.context.uniformFlow&&l!==null){const S=a.build(e,n),A=l.build(e,n),E=e.getTernary(g,S,A);return e.format(E,n,t)}e.addFlowCode(` 3952${e.tab}if ( ${g} ) { 3953 3954`).addFlowTab();let _=a.build(e,n);if(_&&(h?_=p+" = "+_+";":(_="return "+_+";",u===null&&(console.warn("THREE.TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values."),_="// "+_))),e.removeFlowTab().addFlowCode(e.tab+" "+_+` 3955 3956`+e.tab+"}"),l!==null){e.addFlowCode(` else { 3957 3958`).addFlowTab();let S=l.build(e,n);S&&(h?S=p+" = "+S+";":(S="return "+S+";",u===null&&(console.warn("THREE.TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values."),S="// "+S))),e.removeFlowTab().addFlowCode(e.tab+" "+S+` 3959 3960`+e.tab+`} 3961 3962`)}else e.addFlowCode(` 3963 3964`);return e.format(p,n,t)}}const ur=en(NY).setParameterLength(2,3);Le("select",ur);class yI extends Rt{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.getContext();e.setContext({...e.context,...this.value}),this.node.build(e),e.setContext(t)}
3964setup(e){const t=e.getContext();e.setContext({...e.context,...this.value}),this.node.build(e),e.setContext(t)}generate(e,t){const n=e.getContext();e.setContext({...e.context,...this.value});const i=this.node.build(e,t);return e.setContext(n),i}}const mx=en(yI).setParameterLength(1,2),vI=s=>mx(s,{uniformFlow:!0}),hw=(s,e)=>mx(s,{nodeName:e});function _I(s,e){return console.warn('THREE.TSL: "label()" has been deprecated. Use "setName()" instead.'),hw(s,e)}Le("context",mx);Le("label",_I);Le("uniformFlow",vI);Le("setName",hw);class wT extends Rt{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}getNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}build(...e){return this.intent===!0&&e[0].getNodeProperties(this).assign!==!0?this.node.build(...e):super.build(...e)}generate(e){const{node:t,name:n,readOnly:i}=this,{renderer:r}=e,a=r.backend.isWebGPUBackend===!0;let l=!1,u=!1;i&&(l=e.isDeterministic(t),u=a?i:l);const h=e.getVectorType(this.getNodeType(e)),p=t.build(e,h),g=e.getVarFromNode(this,n,h,void 0,u),y=e.getPropertyName(g);let _=y;if(u)if(a)_=l?`const ${y}`:`let ${y}`;else{const S=t.getArrayCount(e);_=`const ${e.getVar(g.type,y,S)}`}return e.addLineFlowCode(`${_} = ${p}`,this),y}}const dw=en(wT),xI=(s,e=null)=>dw(s,e).toStack(),SI=(s,e=null)=>dw(s,e,!0).toStack(),bI=s=>SE()===null?s:dw(s).setIntent(!0).toStack();Le("toVar",xI);Le("toConst",SI);Le("toVarIntent",bI);class CY extends Rt{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}getNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);const t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);const n=this.node.build(e,...t);return e.removeSubBuild(),n}}const my=(s,e,t=null)=>Pe(new CY(Pe(s),e,t));class wY extends Rt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let n=t.varying;if(n===void 0){const i=this.name,r=this.getNodeType(e),a=this.interpolationType,l=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,i,r,a,l),t.node=my(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(a0.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(a0.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),i=this.setupVarying(e);if(n[t]===void 0){const r=this.getNodeType(e),a=e.getPropertyName(i,a0.VERTEX);e.flowNodeFromShaderStage(a0.VERTEX,n.node,r,a),n[t]=a}return e.getPropertyName(i)}}const ac=en(wY).setParameterLength(1,2),TI=s=>ac(s);Le("toVarying",ac);Le("toVertexStage",TI);Le("varying",(...s)=>(console.warn("THREE.TSL: .varying() has been renamed to .toVarying()."),ac(...s)));Le("vertexStage",(...s)=>(console.warn("THREE.TSL: .vertexStage() has been renamed to .toVertexStage()."),ac(...s)));const MI=le(([s])=>{const e=s.mul(.9478672986).add(.0521327014).pow(2.4),t=s.mul(.0773993808),n=s.lessThanEqual(.04045);return Yn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),EI=le(([s])=>{const e=s.pow(.41666).mul(1.055).sub(.055),t=s.mul(12.92),n=s.lessThanEqual(.0031308);return Yn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),fw="WorkingColorSpace",DY="OutputColorSpace";class pw extends vs{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===fw?Kt.workingColorSpace:t===DY?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),i=this.resolveColorSpace(e,this.target);let r=t;return Kt.enabled===!1||n===i||!n||!i||(Kt.getTransfer(n)===Et&&(r=Gt(MI(r.rgb),r.a)),Kt.getPrimaries(n)!==Kt.getPrimaries(i)&&(r=Gt(Yr(Kt._getMatrix(new pn,n,i)).mul(r.rgb),r.a)),Kt.getTransfer(i)===Et&&(r=Gt(EI(r.rgb),r.a))),r}}const AI=(s,e)=>Pe(new pw(Pe(s),fw,e)),UE=(s,e)=>Pe(new pw(Pe(s),e,fw)),UY=(s,e,t)=>Pe(new pw(Pe(s),e,t));Le("workingToColorSpace",AI);Le("colorSpaceToWorking",UE);let LY=class extends vm{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,n,i)}};class RI extends Rt{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,i=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=i,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=mn.OBJECT}setGroup(e){return this.group=e,this}element(e){return Pe(new LY(this,Pe(e)))}setNodeType(e){const t=Vt(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateV
3964alue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let i=1;i<t.length;i++)n=n[t[i]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const BY=(s,e,t)=>Pe(new RI(s,e,t));class PY extends RI{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Pt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}}const NI=(s,e,t=null)=>Pe(new PY(s,e,t));class OY extends vs{static get type(){return"ToneMappingNode"}constructor(e,t=wI,n=null){super("vec3"),this.toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return sM(this.toneMapping)}setup(e){const t=this.colorNode||e.context.color,n=this.toneMapping;if(n===Rr)return t;let i=null;const r=e.renderer.library.getToneMappingFunction(n);return r!==null?i=Gt(r(t.rgb,this.exposureNode),t.a):(console.error("ToneMappingNode: Unsupported Tone Mapping configuration.",n),i=t),i}}const CI=(s,e,t)=>Pe(new OY(s,Pe(e),Pe(t))),wI=NI("toneMappingExposure","float");Le("toneMapping",(s,e,t)=>CI(e,t,s));class IY extends zC{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,i=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=i,this.usage=Py,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(this.bufferStride===0&&this.bufferOffset===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;const t=this.getNodeType(e),n=this.value,i=e.getTypeLength(t),r=this.bufferStride||i,a=this.bufferOffset,l=n.isInterleavedBuffer===!0?n:new sx(n,r),u=new Dd(l,i,a);l.setUsage(this.usage),this.attribute=u,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),i=e.getPropertyName(n);let r=null;return e.shaderStage==="vertex"||e.shaderStage==="compute"?(this.name=i,r=i):r=ac(this).build(e,t),r}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}const gx=(s,e=null,t=0,n=0)=>Pe(new IY(s,e,t,n)),DI=(s,e=null,t=0,n=0)=>gx(s,e,t,n).setUsage(fp),dM=(s,e=null,t=0,n=0)=>gx(s,e,t,n).setInstanced(!0),aN=(s,e=null,t=0,n=0)=>DI(s,e,t,n).setInstanced(!0);Le("toAttribute",s=>gx(s.value));class FY extends Rt{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.version=1,this.name="",this.updateBeforeType=mn.OBJECT,this.onInitFunction=null}setCount(e){return this.count=e,this}getCount(){return this.count}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return console.warn('THREE.TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){const t=this.computeNode.build(e);if(t){const n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:n}=e;if(n==="compute"){const i=this.computeNode.build(e,"void");i!==""&&e.addLineFlowCode(i,this)}else{const r=e.getNodeProperties(this).outputComputeNode;if(r)return r.build(e,t)}}}const mw=(s,e=[64])=>{(e.length===0||e.length>3)&&console.error("THREE.TSL: compute() workgroupSize must have 1, 2, or 3 elements");for(let t=0;t<e.length;t++){const n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&console.error(`THREE.TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`)}for(;e.length<3;)e.push(1);return Pe(new FY(Pe(s),e))},UI=(s,e,t)=>mw(s,t).setCount(e);Le("compute",UI);Le("computeKernel",mw);class VY extends Rt{static get type(){return"CacheNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isCacheNo
3964de=!0}getNodeType(e){const t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);const i=this.node.getNodeType(e);return e.setCache(t),i}build(e,...t){const n=e.getCache(),i=e.getCacheFromNode(this,this.parent);e.setCache(i);const r=this.node.build(e,...t);return e.setCache(n),r}}const S0=(s,e)=>Pe(new VY(Pe(s),e));Le("cache",S0);class zY extends Rt{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const LI=en(zY).setParameterLength(2);Le("bypass",LI);class BI extends Rt{static get type(){return"RemapNode"}constructor(e,t,n,i=j(0),r=j(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=i,this.outHighNode=r,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:n,outLowNode:i,outHighNode:r,doClamp:a}=this;let l=e.sub(t).div(n.sub(t));return a===!0&&(l=l.clamp()),l.mul(r.sub(i)).add(i)}}const PI=en(BI,null,null,{doClamp:!1}).setParameterLength(3,5),OI=en(BI).setParameterLength(3,5);Le("remap",PI);Le("remapClamp",OI);class DT extends Rt{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const n=this.getNodeType(e),i=this.snippet;if(n==="void")e.addLineFlowCode(i,this);else return e.format(i,n,t)}}const oh=en(DT).setParameterLength(1,2),II=s=>(s?ur(s,oh("discard")):oh("discard")).toStack(),GY=()=>oh("return").toStack();Le("discard",II);class HY extends vs{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setup({context:e}){let t=this.colorNode||e.color;const n=(this.toneMapping!==null?this.toneMapping:e.toneMapping)||Rr,i=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||va;return n!==Rr&&(t=t.toneMapping(n)),i!==va&&i!==Kt.workingColorSpace&&(t=t.workingToColorSpace(i)),t}}const FI=(s,e=null,t=null)=>Pe(new HY(Pe(s),e,t));Le("renderOutput",FI);class kY extends vs{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}getNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){const t=this.callback,n=this.node.build(e),i="--- TSL debug - "+e.shaderStage+" shader ---",r="-".repeat(i.length);let a="";return a+="// #"+i+`# 3965`,a+=e.flow.code.replace(/^\t/mg,"")+` 3966`,a+="/* ... */ "+n+` /* ... */ 3967`,a+="// #"+r+`# 3968`,t!==null?t(e,a):console.log(a),n}}const VI=(s,e=null)=>Pe(new kY(Pe(s),e)).toStack();Le("debug",VI);function qY(s){console.warn("THREE.TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",s)}class zI extends Rt{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(t===null){const n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){const i=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(i)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){const r=e.geometry.getAttribute(t),a=e.getTypeFromAttribute(r),l=e.getAttribute(t,a);return e.shaderStage==="vertex"?e.format(l.name,a,n):ac(this).build(e,n)}else return console.warn(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const lh=(s,e=null)=>Pe(new zI(s,e)),vi=(s=0)=>lh("uv"+(s>0?s:""),"vec2");class WY extends Rt{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const n=this.textureNode.build(e,"property"),i=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${i} )`,this.getNodeType(e),t)}}const Rd=en(WY).setParameterLength(1,2);class XY extends fx{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=mn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){const{width:i,height:r}=n;this.value=Math.log2(Math.max(i,r))}}}const gw=en(XY).setParameterLength(1),yw=new qi;
3968class nc extends fx{static get type(){return"TextureNode"}constructor(e=yw,t=null,n=null,i=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=i,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=mn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return this.value.isDepthTexture===!0?"float":this.value.type===gi?"uvec4":this.value.type===Zs?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return vi(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Vt(this.value.matrix)),this._matrixUniform.mul(ae(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this.updateType=e?mn.OBJECT:mn.NONE,this}setupUV(e,t){const n=this.value;return e.isFlipY()&&(n.image instanceof ImageBitmap&&n.flipY===!0||n.isRenderTargetTexture===!0||n.isFramebufferTexture===!0||n.isDepthTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY($(Rd(this,this.levelNode).y).sub(t.y).sub(1))),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const n=this.value;if(!n||n.isTexture!==!0)throw new Error("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().");let i=this.uvNode;(i===null||e.context.forceUVContext===!0)&&e.context.getUV&&(i=e.context.getUV(this,e)),i||(i=this.getDefaultUV()),this.updateMatrix===!0&&(i=this.getTransformedUV(i)),i=this.setupUV(e,i);let r=this.levelNode;r===null&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),t.uvNode=i,t.levelNode=r,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,i,r,a,l,u,h){const p=this.value;let g;return i?g=e.generateTextureLevel(p,t,n,i,a,h):r?g=e.generateTextureBias(p,t,n,r,a,h):u?g=e.generateTextureGrad(p,t,n,u,a,h):l?g=e.generateTextureCompare(p,t,n,l,a,h):this.sampler===!1?g=e.generateTextureLoad(p,t,n,a,h):g=e.generateTexture(p,t,n,a,h),g}generate(e,t){const n=this.value,i=e.getNodeProperties(this),r=super.generate(e,"property");if(/^sampler/.test(t))return r+"_sampler";if(e.isReference(t))return r;{const a=e.getDataFromNode(this);let l=a.propertyName;if(l===void 0){const{uvNode:p,levelNode:g,biasNode:y,compareNode:_,depthNode:S,gradNode:A,offsetNode:E}=i,b=this.generateUV(e,p),C=g?g.build(e,"float"):null,w=y?y.build(e,"float"):null,D=S?S.build(e,"int"):null,P=_?_.build(e,"float"):null,I=A?[A[0].build(e,"vec2"),A[1].build(e,"vec2")]:null,F=E?this.generateOffset(e,E):null,z=e.getVarFromNode(this);l=e.getPropertyName(z);const B=this.generateSnippet(e,r,b,C,w,D,P,I,F);e.addLineFlowCode(`${l} = ${B}`,this),a.snippet=B,a.propertyName=l}let u=l;const h=this.getNodeType(e);return e.needsToWorkingColorSpace(n)&&(u=UE(oh(u,h),n.colorSpace).setup(e).build(e,h)),e.format(u,h,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){return console.warn("THREE.TextureNode: .uv() has been renamed. Use .sample() instead."),this.sample(e)}sample(e){const t=this.clone();return t.uvNode=Pe(e),t.referenceNode=this.getBase(),Pe(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=Pe(e).mul(gw(t)),t.referenceNode=this.getBase();const n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===Ai||n.magFilter===Ai)&&(console.warn("THREE.TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Pe(t)}level(e){const t=this.clone();return t.levelNode=Pe(e),t.referenceNode=this.getBase(),Pe(t)}size(e){return Rd(this,e)}bias(e){const t=this.clone();return t.biasNode=Pe(e),t.referenceNode=this.getBase(),Pe(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=Pe(e),t.referenceNode=this.getBase(),Pe(t)}grad(e,t){const n=this.clone();return n.gradNode=[Pe(e),Pe(t)],n.referenceNode=this.getBase(),Pe(n)}depth(e){const t=this.clone();return t.depthNode=Pe(e),t.referenceNode=this.getBase(),Pe(t)}offset(e){const t=this.clone();return t.offsetNode=Pe(e),t.referenceNode=this.getBase(),Pe(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix()}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}const YY=en(nc).setParameterLength(1,4).setName("texture"),Dn=(s=yw,e=null,t=null,n=null)=>{let i;return s&&s.isTextureNode===!0?(i=Pe(s.clone()),i.referenceNode=s.getBase(),e!==null&&(i.uvNode=Pe(e)),t!==null&&(i.levelNode=Pe(t)),n!==null&&(i.biasNode=Pe(n))):i=YY(s,e,t,n),i},jY=(s=yw)=>Dn(s),fs=(...s)=>Dn(...s).setSampler(!1),KY=s=>(s.isNode===!0?s:Dn(s)).convert("sampler"),ZY=s=>(s.isNode===!0?s:Dn(s)).convert("samplerComparison");class vw extends fx{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const yx=(s,e,t)=>Pe(new vw(s,e,t));class QY extends vm{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),n=this.getNodeType(),i=this.node.getPaddedType();return e.format(t,i,n)}}class $Y extends vw{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Sd(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=mn.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){const{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let i=0;i<e.length;i++){const r=i*4;t[r]=e[i]}else if(n==="color")for(let i=0;i<e.length;i++){const r=i*4,a=e[i];t[r]=a.r,t[r+1]=a.g,t[r+2]=a.b||0}else if(n==="mat2")for(let i=0;i<e.length;i++){const r=i*4,a=e[i];t[r]=a.elements[0],t[r+1]=a.elements[1],t[r+2]=a.elements[2],t[r+3]=a.elements[3]}else if(n==="mat3")for(let i=0;i<e.length;i++){const r=i*16,a=e[i];t[r]=a.elements[0],t[r+1]=a.elements[1],t[r+2]=a.elements[2],t[r+4]=a.elements[3],t[r+5]=a.elements[4],t[r+6]=a.elements[5],t[r+8]=a.elements[6],t[r+9]=a.elements[7],t[r+10]=a.elements[8],t[r+15]=1}else if(n==="mat4")for(let i=0;i<e.length;i++){const r=i*16,a=e[i];for(let l=0;l<a.elements.length;l++)t[r+l]=a.elements[l]}else for(let i=0;i<e.length;i++){const r=i*4,a=e[i];t[r]=a.x,t[r+1]=a.y,t[r+2]=a.z||0,t[r+3]=a.w||0}}setup(e){const t=this.array.length,n=this.elementType;let i=Float32Array;const r=this.paddedType,a=e.getTypeLength(r);return n.charAt(0)==="i"&&(i=Int32Array),n.charAt(0)==="u"&&(i=Uint32Array),this.value=new i(t*a),this.bufferCount=t,this.bufferType=r,super.setup(e)}element(e){return Pe(new QY(this,Pe(e)))}}const kr=(s,e)=>Pe(new $Y(s,e));class JY extends Rt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const hh=en(JY).setParameterLength(1);let G_,H_;class Ui extends Rt{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}getNodeType(){return this.scope===Ui.DPR?"float":this.scope===Ui.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=mn.NONE;return(this.scope===Ui.SIZE||this.scope===Ui.VIEWPORT||this.scope===Ui.DPR)&&(e=mn.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===Ui.VIEWPORT?t!==null?H_.copy(t.viewport):(e.getViewport(H_),H_.multiplyScalar(e.getPixelRatio())):this.scope===Ui.DPR?this._output.value=e.getPixelRatio():t!==null?(G_.width=t.width,G_.height=t.height):e.getDrawingBufferSize(G_)}setup(){const e=this.scope;let t=null;return e===Ui.SIZE?t=Vt(G_||(G_=new Ge)):e===Ui.VIEWPORT?t=Vt(H_||(H_=new kt)):e===Ui.DPR?t=Vt(1):t=Fe(vx.div(am)),this._output=t,t}generate(e){if(this.scope===Ui.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(am).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}Ui.COORDINATE="coordinate";Ui.VIEWPORT="viewport";Ui.SIZE="size";Ui.UV="uv";Ui.DPR="dpr";const GI=ct(Ui,Ui.DPR),$c=ct(Ui,Ui.UV),am=ct(Ui,Ui.SIZE),vx=ct(Ui,Ui.COORDINATE),_w=ct(Ui,Ui.VIEWPORT),xw=_w.zw,HI=vx.sub(_w.xy),ej=HI.div(xw),tj=le(()=>(console.warn('THREE.TSL: "viewportResolution" is deprecated. Use "screenSize" instead.'),am),"vec2").once()(),Gd=Vt(0,"uint").setName("u_cameraIndex").setGroup(AE("cameraIndex")).toVarying("v_cameraIndex"),gd=Vt("float").setName("cameraNear").setGroup(Pt).onRenderUpd
vendor: 5,350 bytes, line 3968
3968ate(({camera:s})=>s.near),yd=Vt("float").setName("cameraFar").setGroup(Pt).onRenderUpdate(({camera:s})=>s.far),rv=le(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.projectionMatrix);e=kr(t).setGroup(Pt).setName("cameraProjectionMatrices").element(s.isMultiViewCamera?hh("gl_ViewID_OVR"):Gd).toConst("cameraProjectionMatrix")}else e=Vt("mat4").setName("cameraProjectionMatrix").setGroup(Pt).onRenderUpdate(({camera:t})=>t.projectionMatrix);return e}).once()(),nj=le(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.projectionMatrixInverse);e=kr(t).setGroup(Pt).setName("cameraProjectionMatricesInverse").element(s.isMultiViewCamera?hh("gl_ViewID_OVR"):Gd).toConst("cameraProjectionMatrixInverse")}else e=Vt("mat4").setName("cameraProjectionMatrixInverse").setGroup(Pt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse);return e}).once()(),dl=le(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.matrixWorldInverse);e=kr(t).setGroup(Pt).setName("cameraViewMatrices").element(s.isMultiViewCamera?hh("gl_ViewID_OVR"):Gd).toConst("cameraViewMatrix")}else e=Vt("mat4").setName("cameraViewMatrix").setGroup(Pt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse);return e}).once()(),ij=le(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.matrixWorld);e=kr(t).setGroup(Pt).setName("cameraWorldMatrices").element(s.isMultiViewCamera?hh("gl_ViewID_OVR"):Gd).toConst("cameraWorldMatrix")}else e=Vt("mat4").setName("cameraWorldMatrix").setGroup(Pt).onRenderUpdate(({camera:t})=>t.matrixWorld);return e}).once()(),sj=le(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.normalMatrix);e=kr(t).setGroup(Pt).setName("cameraNormalMatrices").element(s.isMultiViewCamera?hh("gl_ViewID_OVR"):Gd).toConst("cameraNormalMatrix")}else e=Vt("mat3").setName("cameraNormalMatrix").setGroup(Pt).onRenderUpdate(({camera:t})=>t.normalMatrix);return e}).once()(),kI=le(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(let i=0,r=s.cameras.length;i<r;i++)t.push(new Y);e=kr(t).setGroup(Pt).setName("cameraPositions").onRenderUpdate(({camera:i},r)=>{const a=i.cameras,l=r.array;for(let u=0,h=a.length;u<h;u++)l[u].setFromMatrixPosition(a[u].matrixWorld)}).element(s.isMultiViewCamera?hh("gl_ViewID_OVR"):Gd).toConst("cameraPosition")}else e=Vt(new Y).setName("cameraPosition").setGroup(Pt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld));return e}).once()(),rj=le(({camera:s})=>{let e;if(s.isArrayCamera&&s.cameras.length>0){const t=[];for(const i of s.cameras)t.push(i.viewport);e=kr(t,"vec4").setGroup(Pt).setName("cameraViewports").element(Gd).toConst("cameraViewport")}else e=Gt(0,0,am.x,am.y).toConst("cameraViewport");return e}).once()(),RL=new cr;class In extends Rt{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=mn.OBJECT,this.uniformNode=new fx(null)}getNodeType(){const e=this.scope;if(e===In.WORLD_MATRIX)return"mat4";if(e===In.POSITION||e===In.VIEW_POSITION||e===In.DIRECTION||e===In.SCALE)return"vec3";if(e===In.RADIUS)return"float"}update(e){const t=this.object3d,n=this.uniformNode,i=this.scope;if(i===In.WORLD_MATRIX)n.value=t.matrixWorld;else if(i===In.POSITION)n.value=n.value||new Y,n.value.setFromMatrixPosition(t.matrixWorld);else if(i===In.SCALE)n.value=n.value||new Y,n.value.setFromMatrixScale(t.matrixWorld);else if(i===In.DIRECTION)n.value=n.value||new Y,t.getWorldDirection(n.value);else if(i===In.VIEW_POSITION){const r=e.camera;n.value=n.value||new Y,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(r.matrixWorldInverse)}else if(i===In.RADIUS){const r=e.object.geometry;r.boundingSphere===null&&r.computeBoundingSphere(),RL.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),n.value=RL.radius}}generate(e){const t=this.scope;return t===In.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===In.POSITION||t===In.VIEW_POSITION||t===In.DIRECTION||t===In.SCALE?this.uniformNode.nodeType="vec3":t===In.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}In.WORLD_MATRIX="worldMatrix";In.POSITION="position";In.SCALE="scale";In.VIEW_POSITION="viewPosition";In.DIRECTION="direction";In.RADIUS="radius";const aj=en(In,In.DIRECTION).setParameterLength(1),oj=en(In,In.WORLD_MATRIX).setParameterLength(1),qI=en(In,In.POSITION).setParameterLength(1),lj=en(In,In.SCALE).setParameterLength(1),uj=en(In,In.VIEW_POSITION).setParameterLength(1),cj=en(In,In.RADIUS).setParameterLength(1);class ll extends In{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const hj=ct(ll,ll.DIRECTION),el=ct(ll,ll.WORLD_MATRIX),dj=ct(ll,ll.POSITION),fj=ct(ll,ll.SCALE),pj=ct(ll,ll.VIEW_POSITION),mj=ct(ll,ll.RADIUS),WI=Vt(new pn).onObjectUpdate(({object:s},e)=>e.value.getNormalMatrix(s.matrixWorld)),gj=Vt(new Ot).onObjectUpdate(({object:s},e)=>e.value.copy(s.matrixWorld).invert()),_m=le(s=>s.renderer.overrideNodes.modelViewMatrix||XI).once()().toVar("modelViewMatrix"),
3968XI=dl.mul(el),oN=le(s=>(s.context.isHighPrecisionModelViewMatrix=!0,Vt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),lN=le(s=>{const e=s.context.isHighPrecisionModelViewMatrix;return Vt("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),_x=lh("position","vec3"),ms=_x.toVarying("positionLocal"),fM=_x.toVarying("positionPrevious"),Zu=le(s=>el.mul(ms).xyz.toVarying(s.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),Sw=le(()=>ms.transformDirection(el).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),gs=le(s=>s.context.setupPositionView().toVarying("v_positionView"),"vec3").once(["POSITION"])(),Gi=gs.negate().toVarying("v_positionViewDirection").normalize().toVar("positionViewDirection");class yj extends Rt{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";const{material:t}=e;return t.side===yi?"false":e.getFrontFacing()}}const YI=ct(yj),bw=j(YI).mul(2).sub(1),av=le(([s],{material:e})=>{const t=e.side;return t===yi?s=s.mul(-1):t===br&&(s=s.mul(bw)),s}),LE=lh("normal","vec3"),io=le(s=>s.geometry.hasAttribute("normal")===!1?(console.warn('THREE.TSL: Vertex attribute "normal" not found on geometry.'),ae(0,1,0)):LE,"vec3").once()().toVar("normalLocal"),jI=gs.dFdx().cross(gs.dFdy()).normalize().toVar("normalFlat"),Gy=le(s=>{let e;return s.material.flatShading===!0?e=jI:e=Tw(io).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),KI=le(s=>{let e=Gy.transformDirection(dl);return s.material.flatShading!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),ui=le(({subBuildFn:s,material:e,context:t})=>{let n;return s==="NORMAL"||s==="VERTEX"?(n=Gy,e.flatShading!==!0&&(n=av(n))):n=t.setupNormal().context({getUV:null}),n},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Hd=ui.transformDirection(dl).toVar("normalWorld"),yp=le(({subBuildFn:s,context:e})=>{let t;return s==="NORMAL"||s==="VERTEX"?t=ui:t=e.setupClearcoatNormal().context({getUV:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),ZI=le(([s,e=el])=>{const t=Yr(e),n=s.div(ae(t[0].dot(t[0]),t[1].dot(t[1]),t[2].dot(t[2])));return t.mul(n).xyz}),Tw=le(([s],e)=>{const t=e.renderer.overrideNodes.modelNormalViewMatrix;if(t!==null)return t.transformDirection(s);const n=WI.mul(s);return dl.transformDirection(n)}),vj=le(()=>(console.warn('THREE.TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),ui)).once(["NORMAL","VERTEX"])(),_j=le(()=>(console.warn('THREE.TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Hd)).once(["NORMAL","VERTEX"])(),xj=le(()=>(console.warn('THREE.TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),yp)).once(["NORMAL","VERTEX"])(),NL=new Ma,J1=new Ot,QI=Vt(0).onReference(({material:s})=>s).onObjectUpdate(({material:s})=>s.refractionRatio),UT=Vt(1).onReference(({material:s})=>s).onObjectUpdate(function({material:s,scene:e}){return s.envMap?s.envMapIntensity:e.environmentIntensity}),Mw=Vt(new Ot).onReference(function(s){return s.material}).onObjectUpdate(function({material:s,scene:e}){const t=e.environment!==null&&s.envMap===null?e.environmentRotation:s.envMapRotation;return t?(NL.copy(t),J1.makeRotationFromEuler(NL)):J1.identity(),J1}),$I=Gi.negate().reflect(ui),JI=Gi.negate().refract(ui,QI),eF=$I.transformDirection(dl).toVar("reflectVector"),tF=JI.transformDirection(dl).toVar("reflectVector"),nF=new Id;class Sj extends nc{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,i=null){super(e,t,n,i),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===Eo?eF:e.mapping===sl?tF:(console.error('THREE.CubeTextureNode: Mapping "%s" not supported.',e.mapping),ae(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return(e.renderer.coordinateSystem===rl||!n.isRenderTargetTexture)&&(t=ae(t.x.negate(),t.yz)),Mw.mul(t)}generateUV(e,t){return t.build(e,"vec3")}}const Ew=en(Sj).setParameterLength(1,4).setName("cubeTexture"),Hy=(s=nF,e=null,t=null,n=null)=>{let i;return s&&s.isCubeTextureNode===!0?(i=Pe(s.clone()),i.referenceNode=s,e!==null&&(i.uvNode=Pe(e)),t!==null&&(i.levelNode=Pe(t)),n!==null&&(i.biasNode=Pe(n))):i=Ew(s,e,t,n),i},bj=(s=nF)=>Ew(s);class Tj extends vm{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,n,i)}}class BE extends Rt{static get type(){return"ReferenceNode"}constructor(e,t,n=null,i=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=i,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=mn.OBJECT}element(e){return Pe(new Tj(this,Pe(e)))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return console.warn('THREE.TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=yx(null,e,this.count):Array.isArray(this.getValueFromReference())?t=kr(null,e):e==="texture"?t=Dn(null):e==="cubeTexture"?t=Hy(null):t=Vt(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateV
3968alue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let i=1;i<t.length;i++)n=n[t[i]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);const e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}const Ei=(s,e,t)=>Pe(new BE(s,e,t)),uN=(s,e,t,n)=>Pe(new BE(s,e,n,t));class Mj extends BE{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}}const kc=(s,e,t=null)=>Pe(new Mj(s,e,t)),iF=vi(),Ej=gs.dFdx(),Aj=gs.dFdy(),sF=iF.dFdx(),rF=iF.dFdy(),aF=ui,oF=Aj.cross(aF),lF=aF.cross(Ej),cN=oF.mul(sF.x).add(lF.mul(rF.x)),hN=oF.mul(sF.y).add(lF.mul(rF.y)),CL=cN.dot(cN).max(hN.dot(hN)),uF=CL.equal(0).select(0,CL.inverseSqrt()),Rj=cN.mul(uF).toVar("tangentViewFrame"),Nj=hN.mul(uF).toVar("bitangentViewFrame"),PE=le(s=>(s.geometry.hasAttribute("tangent")===!1&&s.geometry.computeTangents(),lh("tangent","vec4")))(),xx=PE.xyz.toVar("tangentLocal"),OE=le(({subBuildFn:s,geometry:e,material:t})=>{let n;return s==="VERTEX"||e.hasAttribute("tangent")?n=_m.mul(Gt(xx,0)).xyz.toVarying("v_tangentView").normalize():n=Rj,t.flatShading!==!0&&(n=av(n)),n},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),cF=OE.transformDirection(dl).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),IE=le(([s,e],{subBuildFn:t,material:n})=>{let i=s.mul(PE.w).xyz;return t==="NORMAL"&&n.flatShading!==!0&&(i=i.toVarying(e)),i}).once(["NORMAL"]),Cj=IE(LE.cross(PE),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),wj=IE(io.cross(xx),"v_bitangentLocal").normalize().toVar("bitangentLocal"),hF=le(({subBuildFn:s,geometry:e,material:t})=>{let n;return s==="VERTEX"||e.hasAttribute("tangent")?n=IE(ui.cross(OE),"v_bitangentView").normalize():n=Nj,t.flatShading!==!0&&(n=av(n)),n},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),Dj=IE(Hd.cross(cF),"v_bitangentWorld").normalize().toVar("bitangentWorld"),vp=Yr(OE,hF,ui).toVar("TBNViewMatrix"),dF=Gi.mul(vp),Uj=(s,e)=>s.sub(dF.mul(e)),fF=le(()=>{let s=Rp.cross(Gi);return s=s.cross(Rp).normalize(),s=Yn(s,ui,pd.mul(ku.oneMinus()).oneMinus().pow2().pow2()).normalize(),s}).once()();class Lj extends vs{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=ec}setup({material:e}){const{normalMapType:t,scaleNode:n}=this;let i=this.node.mul(2).sub(1);if(n!==null){let a=n;e.flatShading===!0&&(a=av(a)),i=ae(i.xy.mul(a),i.z)}let r=null;return t===jN?r=Tw(i):t===ec?r=vp.mul(i).normalize():(console.error(`THREE.NodeMaterial: Unsupported normal map type: ${t}`),r=ui),r}}const dN=en(Lj).setParameterLength(1,2),Bj=le(({textureNode:s,bumpScale:e})=>{const t=i=>s.cache().context({getUV:r=>i(r.uvNode||vi()),forceUVContext:!0}),n=j(t(i=>i));return Fe(j(t(i=>i.add(i.dFdx()))).sub(n),j(t(i=>i.add(i.dFdy()))).sub(n)).mul(e)}),Pj=le(s=>{const{surf_pos:e,surf_norm:t,dHdxy:n}=s,i=e.dFdx().normalize(),r=e.dFdy().normalize(),a=t,l=r.cross(a),u=a.cross(i),h=i.dot(l).mul(bw),p=h.sign().mul(n.x.mul(l).add(n.y.mul(u)));return h.abs().mul(t).sub(p).normalize()});class Oj extends vs{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=this.scaleNode!==null?this.scaleNode:1,t=Bj({textureNode:this.textureNode,bumpScale:e});return Pj({surf_pos:gs,surf_norm:ui,dHdxy:t})}}const Aw=en(Oj).setParameterLength(1,2),wL=new Map;class Oe extends Rt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=wL.get(e);return n===void 0&&(n=kc(e,t),wL.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){const t=e.context.material,n=this.scope;let i=null;if(n===Oe.COLOR){const r=t.color!==void 0?this.getColor(n):ae();t.map&&t.map.isTexture===!0?i=r.mul(this.getTexture("map")):i=r}else if(n===Oe.OPACITY){const r=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?i=r.mul(this.getTexture("alpha")):i=r}else if(n===Oe.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?i=this.getTexture("specular").r:i=j(1);else if(n===Oe.SPECULAR_INTENSITY){const r=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?i=r.mul(this.getTexture(n).a):i=r}else if(n===Oe.SPECULAR_COLOR){const r=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?i=r.mul(this.getTexture(n).rgb):i=r}else if(n===Oe.ROUGHNESS){const r=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?i=r.mul(this.getTexture(n).g):i=r}else if(n===Oe.METALNESS){const r=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?i=r.mul(this.getTexture(n).b):i=r}else if(n===Oe.EMISSIVE){const r=this.getFloat("emissiveIntensity"),a=this.getColor(n).mul(r);t.emissiveMap&&t.emissiveMap.isTexture===!0?i=a.mul(this.getTexture(n)):i=a}else if(n===Oe.NORMAL)t.normalMap?(i=dN(this.getTexture("normal"),this.getCache("normalScale","vec2")),i.normalMapType=t.normalMapType):t.bumpMap?i=Aw(this.getTexture("bump").r,this.getFloat("bumpScale")):i=ui;else if(n===Oe.CLEARCOAT){const r=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?i=r.mul(this.getTexture(n).r):i=r}else if(n===Oe.CLEARCOAT_ROUGHNESS){const r=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?i=r.mul(this.getTexture(n).r):i=r}else if(n===Oe.CLEARCOAT_NORMAL)t.clearcoatNormalMap?i=dN(this.getTexture(n),this.getCache(n+"Scale","vec2")):i=ui;else if(n===Oe.SHEEN){const r=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?i=r.mul(this.getTexture("sheenColor").rgb):i=r}else if(n===Oe.SHEEN_ROUGHNESS){const r=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?i=r.mul(this.getTexture(n).a):i=r,i=i.clamp(.07,1)}else if(n===Oe.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const r=this.getTexture(n);i=TE(iy.x,iy.y,iy.y.negate(),iy.x).mul(r.rg.mul(2).sub(Fe(1)).normalize().mul(r.b))}else i=iy;else if(n===Oe.IRIDESCENCE_THICKNESS){const r=Ei("1","float",t.iridescenceThicknessRange);
3968if(t.iridescenceThicknessMap){const a=Ei("0","float",t.iridescenceThicknessRange);i=r.sub(a).mul(this.getTexture(n).g).add(a)}else i=r}else if(n===Oe.TRANSMISSION){const r=this.getFloat(n);t.transmissionMap?i=r.mul(this.getTexture(n).r):i=r}else if(n===Oe.THICKNESS){const r=this.getFloat(n);t.thicknessMap?i=r.mul(this.getTexture(n).g):i=r}else if(n===Oe.IOR)i=this.getFloat(n);else if(n===Oe.LIGHT_MAP)i=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity"));else if(n===Oe.AO)i=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(n===Oe.LINE_DASH_OFFSET)i=t.dashOffset?this.getFloat(n):j(0);else{const r=this.getNodeType(e);i=this.getCache(n,r)}return i}}Oe.ALPHA_TEST="alphaTest";Oe.COLOR="color";Oe.OPACITY="opacity";Oe.SHININESS="shininess";Oe.SPECULAR="specular";Oe.SPECULAR_STRENGTH="specularStrength";Oe.SPECULAR_INTENSITY="specularIntensity";Oe.SPECULAR_COLOR="specularColor";Oe.REFLECTIVITY="reflectivity";Oe.ROUGHNESS="roughness";Oe.METALNESS="metalness";Oe.NORMAL="normal";Oe.CLEARCOAT="clearcoat";Oe.CLEARCOAT_ROUGHNESS="clearcoatRoughness";Oe.CLEARCOAT_NORMAL="clearcoatNormal";Oe.EMISSIVE="emissive";Oe.ROTATION="rotation";Oe.SHEEN="sheen";Oe.SHEEN_ROUGHNESS="sheenRoughness";Oe.ANISOTROPY="anisotropy";Oe.IRIDESCENCE="iridescence";Oe.IRIDESCENCE_IOR="iridescenceIOR";Oe.IRIDESCENCE_THICKNESS="iridescenceThickness";Oe.IOR="ior";Oe.TRANSMISSION="transmission";Oe.THICKNESS="thickness";Oe.ATTENUATION_DISTANCE="attenuationDistance";Oe.ATTENUATION_COLOR="attenuationColor";Oe.LINE_SCALE="scale";Oe.LINE_DASH_SIZE="dashSize";Oe.LINE_GAP_SIZE="gapSize";Oe.LINE_WIDTH="linewidth";Oe.LINE_DASH_OFFSET="dashOffset";Oe.POINT_SIZE="size";Oe.DISPERSION="dispersion";Oe.LIGHT_MAP="light";Oe.AO="ao";const pF=ct(Oe,Oe.ALPHA_TEST),mF=ct(Oe,Oe.COLOR),gF=ct(Oe,Oe.SHININESS),yF=ct(Oe,Oe.EMISSIVE),Rw=ct(Oe,Oe.OPACITY),vF=ct(Oe,Oe.SPECULAR),fN=ct(Oe,Oe.SPECULAR_INTENSITY),_F=ct(Oe,Oe.SPECULAR_COLOR),b0=ct(Oe,Oe.SPECULAR_STRENGTH),LT=ct(Oe,Oe.REFLECTIVITY),xF=ct(Oe,Oe.ROUGHNESS),SF=ct(Oe,Oe.METALNESS),bF=ct(Oe,Oe.NORMAL),TF=ct(Oe,Oe.CLEARCOAT),MF=ct(Oe,Oe.CLEARCOAT_ROUGHNESS),EF=ct(Oe,Oe.CLEARCOAT_NORMAL),AF=ct(Oe,Oe.ROTATION),RF=ct(Oe,Oe.SHEEN),NF=ct(Oe,Oe.SHEEN_ROUGHNESS),CF=ct(Oe,Oe.ANISOTROPY),wF=ct(Oe,Oe.IRIDESCENCE),DF=ct(Oe,Oe.IRIDESCENCE_IOR),UF=ct(Oe,Oe.IRIDESCENCE_THICKNESS),LF=ct(Oe,Oe.TRANSMISSION),BF=ct(Oe,Oe.THICKNESS),PF=ct(Oe,Oe.IOR),OF=ct(Oe,Oe.ATTENUATION_DISTANCE),IF=ct(Oe,Oe.ATTENUATION_COLOR),FF=ct(Oe,Oe.LINE_SCALE),VF=ct(Oe,Oe.LINE_DASH_SIZE),zF=ct(Oe,Oe.LINE_GAP_SIZE),Ij=ct(Oe,Oe.LINE_WIDTH),GF=ct(Oe,Oe.LINE_DASH_OFFSET),HF=ct(Oe,Oe.POINT_SIZE),kF=ct(Oe,Oe.DISPERSION),Nw=ct(Oe,Oe.LIGHT_MAP),qF=ct(Oe,Oe.AO),iy=Vt(new Ge).onReference(function(s){return s.material}).onRenderUpdate(function({material:s}){this.value.set(s.anisotropy*Math.cos(s.anisotropyRotation),s.anisotropy*Math.sin(s.anisotropyRotation))}),Cw=le(s=>s.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class Hi extends Rt{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),n=this.scope;let i;if(n===Hi.VERTEX)i=e.getVertexIndex();else if(n===Hi.INSTANCE)i=e.getInstanceIndex();else if(n===Hi.DRAW)i=e.getDrawIndex();else if(n===Hi.INVOCATION_LOCAL)i=e.getInvocationLocalIndex();else if(n===Hi.INVOCATION_SUBGROUP)i=e.getInvocationSubgroupIndex();else if(n===Hi.SUBGROUP)i=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let r;return e.shaderStage==="vertex"||e.shaderStage==="compute"?r=i:r=ac(this).build(e,t),r}}Hi.VERTEX="vertex";Hi.INSTANCE="instance";Hi.SUBGROUP="subgroup";Hi.INVOCATION_LOCAL="invocationLocal";Hi.INVOCATION_SUBGROUP="invocationSubgroup";Hi.DRAW="draw";const WF=ct(Hi,Hi.VERTEX),Nd=ct(Hi,Hi.INSTANCE),Fj=ct(Hi,Hi.SUBGROUP),Vj=ct(Hi,Hi.INVOCATION_SUBGROUP),zj=ct(Hi,Hi.INVOCATION_LOCAL),XF=ct(Hi,Hi.DRAW);class YF extends Rt{static get type(){return"InstanceNode"}constructor(e,t,n=null){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=n,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=mn.FRAME,this.buffer=null,this.bufferColor=null}setup(e){const{instanceMatrix:t,instanceColor:n}=this,{count:i}=t;let{instanceMatrixNode:r,instanceColorNode:a}=this;if(r===null){if(i<=1e3)r=yx(t.array,"mat4",Math.max(i,1)).element
3968(Nd);else{const u=new v3(t.array,16,1);this.buffer=u;const h=t.usage===fp?aN:dM,p=[h(u,"vec4",16,0),h(u,"vec4",16,4),h(u,"vec4",16,8),h(u,"vec4",16,12)];r=Ap(...p)}this.instanceMatrixNode=r}if(n&&a===null){const u=new nl(n.array,3),h=n.usage===fp?aN:dM;this.bufferColor=u,a=ae(h(u,"vec3",3,0)),this.instanceColorNode=a}const l=r.mul(ms).xyz;if(ms.assign(l),e.hasGeometryAttribute("normal")){const u=ZI(io,r);io.assign(u)}this.instanceColorNode!==null&&G0("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){this.instanceMatrix.usage!==fp&&this.buffer!==null&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version),this.instanceColor&&this.instanceColor.usage!==fp&&this.bufferColor!==null&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)}}const Gj=en(YF).setParameterLength(2,3);class Hj extends YF{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:n,instanceColor:i}=e;super(t,n,i),this.instancedMesh=e}}const jF=en(Hj).setParameterLength(1);class kj extends Rt{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){this.batchingIdNode===null&&(e.getDrawIndex()===null?this.batchingIdNode=Nd:this.batchingIdNode=XF);const n=le(([S])=>{const A=$(Rd(fs(this.batchMesh._indirectTexture),0).x),E=$(S).mod(A),b=$(S).div(A);return fs(this.batchMesh._indirectTexture,Ks(E,b)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})($(this.batchingIdNode)),i=this.batchMesh._matricesTexture,r=$(Rd(fs(i),0).x),a=j(n).mul(4).toInt().toVar(),l=a.mod(r),u=a.div(r),h=Ap(fs(i,Ks(l,u)),fs(i,Ks(l.add(1),u)),fs(i,Ks(l.add(2),u)),fs(i,Ks(l.add(3),u))),p=this.batchMesh._colorsTexture;if(p!==null){const A=le(([E])=>{const b=$(Rd(fs(p),0).x),C=E,w=C.mod(b),D=C.div(b);return fs(p,Ks(w,D)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(n);G0("vec3","vBatchColor").assign(A)}const g=Yr(h);ms.assign(h.mul(ms));const y=io.div(ae(g[0].dot(g[0]),g[1].dot(g[1]),g[2].dot(g[2]))),_=g.mul(y).xyz;io.assign(_),e.hasGeometryAttribute("tangent")&&xx.mulAssign(g)}}const KF=en(kj).setParameterLength(1);class qj extends vm{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){const n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const i=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&i!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),i!==!0){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}const Wj=en(qj).setParameterLength(2);class Xj extends vw{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let i,r=null;t&&t.isStruct?(i="struct",r=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(i=$3(e.itemSize),n=e.count):i=t,super(e,i,n),this.isStorageBufferNode=!0,this.structTypeNode=r,this.access=Ar.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(this.bufferCount===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return Wj(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Ar.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=gx(this.value),this._varying=ac(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:n}=this.getAttributeData(),i=n.build(e);return e.registerTransform(i,t),i}}const Np=(s,e=null,t=0)=>Pe(new Xj(s,e,t)),Yj=(s,e,t)=>(console.warn('THREE.TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.'),Np(s,e,t).setPBO(!0)),DL=new WeakMap;class ZF extends Rt{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=mn.OBJECT,this.skinIndexNode=lh("skinIndex","uvec4"),this.skinWeightNode=lh("skinWeight","vec4"),this.bindMatrixNode=Ei("bindMatrix","mat4"),this.bindMatrixInverseNo
3968de=Ei("bindMatrixInverse","mat4"),this.boneMatricesNode=uN("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=ms,this.toPositionNode=ms,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){const{skinIndexNode:n,skinWeightNode:i,bindMatrixNode:r,bindMatrixInverseNode:a}=this,l=e.element(n.x),u=e.element(n.y),h=e.element(n.z),p=e.element(n.w),g=r.mul(t),y=Ns(l.mul(i.x).mul(g),u.mul(i.y).mul(g),h.mul(i.z).mul(g),p.mul(i.w).mul(g));return a.mul(y).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=io){const{skinIndexNode:n,skinWeightNode:i,bindMatrixNode:r,bindMatrixInverseNode:a}=this,l=e.element(n.x),u=e.element(n.y),h=e.element(n.z),p=e.element(n.w);let g=Ns(i.x.mul(l),i.y.mul(u),i.z.mul(h),i.w.mul(p));return g=a.mul(g).mul(r),g.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return this.previousBoneMatricesNode===null&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=uN("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,fM)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")||eO(e.object).useVelocity===!0}setup(e){this.needsPreviousBoneMatrices(e)&&fM.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){const n=this.getSkinnedNormal();io.assign(n),e.hasGeometryAttribute("tangent")&&xx.assign(n)}return t}generate(e,t){if(t!=="void")return super.generate(e,t)}update(e){const t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;DL.get(t)!==e.frameId&&(DL.set(t,e.frameId),this.previousBoneMatricesNode!==null&&t.previousBoneMatrices.set(t.boneMatrices),t.update())}}const QF=s=>Pe(new ZF(s)),jj=(s,e=null)=>{const t=new ZF(s);return t.positionNode=Np(new nl(s.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(Nd).toVar(),t.skinIndexNode=Np(new nl(new Uint32Array(s.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(Nd).toVar(),t.skinWeightNode=Np(new nl(s.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(Nd).toVar(),t.bindMatrixNode=Vt(s.bindMatrix,"mat4"),t.bindMatrixInverseNode=Vt(s.bindMatrixInverse,"mat4"),t.boneMatricesNode=yx(s.skeleton.boneMatrices,"mat4",s.skeleton.bones.length),t.toPositionNode=e,Pe(t)};class Kj extends Rt{static get type(){return"LoopNode"}constructor(e=[]){super(),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){const t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;const n={};for(let a=0,l=this.params.length-1;a<l;a++){const u=this.params[a],h=u.isNode!==!0&&u.name||this.getVarName(a),p=u.isNode!==!0&&u.type||"int";n[h]=oh(h,p)}const i=e.addStack();t.returnsNode=this.params[this.params.length-1](n,e),t.stackNode=i;const r=this.params[0];return r.isNode!==!0&&typeof r.update=="function"&&(t.updateNode=le(this.params[0].update)(n)),e.removeStack(),t}getNodeType(e){const{returnsNode:t}=this.getProperties(e);return t?t.getNodeType(e):"void"}setup(e){this.getProperties(e)}generate(e){const t=this.getProperties(e),n=this.params,i=t.stackNode;for(let l=0,u=n.length-1;l<u;l++){const h=n[l];let p=!1,g=null,y=null,_=null,S=null,A=null,E=null;h.isNode?h.getNodeType(e)==="bool"?(p=!0,S="bool",y=h.build(e,S)):(S="int",_=this.getVarName(l),g="0",y=h.build(e,S),A="<"):(S=h.type||"int",_=h.name||this.getVarName(l),g=h.start,y=h.end,A=h.condition,E=h.update,typeof g=="number"?g=e.generateConst(S,g):g&&g.isNode&&(g=g.build(e,S)),typeof y=="number"?y=e.generateConst(S,y):y&&y.isNode&&(y=y.build(e,S)),g!==void 0&&y===void 0?(g=g+" - 1",y="0",A=">="):y!==void 0&&g===void 0&&(g="0",A="<"),A===void 0&&(Number(g)>Number(y)?A=">=":A="<"));let b;if(p)b=`while ( ${y} )`;else{const C={start:g,end:y},w=C.start,D=C.end;let P;const I=()=>A.includes("<")?"+=":"-=";if(E!=null)switch(typeof E){case"function":P=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":P=_+" "+I()+" "+e.generateConst(S,E);break;case"string":P=_+" "+E;break;default:E.isNode?P=_+" "+I()+" "+E.build(e):(console.error("THREE.TSL: 'Loop( { update: ... } )' is not a function, string or number."),P="break /* invalid update */")}else S==="int"||S==="uint"?E=A.includes("<")?"++":"--":E=I()+" 1.",P=_+" "+E;const F=e.getVar(S,_)+" = "+w,z=_+" "+A+" "+D;b=`for ( ${F}; ${z}; ${P} )`}e.addFlowCode((l===0?` 3969`:"")+e.tab+b+` { 3970 3971`).addFlowTab()}const r=i.build(e,"void"),a=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode(` 3972`+e.tab+r);for(let l=0,u=this.params.length-1;l<u;l++)e.addFlowCode((l===0?"":e.tab)+`} 3973 3974`).removeFlowTab();return e.addFlowTab(),a}}const ci=(...s)=>Pe(new Kj(Ep(s,"int"))).toStack(),Zj=()=>oh("continue").toStack(),$F=()=>oh("break").toStack(),eR=new WeakMap,So=new kt,UL=le(({bufferMap:s,influence:e,stride:t,width:n,depth:i,offset:r})=>{const a=$(WF).mul(t).add(r),l=a.div(n),u=a.sub(l.mul(n));return fs(s,Ks(u,l)).depth(i).xyz.mul(e)});function Qj(s){const e=s.morphAttributes.position!==void 0,t=s.morphAttributes.normal!==void 0,n=s.morphAttributes.color!==void 0,i=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,r=i!==void 0?i.length:0;let a=eR.get(s);if(a===void 0||a.count!==r){let C=function(){E.dispose(),eR.delete(s),s.removeEventListener("dispose",C)};var l=C;a!==void 0&&a.texture.dispose();const u=s.morphAttributes.position||[],h=s.morphAttributes.normal||[],p=s.morphAttributes.color||[];let g=0;e===!0&&(g=1),t===!0&&(g=2),n===!0&&(g=3);let y=s.attributes.position.count*g,_=1;const S=4096;y>S&&(_=Math.ceil(y/S),y=S);const A=new Float32Array(y*_*4*r),E=new nx(A,y,_,r);E.type=Bi,E.needsUpdate=!0;const b=g*4;for(let w=0;w<r;w++){const D=u[w],P=h[w],I=p[w],F=y*_*4*w;for(let z=0;z<D.count;z++){const B=z*b;e===!0&&(So.fromBufferAttribute(D,z),A[F+B+0]=So.x,A[F+B+1]=So.y,A[F+B+2]=So.z,A[F+B+3]=0),t===!0&&(So.fromBufferAttribute(P,z),A[F+B+4]=So.x,A[F+B+5]=So.y,A[F+B+6]=So.z,A[F+B+7]=0),n===!0&&(So.fromBufferAttribute(I,z),A[F+B+8]=So.x,A[F+B+9]=So.y,A[F+B+10]=So.z,A[F+B+11]=I.itemSize===4?So.w:1)}}a={count:r,texture:E,stride:g,size:new Ge(y,_)},eR.set(s,a),s.addEventListener("dispose",C)}return a}class $j extends Rt{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=Vt(1),this.updateType=mn.OBJECT}setup(e){const{geometry:t}=e,n=t.morphAttributes.position!==void 0,i=t.hasAttribute("normal")&&t.morphAttributes.normal!==void 0,r=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,a=r!==void 0?r.length:0,{texture:l,stride:u,size:h}=Qj(t);n===!0&&ms.mulAssign(this.morphBaseInfluence),i===!0&&io.mulAssign(this.morphBaseInfluence);const p=$(h.width);ci(a,({i:g})=>{const y=j(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?y.assign(fs(this.mesh.morphTexture,Ks($(g).add(1),$(Nd))).r):y.assign(Ei("morphTargetInfluences","float").element
vendor: 5,529 bytes, line 3974
3974(g).toVar()),Zt(y.notEqual(0),()=>{n===!0&&ms.addAssign(UL({bufferMap:l,influence:y,stride:u,width:p,depth:g,offset:$(0)})),i===!0&&io.addAssign(UL({bufferMap:l,influence:y,stride:u,width:p,depth:g,offset:$(1)}))})})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((t,n)=>t+n,0)}}const JF=en($j).setParameterLength(1);class ov extends Rt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class Jj extends ov{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class eK extends yI{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,i=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=i,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n=ae().toVar("directDiffuse"),i=ae().toVar("directSpecular"),r=ae().toVar("indirectDiffuse"),a=ae().toVar("indirectSpecular"),l={directDiffuse:n,directSpecular:i,indirectDiffuse:r,indirectSpecular:a};return{radiance:ae().toVar("radiance"),irradiance:ae().toVar("irradiance"),iblIrradiance:ae().toVar("iblIrradiance"),ambientOcclusion:j(1).toVar("ambientOcclusion"),reflectedLight:l,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const eV=en(eK);class tK extends ov{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}const Xg=new Ge;class FE extends nc{static get type(){return"ViewportTextureNode"}constructor(e=$c,t=null,n=null){let i=null;n===null?(i=new tC,i.minFilter=Mr,n=i):i=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=i,this.isOutputTextureNode=!0,this.updateBeforeType=mn.FRAME,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){const i=t.clone();n.set(e,i)}return n.get(e)}updateReference(e){const t=e.renderer.getRenderTarget();return this.value=this.getTextureForReference(t),this.value}updateBefore(e){const t=e.renderer,n=t.getRenderTarget();n===null?t.getDrawingBufferSize(Xg):Xg.set(n.width,n.height);const i=this.getTextureForReference(n);(i.image.width!==Xg.width||i.image.height!==Xg.height)&&(i.image.width=Xg.width,i.image.height=Xg.height,i.needsUpdate=!0);const r=i.generateMipmaps;i.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(i),i.generateMipmaps=r}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const nK=en(FE).setParameterLength(0,3),ww=en(FE,null,null,{generateMipmaps:!0}).setParameterLength(0,3);let tT=null;class iK extends FE{static get type(){return"ViewportDepthTextureNode"}constructor(e=$c,t=null){tT===null&&(tT=new Ta),super(e,t,tT)}getTextureForReference(){return tT}}const Dw=en(iK).setParameterLength(0,2);class Ya extends Rt{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===Ya.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let i=null;if(t===Ya.DEPTH_BASE)n!==null&&(i=nV().assign(n));else if(t===Ya.DEPTH)e.isPerspectiveCamera?i=tV(gs.z,gd,yd):i=gy(gs.z,gd,yd);else if(t===Ya.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){const r=Uw(n,gd,yd);i=gy(r,gd,yd)}else i=n;else i=gy(gs.z,gd,yd);return i}}Ya.DEPTH_BASE="depthBase";Ya.DEPTH="depth";Ya.LINEAR_DEPTH="linearDepth";const gy=(s,e,t)=>s.add(e).div(e.sub(t)),sK=(s,e,t)=>e.sub(t).mul(s).sub(e),tV=(s,e,t)=>e.add(s).mul(t).div(t.sub(e).mul(s)),Uw=(s,e,t)=>e.mul(t).div(t.sub(e).mul(s).sub(t)),Lw=(s,e,t)=>{e=e.max(1e-6).toVar();const n=Yu(s.negate().div(e)),i=Yu(t.div(e));return n.div(i)},rK=(s,e,t)=>{const n=s.mul(RE(t.div(e)));return j(Math.E).pow(n).mul(e).negate()},nV=en(Ya,Ya.DEPTH_BASE),Bw=ct(Ya,Ya.DEPTH),pM=en(Ya,Ya.LINEAR_DEPTH).setParameterLength(0,1),aK=pM(Dw());Bw.assign=s=>nV(s);class il extends Rt{static get type(){return"ClippingNode"}constructor(e=il.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:n,unionPlanes:i}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===il.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,i):this.scope===il.HARDWARE?this.setupHardwareClipping(i,e):this.setupDefault(n,i)}setupAlphaToCoverage(e,t){return le(()=>{const n=j().toVar("distanceToPlane"),i=j().toVar("distanceToGradient"),r=j(1).toVar("clipOpacity"),a=t.length;if(this.hardwareClipping===!1&&a>0){const u=kr(t).setGroup(Pt);ci(a,({i:h})=>{const p=u.element(h);n.assign(gs.dot(p.xyz).negate().add(p.w)),i.assign(n.fwidth().div(2)),r.mulAssign(tc(i.negate(),i,n))})}const l=e.length;if(l>0){const u=kr(e).setGroup(Pt),h=j(1).toVar("intersectionClipOpacity");ci(l,({i:p})=>{const g=u.element(p);n.assign(gs.dot(g.xyz).negate().add(g.w)),i.assign(n.fwidth().div(2)),h.mulAssign(tc(i.negate(),i,n).oneMinus())}),r.mulAssign(h.oneMinus())}Zn.a.mulAssign(r),Zn.a.equal(0).discard()})()}setupDefault(e,t){return le(()=>{const n=t.length;if(this.hardwareClipping===!1&&n>0){const r=kr(t).setGroup(Pt);
3974ci(n,({i:a})=>{const l=r.element(a);gs.dot(l.xyz).greaterThan(l.w).discard()})}const i=e.length;if(i>0){const r=kr(e).setGroup(Pt),a=al(!0).toVar("clipped");ci(i,({i:l})=>{const u=r.element(l);a.assign(gs.dot(u.xyz).greaterThan(u.w).and(a))}),a.discard()}})()}setupHardwareClipping(e,t){const n=e.length;return t.enableHardwareClipping(n),le(()=>{const i=kr(e).setGroup(Pt),r=hh(t.getClipDistance());ci(n,({i:a})=>{const l=i.element(a),u=gs.dot(l.xyz).sub(l.w).negate();r.element(a).assign(u)})})()}}il.ALPHA_TO_COVERAGE="alphaToCoverage";il.DEFAULT="default";il.HARDWARE="hardware";const oK=()=>Pe(new il),lK=()=>Pe(new il(il.ALPHA_TO_COVERAGE)),uK=()=>Pe(new il(il.HARDWARE)),cK=.05,LL=le(([s])=>ch(ln(1e4,To(ln(17,s.x).add(ln(.1,s.y)))).mul(Ns(.1,Li(To(ln(13,s.y).add(s.x))))))),BL=le(([s])=>LL(Fe(LL(s.xy),s.z))),hK=le(([s])=>{const e=rs(Ku(iw(s.xyz)),Ku(sw(s.xyz))),t=j(1).div(j(cK).mul(e)).toVar("pixScale"),n=Fe(zy(ju(Yu(t))),zy(NE(Yu(t)))),i=Fe(BL(ju(n.x.mul(s.xyz))),BL(ju(n.y.mul(s.xyz)))),r=ch(Yu(t)),a=Ns(ln(r.oneMinus(),i.x),ln(r,i.y)),l=no(r,r.oneMinus()),u=ae(a.mul(a).div(ln(2,l).mul(Ln(1,l))),a.sub(ln(.5,l)).div(Ln(1,l)),Ln(1,Ln(1,a).mul(Ln(1,a)).div(ln(2,l).mul(Ln(1,l))))),h=a.lessThan(l.oneMinus()).select(a.lessThan(l).select(u.x,u.y),u.z);return ol(h,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class dK extends zI{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e),n=e.hasGeometryAttribute(t);let i;return n===!0?i=super.generate(e):i=e.generateConst(this.nodeType,new kt(1,1,1,1)),i}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const iV=(s=0)=>Pe(new dK(s)),sV=le(([s,e])=>no(1,s.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),rV=le(([s,e])=>no(s.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),aV=le(([s,e])=>s.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),oV=le(([s,e])=>Yn(s.mul(2).mul(e),s.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),wE(.5,s))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),fK=le(([s,e])=>{const t=e.a.add(s.a.mul(e.a.oneMinus()));return Gt(e.rgb.mul(e.a).add(s.rgb.mul(s.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),lV=le(([s])=>Gt(s.rgb.mul(s.a),s.a),{color:"vec4",return:"vec4"}),pK=le(([s])=>(Zt(s.a.equal(0),()=>Gt(0)),Gt(s.rgb.div(s.a),s.a)),{color:"vec4",return:"vec4"}),mK=(...s)=>(console.warn('THREE.TSL: "burn" has been renamed. Use "blendBurn" instead.'),sV(s)),gK=(...s)=>(console.warn('THREE.TSL: "dodge" has been renamed. Use "blendDodge" instead.'),rV(s)),yK=(...s)=>(console.warn('THREE.TSL: "screen" has been renamed. Use "blendScreen" instead.'),aV(s)),vK=(...s)=>(console.warn('THREE.TSL: "overlay" has been renamed. Use "blendOverlay" instead.'),oV(s));class ys extends hr{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,Object.defineProperty(this,"shadowPositionNode",{get:()=>this.receivedShadowPositionNode,set:e=>{console.warn('THREE.NodeMaterial: ".shadowPositionNode" was renamed to ".receivedShadowPositionNode".'),this.receivedShadowPositionNode=e}})}customProgramCacheKey(){return this.type+Q3(this)}build(e){this.setup(e)}setupObserver(e){return new k7(e)}setup(e){e.context.setupNormal=()=>my(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,n=t.getRenderTarget();e.addStack();const i=my(this.setupVertex(e),"VERTEX"),r=this.vertexNode||i;e.stack.outputNode=r,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let a;const l=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupVariants(e);const u=this.setupLighting(e);l!==null&&e.stack.add(l);const h=Gt(u,Zn.a).max(0);a=this.setupOutput(e,h),py.assign(a);const p=this.outputNode!==null;if(p&&(a=this.outputNode),n!==null){const g=t.getMRT(),y=this.mrtNode;g!==null?(p&&py.assign(a),a=g,y!==null&&(a=g.merge(y))):y!==null&&(a=y)}}else{let u=this.fragmentNode;u.isOutputStructNode!==!0&&(u=Gt(u)),a=this.setupOutput(e,u)}e.stack.outputNode=a,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{unionPlanes:t,intersectionPlanes:n}=e.clippingContext;let i=null;if(t.length>0||n.length>0){const r=e.renderer.samples;this.alphaToCoverage&&r>1?i=lK():e.stack.add(oK())}return i}setupHardwareClipping(e){if(this.hardwareClipping=!1,e.clippingContext===null)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.add(uK()),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:n}=e;let i=this.depthNode;if(i===null){const r=t.getMRT();r&&r.has("depth")?i=r.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?i=Lw(gs.z,gd,yd):i=gy(gs.z,gd,yd))}i!==null&&Bw.assign(i).toStack()}setupPositionView(){return _m.mul(ms).xyz}setupModelViewProjection(){return rv.mul(gs)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),Cw}setupPosition(e){const{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&JF(t).toStack(),t.isSkinnedMesh===!0&&QF(t).toStack(),this.displacementMap){const i=kc("displacementMap","texture"),r=kc("displacementScale","float"),a=kc("displacementBias","float");ms.addAssign(io.normalize().mul(i.x.mul(r).add(a)))}return t.isBatchedMesh&&KF(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&jF(t).toStack(),this.positionNode!==null&&ms.assign(my(this.positionNode,"POSITION","vec3")),ms}setupDiffuseColor({object:e,geometry:t}){this.maskNode!==null&&al(this.maskNode).not().discard();let n=this.colorNode?Gt(this.colorNode):mF;this.vertexColors===!0&&t.hasAttribute("color")&&(n=n.mul(iV())),e.instanceColor&&(n=G0("vec3","vInstanceColor").mul(n)),e.isBatchedMesh&&e._colorsTexture&&(n=G0("vec3","vBatchColor").mul(n)),Zn.assign(n);const i=this.opacityNode?j(this.opacityNode):Rw;Zn.a.assign(Zn.a.mul(i));let r=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(r=this.alphaTestNode!==null?j(this.alphaTestNode):pF,Zn.a.lessThanEqual(r).discard()),this.alphaHash===!0&&Zn.a.lessThan(hK(ms)).discard(),this.transparent===!1&&this.blending===$a&&this.alphaToCoverage===!1?Zn.a.assign(1):r===null&&Zn.a.lessThanEqual(0).discard()}setupVariants(){}setupOutgoingLight(){return this.lights===!0?ae(0):Zn.rgb}setupNormal(){return this.normalNode?ae(this.normalNode):bF}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?kc("envMap","cubeTexture"):kc("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new tK(Nw)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const i=this.setupLightMap(e);if(i&&i.isLightingNode&&t.push(i),this.aoNode!==null||e.material.aoMap){const a=this.aoNode!==null?this.aoNode:qF;t.push(new Jj(a))}let r=this.lightsNode||e.lightsNode;return t.length>0&&(r=e.renderer.lighting.createNode([...r.getLights(),...t])),r}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:i,emissiveNode:r}=this,l=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null;let u=this.setupOutgoingLight(e);if(l&&l.getScope().hasLights){const h=this.setupLightingModel(e)||null;u=eV(l,h,n,i)}else n!==null&&(u=ae(i!==null?Yn(u,n,i):n));return(r&&r.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(sN.assign(ae(r||yF)),u=u.add(sN)),u}setupFog(e,t){const n=e.fogNode;return n&&(py.assign(t),t=Gt(n.toVar())),t}setupPremultipliedAlpha(e,t){return lV(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const n in e){const i=e[n];this[n]===void 0&&(this[n]=i,i&&i.clone&&(this[n]=i.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});const n=hr.prototype.toJSON.call(this,e),i=rM(this);n.inputNodes={};for(const{property:a,childNode:l}of i)n.inputNodes[a]=l.toJSON(e).uuid;function r(a){const l=[];for(const u in a){const h=a[u];delete h.metadata,l.push(h)}return l}if(t){const a=r(e.textures),l=r(e.images),u=r(e.nodes);a.length>0&&(n.textures=a),l.length>0&&(n.images=l),u.length>0&&(n.nodes=u)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.maskNode=e.maskNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,super.copy(e)}}const _K=new jr;class xK extends ys{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(_K),this.setValues(e)}}const SK=new vC;class bK extends ys{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(SK),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?j(this.offsetNode):GF,t=this.dashScaleNode?j(this.dashScaleNode):FF,n=this.dashSizeNode?j(this.dashSizeNode):VF,i=this.gapSizeNode?j(this.gapSizeNode):zF;CT.assign(n),rN.assign(i);const r=ac(lh("lineDistance").mul(t));(e?r.add(e):r).mod(CT.add(rN)).greaterThan(CT).discard()}}let nT=null;class TK extends FE{static get type(){return"ViewportSharedTextureNode"}constructor(e=$c,t=null){nT===null&&(nT=new tC),super(e,t,nT)}getTextureForReference(){return nT}updateReference(){return this}}const MK=en(TK).setParameterLength(0,2),uV=s=>Pe(s).mul(.5).add(.5),EK=s=>Pe(s).mul(2).sub(1),AK=new fC;class RK extends ys{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(AK),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?j(this.opacityNode):Rw;
vendor: 4,298 bytes, line 3974
3974Zn.assign(UE(Gt(uV(ui),e),lr))}}const Pw=le(([s=Sw])=>{const e=s.z.atan(s.x).mul(1/(Math.PI*2)).add(.5),t=s.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return Fe(e,t)});class cV extends YM{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,i=t.generateMipmaps;t.generateMipmaps=!0,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 r=new uh(5,5,5),a=Pw(Sw),l=new ys;l.colorNode=Dn(t,a,0),l.side=yi,l.blending=Qa;const u=new Ri(r,l),h=new Jy;h.add(u),t.minFilter===Mr&&(t.minFilter=hi);const p=new XM(1,10,this),g=e.getMRT();return e.setMRT(null),p.update(e,h),e.setMRT(g),t.minFilter=n,t.currentGenerateMipmaps=i,u.geometry.dispose(),u.material.dispose(),this}}const T0=new WeakMap;class NK extends vs{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Hy(null);const t=new Id;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=mn.RENDER}updateBefore(e){const{renderer:t,material:n}=e,i=this.envNode;if(i.isTextureNode||i.isMaterialReferenceNode){const r=i.isTextureNode?i.value:n[i.property];if(r&&r.isTexture){const a=r.mapping;if(a===Cd||a===wd){if(T0.has(r)){const l=T0.get(r);PL(l,r.mapping),this._cubeTexture=l}else{const l=r.image;if(CK(l)){const u=new cV(l.height);u.fromEquirectangularTexture(t,r),PL(u.texture,r.mapping),this._cubeTexture=u.texture,T0.set(r,u.texture),r.addEventListener("dispose",hV)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function CK(s){return s==null?!1:s.height>0}function hV(s){const e=s.target;e.removeEventListener("dispose",hV);const t=T0.get(e);t!==void 0&&(T0.delete(e),t.dispose())}function PL(s,e){e===Cd?s.mapping=Eo:e===wd&&(s.mapping=sl)}const dV=en(NK).setParameterLength(1);class Ow extends ov{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=dV(this.envNode)}}class wK extends ov{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=j(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class VE{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class fV extends VE{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,n=e.reflectedLight,i=e.irradianceLightMap;n.indirectDiffuse.assign(Gt(0)),i?n.indirectDiffuse.addAssign(i):n.indirectDiffuse.addAssign(Gt(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Zn.rgb)}finish(e){const{material:t,context:n}=e,i=n.outgoingLight,r=e.context.environment;if(r)switch(t.combine){case Zy:i.rgb.assign(Yn(i.rgb,i.rgb.mul(r.rgb),b0.mul(LT)));break;case zN:i.rgb.assign(Yn(i.rgb,r.rgb,b0.mul(LT)));break;case GN:i.rgb.addAssign(r.rgb.mul(b0.mul(LT)));break;default:console.warn("THREE.BasicLightingModel: Unsupported .combine value:",t.combine);break}}}const DK=new xa;class pV extends ys{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(DK),this.setValues(e)}setupNormal(){return av(Gy)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Ow(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new wK(Nw)),t}setupOutgoingLight(){return Zn.rgb}setupLightingModel(){return new fV}}const ky=le(({f0:s,f90:e,dotVH:t})=>{const n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return s.mul(n.oneMinus()).add(e.mul(n))}),om=le(s=>s.diffuseColor.mul(1/Math.PI)),UK=()=>j(.25),LK=le(({dotNH:s})=>uM.mul(j(.5)).add(1).mul(j(1/Math.PI)).mul(s.pow(uM))),BK=le(({lightDirection:s})=>{const e=s.add(Gi).normalize(),t=ui.dot(e).clamp(),n=Gi.dot(e).clamp(),i=ky({f0:ka,f90:1,dotVH:n}),r=UK(),a=LK({dotNH:t});return i.mul(r).mul(a)});class mV extends fV{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const r=ui.dot(e).clamp().mul(t);
vendor: 2,545 bytes, line 3974
3974n.directDiffuse.addAssign(r.mul(om({diffuseColor:Zn.rgb}))),this.specular===!0&&n.directSpecular.addAssign(r.mul(BK({lightDirection:e})).mul(b0))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(n.mul(om({diffuseColor:Zn}))),i.indirectDiffuse.mulAssign(t)}}const PK=new pC;class OK extends ys{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(PK),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Ow(t):null}setupLightingModel(){return new mV(!1)}}const IK=new hC;class FK extends ys{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(IK),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new Ow(t):null}setupLightingModel(){return new mV}setupVariants(){const e=(this.shininessNode?j(this.shininessNode):gF).max(1e-4);uM.assign(e);const t=this.specularNode||vF;ka.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const gV=le(s=>{if(s.geometry.hasAttribute("normal")===!1)return j(0);const e=Gy.dFdx().abs().max(Gy.dFdy().abs());return e.x.max(e.y).max(e.z)}),Iw=le(s=>{const{roughness:e}=s,t=gV();let n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),yV=le(({alpha:s,dotNL:e,dotNV:t})=>{const n=s.pow2(),i=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),r=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return Ao(.5,i.add(r).max(kO))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),VK=le(({alphaT:s,alphaB:e,dotTV:t,dotBV:n,dotTL:i,dotBL:r,dotNV:a,dotNL:l})=>{const u=l.mul(ae(s.mul(t),e.mul(n),a).length()),h=a.mul(ae(s.mul(i),e.mul(r),l).length());return Ao(.5,u.add(h)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),vV=le(({alpha:s,dotNH:e})=>{const t=s.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}
3974).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),zK=j(1/Math.PI),GK=le(({alphaT:s,alphaB:e,dotNH:t,dotTH:n,dotBH:i})=>{const r=s.mul(e),a=ae(e.mul(n),s.mul(i),r.mul(t)),l=a.dot(a),u=r.div(l);return zK.mul(r.mul(u.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),pN=le(({lightDirection:s,f0:e,f90:t,roughness:n,f:i,normalView:r=ui,USE_IRIDESCENCE:a,USE_ANISOTROPY:l})=>{const u=n.pow2(),h=s.add(Gi).normalize(),p=r.dot(s).clamp(),g=r.dot(Gi).clamp(),y=r.dot(h).clamp(),_=Gi.dot(h).clamp();let S=ky({f0:e,f90:t,dotVH:_}),A,E;if(V0(a)&&(S=EE.mix(S,i)),V0(l)){const b=_0.dot(s),C=_0.dot(Gi),w=_0.dot(h),D=Rp.dot(s),P=Rp.dot(Gi),I=Rp.dot(h);A=VK({alphaT:lM,alphaB:u,dotTV:C,dotBV:P,dotTL:b,dotBL:D,dotNV:g,dotNL:p}),E=GK({alphaT:lM,alphaB:u,dotNH:y,dotTH:w,dotBH:I})}else A=yV({alpha:u,dotNL:p,dotNV:g}),E=vV({alpha:u,dotNH:y});return S.mul(A).mul(E)}),Fw=le(({roughness:s,dotNV:e})=>{const t=Gt(-1,-.0275,-.572,.022),n=Gt(1,.0425,1.04,-.04),i=s.mul(t).add(n),r=i.x.mul(i.x).min(e.mul(-9.28).exp2()).mul(i.x).add(i.y);return Fe(-1.04,1.04).mul(r).add(i.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),_V=le(s=>{const{dotNV:e,specularColor:t,specularF90:n,roughness:i}=s,r=Fw({dotNV:e,roughness:i});return t.mul(r.x).add(n.mul(r.y))}),xV=le(({f:s,f90:e,dotVH:t})=>{const n=t.oneMinus().saturate(),i=n.mul(n),r=n.mul(i,i).clamp(0,.9999);return s.sub(ae(e).mul(r)).div(r.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),HK=le(({roughness:s,dotNH:e})=>{const t=s.pow2(),n=j(1).div(t),r=e.pow2().oneMinus().max(.0078125);return j(2).add(n).mul(r.pow(n.mul(.5))).div(2*Math.PI)}
vendor: 4,276 bytes, line 3974
3974).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),kK=le(({dotNV:s,dotNL:e})=>j(1).div(j(4).mul(e.add(s).sub(e.mul(s))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),qK=le(({lightDirection:s})=>{const e=s.add(Gi).normalize(),t=ui.dot(s).clamp(),n=ui.dot(Gi).clamp(),i=ui.dot(e).clamp(),r=HK({roughness:ME,dotNH:i}),a=kK({dotNV:n,dotNL:t});return gp.mul(r).mul(a)}),WK=le(({N:s,V:e,roughness:t})=>{const r=.0078125,a=s.dot(e).saturate(),l=Fe(t,a.oneMinus().sqrt());return l.assign(l.mul(.984375).add(r)),l}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),XK=le(({f:s})=>{const e=s.length();return rs(e.mul(e).add(s.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),iT=le(({v1:s,v2:e})=>{const t=s.dot(e),n=t.abs().toVar(),i=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),r=n.add(4.1616724).mul(n).add(3.417594).toVar(),a=i.div(r),l=t.greaterThan(0).select(a,rs(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return s.cross(e).mul(l)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),OL=le(({N:s,V:e,P:t,mInv:n,p0:i,p1:r,p2:a,p3:l})=>{const u=r.sub(i).toVar(),h=l.sub(i).toVar(),p=u.cross(h),g=ae().toVar();return Zt(p.dot(t.sub(i)).greaterThanEqual(0),()=>{const y=e.sub(s.mul(e.dot(s))).normalize(),_=s.cross(y).negate(),S=n.mul(Yr(y,_,s).transpose()).toVar(),A=S.mul(i.sub(t)).normalize().toVar(),E=S.mul(r.sub(t)).normalize().toVar(),b=S.mul(a.sub(t)).normalize().toVar(),C=S.mul(l.sub(t)).normalize().toVar(),w=ae(0).toVar();w.addAssign(iT({v1:A,v2:E})),w.addAssign(iT({v1:E,v2:b})),w.addAssign(iT({v1:b,v2:C})),w.addAssign(iT({v1:C,v2:A})),g.assign(ae(XK({f:w})))}),g}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),zE=1/6,SV=s=>ln(zE,ln(s,ln(s,s.negate().add(3)).sub(3)).add(1)),mN=s=>ln(zE,ln(s,ln(s,ln(3,s).sub(6))).add(4)),bV=s=>ln(zE,ln(s,ln(s,ln(-3,s).add(3)).add(3)).add(1)),gN=s=>ln(zE,Jo(s,3)),IL=s=>SV(s).add(mN(s)),FL=s=>bV(s).add(gN(s)),VL=s=>Ns(-1,mN(s).div(SV(s).add(mN(s)))),zL=s=>Ns(1,gN(s).div(bV(s).add(gN(s)))),GL=(s,e,t)=>{const n=s.uvNode,i=ln(n,e.zw).add(.5),r=ju(i),a=ch(i),l=IL(a.x),u=FL(a.x),h=VL(a.x),p=zL(a.x),g=VL(a.y),y=zL(a.y),_=Fe(r.x.add(h),r.y.add(g)).sub(.5).mul(e.xy),S=Fe(r.x.add(p),r.y.add(g)).sub(.5).mul(e.xy),A=Fe(r.x.add(h),r.y.add(y)).sub(.5).mul(e.xy),E=Fe(r.x.add(p),r.y.add(y)).sub(.5).mul(e.xy),b=IL(a.y).mul(Ns(l.mul(s.sample(_).level(t)),u.mul(s.sample(S).level(t)))),C=FL(a.y).mul(Ns(l.mul(s.sample(A).level(t)),u.mul(s.sample(E).level(t))));return b.add(C)},Vw=le(([s,e])=>{const t=Fe(s.size($(e))),n=Fe(s.size($(e.add(1)))),i=Ao(1,t),r=Ao(1,n),a=GL(s,Gt(i,t),ju(e)),l=GL(s,Gt(r,n),NE(e));return ch(e).mix(a,l)}),YK=le(([s,e])=>{const t=e.mul(gw(s));return Vw(s,t)}),HL=le(([s,e,t,n,i])=>{const r=ae(uw(e.negate(),ah(s),Ao(1,n))),a=ae(Ku(i[0].xyz),Ku(i[1].xyz),Ku(i[2].xyz));return ah(r).mul(t.mul(a))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),jK=le(([s,e])=>s.mul(ol(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),KK=ww(),ZK=ww(),kL=le(([s,e,t],{material:n})=>{const r=(n.side===yi?KK:ZK).sample(s),a=Yu(am.x).mul(jK(e,t));return Vw(r,a)}),qL=le(([s,e,t])=>(Zt(t.notEqual(0),()=>{const n=RE(e).negate().div(t);return ew(n.negate().mul(s))}),ae(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),QK=le(([s,e,t,n,i,r,a,l,u,h,p,g,y,_,S])=>{let A,E;if(S){A=Gt().toVar(),E=ae().toVar();const P=p.sub(1).mul(S.mul(.025)),I=ae(p.sub(P),p,p.add(P));ci({start:0,end:3},({i:F})=>
vendor: 8,965 bytes, line 3974
3974{const z=I.element(F),B=HL(s,e,g,z,l),O=a.add(B),W=h.mul(u.mul(Gt(O,1))),ee=Fe(W.xy.div(W.w)).toVar();ee.addAssign(1),ee.divAssign(2),ee.assign(Fe(ee.x,ee.y.oneMinus()));const se=kL(ee,t,z);A.element(F).assign(se.element(F)),A.a.addAssign(se.a),E.element(F).assign(n.element(F).mul(qL(Ku(B),y,_).element(F)))}),A.a.divAssign(3)}else{const P=HL(s,e,g,p,l),I=a.add(P),F=h.mul(u.mul(Gt(I,1))),z=Fe(F.xy.div(F.w)).toVar();z.addAssign(1),z.divAssign(2),z.assign(Fe(z.x,z.y.oneMinus())),A=kL(z,t,p),E=n.mul(qL(Ku(P),y,_))}const b=E.rgb.mul(A.rgb),C=s.dot(e).clamp(),w=ae(_V({dotNV:C,specularColor:i,specularF90:r,roughness:t})),D=E.r.add(E.g,E.b).div(3);return Gt(w.oneMinus().mul(b),A.a.oneMinus().mul(D).oneMinus())}),$K=Yr(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),JK=s=>{const e=s.sqrt();return ae(1).add(e).div(ae(1).sub(e))},WL=(s,e)=>s.sub(e).div(s.add(e)).pow2(),eZ=(s,e)=>{const t=s.mul(2*Math.PI*1e-9),n=ae(54856e-17,44201e-17,52481e-17),i=ae(1681e3,1795300,2208400),r=ae(43278e5,93046e5,66121e5),a=j(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp());let l=n.mul(r.mul(2*Math.PI).sqrt()).mul(i.mul(t).add(e).cos()).mul(t.pow2().negate().mul(r).exp());return l=ae(l.x.add(a),l.y,l.z).div(10685e-11),$K.mul(l)},tZ=le(({outsideIOR:s,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:i})=>{const r=Yn(s,e,tc(0,.03,n)),l=s.div(r).pow2().mul(t.pow2().oneMinus()).oneMinus();Zt(l.lessThan(0),()=>ae(1));const u=l.sqrt(),h=WL(r,s),p=ky({f0:h,f90:1,dotVH:t}),g=p.oneMinus(),y=r.lessThan(s).select(Math.PI,0),_=j(Math.PI).sub(y),S=JK(i.clamp(0,.9999)),A=WL(S,r.toVec3()),E=ky({f0:A,f90:1,dotVH:u}),b=ae(S.x.lessThan(r).select(Math.PI,0),S.y.lessThan(r).select(Math.PI,0),S.z.lessThan(r).select(Math.PI,0)),C=r.mul(n,u,2),w=ae(_).add(b),D=p.mul(E).clamp(1e-5,.9999),P=D.sqrt(),I=g.pow2().mul(E).div(ae(1).sub(D)),z=p.add(I).toVar(),B=I.sub(g).toVar();return ci({start:1,end:2,condition:"<=",name:"m"},({m:O})=>{B.mulAssign(P);const W=eZ(j(O).mul(C),j(O).mul(w)).mul(2);z.addAssign(B.mul(W))}),z.max(ae(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),nZ=le(({normal:s,viewDir:e,roughness:t})=>{const n=s.dot(e).saturate(),i=t.pow2(),r=ur(t.lessThan(.25),j(-339.2).mul(i).add(j(161.4).mul(t)).sub(25.9),j(-8.48).mul(i).add(j(14.3).mul(t)).sub(9.95)),a=ur(t.lessThan(.25),j(44).mul(i).sub(j(23.7).mul(t)).add(3.26),j(1.97).mul(i).sub(j(3.27).mul(t)).add(.72));return ur(t.lessThan(.25),0,j(.1).mul(t).sub(.025)).add(r.mul(n).add(a).exp()).mul(1/Math.PI).saturate()}),tR=ae(.04),nR=j(1);class TV extends VE{constructor(e=!1,t=!1,n=!1,i=!1,r=!1,a=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=i,this.transmission=r,this.dispersion=a,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=ae().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=ae().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=ae().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=ae().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=ae().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=ui.dot(Gi).clamp();this.iridescenceFresnel=tZ({outsideIOR:j(1),eta2:WC,cosTheta1:t,thinFilmThickness:XC,baseF0:ka}),this.iridescenceF0=xV({f:this.iridescenceFresnel,f90:1,dotVH:t})}if(this.transmission===!0){const t=Zu,n=kI.sub(Zu).normalize(),i=Hd,r=e.context;r.backdrop=QK(i,n,ku,Zn,ka,q0,t,el,dl,rv,x0,YC,KC,jC,this.dispersion?ZC:null),r.backdropAlpha=cM,Zn.a.mulAssign(Yn(1,r.backdrop.a,cM))}super.start(e)}computeMultiscattering(e,t,n){const i=ui.dot(Gi).clamp(),r=Fw({roughness:ku,dotNV:i}),l=(this.iridescenceF0?EE.mix(ka,this.iridescenceF0):ka).mul(r.x).add(n.mul(r.y)),h=r.x.add(r.y).oneMinus(),p=ka.add(ka.oneMinus().mul(.047619)),g=l.mul(p).div(h.mul(p).oneMinus());e.addAssign(l),t.addAssign(g.mul(h))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const r=ui.dot(e).clamp().mul(t);if(this.sheen===!0&&this.sheenSpecularDirect.addAssign(r.mul(qK({lightDirection:e}))),this.clearcoat===!0){const l=yp.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(l.mul(pN({lightDirection:e,f0:tR,f90:nR,roughness:k0,normalView:yp})))}n.directDiffuse.addAssign(r.mul(om({diffuseColor:Zn.rgb}))),n.directSpecular.addAssign(r.mul(pN({lightDirection:e,f0:ka,f90:1,roughness:ku,iridescence:this.iridescence,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:i,reflectedLight:r,ltc_1:a,ltc_2:l}){const u=t.add(n).sub(i),h=t.sub(n).sub(i),p=t.sub(n).add(i),g=t.add(n).add(i),y=ui,_=Gi,S=gs.toVar(),A=WK({N:y,V:_,roughness:ku}),E=a.sample(A).toVar(),b=l.sample(A).toVar(),C=Yr(ae(E.x,0,E.y),ae(0,1,0),ae(E.z,0,E.w)).toVar(),w=ka.mul(b.x).add(ka.oneMinus().mul(b.y)).toVar();r.directSpecular.addAssign(e.mul(w).mul(OL({N:y,V:_,P:S,mInv:C,p0:u,p1:h,p2:p,p3:g}))),r.directDiffuse.addAssign(e.mul(Zn).mul(OL({N:y,V:_,P:S,mInv:Yr(1,0,0,0,1,0,0,0,1),p0:u,p1:h,p2:p,p3:g})))}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:n}=e.context;n.indirectDiffuse.addAssign(t.mul(om({diffuseColor:Zn})))}indirectSpecular(e){const{radiance:t,iblIrradiance:n,reflectedLight:i}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(gp,nZ({normal:ui,viewDir:Gi,roughness:ME}))),this.clearcoat===!0){const p=yp.dot(Gi).clamp(),g=_V({dotNV:p,specularColor:tR,specularF90:nR,roughness:k0});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(g))}const r=ae().toVar("singleScattering"),a=ae().toVar("multiScattering"),l=n.mul(1/Math.PI);this.computeMultiscattering(r,a,q0);const u=r.add(a),h=Zn.mul(u.r.max(u.g).max(u.b).oneMinus());i.indirectSpecular.addAssign(t.mul(r)),i.indirectSpecular.addAssign(a.mul(l)),i.indirectDiffuse.addAssign(h.mul(l))}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:n}=e.context,r=ui.dot(Gi).clamp().add(t),a=ku.mul(-16).oneMinus().negate().exp2(),l=t.sub(r.pow(a).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(l)}finish({context:e}){const{outgoingLight:t}=e;if(this.clearcoat===!0){const n=yp.dot(Gi).clamp(),i=ky({dotVH:n,f0:tR,f90:nR}),r=t.mul(oM.mul(i).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(oM));t.assign(r)}if(this.sheen===!0){const n=gp.r.max(gp.g).max(gp.b).mul(.157).oneMinus(),i=t.mul(n).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(i)}}}const XL=j(1),yN=j(-2),sT=j(.8),iR=j(-1),rT=j(.4),sR=j(2),aT=j(.305),rR=j(3),YL=j(.21),iZ=j(4),jL=j(4),sZ=j(16),rZ=le(([s])=>{const e=ae(Li(s)).toVar(),t=j(-1).toVar();return Zt(e.x.greaterThan(e.z),()=>{Zt(e.x.greaterThan(e.y),()=>{t.assign(ur(s.x.greaterThan(0),0,3))}).Else(()=>{t.assign(ur(s.y.greaterThan(0),1,4))})}).Else(()=>{Zt(e.z.greaterThan(e.y),()=>{t.assign(ur(s.z.greaterThan(0),2,5))}).Else(()=>{t.assign(ur(s.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),aZ=le(([s,e])=>{const t=Fe().toVar();return Zt(e.equal(0),()=>{t.assign(Fe(s.z,s.y).div(Li(s.x)))}).ElseIf(e.equal(1),()=>{t.assign(Fe(s.x.negate(),s.z.negate()).div(Li(s.y)))}).ElseIf(e.equal(2),()=>{t.assign(Fe(s.x.negate(),s.y).div(Li(s.z)))}).ElseIf(e.equal(3),()=>{t.assign(Fe(s.z.negate(),s.y).div(Li(s.x)))}).ElseIf(e.equal(4),()=>{t.assign(Fe(s.x.negate(),s.z).div(Li(s.y)))}).Else(()=>{t.assign(Fe(s.x,s.y).div(Li(s.z)))}),ln(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),oZ=le(([s])=>{const e=j(0).toVar();return Zt(s.greaterThanEqual(sT),()=>{e.assign(XL.sub(s).mul(iR.sub(yN)).div(XL.sub(sT)).add(yN))}).ElseIf(s.greaterThanEqual(rT),()=>{e.assign(sT.sub(s).mul(sR.sub(iR)).div(sT.sub(rT)).add(iR))}).ElseIf(s.greaterThanEqual(aT),()=>{e.assign(rT.sub(s).mul(rR.sub(sR)).div(rT.sub(aT)).add(sR))}).ElseIf(s.greaterThanEqual(YL),()=>{e.assign(aT.sub(s).mul(iZ.sub(rR)).div(aT.sub(YL)).add(rR))}).Else(()=>{e.assign(j(-2).mul(Yu(ln(1.16,s))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),MV=le(([s,e])=>{const t=s.toVar();t.assign(ln(2,t).sub(1));const n=ae(t,1).toVar();return Zt(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}
3974).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),EV=le(([s,e,t,n,i,r])=>{const a=j(t),l=ae(e),u=ol(oZ(a),yN,r),h=ch(u),p=ju(u),g=ae(vN(s,l,p,n,i,r)).toVar();return Zt(h.notEqual(0),()=>{const y=ae(vN(s,l,p.add(1),n,i,r)).toVar();g.assign(Yn(g,y,h))}),g}),vN=le(([s,e,t,n,i,r])=>{const a=j(t).toVar(),l=ae(e),u=j(rZ(l)).toVar(),h=j(rs(jL.sub(a),0)).toVar();a.assign(rs(a,jL));const p=j(zy(a)).toVar(),g=Fe(aZ(l,u).mul(p.sub(2)).add(1)).toVar();return Zt(u.greaterThan(2),()=>{g.y.addAssign(p),u.subAssign(3)}),g.x.addAssign(u.mul(p)),g.x.addAssign(h.mul(ln(3,sZ))),g.y.addAssign(ln(4,zy(r).sub(p))),g.x.mulAssign(n),g.y.mulAssign(i),s.sample(g).grad(Fe(),Fe())}),aR=le(({envMap:s,mipInt:e,outputDirection:t,theta:n,axis:i,CUBEUV_TEXEL_WIDTH:r,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l})=>{const u=zc(n),h=t.mul(u).add(i.cross(t).mul(To(n))).add(i.mul(i.dot(t).mul(u.oneMinus())));return vN(s,h,e,r,a,l)}),AV=le(({n:s,latitudinal:e,poleAxis:t,outputDirection:n,weights:i,samples:r,dTheta:a,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:g})=>{const y=ae(ur(e,t,DE(t,n))).toVar();Zt(y.equal(ae(0)),()=>{y.assign(ae(n.z,0,n.x.negate()))}),y.assign(ah(y));const _=ae().toVar();return _.addAssign(i.element(0).mul(aR({theta:0,axis:y,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:g}))),ci({start:$(1),end:s},({i:S})=>{Zt(S.greaterThanEqual(r),()=>{$F()});const A=j(a.mul(j(S))).toVar();_.addAssign(i.element(S).mul(aR({theta:A.mul(-1),axis:y,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:g}))),_.addAssign(i.element(S).mul(aR({theta:A,axis:y,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:g})))}),Gt(_,1)}),uy=4,KL=[.125,.215,.35,.446,.526,.582],up=20,oR=new gm(-1,1,1,-1,0,1),lZ=new ps(90,1),ZL=new lt;let lR=null,uR=0,cR=0;const op=(1+Math.sqrt(5))/2,Yg=1/op,QL=[new Y(-op,Yg,0),new Y(op,Yg,0),new Y(-Yg,0,op),new Y(Yg,0,op),new Y(0,op,-Yg),new Y(0,op,Yg),new Y(-1,1,-1),new Y(1,1,-1),new Y(-1,1,1),new Y(1,1,1)],uZ=new Y,RV=new WeakMap,cZ=[3,1,5,0,4,2],hR=MV(vi(),lh("faceIndex")).normalize(),zw=ae(hR.x,hR.y,hR.z);class hZ{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,i=100,r={}){const{size:a=256,position:l=uZ,renderTarget:u=null}=r;if(this._setSize(a),this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Try using .fromSceneAsync() instead.");const p=u||this._allocateTarget();return r.renderTarget=p,this.fromSceneAsync(e,t,n,i,r),p}lR=this._renderer.getRenderTarget(),uR=this._renderer.getActiveCubeFace(),cR=this._renderer.getActiveMipmapLevel();const h=u||this._allocateTarget();return h.depthBuffer=!0,this._init(h),this._sceneToCubeUV(e,n,i,h,l),t>0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}async fromSceneAsync(e,t=0,n=.1,i=100,r={}){return this._hasInitialized===!1&&await this._renderer.init(),this.fromScene(e,t,n,i,r)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using .fromEquirectangularAsync() instead."),this._setSizeFromTexture(e);const n=t||this._allocateTarget();return this.fromEquirectangularAsync(e,n),n}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return this._hasInitialized===!1&&await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const n=t||this._allocateTarget();return this.fromCubemapAsync(e,t),n}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return this._hasInitialized===!1&&await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=JL(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=eB(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===Eo||e.mapping===sl?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(lR,uR,cR),e.scissorTest=!1,oT(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),lR=this._renderer.getRenderTarget(),uR=this._renderer.getActiveCubeFace(),cR=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTarget();return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize;return $L(e,t)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=$L(e.width,e.height);const{_lodMax:t}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas,lodMeshes:this._lodMeshes}=dZ(t)),this._blurMaterial=fZ(t,e.width,e.height)}}async _compileMaterial(e){const t=new Ri(this._lodPlanes[0],e);await this._renderer.compile(t,oR)}_sceneToCubeUV(e,t,n,i,r){const a=lZ;a.near=t,a.far=n;const l=[1,1,1,1,-1,1],u=[1,-1,1,-1,1,-1],h=this._renderer,p=h.autoClear;h.getClearColor(ZL),h.autoClear=!1;let g=this._backgroundBox;
3974if(g===null){const S=new xa({name:"PMREM.Background",side:yi,depthWrite:!1,depthTest:!1});g=new Ri(new uh,S)}let y=!1;const _=e.background;_?_.isColor&&(g.material.color.copy(_),e.background=null,y=!0):(g.material.color.copy(ZL),y=!0),h.setRenderTarget(i),h.clear(),y&&h.render(g,a);for(let S=0;S<6;S++){const A=S%3;A===0?(a.up.set(0,l[S],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+u[S],r.y,r.z)):A===1?(a.up.set(0,0,l[S]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+u[S],r.z)):(a.up.set(0,l[S],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+u[S]));const E=this._cubeSize;oT(i,A*E,S>2?E:0,E,E),h.render(e,a)}h.autoClear=p,e.background=_}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Eo||e.mapping===sl;i?this._cubemapMaterial===null&&(this._cubemapMaterial=JL(e)):this._equirectMaterial===null&&(this._equirectMaterial=eB(e));const r=i?this._cubemapMaterial:this._equirectMaterial;r.fragmentNode.value=e;const a=this._lodMeshes[0];a.material=r;const l=this._cubeSize;oT(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,oR)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let r=1;r<i;r++){const a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),l=QL[(i-r-1)%QL.length];this._blur(e,r-1,r,a,l)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,l){const u=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[i];g.material=h;const y=RV.get(h),_=this._sizeLods[n]-1,S=isFinite(r)?Math.PI/(2*_):2*Math.PI/(2*up-1),A=r/S,E=isFinite(r)?1+Math.floor(p*A):up;E>up&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${E} samples when the maximum is set to ${up}`);const b=[];let C=0;for(let F=0;F<up;++F){const z=F/A,B=Math.exp(-z*z/2);b.push(B),F===0?C+=B:F<E&&(C+=2*B)}for(let F=0;F<b.length;F++)b[F]=b[F]/C;e.texture.frame=(e.texture.frame||0)+1,y.envMap.value=e.texture,y.samples.value=E,y.weights.array=b,y.latitudinal.value=a==="latitudinal"?1:0,l&&(y.poleAxis.value=l);const{_lodMax:w}=this;y.dTheta.value=S,y.mipInt.value=w-n;const D=this._sizeLods[i],P=3*D*(i>w-uy?i-w+uy:0),I=4*(this._cubeSize-D);oT(t,P,I,3*D,2*D),u.setRenderTarget(t),u.render(g,oR)}}function dZ(s){const e=[],t=[],n=[],i=[];let r=s;const a=s-uy+1+KL.length;for(let l=0;l<a;l++){const u=Math.pow(2,r);t.push(u);let h=1/u;l>s-uy?h=KL[l-s+uy-1]:l===0&&(h=0),n.push(h);const p=1/(u-2),g=-p,y=1+p,_=[g,g,y,g,y,y,g,g,y,y,g,y],S=6,A=6,E=3,b=2,C=1,w=new Float32Array(E*A*S),D=new Float32Array(b*A*S),P=new Float32Array(C*A*S);for(let F=0;F<S;F++){const z=F%3*2/3-1,B=F>2?0:-1,O=[z,B,0,z+2/3,B,0,z+2/3,B+1,0,z,B,0,z+2/3,B+1,0,z,B+1,0],W=cZ[F];w.set(O,E*A*W),D.set(_,b*A*W);const ee=[W,W,W,W,W,W];P.set(ee,C*A*W)}const I=new bn;I.setAttribute("position",new ti(w,E)),I.setAttribute("uv",new ti(D,b)),I.setAttribute("faceIndex",new ti(P,C)),e.push(I),i.push(new Ri(I,null)),r>uy&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n,lodMeshes:i}}function $L(s,e){const t={magFilter:hi,minFilter:hi,generateMipmaps:!1,type:As,format:Pi,colorSpace:Yl},n=new Ql(s,e,t);return n.texture.mapping=nh,n.texture.name="PMREM.cubeUv",n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function oT(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function Gw(s){const e=new ys;return e.depthTest=!1,e.depthWrite=!1,e.blending=Qa,e.name=`PMREM_${s}`,e}function fZ(s,e,t){const n=kr(new Array(up).fill(0)),i=Vt(new Y(0,1,0)),r=Vt(0),a=j(up),l=Vt(0),u=Vt(1),h=Dn(null),p=Vt(0),g=j(1/e),y=j(1/t),_=j(s),S={n:a,latitudinal:l,weights:n,poleAxis:i,outputDirection:zw,dTheta:r,samples:u,envMap:h,mipInt:p,CUBEUV_TEXEL_WIDTH:g,CUBEUV_TEXEL_HEIGHT:y,CUBEUV_MAX_MIP:_},A=Gw("blur");return A.fragmentNode=AV({...S,latitudinal:l.equal(1)}),RV.set(A,S),A}function JL(s){const e=Gw("cubemap");return e.fragmentNode=Hy(s,zw),e}function eB(s){const e=Gw("equirect");return e.fragmentNode=Dn(s,Pw(zw),0),e}const tB=new WeakMap;function pZ(s){const e=Math.log2(s)-2,t=1/s;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function mZ(s,e,t){const n=gZ(e);let i=n.get(s);if((i!==void 0?i.pmremVersion:-1)!==s.pmremVersion){const a=s.image;if(s.isCubeTexture)if(vZ(a))i=t.fromCubemap(s,i);else return null;
3974else if(_Z(a))i=t.fromEquirectangular(s,i);else return null;i.pmremVersion=s.pmremVersion,n.set(s,i)}return i.texture}function gZ(s){let e=tB.get(s);return e===void 0&&(e=new WeakMap,tB.set(s,e)),e}class yZ extends vs{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;const i=new qi;i.isRenderTargetTexture=!0,this._texture=Dn(i),this._width=Vt(0),this._height=Vt(0),this._maxMip=Vt(0),this.updateBeforeType=mn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=pZ(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem;const n=t?t.pmremVersion:-1,i=this._value;n!==i.pmremVersion&&(i.isPMREMTexture===!0?t=i:t=mZ(i,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new hZ(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this)),t=Mw.mul(ae(t.x,t.y.negate(),t.z));let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),EV(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}}function vZ(s){if(s==null)return!1;let e=0;const t=6;for(let n=0;n<t;n++)s[n]!==void 0&&e++;return e===t}function _Z(s){return s==null?!1:s.height>0}const Hw=en(yZ).setParameterLength(1,3),nB=new WeakMap;class xZ extends ov{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){const g=n.isTextureNode?n.value:t[n.property];let y=nB.get(g);y===void 0&&(y=Hw(g),nB.set(g,y)),n=y}const r=t.useAnisotropy===!0||t.anisotropy>0?fF:ui,a=n.context(iB(ku,r)).mul(UT),l=n.context(SZ(Hd)).mul(Math.PI).mul(UT),u=S0(a),h=S0(l);e.context.radiance.addAssign(u),e.context.iblIrradiance.addAssign(h);const p=e.context.lightingModel.clearcoatRadiance;if(p){const g=n.context(iB(k0,yp)).mul(UT),y=S0(g);p.addAssign(y)}}}const iB=(s,e)=>{let t=null;return{getUV:()=>(t===null&&(t=Gi.negate().reflect(e),t=s.mul(s).mix(t,e).normalize(),t=t.transformDirection(dl)),t),getTextureLevel:()=>s}},SZ=s=>({getUV:()=>s,getTextureLevel:()=>j(1)}),bZ=new fE;class NV extends ys{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(bZ),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new xZ(t):null}setupLightingModel(){return new TV}setupSpecular(){const e=Yn(ae(.04),Zn.rgb,H0);ka.assign(e),q0.assign(1)}setupVariants(){const e=this.metalnessNode?j(this.metalnessNode):SF;H0.assign(e);let t=this.roughnessNode?j(this.roughnessNode):xF;t=Iw({roughness:t}),ku.assign(t),this.setupSpecular(),Zn.assign(Gt(Zn.rgb.mul(e.oneMinus()),Zn.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const TZ=new cC;class MZ extends NV{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(TZ),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){const e=this.iorNode?j(this.iorNode):PF;x0.assign(e),ka.assign(Yn(no(aw(x0.sub(1).div(x0.add(1))).mul(_F),ae(1)).mul(fN),Zn.rgb,H0)),q0.assign(Yn(fN,1,H0))}setupLightingModel(){return new TV(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?j(this.clearcoatNode):TF,n=this.clearcoatRoughnessNode?j(this.clearcoatRoughnessNode):MF;oM.assign(t),k0.assign(Iw({roughness:n}))}if(this.useSheen){const t=this.sheenNode?ae(this.sheenNode):RF,n=this.sheenRoughnessNode?j(this.sheenRoughnessNode):NF;gp.assign(t),ME.assign(n)}if(this.useIridescence){const t=this.iridescenceNode?j(this.iridescenceNode):wF,n=this.iridescenceIORNode?j(this.iridescenceIORNode):DF,i=this.iridescenceThicknessNode?j(this.iridescenceThicknessNode):UF;EE.assign(t),WC.assign(n),XC.assign(i)}if(this.useAnisotropy){const t=(this.anisotropyNode?Fe(this.anisotropyNode):CF).toVar();pd.assign(t.length()),Zt(pd.equal(0),()=>{t.assign(Fe(1,0))}).Else(()=>{t.divAssign(Fe(pd)),pd.assign(pd.saturate())}),lM.assign(pd.pow2().mix(ku.pow2(),1)),_0.assign(vp[0].mul(t.x).add(vp[1].mul(t.y))),Rp.assign(vp[1].mul(t.x).sub(vp[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?j(this.transmissionNode):LF,n=this.thicknessNode?j(this.thicknessNode):BF,i=this.attenuationDistanceNode?j(this.attenuationDistanceNode):OF,r=this.attenuationColorNode?ae(this.attenuationColorNode):IF;if(cM.assign(t),YC.assign(n),jC.assign(i),KC.assign(r),this.useDispersion){const a=this.dispersionNode?j(this.dispersionNode):kF;ZC.assign(a)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?ae(this.clearcoatNormalNode):EF}setup(e){e.context.setupClearcoatNormal=()=>my(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dis
vendor: 5,004 bytes, line 3974
3974persionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}const EZ=le(({normal:s,lightDirection:e,builder:t})=>{const n=s.dot(e),i=Fe(n.mul(.5).add(.5),0);if(t.material.gradientMap){const r=kc("gradientMap","texture").context({getUV:()=>i});return ae(r.r)}else{const r=i.fwidth().mul(.5);return Yn(ae(.7),ae(1),tc(j(.7).sub(r.x),j(.7).add(r.x),i.x))}});class AZ extends VE{direct({lightDirection:e,lightColor:t,reflectedLight:n},i){const r=EZ({normal:LE,lightDirection:e,builder:i}).mul(t);n.directDiffuse.addAssign(r.mul(om({diffuseColor:Zn.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(n.mul(om({diffuseColor:Zn}))),i.indirectDiffuse.mulAssign(t)}}const RZ=new dC;class NZ extends ys{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(RZ),this.setValues(e)}setupLightingModel(){return new AZ}}const CV=le(()=>{const s=ae(Gi.z,0,Gi.x.negate()).normalize(),e=Gi.cross(s);return Fe(s.dot(ui),e.dot(ui)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),CZ=new yC;class wZ extends ys{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(CZ),this.setValues(e)}setupVariants(e){const t=CV;let n;e.material.matcap?n=kc("matcap","texture").context({getUV:()=>t}):n=ae(Yn(.2,.8,t.y)),Zn.rgb.mulAssign(n.rgb)}}class DZ extends vs{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){const r=t.cos(),a=t.sin();return TE(r,a,a.negate(),r).mul(n)}else{const r=t,a=Ap(Gt(1,0,0,0),Gt(0,zc(r.x),To(r.x).negate(),0),Gt(0,To(r.x),zc(r.x),0),Gt(0,0,0,1)),l=Ap(Gt(zc(r.y),0,To(r.y),0),Gt(0,1,0,0),Gt(To(r.y).negate(),0,zc(r.y),0),Gt(0,0,0,1)),u=Ap(Gt(zc(r.z),To(r.z).negate(),0,0),Gt(To(r.z),zc(r.z),0,0),Gt(0,0,1,0),Gt(0,0,0,1));return a.mul(l).mul(u).mul(Gt(n,1)).xyz}}}const Sx=en(DZ).setParameterLength(2),UZ=new ZM;class wV extends ys{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(UZ),this.setValues(e)}setupPositionView(e){const{object:t,camera:n}=e,{positionNode:i,rotationNode:r,scaleNode:a,sizeAttenuation:l}=this,u=_m.mul(ae(i||0));let h=Fe(el[0].xyz.length(),el[1].xyz.length());a!==null&&(h=h.mul(Fe(a))),n.isPerspectiveCamera&&l===!1&&(h=h.mul(u.z.negate()));let p=_x.xy;if(t.center&&t.center.isVector2===!0){const _=BY("center","vec2",t);p=p.sub(_.sub(.5))}p=p.mul(h);const g=j(r||AF),y=Sx(p,g);return Gt(u.xy.add(y),u.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}const LZ=new $M,BZ=new Ge;class PZ extends wV{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(LZ),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return _m.mul(ae(e||ms)).xyz}setupVertexSprite(e){const{material:t,camera:n}=e,{rotationNode:i,scaleNode:r,sizeNode:a,sizeAttenuation:l}=this;let u=super.setupVertex(e);if(t.isNodeMaterial!==!0)return u;let h=a!==null?Fe(a):HF;h=h.mul(GI),n.isPerspectiveCamera&&l===!0&&(h=h.mul(OZ.div(gs.z.negate()))),r&&r.isNode&&(h=h.mul(Fe(r)));let p=_x.xy;if(i&&i.isNode){const g=j(i);p=Sx(p,g)}return p=p.mul(h),p=p.div(xw.div(2)),p=p.mul(u.w),u=u.add(Gt(p,0,0)),u}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const OZ=Vt(1).onFrameUpdate(function({renderer:s}){const e=s.getSize(BZ);this.value=.5*e.y});class IZ extends VE{constructor(){super(),this.shadowNode=j(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Zn.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Zn.rgb)}}const FZ=new uC;class VZ extends ys{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(FZ),this.setValues(e)}setupLightingModel(){return new IZ}}Qc("vec3");Qc("vec3");Qc("vec3");class zZ{constructor(e,t){this.nodes=e,this.info=t,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){const e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(
3974),this.info.frame=this.nodes.nodeFrame.frameId,this._animationLoop!==null&&this._animationLoop(t,n)};e()}stop(){this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class Zl{constructor(){this.weakMap=new WeakMap}get(e){let t=this.weakMap;for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this.weakMap;for(let i=0;i<e.length-1;i++){const r=e[i];n.has(r)===!1&&n.set(r,new WeakMap),n=n.get(r)}return n.set(e[e.length-1],t),this}delete(e){let t=this.weakMap;for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}}let GZ=0;function HZ(s){const e=Object.keys(s);let t=Object.getPrototypeOf(s);for(;t;){const n=Object.getOwnPropertyDescriptors(t);for(const i in n)if(n[i]!==void 0){const r=n[i];r&&typeof r.get=="function"&&e.push(i)}t=Object.getPrototypeOf(t)}return e}class kZ{constructor(e,t,n,i,r,a,l,u,h,p){this.id=GZ++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=i,this.material=r,this.scene=a,this.camera=l,this.lightsNode=u,this.context=h,this.geometry=i.geometry,this.version=r.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=p,this.clippingContextCacheKey=p!==null?p.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.material.hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(const t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],i=new Set,r={};for(const a of e){let l;if(a.node&&a.node.attribute?l=a.node.attribute:(l=t.getAttribute(a.name),r[a.name]=l.version),l===void 0)continue;n.push(l);const u=l.isInterleavedBufferAttribute?l.data:l;i.add(u)}return this.attributes=n,this.attributesId=r,this.vertexBuffers=Array.from(i.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:n,group:i,drawRange:r}=this,a=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),l=this.getIndex(),u=l!==null;let h=1;if(n.isInstancedBufferGeometry===!0?h=n.instanceCount:e.count!==void 0&&(h=Math.max(0,e.count)),h===0)return null;if(a.instanceCount=h,e.isBatchedMesh===!0)return a;let p=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(p=2);let g=r.start*p,y=(r.start+r.count)*p;i!==null&&(g=Math.max(g,i.start*p),y=Math.min(y,(i.start+i.count)*p));const _=n.attributes.position;let S=1/0;u?S=l.count:_!=null&&(S=_.count),g=Math.max(g,0),y=Math.min(y,S);const A=y-g;
3974return A<0||A===1/0?null:(a.vertexCount=A,a.firstVertex=g,a)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const n of Object.keys(e.attributes).sort()){const i=e.attributes[n];t+=n+",",i.data&&(t+=i.data.stride+","),i.offset&&(t+=i.offset+","),i.itemSize&&(t+=i.itemSize+","),i.normalized&&(t+="n,")}for(const n of Object.keys(e.morphAttributes).sort()){const i=e.morphAttributes[n];t+="morph-"+n+",";for(let r=0,a=i.length;r<a;r++){const l=i[r];t+=l.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){const{object:e,material:t,renderer:n}=this;let i=t.customProgramCacheKey();for(const r of HZ(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(r))continue;const a=t[r];let l;if(a!==null){const u=typeof a;u==="number"?l=a!==0?"1":"0":u==="object"?(l="{",a.isTexture&&(l+=a.mapping,n.backend.isWebGPUBackend===!0&&(l+=a.magFilter,l+=a.minFilter,l+=a.wrapS,l+=a.wrapT,l+=a.wrapR)),l+="}"):l=String(a)}else l=String(a);i+=l+","}return i+=this.clippingContextCacheKey+",",e.geometry&&(i+=this.getGeometryCacheKey()),e.skeleton&&(i+=e.skeleton.bones.length+","),e.isBatchedMesh&&(i+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(i+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(i+=e.uuid+","),i+=e.receiveShadow+",",Z3(i)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){const e=this.attributesId;for(const t in e){const n=this.geometry.getAttribute(t);if(n===void 0||e[t]!==n.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=sM(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=sM(e,1)),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}const Jf=[];class qZ{constructor(e,t,n,i,r,a){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=i,this.bindings=r,this.info=a,this.chainMaps={}}get(e,t,n,i,r,a,l,u){const h=this.getChainMap(u);Jf[0]=e,Jf[1]=t,Jf[2]=a,Jf[3]=r;let p=h.get(Jf);return p===void 0?(p=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,i,r,a,l,u),h.set(Jf,p)):(p.updateClipping(l),p.needsGeometryUpdate&&p.setGeometry(e.geometry),(p.version!==t.version||p.needsUpdate)&&(p.initialCacheKey!==p.getCacheKey()?(p.dispose(),p=this.get(e,t,n,i,r,a,l,u)):p.version=t.version)),Jf.length=0,p}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Zl)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,i,r,a,l,u,h,p,g){const y=this.getChainMap(g),_=new kZ(e,t,n,i,r,a,l,u,h,p);return _.onDispose=()=>{this.pipelines.delete(_),this.bindings.delete(_),this.nodes.delete(_),y.delete(_.getChainArray())},_}}class kd{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const tl={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},vd=16,WZ=211,XZ=212;class YZ extends kd{constructor(e){super(),this.backend=e}delete(e){const t=super.delete(e);return t!==null&&this.backend.destroyAttribute(e),t}update(e,t){const n=this.get(e);if(n.version===void 0)t===tl.VERTEX?this.backend.createAttribute(e):t===tl.INDEX?this.backend.createIndexAttribute(e):t===tl.STORAGE?this.backend.createStorageAttribute(e):t===tl.INDIRECT&&this.backend.createIndirectStorageAttribute(e),n.version=this._getBufferAttribute(e).version;else{const i=this._getBufferAttribute(e);(n.version<i.version||i.usage===fp)&&(this.backend.updateAttribute(e),n.version=i.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}function DV(s){return s.index!==null?s.index.version:s.attributes.position.version}function sB(s){const e=[],t=s.index,n=s.attributes.position;if(t!==null){const r=t.array;for(let a=0,l=r.length;a<l;a+=3){const u=r[a+0],h=r[a+1],p=r[a+2];e.push(u,h,h,p,p,u)}}else{const r=n.array;for(let a=0,l=r.length/3-1;a<l;a+=3){const u=a+0,h=a+1,p=a+2;e.push(u,h,h,p,p,u)}}const i=new(QN(e)?WM:qM)(e,1);return i.version=DV(s),i}class jZ extends kd{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap}has(e){const t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){const t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;const i=()=>{this.info.memory.geometries--;const r=t.index,a=e.getAttributes();r!==null&&this.attributes.delete(r);for(const u of a)this.attributes.delete(u);const l=this.wireframes.get(t);l!==void 0&&this.attributes.delete(l),t.removeEventListener("dispose",i)};t.addEventListener("dispose",i)}updateAttributes(e){const t=e.getAttributes();for(const r of t)r.isStorageBufferAttribute||r.isStorageInstancedBufferAttribute?this.updateAttribute(r,tl.STORAGE):this.updateAttribute(r,tl.VERTEX);const n=this.getIndex(e);n!==null&&this.updateAttribute(n,tl.INDEX);const i=e.geometry.indirect;i!==null&&this.updateAttribute(i,tl.INDIRECT)}updateAttribute(e,t){const n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndex(e){const{geometry:t,material:n}=e;let i=t.index;if(n.wireframe===!0){const r=this.wireframes;let a=r.get(t);a===void 0?(a=sB(t),r.set(t,a)):a.version!==DV(t)&&(this.attributes.delete(a),a=sB(t),r.set(t,a)),i=a}return i}}class KZ{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={geometries:0,textures:0}}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):console.error("THREE.WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0,this.memory.geometries=0,this.memory.textures=0}}class UV{constructor(e){this.cacheKey=e,this.usedTimes=0}}class ZZ extends UV{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}}class QZ extends UV{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let $Z=0;class dR{constructor(e,t,n,i=null,r=null){this.id=$Z++,this.code=e,this.stage=t,this.name=n,this.transforms=i,this.attributes=r,this.usedTimes=0}}class JZ extends kd{constructor(e,t){super(),this.backend=e,this.nodes=t,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:n}=this,i=this.get(e);if(this._needsComputeUpdate(e)){const r=i.pipeline;r&&(r.usedTimes--,r.computeProgram.usedTimes--);const a=this.nodes.getForCompute(e);let l=this.programs.compute.get(a.computeShader);l===void 0&&(r&&r.computeProgram.usedTimes===0&&this._releaseProgram(r.computeProgram),l=new dR(a.computeShader,"compute",e.name,a.transforms,a.nodeAttributes),this.programs.compute.set(a.computeShader,l),n.createProgram(l));const u=this._getComputeCacheKey(e,l);let h=this.caches.get(u);h===void 0&&(r&&r.usedTimes===0&&this._releasePipeline(r),h=this._getComputePipeline(e,l,u,t)),h.usedTimes++,l.usedTimes++,i.version=e.version,i.pipeline=h}return i.pipeline}getForRender(e,t=null){const{backend:n}=this,i=this.get(e);
3974if(this._needsRenderUpdate(e)){const r=i.pipeline;r&&(r.usedTimes--,r.vertexProgram.usedTimes--,r.fragmentProgram.usedTimes--);const a=e.getNodeBuilderState(),l=e.material?e.material.name:"";let u=this.programs.vertex.get(a.vertexShader);u===void 0&&(r&&r.vertexProgram.usedTimes===0&&this._releaseProgram(r.vertexProgram),u=new dR(a.vertexShader,"vertex",l),this.programs.vertex.set(a.vertexShader,u),n.createProgram(u));let h=this.programs.fragment.get(a.fragmentShader);h===void 0&&(r&&r.fragmentProgram.usedTimes===0&&this._releaseProgram(r.fragmentProgram),h=new dR(a.fragmentShader,"fragment",l),this.programs.fragment.set(a.fragmentShader,h),n.createProgram(h));const p=this._getRenderCacheKey(e,u,h);let g=this.caches.get(p);g===void 0?(r&&r.usedTimes===0&&this._releasePipeline(r),g=this._getRenderPipeline(e,u,h,p,t)):e.pipeline=g,g.usedTimes++,u.usedTimes++,h.usedTimes++,i.pipeline=g}return i.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,i){n=n||this._getComputeCacheKey(e,t);let r=this.caches.get(n);return r===void 0&&(r=new QZ(n,t),this.caches.set(n,r),this.backend.createComputePipeline(r,i)),r}_getRenderPipeline(e,t,n,i,r){i=i||this._getRenderCacheKey(e,t,n);let a=this.caches.get(i);return a===void 0&&(a=new ZZ(i,t,n),this.caches.set(i,a),e.pipeline=a,this.backend.createRenderPipeline(e,r)),a}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,n=e.stage;this.programs[n].delete(t)}_needsComputeUpdate(e){const t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}}class eQ extends kd{constructor(e,t,n,i,r,a){super(),this.backend=e,this.textures=n,this.pipelines=r,this.attributes=i,this.nodes=t,this.info=a,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const n of t){const i=this.get(n);i.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),i.bindGroup=n)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const n of t){const i=this.get(n);i.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),i.bindGroup=n)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isStorageBuffer){const n=t.attribute,i=n.isIndirectStorageBufferAttribute?tl.INDIRECT:tl.STORAGE;this.attributes.update(n,i)}}_update(e,t){const{backend:n}=this;let i=!1,r=!0,a=0,l=0;for(const u of e.bindings)if(!(u.isNodeUniformsGroup&&this.nodes.updateGroup(u)===!1)){if(u.isStorageBuffer){const h=u.attribute,p=h.isIndirectStorageBufferAttribute?tl.INDIRECT:tl.STORAGE;this.attributes.update(h,p)}
3974if(u.isUniformBuffer)u.update()&&n.updateBinding(u);else if(u.isSampledTexture){const h=u.update(),p=u.texture,g=this.textures.get(p);if(h&&(this.textures.updateTexture(p),u.generation!==g.generation&&(u.generation=g.generation,i=!0,r=!1)),n.get(p).externalTexture!==void 0||g.isDefaultTexture?r=!1:(a=a*10+p.id,l+=p.version),p.isStorageTexture===!0){const _=this.get(p);u.store===!0?_.needsMipmap=!0:this.textures.needsMipmaps(p)&&_.needsMipmap===!0&&(this.backend.generateMipmaps(p),_.needsMipmap=!1)}}else u.isSampler&&u.update()}i===!0&&this.backend.updateBindings(e,t,r?a:0,l)}}function tQ(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?s.z-e.z:s.id-e.id}function rB(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function aB(s){return(s.transmission>0||s.transmissionNode)&&s.side===br&&s.forceSinglePass===!1}class nQ{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,n),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,i,r,a,l){let u=this.renderItems[this.renderItemsIndex];return u===void 0?(u={id:e.id,object:e,geometry:t,material:n,groupOrder:i,renderOrder:e.renderOrder,z:r,group:a,clippingContext:l},this.renderItems[this.renderItemsIndex]=u):(u.id=e.id,u.object=e,u.geometry=t,u.material=n,u.groupOrder=i,u.renderOrder=e.renderOrder,u.z=r,u.group=a,u.clippingContext=l),this.renderItemsIndex++,u}push(e,t,n,i,r,a,l){const u=this.getNextRenderItem(e,t,n,i,r,a,l);e.occlusionTest===!0&&this.occlusionQueryCount++,n.transparent===!0||n.transmission>0?(aB(n)&&this.transparentDoublePass.push(u),this.transparent.push(u)):this.opaque.push(u)}unshift(e,t,n,i,r,a,l){const u=this.getNextRenderItem(e,t,n,i,r,a,l);n.transparent===!0||n.transmission>0?(aB(n)&&this.transparentDoublePass.unshift(u),this.transparent.unshift(u)):this.opaque.unshift(u)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||tQ),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||rB),this.transparent.length>1&&this.transparent.sort(t||rB)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){const n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}}}const k_=[];class iQ{constructor(e){this.lighting=e,this.lists=new Zl}get(e,t){const n=this.lists;k_[0]=e,k_[1]=t;let i=n.get(k_);return i===void 0&&(i=new nQ(this.lighting,e,t),n.set(k_,i)),k_.length=0,i}dispose(){this.lists=new Zl}}let sQ=0;class rQ{constructor(){this.id=sQ++,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new kt,this.scissor=!1,this.scissorValue=new kt,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.isRenderContext=!0}getCacheKey(){return LV(this)}}function LV(s){const{textures:e,activeCubeFace:t,activeMipmapLevel:n}=s,i=[t,n];for(const r of e)i.push(r.id);return yE(i)}const q_=[],aQ=new Jy,oQ=new ix;class lQ{constructor(){this.chainMaps={}}get(e,t,n=null){q_[0]=e,q_[1]=t;let i;if(n===null)i="default";else{const l=n.texture.format;i=`${n.textures.length}:${l}:${n.samples}:${n.depthBuffer}:${n.stencilBuffer}`}const r=this._getChainMap(i);let a=r.get(q_);return a===void 0&&(a=new rQ,r.set(q_,a)),q_.length=0,n!==null&&(a.sampleCount=n.samples===0?1:n.samples),a}getForClear(e=null){return this.get(aQ,oQ,e)}_getChainMap(e){return this.chainMaps[e]||(this.chainMaps[e]=new Zl)}dispose(){this.chainMaps={}}}const uQ=new Y;class cQ extends kd{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n}updateRenderTarget(e,t=0){const n=this.get(e),i=e.samples===0?1:e.samples,r=n.depthTextureMips||(n.depthTextureMips={}),a=e.textures,l=this.getSize(a[0]),u=l.width>>t,h=l.height>>t;let p=e.depthTexture||r[t];const g=e.depthBuffer===!0||e.stencilBuffer===!0;let y=!1;p===void 0&&g&&(p=new Ta,p.format=e.stencilBuffer?to:eo,p.type=e.stencilBuffer?Ja:gi,p.image.width=u,p.image.height=h,p.image.depth=l.depth,p.isArrayTexture=e.multiview===!0&&l.depth>1,r[t]=p),(n.width!==l.width||l.height!==n.height)&&(y=!0,p&&(p.needsUpdate=!0,p.image.width=u,p.image.height=h,p.image.depth=
3974p.isArrayTexture?p.image.depth:1)),n.width=l.width,n.height=l.height,n.textures=a,n.depthTexture=p||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==i&&(y=!0,p&&(p.needsUpdate=!0),n.sampleCount=i);const _={sampleCount:i};if(e.isXRRenderTarget!==!0){for(let S=0;S<a.length;S++){const A=a[S];y&&(A.needsUpdate=!0),this.updateTexture(A,_)}p&&this.updateTexture(p,_)}if(n.initialized!==!0){n.initialized=!0;const S=()=>{e.removeEventListener("dispose",S);for(let A=0;A<a.length;A++)this._destroyTexture(a[A]);p&&this._destroyTexture(p),this.delete(e),this.backend.delete(e)};e.addEventListener("dispose",S)}}updateTexture(e,t={}){const n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;const i=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,r=this.backend;if(i&&n.initialized===!0&&(r.destroySampler(e),r.destroyTexture(e)),e.isFramebufferTexture){const h=this.renderer.getRenderTarget();h?e.type=h.texture.type:e.type=ki}const{width:a,height:l,depth:u}=this.getSize(e);if(t.width=a,t.height=l,t.depth=u,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,a,l):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,i||e.isStorageTexture===!0||e.isExternalTexture===!0)r.createSampler(e),r.createTexture(e,t),n.generation=e.version;else if(n.initialized!==!0&&r.createSampler(e),e.version>0){const p=e.image;if(p===void 0)console.warn("THREE.Renderer: Texture marked for update but image is undefined.");else if(p.complete===!1)console.warn("THREE.Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const g=[];for(const y of e.images)g.push(y);t.images=g}else t.image=p;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(r.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&r.updateTexture(e,t),t.needsMipmaps&&e.mipmaps.length===0&&r.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else r.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;if(n.initialized!==!0){n.initialized=!0,n.generation=e.version,this.info.memory.textures++,e.isVideoTexture&&Kt.getTransfer(e.colorSpace)!==Et&&console.warn("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace.");const h=()=>{e.removeEventListener("dispose",h),this._destroyTexture(e)};e.addEventListener("dispose",h)}n.version=e.version}getSize(e,t=uQ){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let i;return e.mipmaps.length>0?i=e.mipmaps.length:e.isCompressedTexture===!0?i=1:i=Math.floor(Math.log2(Math.max(t,n)))+1,i}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyTexture(e){this.has(e)===!0&&(this.backend.destroySampler(e),this.backend.destroyTexture(e),this.delete(e),this.info.memory.textures--)}}class kw extends lt{constructor(e,t,n,i=1){super(e,t,n),this.a=i}set(e,t,n,i=1){return this.a=i,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}}class BV extends ri{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}const hQ=(s,e)=>Pe(new BV(s,e));class dQ extends Rt{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this.isStackNode=!0}getNodeType(e){return this.hasOutput?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.hasOutput?this.outputNode.getMemberType(e,t):"void"}add(e){return e.isNode!==!0?(console.error("THREE.TSL: Invalid node added to stack."),this):(this.nodes.push(e),this)}If(e,t){const n=new ly(t);return this._currentCond=ur(e,n),this.add(this._currentCond)}ElseIf(e,t){const n=new ly(t),i=ur(e,n);return this._currentCond.elseNode=i,this._currentCond=i,this}Else(e){return this._currentCond.elseNode=new ly(e),this}Switch(e){return this._expressionNode=Pe(e),this}Case(...e){const t=[];if(e.length>=2)for(let l=0;l<e.length-1;
3974l++)t.push(this._expressionNode.equal(Pe(e[l])));else console.error("THREE.TSL: Invalid parameter length. Case() requires at least two parameters.");const n=e[e.length-1],i=new ly(n);let r=t[0];for(let l=1;l<t.length;l++)r=r.or(t[l]);const a=ur(r,i);return this._currentCond===null?(this._currentCond=a,this.add(this._currentCond)):(this._currentCond.elseNode=a,this._currentCond=a,this)}Default(e){return this.Else(e),this}setup(e){const t=e.getNodeProperties(this);let n=0;for(const i of this.getChildren())i.isVarNode&&i.intent===!0&&e.getNodeProperties(i).assign!==!0||(t["node"+n++]=i);return t.outputNode||null}get hasOutput(){return this.outputNode&&this.outputNode.isNode}build(e,...t){const n=e.currentStack,i=SE();z0(this),e.currentStack=this;const r=e.buildStage;for(const l of this.nodes)if(!(l.isVarNode&&l.intent===!0&&e.getNodeProperties(l).assign!==!0)){if(r==="setup")l.build(e);else if(r==="analyze")l.build(e,this);else if(r==="generate"){const u=e.getDataFromNode(l,"any").stages,h=u&&u[e.shaderStage];if(l.isVarNode&&h&&h.length===1&&h[0]&&h[0].isStackNode)continue;l.build(e,"void")}}let a;return this.hasOutput?a=this.outputNode.build(e,...t):a=super.build(e,...t),z0(i),e.currentStack=n,a}}const BT=en(dQ).setParameterLength(0,1);function fQ(s){return Object.entries(s).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}class pQ extends Rt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=fQ(e),this.name=t,this.isStructLayoutNode=!0}getLength(){const t=Float32Array.BYTES_PER_ELEMENT;let n=0;for(const i of this.membersLayout){const r=i.type,a=W7(r)*t,l=X7(r),u=n%8,h=u%l,p=u+h;n+=h,p!==0&&8-p<a&&(n+=8-p),n+=a}return Math.ceil(n/8)*8/t}getMemberType(e,t){const n=this.membersLayout.find(i=>i.name===t);return n?n.type:"void"}getNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class mQ extends Rt{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}getNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}generate(e){const t=e.getVarFromNode(this),n=t.type,i=e.getPropertyName(t);return e.addLineFlowCode(`${i} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}const gQ=(s,e=null)=>{const t=new pQ(s,e),n=(...i)=>{let r=null;if(i.length>0)if(i[0].isNode){r={};const a=Object.keys(s);for(let l=0;l<i.length;l++)r[a[l]]=i[l]}else r=i[0];return Pe(new mQ(t,r))};return n.layout=t,n.isStruct=!0,n};class PV extends Rt{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}getNodeType(e){const t=e.getNodeProperties(this);if(t.membersLayout===void 0){const n=this.members,i=[];for(let r=0;r<n.length;r++){const a="m"+r,l=n[r].getNodeType(e);i.push({name:a,type:l,index:r})}t.membersLayout=i,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}return t.structType.name}generate(e){const t=e.getOutputStructName(),n=this.members,i=t!==""?t+".":"";for(let r=0;r<n.length;r++){const a=n[r].build(e);e.addLineFlowCode(`${i}m${r} = ${a}`,this)}return t}}const yQ=en(PV);function OV(s,e){for(let t=0;t<s.length;t++)if(s[t].name===e)return t;return-1}class vQ extends PV{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.isMRTNode=!0}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){const t={...this.outputNodes,...e.outputNodes};return IV(t)}setup(e){const t=this.outputNodes,n=e.renderer.getRenderTarget(),i=[],r=n.textures;for(const a in t){const l=OV(r,a);i[l]=Gt(t[a])}return this.members=i,super.setup(e)}}const IV=en(vQ);class bx extends vs{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}getNodeType(e){if(this.inputType!==null){const t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){const t=this.getNodeType(e);let n="";if(this.inputType!==null){const i=this.valueNode.getNodeType(e);n=e.getTypeLength(i)===1?this.inputType:e.changeComponentType(i,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}}const _Q=rt(bx).setParameterLength(2),xQ=s=>new bx(s,"int","float"),SQ=s=>new bx(s,"uint","float"),bQ=s=>
3974new bx(s,"float","int"),TQ=s=>new bx(s,"float","uint"),MQ=le(([s])=>{const e=s.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),_N=(s,e)=>Jo(ln(4,s.mul(Ln(1,s))),e),EQ=(s,e)=>s.lessThan(.5)?_N(s.mul(2),e).div(2):Ln(1,_N(ln(Ln(1,s),2),e).div(2)),AQ=(s,e,t)=>Jo(Ao(Jo(s,e),Ns(Jo(s,e),Jo(Ln(1,s),t))),1/e),RQ=(s,e)=>To(hM.mul(e.mul(s).sub(1))).div(hM.mul(e.mul(s).sub(1))),Gc=le(([s])=>s.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),NQ=le(([s])=>ae(Gc(s.z.add(Gc(s.y.mul(1)))),Gc(s.z.add(Gc(s.x.mul(1)))),Gc(s.y.add(Gc(s.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),CQ=le(([s,e,t])=>{const n=ae(s).toVar(),i=j(1.4).toVar(),r=j(0).toVar(),a=ae(n).toVar();return ci({start:j(0),end:j(3),type:"float",condition:"<="},()=>{const l=ae(NQ(a.mul(2))).toVar();n.addAssign(l.add(t.mul(j(.1).mul(e)))),a.mulAssign(1.8),i.mulAssign(1.5),n.mulAssign(1.2);const u=j(Gc(n.z.add(Gc(n.x.add(Gc(n.y)))))).toVar();r.addAssign(u.div(i)),a.addAssign(.14)}),r}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class wQ extends Rt{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFnCall=null,this.global=!0}getNodeType(){return this.functionNodes[0].shaderNode.layout.type}setup(e){const t=this.parametersNodes;let n=this._candidateFnCall;if(n===null){let i=null,r=-1;for(const a of this.functionNodes){const u=a.shaderNode.layout;if(u===null)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const h=u.inputs;if(t.length===h.length){let p=0;for(let g=0;g<t.length;g++){const y=t[g],_=h[g];y.getNodeType(e)===_.type?p++:p=0}p>r&&(i=a,r=p)}}this._candidateFnCall=n=i(...t)}return n}}const DQ=en(wQ),Nr=s=>(...e)=>DQ(s,...e),lv=Vt(0).setGroup(Pt).onRenderUpdate(s=>s.time),UQ=Vt(0).setGroup(Pt).onRenderUpdate(s=>s.deltaTime),FV=Vt(0,"uint").setGroup(Pt).onRenderUpdate(s=>s.frameId),LQ=(s=lv)=>s.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),BQ=(s=lv)=>s.fract().round(),PQ=(s=lv)=>s.add(.5).fract().mul(2).sub(1).abs(),OQ=(s=lv)=>s.fract(),IQ=le(([s,e,t=Fe(.5)])=>Sx(s.sub(t),e).add(t)),FQ=le(([s,e,t=Fe(.5)])=>{const n=s.sub(t),i=n.dot(n),a=i.mul(i).mul(e);return s.add(n.mul(a))}),VQ=le(({position:s=null,horizontal:e=!0,vertical:t=!1})=>{let n;s!==null?(n=el.toVar(),n[3][0]=s.x,n[3][1]=s.y,n[3][2]=s.z):n=el;const i=dl.mul(n);return V0(e)&&(i[0][0]=el[0].length(),i[0][1]=0,i[0][2]=0),V0(t)&&(i[1][0]=0,i[1][1]=el[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,rv.mul(i).mul(ms)}),zQ=le(([s=null])=>{const e=pM();return pM(Dw(s)).sub(e).lessThan(0).select($c,s)});class GQ extends Rt{static get type(){return"SpriteSheetUVNode"}constructor(e,t=vi(),n=j(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:i,height:r}=n,a=e.mod(i.mul(r)).floor(),l=a.mod(i),u=r.sub(a.add(1).div(i).ceil()),h=n.reciprocal(),p=Fe(l,u);return t.add(p).mul(h)}}const HQ=en(GQ).setParameterLength(3),VV=le(([s,e=null,t=null,n=j(1),i=ms,r=io])=>{let a=r.abs().normalize();a=a.div(a.dot(ae(1)));const l=i.yz.mul(n),u=i.zx.mul(n),h=i.xy.mul(n),p=s.value,g=e!==null?e.value:p,y=t!==null?t.value:p,_=Dn(p,l).mul(a.x),S=Dn(g,u).mul(a.y),A=Dn(y,h).mul(a.z);return Ns(_,S,A)}),kQ=(...s)=>VV(...s),jg=new Hu,ep=new Y,Kg=new Y,fR=new Y,W_=new Ot,lT=new Y(0,0,-1),Vu=new kt,X_=new Y,uT=new Y,Y_=new kt,cT=new Ge,mM=new Ql,qQ=$c.flipX();mM.depthTexture=new Ta(1,1);let hT=!1;class qw extends nc{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||mM.texture,qQ),this._reflectorBaseNode=e.reflector||new WQ(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node
3974can only be requested when the reflector is created with { depth: true }. ");this._depthNode=Pe(new qw({defaultTexture:mM.depthTexture,reflector:this._reflectorBaseNode}))}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class WQ extends Rt{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:n=new jn,resolutionScale:i=1,generateMipmaps:r=!1,bounces:a=!0,depth:l=!1,samples:u=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=i,t.resolution!==void 0&&(qr('THREE.ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=r,this.bounces=a,this.depth=l,this.samples=u,this.updateBeforeType=a?mn.RENDER:mn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const n=this.resolutionScale;t.getDrawingBufferSize(cT),e.setSize(Math.round(cT.width*n),Math.round(cT.height*n))}setup(e){return this._updateResolution(mM,e.renderer),super.setup(e)}dispose(){super.dispose();for(const e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Ql(0,0,{type:As,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=fP,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Ta),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&hT)return!1;hT=!0;const{scene:t,camera:n,renderer:i,material:r}=e,{target:a}=this,l=this.getVirtualCamera(n),u=this.getRenderTarget(l);i.getDrawingBufferSize(cT),this._updateResolution(u,i),Kg.setFromMatrixPosition(a.matrixWorld),fR.setFromMatrixPosition(n.matrixWorld),W_.extractRotation(a.matrixWorld),ep.set(0,0,1),ep.applyMatrix4(W_),X_.subVectors(Kg,fR);const h=X_.dot(ep)>0;let p=!1;if(h===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){hT=!1;return}p=!0}X_.reflect(ep).negate(),X_.add(Kg),W_.extractRotation(n.matrixWorld),lT.set(0,0,-1),lT.applyMatrix4(W_),lT.add(fR),uT.subVectors(Kg,lT),uT.reflect(ep).negate(),uT.add(Kg),l.coordinateSystem=n.coordinateSystem,l.position.copy(X_),l.up.set(0,1,0),l.up.applyMatrix4(W_),l.up.reflect(ep),l.lookAt(uT),l.near=n.near,l.far=n.far,l.updateMatrixWorld(),l.projectionMatrix.copy(n.projectionMatrix),jg.setFromNormalAndCoplanarPoint(ep,Kg),jg.applyMatrix4(l.matrixWorldInverse),Vu.set(jg.normal.x,jg.normal.y,jg.normal.z,jg.constant);const g=l.projectionMatrix;Y_.x=(Math.sign(Vu.x)+g.elements[8])/g.elements[0],Y_.y=(Math.sign(Vu.y)+g.elements[9])/g.elements[5],Y_.z=-1,Y_.w=(1+g.elements[10])/g.elements[14],Vu.multiplyScalar(1/Vu.dot(Y_));const y=0;g.elements[2]=Vu.x,g.elements[6]=Vu.y,g.elements[10]=i.coordinateSystem===rl?Vu.z-y:Vu.z+1-y,g.elements[14]=Vu.w,this.textureNode.value=u.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=u.depthTexture),r.visible=!1;const _=i.getRenderTarget(),S=i.getMRT(),A=i.autoClear;i.setMRT(null),i.setRenderTarget(u),i.autoClear=!0,p?(i.clear(),this.hasOutput=!1):(i.render(t,l),this.hasOutput=!0),i.setMRT(S),i.setRenderTarget(_),i.autoClear=A,r.visible=!0,hT=!1,this.forceUpdate=!1}get resolution(){return qr('THREE.ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){qr('THREE.ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const XQ=s=>Pe(new qw(s)),pR=new gm(-1,1,1,-1,0,1);class YQ extends bn{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new It([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new It(t,2))}}const jQ=new YQ;class GE extends Ri{constructor(e=null){super(jQ,e),this.camera=pR,this.isQuadMesh=!0}async renderAsync(e){return e.renderAsync(this,pR)}render(e){e.render(this,pR)}}const KQ=new Ge;class ZQ extends nc{static get type(){return"RTTNode"}constructor(e,t=null,n=null,i={type:As}){const r=new Ql(t,n,i);super(r.texture,vi()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.pixelRatio=1,this.renderTarget=r,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new GE(new ys),this.updateBeforeType=mn.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const n=e*this.pixelRatio,i=t*this.pixelRatio;this.renderTarget.setSize(n,i),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;if(this.textureNeedsUpdate=!1,this.autoResize===!0){const n=e.getPixelRatio(),i=e.getSize(KQ),r=i.width*n,a=i.height*n;(r!==this.renderTarget.width||a!==this.renderTarget.height)&&(this.renderTarget.setSize(r,a),this.textureNeedsUpdate=!0)}this._quadMesh.material.fragmentNode=this._rttNode;
vendor: 12,672 bytes, line 3974
3974const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new nc(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const zV=(s,...e)=>Pe(new ZQ(Pe(s),...e)),QQ=(s,...e)=>s.isSampleNode||s.isTextureNode?s:s.isPassNode?s.getTextureNode():zV(s,...e),sy=le(([s,e,t],n)=>{let i;n.renderer.coordinateSystem===rl?(s=Fe(s.x,s.y.oneMinus()).mul(2).sub(1),i=Gt(ae(s,e),1)):i=Gt(ae(s.x,s.y.oneMinus(),e).mul(2).sub(1),1);const r=Gt(t.mul(i));return r.xyz.div(r.w)}),$Q=le(([s,e])=>{const t=e.mul(Gt(s,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return Fe(n.x,n.y.oneMinus())}),JQ=le(([s,e,t])=>{const n=Rd(fs(e)),i=Ks(s.mul(n)).toVar(),r=fs(e,i).toVar(),a=fs(e,i.sub(Ks(2,0))).toVar(),l=fs(e,i.sub(Ks(1,0))).toVar(),u=fs(e,i.add(Ks(1,0))).toVar(),h=fs(e,i.add(Ks(2,0))).toVar(),p=fs(e,i.add(Ks(0,2))).toVar(),g=fs(e,i.add(Ks(0,1))).toVar(),y=fs(e,i.sub(Ks(0,1))).toVar(),_=fs(e,i.sub(Ks(0,2))).toVar(),S=Li(Ln(j(2).mul(l).sub(a),r)).toVar(),A=Li(Ln(j(2).mul(u).sub(h),r)).toVar(),E=Li(Ln(j(2).mul(g).sub(p),r)).toVar(),b=Li(Ln(j(2).mul(y).sub(_),r)).toVar(),C=sy(s,r,t).toVar(),w=S.lessThan(A).select(C.sub(sy(s.sub(Fe(j(1).div(n.x),0)),l,t)),C.negate().add(sy(s.add(Fe(j(1).div(n.x),0)),u,t))),D=E.lessThan(b).select(C.sub(sy(s.add(Fe(0,j(1).div(n.y))),g,t)),C.negate().add(sy(s.sub(Fe(0,j(1).div(n.y))),y,t)));return ah(DE(w,D))});class e$ extends Rt{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(vi())}sample(e){return this.callback(e)}}const t$=(s,e=null)=>Pe(new e$(s,Pe(e)));class Bd extends Rt{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===Bd.OBJECT?this.updateType=mn.OBJECT:e===Bd.MATERIAL&&(this.updateType=mn.RENDER)}update(e){this.callback(e)}}Bd.OBJECT="object";Bd.MATERIAL="material";const GV=(s,e)=>Pe(new Bd(s,e)).toStack(),n$=s=>GV(Bd.OBJECT,s),i$=s=>GV(Bd.MATERIAL,s);class s$ extends nl{constructor(e,t,n=Float32Array){const i=ArrayBuffer.isView(e)?e:new n(e*t);super(i,t),this.isStorageInstancedBufferAttribute=!0}}class r$ extends ti{constructor(e,t,n=Float32Array){const i=ArrayBuffer.isView(e)?e:new n(e*t);super(i,t),this.isStorageBufferAttribute=!0}}const a$=(s,e="float")=>{let t,n;e.isStruct===!0?(t=e.layout.getLength(),n=aM("float")):(t=J3(e),n=aM(e));const i=new r$(s,t,n);return Np(i,e,s)},o$=(s,e="float")=>{let t,n;e.isStruct===!0?(t=e.layout.getLength(),n=aM("float")):(t=J3(e),n=aM(e));const i=new s$(s,t,n);return Np(i,e,s)};class l$ extends Rt{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const u$=ct(l$),j_=new Ma,mR=new Ot;class ja extends Rt{static get type(){return"SceneNode"}constructor(e=ja.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,n=this.scene!==null?this.scene:e.scene;let i;return t===ja.BACKGROUND_BLURRINESS?i=Ei("backgroundBlurriness","float",n):t===ja.BACKGROUND_INTENSITY?i=Ei("backgroundIntensity","float",n):t===ja.BACKGROUND_ROTATION?i=Vt("mat4").setName("backgroundRotation").setGroup(Pt).onRenderUpdate(()=>{const r=n.background;return r!==null&&r.isTexture&&r.mapping!==j0?(j_.copy(n.backgroundRotation),j_.x*=-1,j_.y*=-1,j_.z*=-1,mR.makeRotationFromEuler(j_)):mR.identity(),mR}):console.error("THREE.SceneNode: Unknown scope:",t),i}}ja.BACKGROUND_BLURRINESS="backgroundBlurriness";ja.BACKGROUND_INTENSITY="backgroundIntensity";ja.BACKGROUND_ROTATION="backgroundRotation";const HV=ct(ja,ja.BACKGROUND_BLURRINESS),xN=ct(ja,ja.BACKGROUND_INTENSITY),kV=ct(ja,ja.BACKGROUND_ROTATION);class c$ extends nc{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.isStorageTextureNode=!0,this.access=Ar.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}generate(e,t){let n;return this.storeNode!==null?n=this.generateStore(e):n=super.generate(e,t),n}toReadWrite(){return this.setAccess(Ar.READ_WRITE)}toReadOnly(){return this.setAccess(Ar.READ_ONLY)}toWriteOnly(){return this.setAccess(Ar.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:i,depthNode:r}=t,a=super.generate(e,"property"),l=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),u=i.build(e,"vec4"),h=r?r.build(e,"int"):null,p=e.generateTextureStore(e,a,l,h,u);e.addLineFlowCode(p,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e}}const qV=en(c$).setParameterLength(1,3),h$=(s,e,t)=>{const n=qV(s,e,t);return t!==null&&n.toStack(),n},d$=le(({texture:s,uv:e})=>{const n=ae().toVar();return Zt(e.x.lessThan(1e-4),()=>{n.assign(ae(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(ae(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(ae(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(ae(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(ae(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(ae(0,0,-1))}).Else(()=>{const r=s.sample(e.add(ae(-.01,0,0))).r.sub(s.sample(e.add(ae(.01,0,0))).r),a=s.sample(e.add(ae(0,-.01,0))).r.sub(s.sample(e.add(ae(0,.01,0))).r),l=s.sample(e.add(ae(0,0,-.01))).r.sub(s.sample(e.add(ae(0,0,.01))).r);n.assign(ae(r,a,l))}),n.normalize()});class f$ extends nc{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return ae(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return e.isFlipY()&&(n.isRenderTargetTexture===!0||n.isFramebufferTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY($(Rd(this,this.levelNode).y).sub(t.y).sub(1))),t}generateUV(e,t){return t.build(e,"vec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return d$({texture:this,uv:e})}}const WV=en(f$).setParameterLength(1,3);class p$ extends BE{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}}const m$=(s,e,t)=>Pe(new p$(s,e,t)),oB=new WeakMap;class g$ extends vs{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=mn.OBJECT,this.updateAfterType=mn.OBJECT,this.previousModelWorldMatrix=Vt(new Ot),this.previousProjectionMatrix=Vt(new Ot).setGroup(Pt),this.previousCameraViewMatrix=Vt(new Ot)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){const i=lB(n);this.previousModelWorldMatrix.value.copy(i);const r=XV(t);r.frameId!==e&&(r.frameId=e,r.previousProjectionMatrix===void 0?(r.previousProjectionMatrix=new Ot,r.previousCameraViewMatrix=new Ot,r.currentProjectionMatrix=new Ot,r.currentCameraViewMatrix=new Ot,r.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),r.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(r.previousProjectionMatrix.copy(r.currentProjectionMatrix),r.previousCameraViewMatrix.copy(r.currentCameraViewMatrix)),r.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),r.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(r.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(r.previousCameraViewMatrix))}updateAfter({object:e}){lB(e).copy(e.matrixWorld)}setup(){const e=this.projectionMatrix===null?rv:Vt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(_m).mul(ms),i=this.previousProjectionMatrix.mul(t).mul(fM),r=n.xy.div(n.w),a=i.xy.div(i.w);return Ln(r,a)}}function XV(s){let e=oB.get(s);return e===void 0&&(e={},oB.set(s,e)),e}function lB(s,e=0){const t=XV(s);let n=t[e];return n===void 0&&(t[e]=n=new Ot,t[e].copy(s.matrixWorld)),n}const y$=ct(g$),v$=le(([s])=>Ww(s.rgb)),_$=le(([s,e=j(1)])=>e.mix(Ww(s.rgb),s.rgb)),x$=le(([s,e=j(1)])=>{const t=Ns(s.r,s.g,s.b).div(3),n=s.r.max(s.g.max(s.b)),i=n.sub(t).mul(e).mul(-3);return Yn(s.rgb,n,i)}),S$=le(([s,e=j(1)])=>{const t=ae(.57735,.57735,.57735),n=e.cos();return ae(s.rgb.mul(n).add(t.cross(s.rgb).mul(e.sin()).add(t.mul(zd(t,s.rgb).mul(n.oneMinus())))))}),Ww=(s,e=ae(Kt.getLuminanceCoefficients(new Y)))=>zd(s,e),b$=le(([s,e=ae(1),t=ae(0),n=ae(1),i=j(1),r=ae(Kt.getLuminanceCoefficients(new Y,Yl))])=>{const a=s.rgb.dot(ae(r)),l=rs(s.rgb.mul(e).add(t),0).toVar(),u=l.pow(n).toVar();return Zt(l.r.greaterThan(0),()=>{l.r.assign(u.r)}),Zt(l.g.greaterThan(0),()=>{l.g.assign(u.g)}),Zt(l.b.greaterThan(0),()=>{l.b.assign(u.b)}),l.assign(a.add(l.sub(a).mul(i))),Gt(l.rgb,s.a)});class T$ extends vs{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}const M$=en(T$).setParameterLength(2),dT=new Ge;class YV extends nc{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class uB extends YV{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){const e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e}}class ic extends vs{static get type(){return"PassNode"}constructor(e,t,n,i={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=i,this._pixelRatio=1,this._width=1,this._height=1;const r=new Ta;r.isRenderTargetTexture=!0,r.name="depth";const a=new Ql(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:As,...i});a.texture.name="output",a.depthTexture=r,this.renderTarget=a,this._textures={output:a.texture,depth:r},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Vt(0),this._cameraFar=Vt(0),this._mrt=null,this._layers=null,this._resolution=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=mn.FRAME,this.global=!0}setResolution(e){return this._resolution=e,this}getResolution(){return this._resolution}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const n=this._textures[e],i=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[i]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=Pe(new uB(this,e)),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=Pe(new uB(this,e,!0)),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const n=this._cameraNear,i=this._cameraFar;this._viewZNodes[e]=t=Uw(this.getTextureNode(e),n,i)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const n=this._cameraNear,i=this._cameraFar,r=this.getViewZNode(e);this._linearDepthNodes[e]=t=gy(r,n,i)}return t}async compileAsync(e){const t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getColorBufferType(),this.scope===ic.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n}=this;let i,r;
3974const a=t.getOutputRenderTarget();a&&a.isXRRenderTarget===!0?(r=1,i=t.xr.getCamera(),t.xr.updateCamera(i),dT.set(a.width,a.height)):(i=this.camera,r=t.getPixelRatio(),t.getSize(dT)),this._pixelRatio=r,this.setSize(dT.width,dT.height);const l=t.getRenderTarget(),u=t.getMRT(),h=i.layers.mask;this._cameraNear.value=i.near,this._cameraFar.value=i.far,this._layers!==null&&(i.layers.mask=this._layers.mask);for(const p in this._previousTextures)this.toggleTexture(p);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(n,i),t.setRenderTarget(l),t.setMRT(u),i.layers.mask=h}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio*this._resolution,i=this._height*this._pixelRatio*this._resolution;this.renderTarget.setSize(n,i),this._scissor!==null&&this.renderTarget.scissor.copy(this._scissor),this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport)}setScissor(e,t,n,i){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new kt),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,i),this._scissor.multiplyScalar(this._pixelRatio*this._resolution).floor())}setViewport(e,t,n,i){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new kt),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,i),this._viewport.multiplyScalar(this._pixelRatio*this._resolution).floor())}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}ic.COLOR="color";ic.DEPTH="depth";const E$=(s,e,t)=>Pe(new ic(ic.COLOR,s,e,t)),A$=(s,e)=>Pe(new YV(s,e)),R$=(s,e,t)=>Pe(new ic(ic.DEPTH,s,e,t));class N$ extends ic{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,i,r){super(ic.COLOR,e,t),this.colorNode=n,this.thicknessNode=i,this.alphaNode=r,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((i,r,a,l,u,h,p,g)=>{if((u.isMeshToonMaterial||u.isMeshToonNodeMaterial)&&u.wireframe===!1){const y=this._getOutlineMaterial(u);t.renderObject(i,r,a,l,y,h,p,g)}t.renderObject(i,r,a,l,u,h,p,g)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new ys;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=yi;const t=io.negate(),n=rv.mul(_m),i=j(1),r=n.mul(Gt(ms,1)),a=n.mul(Gt(ms.add(t),1)),l=ah(r.sub(a));return e.vertexNode=r.add(l.mul(this.thicknessNode).mul(r.w).mul(i)),e.colorNode=Gt(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const C$=(s,e,t=new lt(0,0,0),n=.003,i=1)=>Pe(new N$(s,e,Pe(t),Pe(n),Pe(i))),jV=le(([s,e])=>s.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),KV=le(([s,e])=>(s=s.mul(e),s.div(s.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),ZV=le(([s,e])=>{s=s.mul(e),s=s.sub(.004).max(0);const t=s.mul(s.mul(6.2).add(.5)),n=s.mul(s.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),w$=le(([s])=>{const e=s.mul(s.add(.0245786)).sub(90537e-9),t=s.mul(s.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),QV=le(([s,e])=>{const t=Yr(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=Yr(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return s=s.mul(e).div(.6),s=t.mul(s),s=w$(s),s=n.mul(s),s.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),D$=Yr(ae(1.6605,-.1246,-.0182),ae(-.5876,1.1329,-.1006),ae(-.0728,-.0083,1.1187)),U$=Yr(ae(.6274,.0691,.0164),ae(.3293,.9195,.088),ae(.0433,.0113,.8956)),L$=le(([s])=>{const e=ae(s).toVar(),t=ae(e.mul(e)).toVar(),n=ae(t.mul(t)).toVar();return j(15.5).mul(n.mul(t)).sub(ln(40.14,n.mul(e))).add(ln(31.96,n).sub(ln(6.868,t.mul(e))).add(ln(.4298,t).add(ln(.1191,e).sub(.00232))))}),$V=le(([s,e])=>{const t=ae(s).toVar(),n=Yr(ae(.856627153315983,.137318972929847,.11189821299995),ae(.0951212405381588,.761241990602591,.0767994186031903),ae(.0482516061458583,.101439036467562,.811302368396859)),i=Yr(ae(1.1271005818144368,-.1413297634984383,-.14132976349843826),ae(-.11060664309660323,1.157823702216272,-.11060664309660294),ae(-.016493938717834573,-.016493938717834257,1.2519364065950405)),r=j(-12.47393),a=j(4.026069);return t.mulAssign(e),t.assign(U$.mul(t)),t.assign(n.mul(t)),t.assign(rs(t,1e-10)),t.assign(Yu(t)),t.assign(t.sub(r).div(a.sub(r))),t.assign(ol(t,0,1)),t.assign(L$(t)),t.assign(i.mul(t)),t.assign(Jo(rs(ae(0),t),ae(2.2))),t.assign(D$.mul(t)),t.assign(ol(t,0,1)),t}
3974).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),JV=le(([s,e])=>{const t=j(.76),n=j(.15);s=s.mul(e);const i=no(s.r,no(s.g,s.b)),r=ur(i.lessThan(.08),i.sub(ln(6.25,i.mul(i))),.04);s.subAssign(r);const a=rs(s.r,rs(s.g,s.b));Zt(a.lessThan(t),()=>s);const l=Ln(1,t),u=Ln(1,l.mul(l).div(a.add(l.sub(t))));s.mulAssign(u.div(a));const h=Ln(1,Ao(1,n.mul(a.sub(u)).add(1)));return Yn(s,ae(u),h)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class Gr extends Rt{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const i of t)i.build(e);const n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const HE=en(Gr).setParameterLength(1,3),B$=(s,e)=>HE(s,e,"js"),P$=(s,e)=>HE(s,e,"wgsl"),O$=(s,e)=>HE(s,e,"glsl");class ez extends Gr{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){const n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);const n=this.getNodeFunction(e),i=n.name,r=n.type,a=e.getCodeFromNode(this,r);i!==""&&(a.name=i);const l=e.getPropertyName(a),u=this.getNodeFunction(e).getCode(l);return a.code=u+` 3975`,t==="property"?l:e.format(`${l}()`,r,t)}}const tz=(s,e=[],t="")=>{for(let r=0;r<e.length;r++){const a=e[r];typeof a=="function"&&(e[r]=a.functionNode)}const n=Pe(new ez(s,e,t)),i=(...r)=>n.call(...r);return i.functionNode=n,i},I$=(s,e)=>tz(s,e,"glsl"),F$=(s,e)=>tz(s,e,"wgsl");class V$ extends Rt{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new Ro,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return this.outputType!==null}set value(e){this._value!==e&&(this._cache&&this.inputType==="URL"&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&this._cache===null&&this.inputType==="URL"&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&e.value!==null&&e.value!==void 0&&((this.inputType==="URL"||this.inputType==="String")&&typeof e.value=="string"||this.inputType==="Number"&&typeof e.value=="number"||this.inputType==="Vector2"&&e.value.isVector2||this.inputType==="Vector3"&&e.value.isVector3||this.inputType==="Vector4"&&e.value.isVector4||this.inputType==="Color"&&e.value.isColor||this.inputType==="Matrix3"&&e.value.isMatrix3||this.inputType==="Matrix4"&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:j()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=tO(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;e.value!==null&&(e.inputType==="ArrayBuffer"?t=nO(e.value):e.inputType==="Texture"?t=e.meta.textures[e.value]:t=e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const PT=en(V$).setParameterLength(1);
3975class nz extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(t!==null){const i=t(...n);return this.set(e,i),i}}}class z${constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const OT=new nz;class G$ extends Rt{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new nz,this._output=PT(null),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const n=this._outputs;return n[e]===void 0?n[e]=PT(t):n[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):n[e]===void 0?(n[e]=PT(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const i=this.getObject()[e];if(typeof i=="function")return i(...t)}async callAsync(e,...t){const i=this.getObject()[e];if(typeof i=="function")return i.constructor.name==="AsyncFunction"?await i(...t):i(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){e!==null?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),this._object!==null)return this._object;const e=()=>this.refresh(),t=(h,p)=>this.setOutput(h,p),n=new z$(this),i=OT.get("THREE"),r=OT.get("TSL"),a=this.getMethod(),l=[n,this._local,OT,e,t,i,r];this._object=a(...l);const u=this._object.layout;if(u&&(u.cache===!1&&this._local.clear(),this._output.outputType=u.outputType||null,Array.isArray(u.elements)))for(const h of u.elements){const p=h.id||h.name;h.inputType&&(this.getParameter(p)===void 0&&this.setParameter(p,null),this.getParameter(p).inputType=h.inputType),h.outputType&&(this.getOutput(p)===void 0&&this.setOutput(p,null),this.getOutput(p).outputType=h.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const t in this.parameters){let n=this.parameters[t];n.isScriptableNode&&(n=n.getDefaultOutput()),n.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:j()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),this._method!==null)return this._method;const e=["parameters","local","global","refresh","setOutput","THREE","TSL"],n=["layout","init","main","dispose"].join(", "),i="var "+n+`; var output = {}; 3976`,r=` 3977return { ...output, `+n+" };",a=i+this.codeNode.code+r;return this._method=new Function(...e,a),this._method}dispose(){this._method!==null&&(this._object&&typeof this._object.dispose=="function"&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[Z3(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return yE(t)}set needsUpdate(e){e===!0&&this.dispose()}get needsUpdate(){return this.source!==this._source}
3977_exec(){return this.codeNode===null?this:(this._needsOutputUpdate===!0&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value,this)}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const H$=en(G$).setParameterLength(1,2);function iz(s){let e;const t=s.context.getViewZ;return t!==void 0&&(e=t(this)),(e||gs.z).negate()}const Xw=le(([s,e],t)=>{const n=iz(t);return tc(s,e,n)}),Yw=le(([s],e)=>{const t=iz(e);return s.mul(s,t,t).negate().exp().oneMinus()}),X0=le(([s,e])=>Gt(e.toFloat().mix(py.rgb,s.toVec3()),py.a));function k$(s,e,t){return console.warn('THREE.TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),X0(s,Xw(e,t))}function q$(s,e){return console.warn('THREE.TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),X0(s,Yw(e))}let tp=null,np=null;class W$ extends Rt{static get type(){return"RangeNode"}constructor(e=j(),t=j()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Sd(this.minNode.value)),n=e.getTypeLength(Sd(this.maxNode.value));return t>n?t:n}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let n=null;if(t.count>1){const i=this.minNode.value,r=this.maxNode.value,a=e.getTypeLength(Sd(i)),l=e.getTypeLength(Sd(r));tp=tp||new kt,np=np||new kt,tp.setScalar(0),np.setScalar(0),a===1?tp.setScalar(i):i.isColor?tp.set(i.r,i.g,i.b,1):tp.set(i.x,i.y,i.z||0,i.w||0),l===1?np.setScalar(r):r.isColor?np.set(r.r,r.g,r.b,1):np.set(r.x,r.y,r.z||0,r.w||0);const u=4,h=u*t.count,p=new Float32Array(h);for(let y=0;y<h;y++){const _=y%u,S=tp.getComponent(_),A=np.getComponent(_);p[y]=ZN.lerp(S,A,Math.random())}const g=this.getNodeType(e);if(t.count<=4096)n=yx(p,"vec4",t.count).element(Nd).convert(g);else{const y=new nl(p,4);e.geometry.setAttribute("__range"+this.id,y),n=dM(y).convert(g)}}else n=j(0);return n}}const X$=en(W$).setParameterLength(2);class Y$ extends Rt{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}getNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){const n=this.getBuiltinName(e),i=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,i,t):(console.warn(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(i))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}}const Tx=(s,e)=>Pe(new Y$(s,e)),j$=Tx("numWorkgroups","uvec3"),K$=Tx("workgroupId","uvec3"),Z$=Tx("globalId","uvec3"),Q$=Tx("localId","uvec3"),$$=Tx("subgroupSize","uint");class J$ extends Rt{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 3978`):e.addLineFlowCode(`${t}Barrier()`,this)}}const jw=en(J$),eJ=()=>jw("workgroup").toStack(),tJ=()=>jw("storage").toStack(),nJ=()=>jw("texture").toStack();class iJ extends vm{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const i=e.context.assign;if(n=super.generate(e),i!==!0){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}class sJ extends Rt{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return console.warn('THREE.TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return Pe(new iJ(this,e))}generate(e){const t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const rJ=(s,e)=>Pe(new sJ("Workgroup",s,e));class Js extends Rt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=e.getNodeProperties(this),n=t.parents,i=this.method,r=this.getNodeType(e),a=this.getInputType(e),l=this.pointerNode,u=this.valueNode,h=[];h.push(`&${l.build(e,a)}`),u!==null&&h.push(u.build(e,a));const p=`${e.getMethod(i,r)}( ${h.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(p,this);else return t.constNode===void 0&&(t.constNode=oh(p,r).toConst()),t.constNode.build(e)}}Js.ATOMIC_LOAD="atomicLoad";Js.ATOMIC_STORE="atomicStore";Js.ATOMIC_ADD="atomicAdd";Js.ATOMIC_SUB="atomicSub";Js.ATOMIC_MAX="atomicMax";Js.ATOMIC_MIN="atomicMin";Js.ATOMIC_AND="atomicAnd";Js.ATOMIC_OR="atomicOr";Js.ATOMIC_XOR="atomicXor";const aJ=en(Js),oc=(s,e,t)=>aJ(s,e,t).toStack(),oJ=s=>oc(Js.ATOMIC_LOAD,s,null),lJ=(s,e)=>oc(Js.ATOMIC_STORE,s,e),uJ=(s,e)=>oc(Js.ATOMIC_ADD,s,e),cJ=(s,e)=>oc(Js.ATOMIC_SUB,s,e),hJ=(s,e)=>oc(Js.ATOMIC_MAX,s,e),dJ=(s,e)=>oc(Js.ATOMIC_MIN,s,e),fJ=(s,e)=>oc(Js.ATOMIC_AND,s,e),pJ=(s,e)=>oc(Js.ATOMIC_OR,s,e),mJ=(s,e)=>oc(Js.ATOMIC_XOR,s,e);class vt extends vs{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){const t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,i=e.isMatrix(t)?0:e.getTypeLength(t),r=e.isMatrix(n)?0:e.getTypeLength(n);return i>r?t:n}
3978getNodeType(e){const t=this.method;return t===vt.SUBGROUP_ELECT?"bool":t===vt.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const n=this.method,i=this.getNodeType(e),r=this.getInputType(e),a=this.aNode,l=this.bNode,u=[];if(n===vt.SUBGROUP_BROADCAST||n===vt.SUBGROUP_SHUFFLE||n===vt.QUAD_BROADCAST){const p=l.getNodeType(e);u.push(a.build(e,i),l.build(e,p==="float"?"int":i))}else n===vt.SUBGROUP_SHUFFLE_XOR||n===vt.SUBGROUP_SHUFFLE_DOWN||n===vt.SUBGROUP_SHUFFLE_UP?u.push(a.build(e,i),l.build(e,"uint")):(a!==null&&u.push(a.build(e,r)),l!==null&&u.push(l.build(e,r)));const h=u.length===0?"()":`( ${u.join(", ")} )`;return e.format(`${e.getMethod(n,i)}${h}`,i,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}vt.SUBGROUP_ELECT="subgroupElect";vt.SUBGROUP_BALLOT="subgroupBallot";vt.SUBGROUP_ADD="subgroupAdd";vt.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";vt.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";vt.SUBGROUP_MUL="subgroupMul";vt.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";vt.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";vt.SUBGROUP_AND="subgroupAnd";vt.SUBGROUP_OR="subgroupOr";vt.SUBGROUP_XOR="subgroupXor";vt.SUBGROUP_MIN="subgroupMin";vt.SUBGROUP_MAX="subgroupMax";vt.SUBGROUP_ALL="subgroupAll";vt.SUBGROUP_ANY="subgroupAny";vt.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";vt.QUAD_SWAP_X="quadSwapX";vt.QUAD_SWAP_Y="quadSwapY";vt.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";vt.SUBGROUP_BROADCAST="subgroupBroadcast";vt.SUBGROUP_SHUFFLE="subgroupShuffle";vt.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";vt.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";vt.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";vt.QUAD_BROADCAST="quadBroadcast";const gJ=rt(vt,vt.SUBGROUP_ELECT).setParameterLength(0),yJ=rt(vt,vt.SUBGROUP_BALLOT).setParameterLength(1),vJ=rt(vt,vt.SUBGROUP_ADD).setParameterLength(1),_J=rt(vt,vt.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),xJ=rt(vt,vt.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),SJ=rt(vt,vt.SUBGROUP_MUL).setParameterLength(1),bJ=rt(vt,vt.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),TJ=rt(vt,vt.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),MJ=rt(vt,vt.SUBGROUP_AND).setParameterLength(1),EJ=rt(vt,vt.SUBGROUP_OR).setParameterLength(1),AJ=rt(vt,vt.SUBGROUP_XOR).setParameterLength(1),RJ=rt(vt,vt.SUBGROUP_MIN).setParameterLength(1),NJ=rt(vt,vt.SUBGROUP_MAX).setParameterLength(1),CJ=rt(vt,vt.SUBGROUP_ALL).setParameterLength(0),wJ=rt(vt,vt.SUBGROUP_ANY).setParameterLength(0),DJ=rt(vt,vt.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),UJ=rt(vt,vt.QUAD_SWAP_X).setParameterLength(1),LJ=rt(vt,vt.QUAD_SWAP_Y).setParameterLength(1),BJ=rt(vt,vt.QUAD_SWAP_DIAGONAL).setParameterLength(1),PJ=rt(vt,vt.SUBGROUP_BROADCAST).setParameterLength(2),OJ=rt(vt,vt.SUBGROUP_SHUFFLE).setParameterLength(2),IJ=rt(vt,vt.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),FJ=rt(vt,vt.SUBGROUP_SHUFFLE_UP).setParameterLength(2),VJ=rt(vt,vt.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),zJ=rt(vt,vt.QUAD_BROADCAST).setParameterLength(1);let fT;function kE(s){fT=fT||new WeakMap;let e=fT.get(s);return e===void 0&&fT.set(s,e={}),e}function qE(s){const e=kE(s);return e.shadowMatrix||(e.shadowMatrix=Vt("mat4").setGroup(Pt).onRenderUpdate(t=>((s.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&s.shadow.updateMatrices(s),s.shadow.matrix)))}function sz(s,e=Zu){const t=qE(s).mul(e);return t.xyz.div(t.w)}function Kw(s){const e=kE(s);return e.position||(e.position=Vt(new Y).setGroup(Pt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(s.matrixWorld)))}function rz(s){const e=kE(s);return e.targetPosition||(e.targetPosition=Vt(new Y).setGroup(Pt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(s.target.matrixWorld)))}function Zw(s){const e=kE(s);return e.viewPosition||(e.viewPosition=Vt(new Y).setGroup(Pt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new Y,n.value.setFromMatrixPosition(s.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const Qw=s=>dl.transformDirection(Kw(s).sub(rz(s))),GJ=s=>s.sort((e,t)=>e.id-t.id),HJ=(s,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===s)return t;return null},gR=new WeakMap,K_=[];class $w extends Rt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Qc("vec3","totalDiffuse"),this.totalSpecularNode=Qc("vec3","totalSpecular"),this.outgoingLightNode=Qc("vec3","outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=this._lights;for(let n=0;n<e.length;n++){const i=e[n];
vendor: 6,377 bytes, line 3978
3978if(K_.push(i.id),K_.push(i.castShadow?1:0),i.isSpotLight===!0){const r=i.map!==null?i.map.id:-1,a=i.colorNode?i.colorNode.getCacheKey():-1;K_.push(r,a)}}const t=yE(K_);return K_.length=0,t}getHash(e){if(this._lightNodesHash===null){this._lightNodes===null&&this.setupLightsNode(e);const t=[];for(const n of this._lightNodes)t.push(n.getHash());this._lightNodesHash="lights-"+t.join(",")}return this._lightNodesHash}analyze(e){const t=e.getNodeProperties(this);for(const n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){const t=[],n=this._lightNodes,i=GJ(this._lights),r=e.renderer.library;for(const a of i)if(a.isNode)t.push(Pe(a));else{let l=null;if(n!==null&&(l=HJ(a.id,n)),l===null){const u=r.getLightNodeClass(a.constructor);if(u===null){console.warn(`LightsNode.setupNodeLights: Light node not found for ${a.constructor.name}`);continue}let h=null;gR.has(a)?h=gR.get(a):(h=Pe(new u(a)),gR.set(a,h)),t.push(h)}}this._lightNodes=t}setupDirectLight(e,t,n){const{lightingModel:i,reflectedLight:r}=e.context;i.direct({...n,lightNode:t,reflectedLight:r},e)}setupDirectRectAreaLight(e,t,n){const{lightingModel:i,reflectedLight:r}=e.context;i.directRectArea({...n,lightNode:t,reflectedLight:r},e)}setupLights(e,t){for(const n of t)n.build(e)}getLightNodes(e){return this._lightNodes===null&&this.setupLightsNode(e),this._lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode;const i=e.context,r=i.lightingModel,a=e.getNodeProperties(this);if(r){const{totalDiffuseNode:l,totalSpecularNode:u}=this;i.outgoingLight=n;const h=e.addStack();a.nodes=h.nodes,r.start(e);const{backdrop:p,backdropAlpha:g}=i,{directDiffuse:y,directSpecular:_,indirectDiffuse:S,indirectSpecular:A}=i.reflectedLight;let E=y.add(S);p!==null&&(g!==null?E=ae(g.mix(E,p)):E=ae(p),i.material.transparent=!0),l.assign(E),u.assign(_.add(A)),n.assign(l.add(u)),r.finish(e),n=n.bypass(e.removeStack())}else a.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}const kJ=(s=[])=>Pe(new $w).setLights(s);class qJ extends Rt{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=mn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){Jw.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Zu)}}const Jw=Qc("vec3","shadowPositionWorld");function WJ(s,e={}){return e.toneMapping=s.toneMapping,e.toneMappingExposure=s.toneMappingExposure,e.outputColorSpace=s.outputColorSpace,e.renderTarget=s.getRenderTarget(),e.activeCubeFace=s.getActiveCubeFace(),e.activeMipmapLevel=s.getActiveMipmapLevel(),e.renderObjectFunction=s.getRenderObjectFunction(),e.pixelRatio=s.getPixelRatio(),e.mrt=s.getMRT(),e.clearColor=s.getClearColor(e.clearColor||new lt),e.clearAlpha=s.getClearAlpha(),e.autoClear=s.autoClear,e.scissorTest=s.getScissorTest(),e}function XJ(s,e){return e=WJ(s,e),s.setMRT(null),s.setRenderObjectFunction(null),s.setClearColor(0,1),s.autoClear=!0,e}function YJ(s,e){s.toneMapping=e.toneMapping,s.toneMappingExposure=e.toneMappingExposure,s.outputColorSpace=e.outputColorSpace,s.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),s.setRenderObjectFunction(e.renderObjectFunction),s.setPixelRatio(e.pixelRatio),s.setMRT(e.mrt),s.setClearColor(e.clearColor,e.clearAlpha),s.autoClear=e.autoClear,s.setScissorTest(e.scissorTest)}function jJ(s,e={}){return e.background=s.background,e.backgroundNode=s.backgroundNode,e.overrideMaterial=s.overrideMaterial,e}function KJ(s,e){return e=jJ(s,e),s.background=null,s.backgroundNode=null,s.overrideMaterial=null,e}function ZJ(s,e){s.background=e.background,s.backgroundNode=e.backgroundNode,s.overrideMaterial=e.overrideMaterial}function QJ(s,e,t){return t=XJ(s,t),t=KJ(e,t),t}function $J(s,e,t){YJ(s,t),ZJ(e,t)}const cB=new WeakMap,az=le(({depthTexture:s,shadowCoord:e,depthLayer:t})=>{let n=Dn(s,e.xy).setName("t_basic");return s.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),oz=le(({depthTexture:s,shadowCoord:e,shadow:t,depthLayer:n})=>{const i=(E,b)=>{let C=Dn(s,E);return s.isArrayTexture&&(C=C.depth(n)),C.compare(b)},r=Ei("mapSize","vec2",t).setGroup(Pt),a=Ei("radius","float",t).setGroup(Pt),l=Fe(1).div(r),u=l.x.negate().mul(a),h=l.y.negate().mul(a),p=l.x.mul(a),g=l.y.mul(a),y=u.div(2),_=h.div(2),S=p.div(2),A=g.div(2);return Ns(i(e.xy.add(Fe(u,h)),e.z),i(e.xy.add(Fe(0,h)),e.z),i(e.xy.add(Fe(p,h)),e.z),i(e.xy.add(Fe(y,_)),e.z),i(e.xy.add(Fe(0,_)),e.z),i(e.xy.add(Fe(S,_)),e.z),i(e.xy.add(Fe(u,0)),e.z),i(e.xy.add(Fe(y,0)),e.z),i(e.xy,e.z),i(e.xy.add(Fe(S,0)),e.z),i(e.xy.add(Fe(p,0)),e.z),i(e.xy.add(Fe(y,A)),e.z),i(e.xy.add(Fe(0,A)),e.z),i(e.xy.add(Fe(S,A)),e.z),i(e.xy.add(Fe(u,g)),e.z),i(e.xy.add(Fe(0,g)),e.z),i(e.xy.add(Fe(p,g)),e.z)).mul(1/17)}),lz=le(({depthTexture:s,shadowCoord:e,shadow:t,depthLayer:n})=>{const i=(g,y)=>{let _=Dn(s,g);return s.isArrayTexture&&(_=_.depth(n)),_.compare(y)},r=Ei("mapSize","vec2",t).setGroup(Pt),a=Fe(1).div(r),l=a.x,u=a.y,h=e.xy,p=ch(h.mul(r).add(.5));return h.subAssign(p.mul(a)),Ns(i(h,e.z),i(h.add(Fe(l,0)),e.z),i(h.add(Fe(0,u)),e.z),i(h.add(a),e.z),Yn(i(h.add(Fe(l.negate(),0)),e.z),i(h.add(Fe(l.mul(2),0)),e.z),p.x),Yn(i(h.add(Fe(l.negate(),u)),e.z),i(h.add(Fe(l.mul(2),u)),e.z),p.x),Yn(i(h.add(Fe(0,u.negate())),e.z),i(h.add(Fe(0,u.mul(2))),e.z),p.y),Yn(i(h.add(Fe(l,u.negate())),e.z),i(h.add(Fe(l,u.mul(2))),e.z),p.y),Yn(Yn(i(h.add(Fe(l.negate(),u.negate())),e.z),i(h.add(Fe(l.mul(2),u.negate())),e.z),p.x),Yn(i(h.add(Fe(l.negate(),u.mul(2))),e.z),i(h.add(Fe(l.mul(2),u.mul(2))),e.z),p.x),p.y)).mul(1/9)}),uz=le(({depthTexture:s,shadowCoord:e,depthLayer:t})=>{const n=j(1).toVar();let i=Dn(s).sample(e.xy);s.isArrayTexture&&(i=i.depth(t)),i=i.rg;const r=wE(e.z,i.x);return Zt(r.notEqual(j(1)),()=>{const a=e.z.sub(i.x),l=rs(0,i.y.mul(i.y));let u=l.div(l.add(a.mul(a)));u=ol(Ln(u,.3).div(.95-.3)),n.assign(ol(rs(r,u)))}),n}),JJ=le(([s,e,t])=>{let n=Zu.sub(s).length();return n=n.sub(e).div(t.sub(e)),n=n.saturate(),n}),eee=s=>{const e=s.shadow.camera,t=Ei("near","float",e).setGroup(Pt),n=Ei("far","float",e).setGroup(Pt),i=qI(s);return JJ(i,t,n)},cz=s=>{let e=cB.get(s);if(e===void 0){const t=s.isPointLight?eee(s):null;e=new ys,e.colorNode=Gt(0,0,0,1),e.depthNode=t,e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.fog=!1,
vendor: 4,123 bytes, line 3978
3978cB.set(s,e)}return e},hB=new Zl,Zg=[],hz=(s,e,t,n)=>{Zg[0]=s,Zg[1]=e;let i=hB.get(Zg);return(i===void 0||i.shadowType!==t||i.useVelocity!==n)&&(i=(r,a,l,u,h,p,...g)=>{(r.castShadow===!0||r.receiveShadow&&t===ya)&&(n&&(eO(r).useVelocity=!0),r.onBeforeShadow(s,r,l,e.camera,u,a.overrideMaterial,p),s.renderObject(r,a,l,u,h,p,...g),r.onAfterShadow(s,r,l,e.camera,u,a.overrideMaterial,p))},i.shadowType=t,i.useVelocity=n,hB.set(Zg,i)),Zg[0]=null,Zg[1]=null,i},tee=le(({samples:s,radius:e,size:t,shadowPass:n,depthLayer:i})=>{const r=j(0).toVar("meanVertical"),a=j(0).toVar("squareMeanVertical"),l=s.lessThanEqual(j(1)).select(j(0),j(2).div(s.sub(1))),u=s.lessThanEqual(j(1)).select(j(0),j(-1));ci({start:$(0),end:$(s),type:"int",condition:"<"},({i:p})=>{const g=u.add(j(p).mul(l));let y=n.sample(Ns(vx.xy,Fe(0,g).mul(e)).div(t));n.value.isArrayTexture&&(y=y.depth(i)),y=y.x,r.addAssign(y),a.addAssign(y.mul(y))}),r.divAssign(s),a.divAssign(s);const h=rc(a.sub(r.mul(r)));return Fe(r,h)}),nee=le(({samples:s,radius:e,size:t,shadowPass:n,depthLayer:i})=>{const r=j(0).toVar("meanHorizontal"),a=j(0).toVar("squareMeanHorizontal"),l=s.lessThanEqual(j(1)).select(j(0),j(2).div(s.sub(1))),u=s.lessThanEqual(j(1)).select(j(0),j(-1));ci({start:$(0),end:$(s),type:"int",condition:"<"},({i:p})=>{const g=u.add(j(p).mul(l));let y=n.sample(Ns(vx.xy,Fe(g,0).mul(e)).div(t));n.value.isArrayTexture&&(y=y.depth(i)),r.addAssign(y.x),a.addAssign(Ns(y.y.mul(y.y),y.x.mul(y.x)))}),r.divAssign(s),a.divAssign(s);const h=rc(a.sub(r.mul(r)));return Fe(r,h)}),iee=[az,oz,lz,uz];let yR;const pT=new GE;class dz extends qJ{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:i,shadow:r,depthLayer:a}){const l=i.x.greaterThanEqual(0).and(i.x.lessThanEqual(1)).and(i.y.greaterThanEqual(0)).and(i.y.lessThanEqual(1)).and(i.z.lessThanEqual(1)),u=t({depthTexture:n,shadowCoord:i,shadow:r,depthLayer:a});return l.select(u,j(1))}setupShadowCoord(e,t){const{shadow:n}=this,{renderer:i}=e,r=Ei("bias","float",n).setGroup(Pt);let a=t,l;if(n.camera.isOrthographicCamera||i.logarithmicDepthBuffer!==!0)a=a.xyz.div(a.w),l=a.z,i.coordinateSystem===rl&&(l=l.mul(2).sub(1));else{const u=a.w;a=a.xy.div(u);const h=Ei("near","float",n.camera).setGroup(Pt),p=Ei("far","float",n.camera).setGroup(Pt);l=Lw(u.negate(),h,p)}return a=ae(a.x,a.y.oneMinus(),l.add(r)),a}getShadowFilterFn(e){return iee[e]}setupRenderTarget(e,t){const n=new Ta(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=ex;const i=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return i.texture.name="ShadowMap",i.texture.type=e.mapType,i.depthTexture=n,{shadowMap:i,depthTexture:n}}setupShadow(e){const{renderer:t}=e,{light:n,shadow:i}=this,r=t.shadowMap.type,{depthTexture:a,shadowMap:l}=this.setupRenderTarget(i,e);if(i.camera.updateProjectionMatrix(),r===ya&&i.isPointLightShadow!==!0){a.compareFunction=null,l.depth>1?(l._vsmShadowMapVertical||(l._vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:Wu,type:As,depth:l.depth,depthBuffer:!1}),l._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=l._vsmShadowMapVertical,l._vsmShadowMapHorizontal||(l._vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:Wu,type:As,depth:l.depth,depthBuffer:!1}),l._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=l._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:Wu,type:As,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:Wu,type:As,depthBuffer:!1}));let b=Dn(a);a.isArrayTexture&&(b=b.depth(this.depthLayer));let C=Dn(this.vsmShadowMapVertical.texture);a.isArrayTexture&&(C=C.depth(this.depthLayer));
vendor: 4,820 bytes, line 3978
3978const w=Ei("blurSamples","float",i).setGroup(Pt),D=Ei("radius","float",i).setGroup(Pt),P=Ei("mapSize","vec2",i).setGroup(Pt);let I=this.vsmMaterialVertical||(this.vsmMaterialVertical=new ys);I.fragmentNode=tee({samples:w,radius:D,size:P,shadowPass:b,depthLayer:this.depthLayer}).context(e.getSharedContext()),I.name="VSMVertical",I=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new ys),I.fragmentNode=nee({samples:w,radius:D,size:P,shadowPass:C,depthLayer:this.depthLayer}).context(e.getSharedContext()),I.name="VSMHorizontal"}const u=Ei("intensity","float",i).setGroup(Pt),h=Ei("normalBias","float",i).setGroup(Pt),p=qE(n).mul(Jw.add(Hd.mul(h))),g=this.setupShadowCoord(e,p),y=i.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(y===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const _=r===ya&&i.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:a,S=this.setupShadowFilter(e,{filterFn:y,shadowTexture:l.texture,depthTexture:_,shadowCoord:g,shadow:i,depthLayer:this.depthLayer});let A=Dn(l.texture,g);a.isArrayTexture&&(A=A.depth(this.depthLayer));const E=Yn(1,S.rgb.mix(A,1),u.mul(A.a)).toVar();return this.shadowMap=l,this.shadow.map=l,E}setup(e){if(e.renderer.shadowMap.enabled!==!1)return le(()=>{let t=this._node;return this.setupShadowPosition(e),t===null&&(this._node=t=this.setupShadow(e)),e.material.shadowNode&&console.warn('THREE.NodeMaterial: ".shadowNode" is deprecated. Use ".castShadowNode" instead.'),e.material.receivedShadowNode&&(t=e.material.receivedShadowNode(t)),t})()}renderShadow(e){const{shadow:t,shadowMap:n,light:i}=this,{renderer:r,scene:a}=e;t.updateMatrices(i),n.setSize(t.mapSize.width,t.mapSize.height,n.depth),r.render(a,t.camera)}updateShadow(e){const{shadowMap:t,light:n,shadow:i}=this,{renderer:r,scene:a,camera:l}=e,u=r.shadowMap.type,h=t.depthTexture.version;this._depthVersionCached=h;const p=i.camera.layers.mask;(i.camera.layers.mask&4294967294)===0&&(i.camera.layers.mask=l.layers.mask);const g=r.getRenderObjectFunction(),y=r.getMRT(),_=y?y.has("velocity"):!1;yR=QJ(r,a,yR),a.overrideMaterial=cz(n),r.setRenderObjectFunction(hz(r,i,u,_)),r.setClearColor(0,0),r.setRenderTarget(t),this.renderShadow(e),r.setRenderObjectFunction(g),u===ya&&i.isPointLightShadow!==!0&&this.vsmPass(r),i.camera.layers.mask=p,$J(r,a,yR)}vsmPass(e){const{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),pT.material=this.vsmMaterialVertical,pT.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),pT.material=this.vsmMaterialHorizontal,pT.render(e)}dispose(){this.shadowMap.dispose(),this.shadowMap=null,this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null),super.dispose()}updateBefore(e){const{shadow:t}=this;let n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const fz=(s,e)=>Pe(new dz(s,e)),see=new lt,Hl=le(([s,e])=>{const t=s.toVar(),n=Li(t),i=Ao(1,rs(n.x,rs(n.y,n.z)));n.mulAssign(i),t.mulAssign(i.mul(e.mul(2).oneMinus()));const r=Fe(t.xy).toVar(),l=e.mul(1.5).oneMinus();return Zt(n.z.greaterThanEqual(l),()=>{Zt(t.z.greaterThan(0),()=>{r.x.assign(Ln(4,t.x))})}).ElseIf(n.x.greaterThanEqual(l),()=>{const u=W0(t.x);r.x.assign(t.z.mul(u).add(u.mul(2)))}).ElseIf(n.y.greaterThanEqual(l),()=>{const u=W0(t.y);r.x.assign(t.x.add(u.mul(2)).add(2)),r.y.assign(t.z.mul(u).sub(2))}),Fe(.125,.25).mul(r).add(Fe(.375,.75)).flipY()}).setLayout({name:"cubeToUV",type:"vec2",inputs:[{name:"pos",type:"vec3"},{name:"texelSizeY",type:"float"}]}),pz=le(({depthTexture:s,bd3D:e,dp:t,texelSize:n})=>Dn(s,Hl(e,n.y)).compare(t)),mz=le(({depthTexture:s,bd3D:e,dp:t,texelSize:n,shadow:i})=>{const r=Ei("radius","float",i).setGroup(Pt),a=Fe(-1,1).mul(r).mul(n.y);return Dn(s,Hl(e.add(a.xyy),n.y)).compare(t).add(Dn(s,Hl(e.add(a.yyy),n.y)).compare(t)).add(Dn(s,Hl(e.add(a.xyx),n.y)).compare(t)).add(Dn(s,Hl(e.add(a.yyx),n.y)).compare(t)).add(Dn(s,Hl(e,n.y)).compare(t)).add(Dn(s,Hl(e.add(a.xxy),n.y)).compare(t)).add(Dn(s,Hl(e.add(a.yxy),n.y)).compare(t)).add(Dn(s,Hl(e.add(a.xxx),n.y)).compare(t)).add(Dn(s,Hl(e.add(a.yxx),n.y)).compare(t)).mul(1/9)}),ree=le(({filterFn:s,depthTexture:e,shadowCoord:t,shadow:n})=>{const i=t.xyz.toVar(),r=i.length(),a=Vt("float").setGroup(Pt).onRenderUpd
vendor: 8,613 bytes, line 3978
3978ate(()=>n.camera.near),l=Vt("float").setGroup(Pt).onRenderUpdate(()=>n.camera.far),u=Ei("bias","float",n).setGroup(Pt),h=Vt(n.mapSize).setGroup(Pt),p=j(1).toVar();return Zt(r.sub(l).lessThanEqual(0).and(r.sub(a).greaterThanEqual(0)),()=>{const g=r.sub(a).div(l.sub(a)).toVar();g.addAssign(u);const y=i.normalize(),_=Fe(1).div(h.mul(Fe(4,2)));p.assign(s({depthTexture:e,bd3D:y,dp:g,texelSize:_,shadow:n}))}),p}),dB=new kt,Qg=new Ge,Z_=new Ge;class aee extends dz{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===IN?pz:mz}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,shadowTexture:n,depthTexture:i,shadowCoord:r,shadow:a}){return ree({filterFn:t,shadowTexture:n,depthTexture:i,shadowCoord:r,shadow:a})}renderShadow(e){const{shadow:t,shadowMap:n,light:i}=this,{renderer:r,scene:a}=e,l=t.getFrameExtents();Z_.copy(t.mapSize),Z_.multiply(l),n.setSize(Z_.width,Z_.height),Qg.copy(t.mapSize);const u=r.autoClear,h=r.getClearColor(see),p=r.getClearAlpha();r.autoClear=!1,r.setClearColor(t.clearColor,t.clearAlpha),r.clear();const g=t.getViewportCount();for(let y=0;y<g;y++){const _=t.getViewport(y),S=Qg.x*_.x,A=Z_.y-Qg.y-Qg.y*_.y;dB.set(S,A,Qg.x*_.z,Qg.y*_.w),n.viewport.copy(dB),t.updateMatrices(i,y),r.render(a,t.camera)}r.autoClear=u,r.setClearColor(h,p)}}const gz=(s,e)=>Pe(new aee(s,e));class xm extends ov{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new lt,this.colorNode=e&&e.colorNode||Vt(this.color).setGroup(Pt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=mn.FRAME}getHash(){return this.light.uuid}getLightVector(e){return Zw(this.light).sub(e.context.positionView||gs)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return fz(this.light)}setupShadow(e){const{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){const i=this.light.shadow.shadowNode;let r;i!==void 0?r=Pe(i):r=this.setupShadowNode(),this.shadowNode=r,this.shadowColorNode=n=this.colorNode.mul(r),this.baseColorNode=this.colorNode}this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);const t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const e2=le(({lightDistance:s,cutoffDistance:e,decayExponent:t})=>{const n=s.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(s.div(e).pow4().oneMinus().clamp().pow2()),n)}),yz=({color:s,lightVector:e,cutoffDistance:t,decayExponent:n})=>{const i=e.normalize(),r=e.length(),a=e2({lightDistance:r,cutoffDistance:t,decayExponent:n}),l=s.mul(a);return{lightDirection:i,lightColor:l}};class oee extends xm{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Vt(0).setGroup(Pt),this.decayExponentNode=Vt(2).setGroup(Pt)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return gz(this.light)}setupDirect(e){return yz({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const lee=le(([s=vi()])=>{const e=s.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),uee=le(([s=vi()],{renderer:e,material:t})=>{const n=ow(s.mul(2).sub(1));let i;if(t.alphaToCoverage&&e.samples>1){const r=j(n.fwidth()).toVar();i=tc(r.oneMinus(),r.add(1),n).oneMinus()}else i=ur(n.greaterThan(1),0,1);return i}),M0=le(([s,e,t])=>{const n=j(t).toVar(),i=j(e).toVar(),r=al(s).toVar();return ur(r,i,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),gM=le(([s,e])=>{const t=al(e).toVar(),n=j(s).toVar();return ur(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Rs=le(([s])=>{const e=j(s).toVar();return $(ju(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Wi=le(([s,e])=>{const t=j(s).toVar();return e.assign(Rs(t)),t.sub(j(e))}),cee=le(([s,e,t,n,i,r])=>{const a=j(r).toVar(),l=j(i).toVar(),u=j(n).toVar(),h=j(t).toVar(),p=j(e).toVar(),g=j(s).toVar(),y=j(Ln(1,l)).toVar();return Ln(1,a).mul(g.mul(y).add(p.mul(l))).add(a.mul(h.mul(y).add(u.mul(l))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),hee=le(([s,e,t,n,i,r])=>{const a=j(r).toVar(),l=j(i).toVar(),u=ae(n).toVar(),h=ae(t).toVar(),p=ae(e).toVar(),g=ae(s).toVar(),y=j(Ln(1,l)).toVar();return Ln(1,a).mul(g.mul(y).add(p.mul(l))).add(a.mul(h.mul(y).add(u.mul(l))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),vz=Nr([cee,hee]),dee=le(([s,e,t,n,i,r,a,l,u,h,p])=>{const g=j(p).toVar(),y=j(h).toVar(),_=j(u).toVar(),S=j(l).toVar(),A=j(a).toVar(),E=j(r).toVar(),b=j(i).toVar(),C=j(n).toVar(),w=j(t).toVar(),D=j(e).toVar(),P=j(s).toVar(),I=j(Ln(1,_)).toVar(),F=j(Ln(1,y)).toVar();return j(Ln(1,g)).toVar().mul(F.mul(P.mul(I).add(D.mul(_))).add(y.mul(w.mul(I).add(C.mul(_))))).add(g.mul(F.mul(b.mul(I).add(E.mul(_))).add(y.mul(A.mul(I).add(S.mul(_))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),fee=le(([s,e,t,n,i,r,a,l,u,h,p])=>{const g=j(p).toVar(),y=j(h).toVar(),_=j(u).toVar(),S=ae(l).toVar(),A=ae(a).toVar(),E=ae(r).toVar(),b=ae(i).toVar(),C=ae(n).toVar(),w=ae(t).toVar(),D=ae(e).toVar(),P=ae(s).toVar(),I=j(Ln(1,_)).toVar(),F=j(Ln(1,y)).toVar();return j(Ln(1,g)).toVar().mul(F.mul(P.mul(I).add(D.mul(_))).add(y.mul(w.mul(I).add(C.mul(_))))).add(g.mul(F.mul(b.mul(I).add(E.mul(_))).add(y.mul(A.mul(I).add(S.mul(_))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),_z=Nr([dee,fee]),pee=le(([s,e,t])=>{const n=j(t).toVar(),i=j(e).toVar(),r=xt(s).toVar(),a=xt(r.bitAnd(xt(7))).toVar(),l=j(M0(a.lessThan(xt(4)),i,n)).toVar(),u=j(ln(2,M0(a.lessThan(xt(4)),n,i))).toVar();return gM(l,al(a.bitAnd(xt(1)))).add(gM(u,al(a.bitAnd(xt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),mee=le(([s,e,t,n])=>{const i=j(n).toVar(),r=j(t).toVar(),a=j(e).toVar(),l=xt(s).toVar(),u=xt(l.bitAnd(xt(15))).toVar(),h=j(M0(u.lessThan(xt(8)),a,r)).toVar(),p=j(M0(u.lessThan(xt(4)),r,M0(u.equal(xt(12)).or(u.equal(xt(14))),a,i))).toVar();return gM(h,al(u.bitAnd(xt(1)))).add(gM(p,al(u.bitAnd(xt(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),or=Nr([pee,mee]),gee=le(([s,e,t])=>{const n=j(t).toVar(),i=j(e).toVar(),r=sv(s).toVar();return ae(or(r.x,i,n),or(r.y,i,n),or(r.z,i,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),yee=le(([s,e,t,n])=>{const i=j(n).toVar(),r=j(t).toVar(),a=j(e).toVar(),l=sv(s).toVar();return ae(or(l.x,a,r,i),or(l.y,a,r,i),or(l.z,a,r,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),Ko=Nr([gee,yee]),vee=le(([s])=>{const e=j(s).toVar();return ln(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),_ee=le(([s])=>{const e=j(s).toVar();return ln(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),xee=le(([s])=>{const e=ae(s).toVar();return ln(.6616,e)}
vendor: 10,797 bytes, line 3978
3978).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),xz=Nr([vee,xee]),See=le(([s])=>{const e=ae(s).toVar();return ln(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Sz=Nr([_ee,See]),bo=le(([s,e])=>{const t=$(e).toVar(),n=xt(s).toVar();return n.shiftLeft(t).bitOr(n.shiftRight($(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),bz=le(([s,e,t])=>{s.subAssign(t),s.bitXorAssign(bo(t,$(4))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(bo(s,$(6))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(bo(e,$(8))),e.addAssign(s),s.subAssign(t),s.bitXorAssign(bo(t,$(16))),t.addAssign(e),e.subAssign(s),e.bitXorAssign(bo(s,$(19))),s.addAssign(t),t.subAssign(e),t.bitXorAssign(bo(e,$(4))),e.addAssign(s)}),Mx=le(([s,e,t])=>{const n=xt(t).toVar(),i=xt(e).toVar(),r=xt(s).toVar();return n.bitXorAssign(i),n.subAssign(bo(i,$(14))),r.bitXorAssign(n),r.subAssign(bo(n,$(11))),i.bitXorAssign(r),i.subAssign(bo(r,$(25))),n.bitXorAssign(i),n.subAssign(bo(i,$(16))),r.bitXorAssign(n),r.subAssign(bo(n,$(4))),i.bitXorAssign(r),i.subAssign(bo(r,$(14))),n.bitXorAssign(i),n.subAssign(bo(i,$(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Xr=le(([s])=>{const e=xt(s).toVar();return j(e).div(j(xt($(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),Qu=le(([s])=>{const e=j(s).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),bee=le(([s])=>{const e=$(s).toVar(),t=xt(xt(1)).toVar(),n=xt(xt($(3735928559)).add(t.shiftLeft(xt(2))).add(xt(13))).toVar();return Mx(n.add(xt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),Tee=le(([s,e])=>{const t=$(e).toVar(),n=$(s).toVar(),i=xt(xt(2)).toVar(),r=xt().toVar(),a=xt().toVar(),l=xt().toVar();return r.assign(a.assign(l.assign(xt($(3735928559)).add(i.shiftLeft(xt(2))).add(xt(13))))),r.addAssign(xt(n)),a.addAssign(xt(t)),Mx(r,a,l)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Mee=le(([s,e,t])=>{const n=$(t).toVar(),i=$(e).toVar(),r=$(s).toVar(),a=xt(xt(3)).toVar(),l=xt().toVar(),u=xt().toVar(),h=xt().toVar();return l.assign(u.assign(h.assign(xt($(3735928559)).add(a.shiftLeft(xt(2))).add(xt(13))))),l.addAssign(xt(r)),u.addAssign(xt(i)),h.addAssign(xt(n)),Mx(l,u,h)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Eee=le(([s,e,t,n])=>{const i=$(n).toVar(),r=$(t).toVar(),a=$(e).toVar(),l=$(s).toVar(),u=xt(xt(4)).toVar(),h=xt().toVar(),p=xt().toVar(),g=xt().toVar();return h.assign(p.assign(g.assign(xt($(3735928559)).add(u.shiftLeft(xt(2))).add(xt(13))))),h.addAssign(xt(l)),p.addAssign(xt(a)),g.addAssign(xt(r)),bz(h,p,g),h.addAssign(xt(i)),Mx(h,p,g)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),Aee=le(([s,e,t,n,i])=>{const r=$(i).toVar(),a=$(n).toVar(),l=$(t).toVar(),u=$(e).toVar(),h=$(s).toVar(),p=xt(xt(5)).toVar(),g=xt().toVar(),y=xt().toVar(),_=xt().toVar();return g.assign(y.assign(_.assign(xt($(3735928559)).add(p.shiftLeft(xt(2))).add(xt(13))))),g.addAssign(xt(h)),y.addAssign(xt(u)),_.addAssign(xt(l)),bz(g,y,_),g.addAssign(xt(a)),y.addAssign(xt(r)),Mx(g,y,_)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),li=Nr([bee,Tee,Mee,Eee,Aee]),Ree=le(([s,e])=>{const t=$(e).toVar(),n=$(s).toVar(),i=xt(li(n,t)).toVar(),r=sv().toVar();return r.x.assign(i.bitAnd($(255))),r.y.assign(i.shiftRight($(8)).bitAnd($(255))),r.z.assign(i.shiftRight($(16)).bitAnd($(255))),r}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Nee=le(([s,e,t])=>{const n=$(t).toVar(),i=$(e).toVar(),r=$(s).toVar(),a=xt(li(r,i,n)).toVar(),l=sv().toVar();return l.x.assign(a.bitAnd($(255))),l.y.assign(a.shiftRight($(8)).bitAnd($(255))),l.z.assign(a.shiftRight($(16)).bitAnd($(255))),l}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Zo=Nr([Ree,Nee]),Cee=le(([s])=>{const e=Fe(s).toVar(),t=$().toVar(),n=$().toVar(),i=j(Wi(e.x,t)).toVar(),r=j(Wi(e.y,n)).toVar(),a=j(Qu(i)).toVar(),l=j(Qu(r)).toVar(),u=j(vz(or(li(t,n),i,r),or(li(t.add($(1)),n),i.sub(1),r),or(li(t,n.add($(1))),i,r.sub(1)),or(li(t.add($(1)),n.add($(1))),i.sub(1),r.sub(1)),a,l)).toVar();return xz(u)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),wee=le(([s])=>{const e=ae(s).toVar(),t=$().toVar(),n=$().toVar(),i=$().toVar(),r=j(Wi(e.x,t)).toVar(),a=j(Wi(e.y,n)).toVar(),l=j(Wi(e.z,i)).toVar(),u=j(Qu(r)).toVar(),h=j(Qu(a)).toVar(),p=j(Qu(l)).toVar(),g=j(_z(or(li(t,n,i),r,a,l),or(li(t.add($(1)),n,i),r.sub(1),a,l),or(li(t,n.add($(1)),i),r,a.sub(1),l),or(li(t.add($(1)),n.add($(1)),i),r.sub(1),a.sub(1),l),or(li(t,n,i.add($(1))),r,a,l.sub(1)),or(li(t.add($(1)),n,i.add($(1))),r.sub(1),a,l.sub(1)),or(li(t,n.add($(1)),i.add($(1))),r,a.sub(1),l.sub(1)),or(li(t.add($(1)),n.add($(1)),i.add($(1))),r.sub(1),a.sub(1),l.sub(1)),u,h,p)).toVar();return Sz(g)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),t2=Nr([Cee,wee]),Dee=le(([s])=>{const e=Fe(s).toVar(),t=$().toVar(),n=$().toVar(),i=j(Wi(e.x,t)).toVar(),r=j(Wi(e.y,n)).toVar(),a=j(Qu(i)).toVar(),l=j(Qu(r)).toVar(),u=ae(vz(Ko(Zo(t,n),i,r),Ko(Zo(t.add($(1)),n),i.sub(1),r),Ko(Zo(t,n.add($(1))),i,r.sub(1)),Ko(Zo(t.add($(1)),n.add($(1))),i.sub(1),r.sub(1)),a,l)).toVar();return xz(u)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Uee=le(([s])=>{const e=ae(s).toVar(),t=$().toVar(),n=$().toVar(),i=$().toVar(),r=j(Wi(e.x,t)).toVar(),a=j(Wi(e.y,n)).toVar(),l=j(Wi(e.z,i)).toVar(),u=j(Qu(r)).toVar(),h=j(Qu(a)).toVar(),p=j(Qu(l)).toVar(),g=ae(_z(Ko(Zo(t,n,i),r,a,l),Ko(Zo(t.add($(1)),n,i),r.sub(1),a,l),Ko(Zo(t,n.add($(1)),i),r,a.sub(1),l),Ko(Zo(t.add($(1)),n.add($(1)),i),r.sub(1),a.sub(1),l),Ko(Zo(t,n,i.add($(1))),r,a,l.sub(1)),Ko(Zo(t.add($(1)),n,i.add($(1))),r.sub(1),a,l.sub(1)),Ko(Zo(t,n.add($(1)),i.add($(1))),r,a.sub(1),l.sub(1)),Ko(Zo(t.add($(1)),n.add($(1)),i.add($(1))),r.sub(1),a.sub(1),l.sub(1)),u,h,p)).toVar();return Sz(g)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Ex=Nr([Dee,Uee]),Lee=le(([s])=>{const e=j(s).toVar(),t=$(Rs(e)).toVar();return Xr(li(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Bee=le(([s])=>{const e=Fe(s).toVar(),t=$(Rs(e.x)).toVar(),n=$(Rs(e.y)).toVar();return Xr(li(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Pee=le(([s])=>{const e=ae(s).toVar(),t=$(Rs(e.x)).toVar(),n=$(Rs(e.y)).toVar(),i=$(Rs(e.z)).toVar();return Xr(li(t,n,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Oee=le(([s])=>{const e=Gt(s).toVar(),t=$(Rs(e.x)).toVar(),n=$(Rs(e.y)).toVar(),i=$(Rs(e.z)).toVar(),r=$(Rs(e.w)).toVar();return Xr(li(t,n,i,r))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),Iee=Nr([Lee,Bee,Pee,Oee]),Fee=le(([s])=>{const e=j(s).toVar(),t=$(Rs(e)).toVar();return ae(Xr(li(t,$(0))),Xr(li(t,$(1))),Xr(li(t,$(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),Vee=le(([s])=>{const e=Fe(s).toVar(),t=$(Rs(e.x)).toVar(),n=$(Rs(e.y)).toVar();return ae(Xr(li(t,n,$(0))),Xr(li(t,n,$(1))),Xr(li(t,n,$(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),zee=le(([s])=>{const e=ae(s).toVar(),t=$(Rs(e.x)).toVar(),n=$(Rs(e.y)).toVar(),i=$(Rs(e.z)).toVar();return ae(Xr(li(t,n,i,$(0))),Xr(li(t,n,i,$(1))),Xr(li(t,n,i,$(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Gee=le(([s])=>{const e=Gt(s).toVar(),t=$(Rs(e.x)).toVar(),n=$(Rs(e.y)).toVar(),i=$(Rs(e.z)).toVar(),r=$(Rs(e.w)).toVar();return ae(Xr(li(t,n,i,r,$(0))),Xr(li(t,n,i,r,$(1))),Xr(li(t,n,i,r,$(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),WE=Nr([Fee,Vee,zee,Gee]),yM=le(([s,e,t,n])=>{const i=j(n).toVar(),r=j(t).toVar(),a=$(e).toVar(),l=ae(s).toVar(),u=j(0).toVar(),h=j(1).toVar();return ci(a,()=>{u.addAssign(h.mul(t2(l))),h.mulAssign(i),l.mulAssign(r)}),u}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),XE=le(([s,e,t,n])=>{const i=j(n).toVar(),r=j(t).toVar(),a=$(e).toVar(),l=ae(s).toVar(),u=ae(0).toVar(),h=j(1).toVar();return ci(a,()=>{u.addAssign(h.mul(Ex(l))),h.mulAssign(i),l.mulAssign(r)}),u}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Hee=le(([s,e,t,n])=>{const i=j(n).toVar(),r=j(t).toVar(),a=$(e).toVar(),l=ae(s).toVar();return Fe(yM(l,a,r,i),yM(l.add(ae($(19),$(193),$(17))),a,r,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),kee=le(([s,e,t,n])=>{const i=j(n).toVar(),r=j(t).toVar(),a=$(e).toVar(),l=ae(s).toVar(),u=ae(XE(l,a,r,i)).toVar(),h=j(yM(l.add(ae($(19),$(193),$(17))),a,r,i)).toVar();return Gt(u,h)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),qee=le(([s,e,t,n,i,r,a])=>{const l=$(a).toVar(),u=j(r).toVar(),h=$(i).toVar(),p=$(n).toVar(),g=$(t).toVar(),y=$(e).toVar(),_=Fe(s).toVar(),S=ae(WE(Fe(y.add(p),g.add(h)))).toVar(),A=Fe(S.x,S.y).toVar();A.subAssign(.5),A.mulAssign(u),A.addAssign(.5);const E=Fe(Fe(j(y),j(g)).add(A)).toVar(),b=Fe(E.sub(_)).toVar();return Zt(l.equal($(2)),()=>Li(b.x).add(Li(b.y))),Zt(l.equal($(3)),()=>rs(Li(b.x),Li(b.y))),zd(b,b)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Wee=le(([s,e,t,n,i,r,a,l,u])=>{const h=$(u).toVar(),p=j(l).toVar(),g=$(a).toVar(),y=$(r).toVar(),_=$(i).toVar(),S=$(n).toVar(),A=$(t).toVar(),E=$(e).toVar(),b=ae(s).toVar(),C=ae(WE(ae(E.add(_),A.add(y),S.add(g)))).toVar();
vendor: 4,299 bytes, line 3978
3978C.subAssign(.5),C.mulAssign(p),C.addAssign(.5);const w=ae(ae(j(E),j(A),j(S)).add(C)).toVar(),D=ae(w.sub(b)).toVar();return Zt(h.equal($(2)),()=>Li(D.x).add(Li(D.y)).add(Li(D.z))),Zt(h.equal($(3)),()=>rs(Li(D.x),Li(D.y),Li(D.z))),zd(D,D)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),uv=Nr([qee,Wee]),Xee=le(([s,e,t])=>{const n=$(t).toVar(),i=j(e).toVar(),r=Fe(s).toVar(),a=$().toVar(),l=$().toVar(),u=Fe(Wi(r.x,a),Wi(r.y,l)).toVar(),h=j(1e6).toVar();return ci({start:-1,end:$(1),name:"x",condition:"<="},({x:p})=>{ci({start:-1,end:$(1),name:"y",condition:"<="},({y:g})=>{const y=j(uv(u,p,g,a,l,i,n)).toVar();h.assign(no(h,y))})}),Zt(n.equal($(0)),()=>{h.assign(rc(h))}),h}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Yee=le(([s,e,t])=>{const n=$(t).toVar(),i=j(e).toVar(),r=Fe(s).toVar(),a=$().toVar(),l=$().toVar(),u=Fe(Wi(r.x,a),Wi(r.y,l)).toVar(),h=Fe(1e6,1e6).toVar();return ci({start:-1,end:$(1),name:"x",condition:"<="},({x:p})=>{ci({start:-1,end:$(1),name:"y",condition:"<="},({y:g})=>{const y=j(uv(u,p,g,a,l,i,n)).toVar();Zt(y.lessThan(h.x),()=>{h.y.assign(h.x),h.x.assign(y)}).ElseIf(y.lessThan(h.y),()=>{h.y.assign(y)})})}),Zt(n.equal($(0)),()=>{h.assign(rc(h))}),h}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),jee=le(([s,e,t])=>{const n=$(t).toVar(),i=j(e).toVar(),r=Fe(s).toVar(),a=$().toVar(),l=$().toVar(),u=Fe(Wi(r.x,a),Wi(r.y,l)).toVar(),h=ae(1e6,1e6,1e6).toVar();return ci({start:-1,end:$(1),name:"x",condition:"<="},({x:p})=>{ci({start:-1,end:$(1),name:"y",condition:"<="},({y:g})=>{const y=j(uv(u,p,g,a,l,i,n)).toVar();Zt(y.lessThan(h.x),()=>{h.z.assign(h.y),h.y.assign(h.x),h.x.assign(y)}).ElseIf(y.lessThan(h.y),()=>{h.z.assign(h.y),h.y.assign(y)}).ElseIf(y.lessThan(h.z),()=>{h.z.assign(y)})})}),Zt(n.equal($(0)),()=>{h.assign(rc(h))}),h}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Kee=le(([s,e,t])=>{const n=$(t).toVar(),i=j(e).toVar(),r=ae(s).toVar(),a=$().toVar(),l=$().toVar(),u=$().toVar(),h=ae(Wi(r.x,a),Wi(r.y,l),Wi(r.z,u)).toVar(),p=j(1e6).toVar();return ci({start:-1,end:$(1),name:"x",condition:"<="},({x:g})=>{ci({start:-1,end:$(1),name:"y",condition:"<="},({y})=>{ci({start:-1,end:$(1),name:"z",condition:"<="},({z:_})=>{const S=j(uv(h,g,y,_,a,l,u,i,n)).toVar();p.assign(no(p,S))})})}),Zt(n.equal($(0)),()=>{p.assign(rc(p))}),p}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Zee=Nr([Xee,Kee]),Qee=le(([s,e,t])=>{const n=$(t).toVar(),i=j(e).toVar(),r=ae(s).toVar(),a=$().toVar(),l=$().toVar(),u=$().toVar(),h=ae(Wi(r.x,a),Wi(r.y,l),Wi(r.z,u)).toVar(),p=Fe(1e6,1e6).toVar();return ci({start:-1,end:$(1),name:"x",condition:"<="},({x:g})=>{ci({start:-1,end:$(1),name:"y",condition:"<="},({y})=>{ci({start:-1,end:$(1),name:"z",condition:"<="},({z:_})=>{const S=j(uv(h,g,y,_,a,l,u,i,n)).toVar();Zt(S.lessThan(p.x),()=>{p.y.assign(p.x),p.x.assign(S)}).ElseIf(S.lessThan(p.y),()=>{p.y.assign(S)})})})}),Zt(n.equal($(0)),()=>{p.assign(rc(p))}),p}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),$ee=Nr([Yee,Qee]),Jee=le(([s,e,t])=>{const n=$(t).toVar(),i=j(e).toVar(),r=ae(s).toVar(),a=$().toVar(),l=$().toVar(),u=$().toVar(),h=ae(Wi(r.x,a),Wi(r.y,l),Wi(r.z,u)).toVar(),p=ae(1e6,1e6,1e6).toVar();return ci({start:-1,end:$(1),name:"x",condition:"<="},({x:g})=>{ci({start:-1,end:$(1),name:"y",condition:"<="},({y})=>{ci({start:-1,end:$(1),name:"z",condition:"<="},({z:_})=>{const S=j(uv(h,g,y,_,a,l,u,i,n)).toVar();Zt(S.lessThan(p.x),()=>{p.z.assign(p.y),p.y.assign(p.x),p.x.assign(S)}).ElseIf(S.lessThan(p.y),()=>{p.z.assign(p.y),p.y.assign(S)}).ElseIf(S.lessThan(p.z),()=>{p.z.assign(S)})})})}),Zt(n.equal($(0)),()=>{p.assign(rc(p))}),p}
vendor: 5,366 bytes, line 3978
3978).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),n2=Nr([jee,Jee]),ete=le(([s,e,t,n,i,r,a,l,u,h,p])=>{const g=$(s).toVar(),y=Fe(e).toVar(),_=Fe(t).toVar(),S=Fe(n).toVar(),A=j(i).toVar(),E=j(r).toVar(),b=j(a).toVar(),C=al(l).toVar(),w=$(u).toVar(),D=j(h).toVar(),P=j(p).toVar(),I=y.mul(_).add(S),F=j(0).toVar();return Zt(g.equal($(0)),()=>{F.assign(Ex(I))}),Zt(g.equal($(1)),()=>{F.assign(WE(I))}),Zt(g.equal($(2)),()=>{F.assign(n2(I,A,$(0)))}),Zt(g.equal($(3)),()=>{F.assign(XE(ae(I,0),w,D,P))}),F.assign(F.mul(b.sub(E)).add(E)),Zt(C,()=>{F.assign(ol(F,E,b))}),F}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),tte=le(([s,e,t,n,i,r,a,l,u,h,p])=>{const g=$(s).toVar(),y=ae(e).toVar(),_=ae(t).toVar(),S=ae(n).toVar(),A=j(i).toVar(),E=j(r).toVar(),b=j(a).toVar(),C=al(l).toVar(),w=$(u).toVar(),D=j(h).toVar(),P=j(p).toVar(),I=y.mul(_).add(S),F=j(0).toVar();return Zt(g.equal($(0)),()=>{F.assign(Ex(I))}),Zt(g.equal($(1)),()=>{F.assign(WE(I))}),Zt(g.equal($(2)),()=>{F.assign(n2(I,A,$(0)))}),Zt(g.equal($(3)),()=>{F.assign(XE(I,w,D,P))}),F.assign(F.mul(b.sub(E)).add(E)),Zt(C,()=>{F.assign(ol(F,E,b))}),F}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),nte=le(([s])=>{const e=s.y,t=s.z,n=ae().toVar();return Zt(e.lessThan(1e-4),()=>{n.assign(ae(t,t,t))}).Else(()=>{let i=s.x;i=i.sub(ju(i)).mul(6).toVar();const r=$(rw(i)),a=i.sub(j(r)),l=t.mul(e.oneMinus()),u=t.mul(e.mul(a).oneMinus()),h=t.mul(e.mul(a.oneMinus()).oneMinus());Zt(r.equal($(0)),()=>{n.assign(ae(t,h,l))}).ElseIf(r.equal($(1)),()=>{n.assign(ae(u,t,l))}).ElseIf(r.equal($(2)),()=>{n.assign(ae(l,t,h))}).ElseIf(r.equal($(3)),()=>{n.assign(ae(l,u,t))}).ElseIf(r.equal($(4)),()=>{n.assign(ae(h,l,t))}).Else(()=>{n.assign(ae(t,l,u))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),ite=le(([s])=>{const e=ae(s).toVar(),t=j(e.x).toVar(),n=j(e.y).toVar(),i=j(e.z).toVar(),r=j(no(t,no(n,i))).toVar(),a=j(rs(t,rs(n,i))).toVar(),l=j(a.sub(r)).toVar(),u=j().toVar(),h=j().toVar(),p=j().toVar();return p.assign(a),Zt(a.greaterThan(0),()=>{h.assign(l.div(a))}).Else(()=>{h.assign(0)}),Zt(h.lessThanEqual(0),()=>{u.assign(0)}).Else(()=>{Zt(t.greaterThanEqual(a),()=>{u.assign(n.sub(i).div(l))}).ElseIf(n.greaterThanEqual(a),()=>{u.assign(Ns(2,i.sub(t).div(l)))}).Else(()=>{u.assign(Ns(4,t.sub(n).div(l)))}),u.mulAssign(1/6),Zt(u.lessThan(0),()=>{u.addAssign(1)})}),ae(u,h,p)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),ste=le(([s])=>{const e=ae(s).toVar(),t=qC(JC(e,ae(.04045))).toVar(),n=ae(e.div(12.92)).toVar(),i=ae(Jo(rs(e.add(ae(.055)),ae(0)).div(1.055),ae(2.4))).toVar();return Yn(n,i,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Tz=(s,e)=>{s=j(s),e=j(e);const t=Fe(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return tc(s.sub(t),s.add(t),e)},Mz=(s,e,t,n)=>Yn(s,e,t[n].clamp()),rte=(s,e,t=vi())=>Mz(s,e,t,"x"),ate=(s,e,t=vi())=>Mz(s,e,t,"y"),ote=(s,e,t,n,i=vi())=>{const r=i.x.clamp(),a=i.y.clamp(),l=Yn(s,e,r),u=Yn(t,n,r);return Yn(l,u,a)},Ez=(s,e,t,n,i)=>Yn(s,e,Tz(t,n[i])),lte=(s,e,t,n=vi())=>Ez(s,e,t,n,"x"),ute=(s,e,t,n=vi())=>Ez(s,e,t,n,"y"),cte=(s=1,e=0,t=vi())=>t.mul(s).add(e),hte=(s,e=1)=>(s=j(s),s.abs().pow(e).mul(s.sign())),dte=(s,e=1,t=.5)=>j(s).sub(t).mul(e).add(t),fte=(s=vi(),e=1,t=0)=>t2(s.convert("vec2|vec3")).mul(e).add(t),pte=(s=vi(),e=1,t=0)=>Ex(s.convert("vec2|vec3")).mul(e).add(t),mte=(s=vi(),e=1,t=0)=>(s=s.convert("vec2|vec3"),Gt(Ex(s),t2(s.add(Fe(19,73)))).mul(e).add(t)),gte=(s,e=vi(),t=Fe(1,1),n=Fe(0,0),i=1,r=0,a=1,l=!1,u=1,h=2,p=.5)=>ete(s,e.convert("vec2|vec3"),t,n,i,r,a,l,u,h,p),yte=(s,e=vi(),t=Fe(1,1),n=Fe(0,0),i=1,r=0,a=1,l=!1,u=1,h=2,p=.5)=>tte(s,e.convert("vec2|vec3"),t,n,i,r,a,l,u,h,p),vte=(s=vi(),e=1)=>Zee(s.convert("vec2|vec3"),e,$(1)),_te=(s=vi(),e=1)=>$ee(s.convert("vec2|vec3"),e,$(1)),xte=(s=vi(),e=1)=>n2(s.convert("vec2|vec3"),e,$(1)),Ste=(s=vi())=>Iee(s.convert("vec2|vec3")),bte=(s=vi(),e=3,t=2,n=.5,i=1)=>yM(s,$(e),t,n).mul(i),Tte=(s=vi(),e=3,t=2,n=.5,i=1)=>Hee(s,$(e),t,n).mul(i),Mte=(s=vi(),e=3,t=2,n=.5,i=1)=>XE(s,$(e),t,n).mul(i),Ete=(s=vi(),e=3,t=2,n=.5,i=1)=>kee(s,$(e),t,n).mul(i),Ate=(s,e=j(0))=>Ns(s,e),Rte=(s,e=j(0))=>Ln(s,e),Nte=(s,e=j(1))=>ln(s,e),Cte=(s,e=j(1))=>Ao(s,e),wte=(s,e=j(1))=>px(s,e),Dte=(s,e=j(1))=>Jo(s,e),Ute=(s=j(0),e=j(1))=>CE(s,e),Lte=()=>lv,Bte=()=>FV,Pte=(s,e=j(1))=>Ln(e,s),Ote=(s,e,t,n)=>s.greaterThan(e).mix(t,n),Ite=(s,e,t,n)=>s.greaterThanEqual(e).mix(t,n),Fte=(s,e,t,n)=>s.equal(e).mix(t,n),Vte=(s,e=null)=>{if(typeof e=="string"){const t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();
3978if(t[n]!==void 0)return s.element(t[n])}if(typeof e=="number")return s.element(e);if(typeof e=="string"&&e.length===1){const t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return s.element(t[e])}return s},zte=(s,e=Fe(.5,.5),t=Fe(1,1),n=j(0),i=Fe(0,0))=>{let r=s;if(e&&(r=r.sub(e)),t&&(r=r.mul(t)),n){const a=n.mul(Math.PI/180),l=a.cos(),u=a.sin();r=Fe(r.x.mul(l).sub(r.y.mul(u)),r.x.mul(u).add(r.y.mul(l)))}return e&&(r=r.add(e)),i&&(r=r.add(i)),r},Gte=(s,e)=>{s=Fe(s),e=j(e);const t=e.mul(Math.PI/180);return Sx(s,t)},Hte=(s,e,t)=>{s=ae(s),e=j(e),t=ae(t);const n=e.mul(Math.PI/180),i=t.normalize(),r=n.cos(),a=n.sin(),l=j(1).sub(r);return s.mul(r).add(i.cross(s).mul(a)).add(i.mul(i.dot(s)).mul(l))},kte=(s,e)=>(s=ae(s),e=j(e),Aw(s,e)),qte=le(([s,e,t])=>{const n=ah(s).toVar(),i=Ln(j(.5).mul(e.sub(t)),Zu).div(n).toVar(),r=Ln(j(-.5).mul(e.sub(t)),Zu).div(n).toVar(),a=ae().toVar();a.x=n.x.greaterThan(j(0)).select(i.x,r.x),a.y=n.y.greaterThan(j(0)).select(i.y,r.y),a.z=n.z.greaterThan(j(0)).select(i.z,r.z);const l=no(a.x,a.y,a.z).toVar();return Zu.add(n.mul(l)).toVar().sub(t)}),Az=le(([s,e])=>{const t=s.x,n=s.y,i=s.z;let r=e.element(0).mul(.886227);return r=r.add(e.element(1).mul(2*.511664).mul(n)),r=r.add(e.element(2).mul(2*.511664).mul(i)),r=r.add(e.element(3).mul(2*.511664).mul(t)),r=r.add(e.element(4).mul(2*.429043).mul(t).mul(n)),r=r.add(e.element(5).mul(2*.429043).mul(n).mul(i)),r=r.add(e.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),r=r.add(e.element(7).mul(2*.429043).mul(t).mul(i)),r=r.add(e.element(8).mul(.429043).mul(ln(t,t).sub(ln(n,n)))),r});var U=Object.freeze({__proto__:null,BRDF_GGX:pN,BRDF_Lambert:om,BasicPointShadowFilter:pz,BasicShadowFilter:az,Break:$F,Const:SI,Continue:Zj,DFGApprox:Fw,D_GGX:vV,Discard:II,EPSILON:kO,F_Schlick:ky,Fn:le,INFINITY:MY,If:Zt,Loop:ci,NodeAccess:Ar,NodeShaderStage:a0,NodeType:Y7,NodeUpdateType:mn,OnMaterialUpdate:i$,OnObjectUpdate:n$,PCFShadowFilter:oz,PCFSoftShadowFilter:lz,PI:hM,PI2:EY,PointShadowFilter:mz,Return:GY,Schlick_to_F0:xV,ScriptableNodeResources:OT,ShaderNode:ly,Stack:bE,Switch:mY,TBNViewMatrix:vp,VSMShadowFilter:uz,V_GGX_SmithCorrelated:yV,Var:xI,VarIntent:bI,abs:Li,acesFilmicToneMapping:QV,acos:nw,add:Ns,addMethodChaining:Le,addNodeElement:qY,agxToneMapping:$V,all:qO,alphaT:lM,and:NO,anisotropy:pd,anisotropyB:Rp,anisotropyT:_0,any:WO,append:_Y,array:SO,arrayBuffer:yY,asin:KO,assign:bO,atan:CE,atan2:gI,atomicAdd:uJ,atomicAnd:fJ,atomicFunc:oc,atomicLoad:oJ,atomicMax:hJ,atomicMin:dJ,atomicOr:pJ,atomicStore:lJ,atomicSub:cJ,atomicXor:mJ,attenuationColor:KC,attenuationDistance:jC,attribute:lh,attributeArray:a$,backgroundBlurriness:HV,backgroundIntensity:xN,backgroundRotation:kV,batch:KF,bentNormalView:fF,billboarding:VQ,bitAnd:UO,bitNot:LO,bitOr:BO,bitXor:PO,bitangentGeometry:Cj,bitangentLocal:wj,bitangentView:hF,bitangentWorld:Dj,bitcast:_Q,blendBurn:sV,blendColor:fK,blendDodge:rV,blendOverlay:oV,blendScreen:aV,blur:AV,bool:al,buffer:yx,bufferAttribute:gx,builtin:hh,bumpMap:Aw,burn:mK,bvec2:hO,bvec3:qC,bvec4:mO,bypass:LI,cache:S0,call:TO,cameraFar:yd,cameraIndex:Gd,cameraNear:gd,cameraNormalMatrix:sj,cameraPosition:kI,cameraProjectionMatrix:rv,cameraProjectionMatrixInverse:nj,cameraViewMatrix:dl,cameraViewport:rj,cameraWorldMatrix:ij,cbrt:hI,cdl:b$,ceil:NE,checker:lee,cineonToneMapping:ZV,clamp:ol,clearcoat:oM,clearcoatNormalView:yp,clearcoatRoughness:k0,code:HE,color:uO,colorSpaceToWorking:UE,colorToDirection:EK,compute:UI,computeKernel:mw,computeSkinning:jj,context:mx,convert:yO,convertColorSpace:UY,convertToTexture:QQ,cos:zc,cross:DE,cubeTexture:Hy,cubeTextureBase:Ew,cubeToUV:Hl,dFdx:iw,dFdy:sw,dashSize:CT,debug:VI,decrement:GO,decrementBefore:VO,defaultBuildStages:eN,defaultShaderStages:iO,defined:V0,degrees:YO,deltaTime:UQ,densityFog:q$,densityFogFactor:Yw,depth:Bw,depthPass:R$,determinant:nI,difference:oI,diffuseColor:Zn,directPointLight:yz,directionToColor:uV,directionToFaceDirection:av,dispersion:ZC,distance:aI,div:Ao,dodge:gK,dot:zd,drawIndex:XF,dynamicBufferAttribute:DI,element:gO,emissive:sN,equal:$C,equals:sI,equirectUV:Pw,exp:ew,exp2:zy,expression:oh,faceDirection:bw,faceForward:cw,faceforward:AY,float:j,floatBitsToInt:xQ,floatBitsToUint:SQ,floor:ju,fog:X0,fract:ch,frameGroup:xO,frameId:FV,frontFacing:YI,fwidth:eI,gain:EQ,gapSize:rN,getConstNodeType:lO,getCurrentStack:SE,getDirection:MV,getDistanceAttenuation:e2,getGeometryRoughness:gV,getNormalFromDepth:JQ,getParallaxCorrectNormal:qte,getRoughness:Iw,getScreenPosition:$Q,getShIrradianceAt:Az,getShadowMaterial:cz,getShadowRenderObjectFunction:hz,getTextureIndex:OV,getViewPosition:sy,globalId:Z$,glsl:O$,glslFn:I$,grayscale:v$,greaterThan:JC,greaterThanEqual:RO,hash:MQ,highpModelNormalViewMatrix:lN,highpModelViewMatrix:oN,hue:S$,increment:zO,incrementBefore:FO,instance:Gj,instanceIndex:Nd,instancedArray:o$,instancedBufferAttribute:dM,instancedDynamicBufferAttribute:aN,instancedMesh:jF,int:$,intBitsToFloat:bQ,inverse:iI,inverseSqrt:tw,inversesqrt:RY,invocationLocalIndex:zj,invocationSubgroupIndex:Vj,ior:x0,iridescence:EE,iridescenceIOR:WC,iridescenceThickness:XC,ivec2:Ks,ivec3:dO,ivec4:fO,js:B$,label:_I,length:Ku,lengthSq:ow,lessThan:EO,lessThanEqual:AO,lightPosition:Kw,lightProjectionUV:sz,lightShadowMatrix:qE,lightTargetDirection:Qw,lightTargetPosition:rz,lightViewPosition:Zw,lightingContext:eV,lights:kJ,linearDepth:pM,linearToneMapping:jV,localId:Q$,log:RE,log2:Yu,logarithmicDepthToViewZ:rK,luminance:Ww,mat2:TE,mat3:Yr,mat4:Ap,matcapUV:CV,materialAO:qF,materialAlphaTest:pF,materialAnisotropy:CF,materialAnisotropyVector:iy,materialAttenuationColor:IF,materialAttenuationDistance:OF,materialClearcoat:TF,materialClearcoatNormal:EF,materialClearcoatRoughness:MF,materialColor:mF,materialDispersion:kF,materialEmissive:yF,materialEnvIntensity:UT,materialEnvRotation:Mw,materialIOR:PF,materialIridescence:wF,materialIridescenceIOR:DF,materialIridescenceThickness:UF,materialLightMap:Nw,materialLineDashOffset:GF,materialLineDashSize:VF,materialLineGapSize:zF,materialLineScale:FF,materialLineWidth:Ij,materialMetalness:SF,materialNormal:bF,materialOpacity:Rw,materialPointSize:HF,materialReference:kc,materialReflectivity:LT,materialRefractionRatio:QI,materialRotation:AF,materialRoughness:xF,materialSheen:RF,materialSheenRoughness:NF,materialShininess:gF,materialSpecular:vF,materialSpecularColor:_F,materialSpecularIntensity:fN,materialSpecularStrength:b0,materialThickness:BF,materialTransmission:LF,max:rs,maxMipLevel:gw,mediumpModelViewMatrix:XI,metalness:H0,min:no,mix:Yn,mixElement:fI,mod:px,modInt:HO,modelDirection:hj,modelNormalMatrix:WI,modelPosition:dj,modelRadius:mj,modelScale:fj,modelViewMatrix:_m,modelViewPosition:pj,modelViewProjection:Cw,modelWorldMatrix:el,modelWorldMatrixInverse:gj,morphReference:JF,mrt:IV,mul:ln,mx_aastep:Tz,mx_add:Ate,mx_atan2:Ute,mx_cell_noise_float:Ste,mx_contrast:dte,mx_divide:Cte,mx_fractal_noise_float:bte,mx_fractal_noise_vec2:Tte,mx_fractal_noise_vec3:Mte,mx_fractal_noise_vec4:Ete,mx_frame:Bte,mx_heighttonormal:kte,mx_hsvtorgb:nte,mx_ifequal:Fte,mx_ifgreater:Ote,mx_ifgreatereq:Ite,mx_invert:Pte,mx_modulo:wte,mx_multiply:Nte,mx_noise_float:fte,mx_noise_vec3:pte,mx_noise_vec4:mte,mx_place2d:zte,mx_power:Dte,mx_ramp4:ote,mx_ramplr:rte,mx_ramptb:ate,mx_rgbtohsv:ite,mx_rotate2d:Gte,mx_rotate3d:Hte,mx_safepower:hte,mx_separate:Vte,mx_splitlr:lte,mx_splittb:ute,mx_srgb_texture_to_lin_rec709:ste,mx_subtract:Rte,mx_timer:Lte,mx_transform_uv:cte,mx_unifiednoise2d:gte,mx_unifiednoise3d:yte,mx_worley_noise_float:vte,mx_worley_noise_vec2:_te,mx_worley_noise_vec3:xte,negate:ZO,neutralToneMapping:JV,nodeArray:Ep,nodeImmutable:ct,nodeObject:Pe,nodeObjectIntent:o0,nodeObjects:xE,nodeProxy:en,nodeProxyIntent:rt,n
3978ormalFlat:jI,normalGeometry:LE,normalLocal:io,normalMap:dN,normalView:ui,normalViewGeometry:Gy,normalWorld:Hd,normalWorldGeometry:KI,normalize:ah,not:wO,notEqual:MO,numWorkgroups:j$,objectDirection:aj,objectGroup:QC,objectPosition:qI,objectRadius:cj,objectScale:lj,objectViewPosition:uj,objectWorldMatrix:oj,oneMinus:QO,or:CO,orthographicDepthToViewZ:sK,oscSawtooth:OQ,oscSine:LQ,oscSquare:BQ,oscTriangle:PQ,output:py,outputStruct:yQ,overlay:vK,overloadingFn:Nr,parabola:_N,parallaxDirection:dF,parallaxUV:Uj,parameter:hQ,pass:E$,passTexture:A$,pcurve:AQ,perspectiveDepthToViewZ:Uw,pmremTexture:Hw,pointShadow:gz,pointUV:u$,pointWidth:xY,positionGeometry:_x,positionLocal:ms,positionPrevious:fM,positionView:gs,positionViewDirection:Gi,positionWorld:Zu,positionWorldDirection:Sw,posterize:M$,pow:Jo,pow2:aw,pow3:lI,pow4:uI,premultiplyAlpha:lV,property:Qc,quadBroadcast:zJ,quadSwapDiagonal:BJ,quadSwapX:UJ,quadSwapY:LJ,radians:XO,rand:dI,range:X$,rangeFog:k$,rangeFogFactor:Xw,reciprocal:JO,reference:Ei,referenceBuffer:uN,reflect:rI,reflectVector:eF,reflectView:$I,reflector:XQ,refract:uw,refractVector:tF,refractView:JI,reinhardToneMapping:KV,remap:PI,remapClamp:OI,renderGroup:Pt,renderOutput:FI,rendererReference:NI,rotate:Sx,rotateUV:IQ,roughness:ku,round:$O,rtt:zV,sRGBTransferEOTF:MI,sRGBTransferOETF:EI,sample:t$,sampler:KY,samplerComparison:ZY,saturate:lw,saturation:_$,screen:yK,screenCoordinate:vx,screenDPR:GI,screenSize:am,screenUV:$c,scriptable:H$,scriptableValue:PT,select:ur,setCurrentStack:z0,setName:hw,shaderStages:tN,shadow:fz,shadowPositionWorld:Jw,shapeCircle:uee,sharedUniformGroup:AE,sheen:gp,sheenRoughness:ME,shiftLeft:OO,shiftRight:IO,shininess:uM,sign:W0,sin:To,sinc:RQ,skinning:QF,smoothstep:tc,smoothstepElement:pI,specularColor:ka,specularF90:q0,spherizeUV:FQ,split:vY,spritesheetUV:HQ,sqrt:rc,stack:BT,step:wE,stepElement:mI,storage:Np,storageBarrier:tJ,storageObject:Yj,storageTexture:qV,string:gY,struct:gQ,sub:Ln,subBuild:my,subgroupAdd:vJ,subgroupAll:CJ,subgroupAnd:MJ,subgroupAny:wJ,subgroupBallot:yJ,subgroupBroadcast:PJ,subgroupBroadcastFirst:DJ,subgroupElect:gJ,subgroupExclusiveAdd:xJ,subgroupExclusiveMul:TJ,subgroupInclusiveAdd:_J,subgroupInclusiveMul:bJ,subgroupIndex:Fj,subgroupMax:NJ,subgroupMin:RJ,subgroupMul:SJ,subgroupOr:EJ,subgroupShuffle:OJ,subgroupShuffleDown:VJ,subgroupShuffleUp:FJ,subgroupShuffleXor:IJ,subgroupSize:$$,subgroupXor:AJ,tan:jO,tangentGeometry:PE,tangentLocal:xx,tangentView:OE,tangentWorld:cF,texture:Dn,texture3D:WV,textureBarrier:nJ,textureBicubic:YK,textureBicubicLevel:Vw,textureCubeUV:EV,textureLoad:fs,textureSize:Rd,textureStore:h$,thickness:YC,time:lv,toneMapping:CI,toneMappingExposure:wI,toonOutlinePass:C$,transformDirection:cI,transformNormal:ZI,transformNormalToView:Tw,transformedClearcoatNormalView:xj,transformedNormalView:vj,transformedNormalWorld:_j,transmission:cM,transpose:tI,triNoise3D:CQ,triplanarTexture:kQ,triplanarTextures:VV,trunc:rw,uint:xt,uintBitsToFloat:TQ,uniform:Vt,uniformArray:kr,uniformCubeTexture:bj,uniformFlow:vI,uniformGroup:_O,uniformTexture:jY,unpremultiplyAlpha:pK,userData:m$,uv:vi,uvec2:cO,uvec3:sv,uvec4:pO,varying:ac,varyingProperty:G0,vec2:Fe,vec3:ae,vec4:Gt,vectorComponents:ym,velocity:y$,vertexColor:iV,vertexIndex:WF,vertexStage:TI,vibrance:x$,viewZToLogarithmicDepth:Lw,viewZToOrthographicDepth:gy,viewZToPerspectiveDepth:tV,viewport:_w,viewportCoordinate:HI,viewportDepthTexture:Dw,viewportLinearDepth:aK,viewportMipTexture:ww,viewportResolution:tj,viewportSafeUV:zQ,viewportSharedTexture:MK,viewportSize:xw,viewportTexture:nK,viewportUV:ej,wgsl:P$,wgslFn:F$,workgroupArray:rJ,workgroupBarrier:eJ,workgroupId:K$,workingToColorSpace:AI,xor:DO});const Gl=new kw;class Wte extends kd{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){const i=this.renderer,r=this.nodes.getBackgroundNode(e)||e.background;let a=!1;if(r===null)i._clearColor.getRGB(Gl),Gl.a=i._clearColor.a;else if(r.isColor===!0)r.getRGB(Gl),Gl.a=1,a=!0;else if(r.isNode===!0){const h=this.get(e),p=r;Gl.copy(i._clearColor);let g=h.backgroundMesh;if(g===void 0){let E=function(){r.removeEventListener("dispose",E),g.material.dispose(),g.geometry.dispose()};var u=E;const _=mx(Gt(p).mul(xN),{getUV:()=>kV.mul(KI),getTextureLevel:()=>HV});let S=Cw;S=S.setZ(S.w);const A=new ys;
3978A.name="Background.material",A.side=yi,A.depthTest=!1,A.depthWrite=!1,A.allowOverride=!1,A.fog=!1,A.lights=!1,A.vertexNode=S,A.colorNode=_,h.backgroundMeshNode=_,h.backgroundMesh=g=new Ri(new tv(1,32,32),A),g.frustumCulled=!1,g.name="Background.mesh",g.onBeforeRender=function(b,C,w){this.matrixWorld.copyPosition(w.matrixWorld)},r.addEventListener("dispose",E)}const y=p.getCacheKey();h.backgroundCacheKey!==y&&(h.backgroundMeshNode.node=Gt(p).mul(xN),h.backgroundMeshNode.needsUpdate=!0,g.material.needsUpdate=!0,h.backgroundCacheKey=y),t.unshift(g,g.geometry,g.material,0,0,null,null)}else console.error("THREE.Renderer: Unsupported background configuration.",r);const l=i.xr.getEnvironmentBlendMode();if(l==="additive"?Gl.set(0,0,0,1):l==="alpha-blend"&&Gl.set(0,0,0,0),i.autoClear===!0||a===!0){const h=n.clearColorValue;h.r=Gl.r,h.g=Gl.g,h.b=Gl.b,h.a=Gl.a,(i.backend.isWebGLBackend===!0||i.alpha===!0)&&(h.r*=h.a,h.g*=h.a,h.b*=h.a),n.depthClearValue=i._clearDepth,n.stencilClearValue=i._clearStencil,n.clearColor=i.autoClearColor===!0,n.clearDepth=i.autoClearDepth===!0,n.clearStencil=i.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}}let Xte=0;class SN{constructor(e="",t=[],n=0,i=[]){this.name=e,this.bindings=t,this.index=n,this.bindingsReference=i,this.id=Xte++}}class Yte{constructor(e,t,n,i,r,a,l,u,h,p=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=p,this.nodeAttributes=i,this.bindings=r,this.updateNodes=a,this.updateBeforeNodes=l,this.updateAfterNodes=u,this.observer=h,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){const i=new SN(t.name,[],t.index,t.bindingsReference);e.push(i);for(const r of t.bindings)i.bindings.push(r.clone())}else e.push(t);return e}}class fB{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class jte{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class Rz{constructor(e,t,n=!1,i=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=i}}class Kte extends Rz{constructor(e,t,n=null,i=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=i}}class Zte{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let Qte=0;class vR{constructor(e=null){this.id=Qte++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class $te{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class qd{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0}setValue(e){this.value=e}getValue(){return this.value}}class Jte extends qd{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class ene extends qd{constructor(e,t=new Ge){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class tne extends qd{constructor(e,t=new Y){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class nne extends qd{constructor(e,t=new kt){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class ine extends qd{constructor(e,t=new lt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class sne extends qd{constructor(e,t=new hx){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class rne extends qd{constructor(e,t=new pn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class ane extends qd{constructor(e,t=new Ot){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class one extends Jte{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class lne extends ene{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class une extends tne{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class cne extends nne{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class hne extends ine{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class dne extends sne{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class fne extends rne{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class pne extends ane{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}const pB=new WeakMap,mne=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),mT=s=>/e/g.test(s)?String(s).replace(/\+/g,""):(s=Number(s),s+(s%1?"":".0"));class Nz{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=BT(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new vR,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.currentStack=null,this.subBuildFn=null}getBindGroupsCache(){let e=pB.get(this.renderer);return e===void 0&&(e=new Zl,pB.set(this.renderer,e)),e}createRenderTarget(e,t,n){return new Ql(e,t,n)}createCubeRenderTarget(e,t){return new cV(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){const n=this.getBindGroupsCache(),i=[];let r=!0;for(const l of t)i.push(l),r=r&&l.groupNode.shared!==!0;let a;return r?(a=n.get(i),a===void 0&&(a=new SN(e,i,this.bindingsIndexes[e].group,i),n.set(i,a))):a=new SN(e,i,this.bindingsIndexes[e].group,i),a}getBindGroupArray(e,t){const n=this.bindings[t];let i=n[e];return i===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=i=[]),i}getBindings(){let e=this.bindGroups;if(e===null){const t={},n=this.bindings;for(const i of tN)for(const r in n[i]){const a=n[i][r];(t[r]||(t[r]=[])).push(...a)}e=[];for(const i in t){const r=t[i],a=this._getBindGroup(i,r);e.push(a)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){const n=e[t];this.bindingsIndexes[n.name].group=t,n.index=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.includes(e)===!1&&(this.nodes.push(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){this.sequentialNodes.includes(e)===!1&&this.sequentialNodes.push(e)}buildUpdateNodes(){for(const e of this.nodes)e.getUpdateType()!==mn.NONE&&this.updateNodes.push(e);for(const e of this.sequentialNodes){const t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==mn.NONE&&this.updateBeforeNodes.push(e),n!==mn.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===hi||e.magFilter===Md||e.magFilter===ql||e.magFilter===Mr||e.minFilter===hi||e.minFilter===Md||e.minFilter===ql||e.minFilter===Mr}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}getSharedContext(){return{...this.context},this.context}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){const n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new vR(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){console.warn("Abstract function.")}getInstanceIndex(){console.warn("Abstract function.")}getDrawIndex(){console.warn("Abstract function.")}getFrontFacing(){console.warn("Abstract function.")}getFragCoord(){console.warn("Abstract function.")}isFlipY(){return!1}increaseUsage(e){const t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,t.usageCount}generateTexture(){console.warn("Abstract function.")}generateTextureLod(){console.warn("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let i=this.generateArrayDeclaration(e,t)+"( ";for(let r=0;r<t;r++){const a=n?n[r]:null;a!==null?i+=a.build(this,e):i+=this.generateConst(e),r<t-1&&(i+=", ")}return i+=" )",i}generateStruct(e,t,n=null){const i=[];for(const r of t){const{name:a,type:l}=r;n&&n[a]&&n[a].isNode?i.push(n[a].build(this,l)):i.push(this.generateConst(l))}return e+"( "+i.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new lt:e==="vec2"?t=new Ge:e==="vec3"?t=new Y:e==="vec4"&&(t=new kt)),e==="float")return mT(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${mT(t.r)}, ${mT(t.g)}, ${mT(t.b)} )`;const n=this.getTypeLength(e),i=this.getComponentType(e),r=a=>this.generateConst(i,a);if(n===2)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)} )`;if(n===3)return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${r(t.x)}, ${r(t.y)}, ${r(t.z)}, ${r(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(r).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){const n=this.attributes;for(const r of n)if(r.name===e)return r;const i=new fB(e,t);return this.registerDeclaration(i),n.push(i),i}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===Zs)return"int";if(t===gi)return"uint"}return"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=$3(e);const i=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),i+n}getTypeFromArray(e){return mne.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const n=t.array,i=e.itemSize,r=e.normalized;let a;return!(e instanceof JN)&&r!==!0&&(a=this.getTypeFromArray(n)),this.getTypeFromLength(i,a)}getTypeLength(e){const t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}addStack(){this.stack=BT(this.stack);const e=SE();return this.stacks.push(e),z0(this.stack),this.stack}removeStack(){const e=this.stack;return this.stack=e.parent,z0(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let i=n.getData(e);i===void 0&&(i={},n.setData(e,i)),i[t]===void 0&&(i[t]={});let r=i[t];const a=i.any?i.any.subBuilds:null,l=this.getClosestSubBuild(a);return l&&(r.subBuildsCache===void 0&&(r.subBuildsCache={}),r=r.subBuildsCache[l]||(r.subBuildsCache[l]={}),r.subBuilds=a),r}
3978getNodeProperties(e,t="any"){const n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const n=this.getDataFromNode(e);let i=n.bufferAttribute;if(i===void 0){const r=this.uniforms.index++;i=new fB("nodeAttribute"+r,t,e),this.bufferAttributes.push(i),n.bufferAttribute=i}return i}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,i=this.shaderStage){const r=this.getDataFromNode(e,i,this.globalCache);let a=r.structType;if(a===void 0){const l=this.structs.index++;n===null&&(n="StructType"+l),a=new $te(n,t),this.structs[i].push(a),this.types[i][n]=e,r.structType=a}return a}getOutputStructTypeFromNode(e,t){const n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,i=null){const r=this.getDataFromNode(e,n,this.globalCache);let a=r.uniform;if(a===void 0){const l=this.uniforms.index++;a=new jte(i||"nodeUniform"+l,t,e),this.uniforms[n].push(a),this.registerDeclaration(a),r.uniform=a}return a}getVarFromNode(e,t=null,n=e.getNodeType(this),i=this.shaderStage,r=!1){const a=this.getDataFromNode(e,i),l=this.getSubBuildProperty("variable",a.subBuilds);let u=a[l];if(u===void 0){const h=r?"_const":"_var",p=this.vars[i]||(this.vars[i]=[]),g=this.vars[h]||(this.vars[h]=0);t===null&&(t=(r?"nodeConst":"nodeVar")+g,this.vars[h]++),l!=="variable"&&(t=this.getSubBuildProperty(t,a.subBuilds));const y=e.getArrayCount(this);u=new Rz(t,n,r,y),r||p.push(u),this.registerDeclaration(u),a[l]=u}return u}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(const t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),i=null,r=null){const a=this.getDataFromNode(e,"any"),l=this.getSubBuildProperty("varying",a.subBuilds);let u=a[l];if(u===void 0){const h=this.varyings,p=h.length;t===null&&(t="nodeVarying"+p),l!=="varying"&&(t=this.getSubBuildProperty(t,a.subBuilds)),u=new Kte(t,n,i,r),h.push(u),this.registerDeclaration(u),a[l]=u}return u}registerDeclaration(e){const t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),i=this.getPropertyName(e);let r=1,a=i;for(;n[a]!==void 0;)a=i+"_"+r++;r>1&&(e.name=a,console.warn(`THREE.TSL: Declaration name '${i}' of '${e.type}' already in use. Renamed to '${a}'.`)),n[a]=e}getCodeFromNode(e,t,n=this.shaderStage){const i=this.getDataFromNode(e);let r=i.code;if(r===void 0){const a=this.codes[n]||(this.codes[n]=[]),l=a.length;r=new Zte("nodeCode"+l,t),a.push(r),i.code=r}return r}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:i}=this.getDataFromNode(e);let r=!0,a=t;for(;a;){if(i.get(a)===!0){r=!1;break}a=this.getDataFromNode(a).parentNodeBlock}if(r)for(const l of n)this.addLineFlowCode(l)}addLineFlowCodeBlock(e,t,n){const i=this.getDataFromNode(e),r=i.flowCodes||(i.flowCodes=[]),a=i.flowCodeBlock||(i.flowCodeBlock=new WeakMap);r.push(t),a.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`; 3979`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=new ez,n=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=n,t}flowShaderNode(e){const t=e.layout,n={[Symbol.iterator](){let a=0;const l=Object.values(this);return{next:()=>({value:l[a],done:a++>=l.length})}}};
3979for(const a of t.inputs)n[a.name]=new BV(a.type,a.name);e.layout=null;const i=e.call(n),r=this.flowStagesNode(i,t.type);return e.layout=t,r}flowBuildStage(e,t,n=null){const i=this.getBuildStage();this.setBuildStage(t);const r=e.build(this,n);return this.setBuildStage(i),r}flowStagesNode(e,t=null){const n=this.flow,i=this.vars,r=this.declarations,a=this.cache,l=this.buildStage,u=this.stack,h={code:""};this.flow=h,this.vars={},this.declarations={},this.cache=new vR,this.stack=BT();for(const p of eN)this.setBuildStage(p),h.result=e.build(this,t);return h.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=i,this.declarations=r,this.cache=a,this.stack=u,this.setBuildStage(l),h}getFunctionOperator(){return null}buildFunctionCode(){console.warn("Abstract function.")}flowChildNode(e,t=null){const n=this.flow,i={code:""};return this.flow=i,i.result=e.build(this,t),this.flow=n,i}flowNodeFromShaderStage(e,t,n=null,i=null){const r=this.tab,a=this.cache,l=this.shaderStage,u=this.context;this.setShaderStage(e);const h={...this.context};delete h.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=h;let p=null;if(this.buildStage==="generate"){const g=this.flowChildNode(t,n);i!==null&&(g.code+=`${this.tab+i} = ${g.result}; 3980`),this.flowCode[e]=this.flowCode[e]+g.code,p=g}else p=t.build(this);return this.setShaderStage(l),this.cache=a,this.tab=r,this.context=u,p}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){console.warn("Abstract function.")}getVaryings(){console.warn("Abstract function.")}getVar(e,t,n=null){return`${n!==null?this.generateArrayDeclaration(e,n):this.getType(e)} ${t}`}getVars(e){let t="";const n=this.vars[e];if(n!==void 0)for(const i of n)t+=`${this.getVar(i.type,i.name)}; `;return t}getUniforms(){console.warn("Abstract function.")}getCodes(e){const t=this.codes[e];let n="";if(t!==void 0)for(const i of t)n+=i.code+` 3981`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){console.warn("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;const n=this.subBuildLayers;for(let i=t.length-1;i>=0;i--){const r=t[i];if(n.includes(r))return r}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let i;return n?i=e?n+"_"+e:n:i=e,i}build(){const{object:e,material:t,renderer:n}=this;if(t!==null){let i=n.library.fromMaterial(t);i===null&&(console.error(`NodeMaterial: Material "${t.type}" is not compatible.`),i=new ys),i.build(this)}else this.addFlow("compute",e);for(const i of eN){this.setBuildStage(i),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const r of tN){this.setShaderStage(r);const a=this.flowNodes[r];for(const l of a)i==="generate"?this.flowNode(l):l.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getNodeUniform(e,t){if(t==="float"||t==="int"||t==="uint")return new one(e);if(t==="vec2"||t==="ivec2"||t==="uvec2")return new lne(e);if(t==="vec3"||t==="ivec3"||t==="uvec3")return new une(e);if(t==="vec4"||t==="ivec4"||t==="uvec4")return new cne(e);if(t==="color")return new hne(e);if(t==="mat2")return new dne(e);if(t==="mat3")return new fne(e);if(t==="mat4")return new pne(e);throw new Error(`Uniform "${t}" not declared.`)}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;const i=this.getTypeLength(t),r=this.getTypeLength(n);return i===16&&r===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:i===9&&r===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:i>4||r>4||r===0?e:i===r?`${this.getType(n)}( ${e} )`:i>r?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,r)}`,this.format(e,this.getTypeFromLength(r,this.getComponentType(t)),n)):r===4&&i>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:i===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(i===1&&r>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${Ky}
3981 - Node System 3982`}}class mB{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderMap:new WeakMap,frameMap:new WeakMap},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===mn.FRAME){const{frameMap:i}=this._getMaps(this.updateBeforeMap,n);i.get(n)!==this.frameId&&e.updateBefore(this)!==!1&&i.set(n,this.frameId)}else if(t===mn.RENDER){const{renderMap:i}=this._getMaps(this.updateBeforeMap,n);i.get(n)!==this.renderId&&e.updateBefore(this)!==!1&&i.set(n,this.renderId)}else t===mn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===mn.FRAME){const{frameMap:i}=this._getMaps(this.updateAfterMap,n);i.get(n)!==this.frameId&&e.updateAfter(this)!==!1&&i.set(n,this.frameId)}else if(t===mn.RENDER){const{renderMap:i}=this._getMaps(this.updateAfterMap,n);i.get(n)!==this.renderId&&e.updateAfter(this)!==!1&&i.set(n,this.renderId)}else t===mn.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===mn.FRAME){const{frameMap:i}=this._getMaps(this.updateMap,n);i.get(n)!==this.frameId&&e.update(this)!==!1&&i.set(n,this.frameId)}else if(t===mn.RENDER){const{renderMap:i}=this._getMaps(this.updateMap,n);i.get(n)!==this.renderId&&e.update(this)!==!1&&i.set(n,this.renderId)}else t===mn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class i2{constructor(e,t,n=null,i="",r=!1){this.type=e,this.name=t,this.count=n,this.qualifier=i,this.isConst=r}}i2.isNodeFunctionInput=!0;class gne extends xm{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:Qw(this.light),lightColor:e}}}const _R=new Ot,gT=new Ot;let Q_=null;class yne extends xm{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Vt(new Y).setGroup(Pt),this.halfWidth=Vt(new Y).setGroup(Pt),this.updateType=mn.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;gT.identity(),_R.copy(t.matrixWorld),_R.premultiply(n),gT.extractRotation(_R),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(gT),this.halfHeight.value.applyMatrix4(gT)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=Dn(Q_.LTC_FLOAT_1),n=Dn(Q_.LTC_FLOAT_2)):(t=Dn(Q_.LTC_HALF_1),n=Dn(Q_.LTC_HALF_2));const{colorNode:i,light:r}=this,a=Zw(r);return{lightColor:i,lightPosition:a,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Q_=e}}class s2 extends xm{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Vt(0).setGroup(Pt),this.penumbraCosNode=Vt(0).setGroup(Pt),this.cutoffDistanceNode=Vt(0).setGroup(Pt),this.decayExponentNode=Vt(0).setGroup(Pt),this.colorNode=Vt(this.color).setGroup(Pt)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){const{coneCosNode:n,penumbraCosNode:i}=this;return tc(n,i,t)}getLightCoord(e){const t=e.getNodeProperties(this);let n=t.projectionUV;return n===void 0&&(n=sz(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:i,light:r}=this,a=this.getLightVector(e),l=a.normalize(),u=l.dot(Qw(r)),h=this.getSpotAttenuation(e,u),p=a.length(),g=e2({lightDistance:p,cutoffDistance:n,decayExponent:i});let y=t.mul(h).mul(g),_,S;return r.colorNode?(S=this.getLightCoord(e),_=r.colorNode(S)):r.map&&(S=this.getLightCoord(e),_=Dn(r.map,S.xy).onRenderUpd
3982ate(()=>r.map)),_&&(y=S.mul(2).sub(1).abs().lessThan(1).all().select(y.mul(_),y)),{lightColor:y,lightDirection:l}}}class vne extends s2{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){const n=this.light.iesMap;let i=null;if(n&&n.isTexture===!0){const r=t.acos().mul(1/Math.PI);i=Dn(n,Fe(r,0),0).r}else i=super.getSpotAttenuation(t);return i}}const _ne=le(([s,e])=>{const t=s.abs().sub(e);return Ku(rs(t,0)).add(no(rs(t.x,t.y),0))});class xne extends s2{static get type(){return"ProjectorLightNode"}update(e){super.update(e);const t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=j(0),n=this.penumbraCosNode,i=qE(this.light).mul(e.context.positionWorld||Zu);return Zt(i.w.greaterThan(0),()=>{const r=i.xyz.div(i.w),a=_ne(r.xy.sub(Fe(.5)),Fe(.5)),l=Ao(-1,Ln(1,nw(n)).sub(1));t.assign(lw(a.mul(-2).mul(l)))}),t}}class Sne extends xm{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class bne extends xm{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=Kw(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Vt(new lt).setGroup(Pt)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:i}=this,a=Hd.dot(i).mul(.5).add(.5),l=Yn(n,t,a);e.context.irradiance.addAssign(l)}}class Tne extends xm{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new Y);this.lightProbe=kr(t)}update(e){const{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){const t=Az(Hd,this.lightProbe);e.context.irradiance.addAssign(t)}}class Cz{parseFunction(){console.warn("Abstract function.")}}class r2{constructor(e,t,n="",i=""){this.type=e,this.inputs=t,this.name=n,this.precision=i}getCode(){console.warn("Abstract function.")}}r2.isNodeFunction=!0;const Mne=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,Ene=/[a-z_0-9]+/ig,gB="#pragma main",Ane=s=>{s=s.trim();const e=s.indexOf(gB),t=e!==-1?s.slice(e+gB.length):s,n=t.match(Mne);if(n!==null&&n.length===5){const i=n[4],r=[];let a=null;for(;(a=Ene.exec(i))!==null;)r.push(a);const l=[];let u=0;for(;u<r.length;){const S=r[u][0]==="const";S===!0&&u++;let A=r[u][0];A==="in"||A==="out"||A==="inout"?u++:A="";const E=r[u++][0];let b=Number.parseInt(r[u][0]);Number.isNaN(b)===!1?u++:b=null;const C=r[u++][0];l.push(new i2(E,C,b,A,S))}const h=t.substring(n[0].length),p=n[3]!==void 0?n[3]:"",g=n[2],y=n[1]!==void 0?n[1]:"",_=e!==-1?s.slice(0,e):"";return{type:g,inputs:l,name:p,precision:y,inputsCode:i,blockCode:h,headerCode:_}}else throw new Error("FunctionNode: Function is not a GLSL code.")};class Rne extends r2{constructor(e){const{type:t,inputs:n,name:i,precision:r,inputsCode:a,blockCode:l,headerCode:u}=Ane(e);super(t,n,i,r),this.inputsCode=a,this.blockCode=l,this.headerCode=u}getCode(e=this.name){let t;const n=this.blockCode;if(n!==""){const{type:i,inputsCode:r,headerCode:a,precision:l}=this;let u=`${i} ${e} ( ${r.trim()} )`;l!==""&&(u=`${l} ${u}`),t=a+u+n}else t="";return t}}class Nne extends Cz{parseFunction(e){return new Rne(e)}}const yB=new WeakMap,zu=[],ip=[];class Cne extends kd{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new mB,this.nodeBuilderCache=new Map,this.callHashCache=new Zl,this.groupsData=new Zl,this.cacheLib={}}updateGroup(e){const t=e.groupNode,n=t.name;if(n===QC.name)return!0;if(n===Pt.name){const r=this.get(e),a=this.nodeFrame.renderId;return r.renderId!==a?(r.renderId=a,!0):!1}if(n===xO.name){const r=this.get(e),a=this.nodeFrame.frameId;return r.frameId!==a?(r.frameId=a,!0):!1}zu[0]=t,zu[1]=e;let i=this.groupsData.get(zu);return i===void 0&&this.groupsData.set(zu,i={}),zu.length=0,i.version!==t.version?(i.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}getForRender(e){const t=this.get(e);let n=t.nodeBuilderState;if(n===void 0){const{nodeBuilderCache:i}=this,r=this.getForRenderCacheKey(e);if(n=i.get(r),n===void 0){const a=this.backend.createNodeBuilder(e.object,this.renderer);a.scene=e.scene,a.material=e.material,a.camera=e.camera,a.context.material=e.material,a.lightsNode=e.lightsNode,a.environmentNode=this.getEnvironmentNode(e.scene),a.fogNode=this.getFogNode(e.scene),a.clippingContext=e.clippingContext,this.renderer.getOutputRe
vendor: 1,815 bytes, line 3982
3982nderTarget()&&this.renderer.getOutputRenderTarget().multiview&&a.enableMultiview(),a.build(),n=this._createNodeBuilderState(a),i.set(r,n)}n.usedTimes++,t.nodeBuilderState=n}return n}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e))}return super.delete(e)}getForCompute(e){const t=this.get(e);let n=t.nodeBuilderState;if(n===void 0){const i=this.backend.createNodeBuilder(e,this.renderer);i.build(),n=this._createNodeBuilderState(i),t.nodeBuilderState=n}return n}_createNodeBuilderState(e){return new Yte(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.transforms)}getEnvironmentNode(e){this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{const n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{const n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){zu[0]=e,zu[1]=t;const n=this.renderer.info.calls,i=this.callHashCache.get(zu)||{};if(i.callId!==n){const r=this.getEnvironmentNode(e),a=this.getFogNode(e);t&&ip.push(t.getCacheKey(!0)),r&&ip.push(r.getCacheKey()),a&&ip.push(a.getCacheKey()),ip.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),ip.push(this.renderer.shadowMap.enabled?1:0),i.callId=n,i.cacheKey=yE(ip),this.callHashCache.set(zu,i),ip.length=0}return zu.length=0,i.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}
3982updateBackground(e){const t=this.get(e),n=e.background;if(n){const i=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||i){const r=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===Cd||n.mapping===wd||n.mapping===nh){if(e.backgroundBlurriness>0||n.mapping===nh)return Hw(n);{let a;return n.isCubeTexture===!0?a=Hy(n):a=Dn(n),dV(a)}}else{if(n.isTexture===!0)return Dn(n,$c.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&console.error("WebGPUNodes: Unsupported background configuration.",n)}},i);t.backgroundNode=r,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,i=!1){const r=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let a=r.get(t);return(a===void 0||i)&&(a=n(),r.set(t,a)),a}updateFog(e){const t=this.get(e),n=e.fog;if(n){if(t.fog!==n){const i=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){const r=Ei("color","color",n).setGroup(Pt),a=Ei("density","float",n).setGroup(Pt);return X0(r,Yw(a))}else if(n.isFog){const r=Ei("color","color",n).setGroup(Pt),a=Ei("near","float",n).setGroup(Pt),l=Ei("far","float",n).setGroup(Pt);return X0(r,Xw(a,l))}else console.error("THREE.Renderer: Unsupported fog configuration.",n)});t.fogNode=i,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),n=e.environment;if(n){if(t.environment!==n){const i=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return Hy(n);if(n.isTexture===!0)return Dn(n);console.error("Nodes: Unsupported environment configuration.",n)});t.environmentNode=i,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,i=null,r=null){const a=this.nodeFrame;return a.renderer=e,a.scene=t,a.object=n,a.camera=i,a.material=r,a}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}hasOutputChange(e){return yB.get(e)!==this.getOutputCacheKey()}getOutputNode(e){const t=this.renderer,n=this.getOutputCacheKey(),i=e.isArrayTexture?WV(e,ae($c,hh("gl_ViewID_OVR"))).renderOutput(t.toneMapping,t.currentColorSpace):Dn(e,$c).renderOutput(t.toneMapping,t.currentColorSpace);return yB.set(e,n),i}updateBefore(e){const t=e.getNodeBuilderState();for(const n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){const t=e.getNodeBuilderState();for(const n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){const t=this.getNodeFrame(),n=this.getForCompute(e);for(const i of n.updateNodes)t.updateNode(i)}updateForRender(e){const t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(const i of n.updateNodes)t.updateNode(i)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new mB,this.nodeBuilderCache=new Map,this.cacheLib={}}}const xR=new Hu;class vM{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new pn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,n){const i=e.length;for(let r=0;r<i;r++){xR.copy(e[r]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);const a=t[n+r],l=xR.normal;a.x=-l.x,a.y=-l.y,a.z=-l.z,a.w=xR.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix=t.matrixWorldInverse,this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);const i=t.clippingPlanes,r=i.length;let a,l;if(this.clipIntersection?(a=this.intersectionPlanes,l=e.intersectionPlanes.length):(a=this.unionPlanes,l=e.unionPlanes.length),a.length!==l+r){a.length=l+r;for(let u=0;u<r;u++)a[l+u]=new kt;n=!0}this.projectPlanes(i,a,l),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}
3982getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new vM(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}}class wne{constructor(e,t){this.bundleGroup=e,this.camera=t}}const $_=[];class Dne{constructor(){this.bundles=new Zl}get(e,t){const n=this.bundles;$_[0]=e,$_[1]=t;let i=n.get($_);return i===void 0&&(i=new wne(e,t),n.set($_,i)),$_.length=0,i}dispose(){this.bundles=new Zl}}class wz{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null;const n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(const i in e)t[i]=e[i]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){console.warn(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`Base class ${t.name} is not a class.`);n.set(t,e)}}const Une=new $w,J_=[];class Lne extends Zl{constructor(){super()}createNode(e=[]){return new $w().setLights(e)}getNode(e,t){if(e.isQuadMesh)return Une;J_[0]=e,J_[1]=t;let n=this.get(J_);return n===void 0&&(n=this.createNode(),this.set(J_,n)),J_.length=0,n}}class l0 extends Ql{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}}const vB=new Y,_B=new Y;class Bne extends Ro{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new ps,this._cameraL.viewport=new kt,this._cameraR=new ps,this._cameraR.viewport=new kt,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new DC,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._frameBufferTargets=null,this._createXRLayer=zne.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSize=new Ge,this._onSessionEvent=Ine.bind(this),this._onSessionEnd=Fne.bind(this),this._onInputSourcesChange=Vne.bind(this),this._onAnimationFrame=Gne.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){if(!(this._glProjLayer===null&&this._glBaseLayer===null))return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&console.warn("THREE.XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&console.warn("THREE.XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,i,r,a,l,u={}){const h=new fm(e,t),p=new l0(r,a,{format:Pi,type:ki,depthTexture:new Ta(r,a,u.stencil?Ja:gi,void 0,void 0,void 0,void 0,void 0,void 0,u.stencil?to:eo),stencilBuffer:u.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});p._autoAllocateDepthBuffer=!0;const g=new xa({color:16777215,side:Za});g.map=p.texture,g.map.offset.y=1,g.map.repeat.y=-1;const y=new Ri(h,g);y.position.copy(n),y.quaternion.copy(i);const _={type:"quad",width:e,height:t,translation:n,quaternion:i,pixelwidth:r,pixelheight:a,plane:y,material:g,rendercall:l,renderTarget:p};if(this._layers.push(_),this._session!==null){_.plane.material=new xa({color:16777215,side:Za}),_.plane.material.blending=bp,_.plane.material.blendEquation=Tr,_.plane.material.blendSrc=Gu,_.plane.material.blendDst=Gu,_.xrlayer=this._createXRLayer(_);const S=this._session.renderState.layers;S.unshift(_.xrlayer),this._session.updateRenderState({layers:S})}else p.isXRRenderTarget=!1;return y}createCylinderLayer(e,t,n,i,r,a,l,u,h={}){const p=new ev(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),g=new l0(a,l,{format:Pi,type:ki,depthTexture:new Ta(a,l,h.stencil?Ja:gi,void 0,void 0,void 0,void 0,void 0,void 0,h.stencil?to:eo),stencilBuffer:h.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});g._autoAllocateDepthBuffer=!0;const y=new xa({color:16777215,side:yi});y.map=g.texture,y.map.offset.y=1,y.map.repeat.y=-1;const _=new Ri(p,y);_.position.copy(i),_.quaternion.copy(r);
3982const S={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:i,quaternion:r,pixelwidth:a,pixelheight:l,plane:_,material:y,rendercall:u,renderTarget:g};if(this._layers.push(S),this._session!==null){S.plane.material=new xa({color:16777215,side:yi}),S.plane.material.blending=bp,S.plane.material.blendEquation=Tr,S.plane.material.blendSrc=Gu,S.plane.material.blendDst=Gu,S.xrlayer=this._createXRLayer(S);const A=this._session.renderState.layers;A.unshift(S.xrlayer),this._session.updateRenderState({layers:A})}else g.isXRRenderTarget=!1;return _}renderLayers(){const e=new Y,t=new ba,n=this._renderer,i=this.isPresenting,r=n.getOutputRenderTarget(),a=n._frameBufferTarget;this.isPresenting=!1;const l=new Ge;n.getSize(l);const u=n._quad;for(const h of this._layers)if(h.renderTarget.isXRRenderTarget=this._session!==null,h.renderTarget._hasExternalTextures=h.renderTarget.isXRRenderTarget,h.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){h.xrlayer.transform=new XRRigidTransform(h.plane.getWorldPosition(e),h.plane.getWorldQuaternion(t));const p=this._glBinding.getSubImage(h.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(h.renderTarget,p.colorTexture,void 0),n._setXRLayerSize(h.renderTarget.width,h.renderTarget.height),n.setOutputRenderTarget(h.renderTarget),n.setRenderTarget(null),n._frameBufferTarget=null,this._frameBufferTargets||(this._frameBufferTargets=new WeakMap);const{frameBufferTarget:g,quad:y}=this._frameBufferTargets.get(h.renderTarget)||{frameBufferTarget:null,quad:null};g?(n._frameBufferTarget=g,n._quad=y):(n._quad=new GE(new ys),this._frameBufferTargets.set(h.renderTarget,{frameBufferTarget:n._getFrameBufferTarget(),quad:n._quad})),h.rendercall(),n._frameBufferTarget=null}else n.setRenderTarget(h.renderTarget),h.rendercall();n.setRenderTarget(null),n.setOutputRenderTarget(r),n._frameBufferTarget=a,n._setXRLayerSize(l.x,l.y),n._quad=u,this.isPresenting=i}getSession(){return this._session}async setSession(e){const t=this._renderer,n=t.backend;this._gl=t.getContext();const i=this._gl,r=i.getContextAttributes();if(this._session=e,e!==null){if(n.isWebGPUBackend===!0)throw new Error('THREE.XRManager: XR is currently not supported with a WebGPU backend. Use WebGL by passing "{ forceWebGL: true }" to the constructor of the renderer.');if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),await n.makeXRCompatible(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._supportsLayers===!0){let a=null,l=null,u=null;t.depth&&(u=t.stencil?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24,a=t.stencil?to:eo,l=t.stencil?Ja:gi);const h={colorFormat:i.RGBA8,depthFormat:u,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(h.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();const p=this._glBinding.createProjectionLayer(h),g=[p];this._glProjLayer=p,t.setPixelRatio(1),t._setXRLayerSize(p.textureWidth,p.textureHeight);const y=this._useMultiview?2:1,_=new Ta(p.textureWidth,p.textureHeight,l,void 0,void 0,void 0,void 0,void 0,void 0,a,y);if(this._xrRenderTarget=new l0(p.textureWidth,p.textureHeight,{format:Pi,type:ki,colorSpace:t.outputColorSpace,depthTexture:_,stencilBuffer:t.stencil,samples:r.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(const S of this._layers)S.plane.material=new xa({color:16777215,side:S.type==="cylinder"?yi:Za}),S.plane.material.blending=bp,S.plane.material.blendEquation=Tr,S.plane.material.blendSrc=Gu,S.plane.material.blendDst=Gu,S.xrlayer=this._createXRLayer(S),g.unshift(S.xrlayer);e.updateRenderState({layers:g})}else{const a={antialias:t.samples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},l=new XRWebGLLayer(e,i,a);this._glBaseLayer=l,e.updateRenderState({baseLayer:l}),t.setPixelRatio(1),t._setXRLayerSize(l.framebufferWidth,l.framebufferHeight),this._xrRenderTarget=new l0(l.framebufferWidth,l.framebufferHeight,{format:Pi,type:ki,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:l.ignoreDepthValues===!1,resolveStencilBuffer:l.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}this.setFoveation(this.getFoveation()),t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){const t=this._session;if(t===null)return;const n=e.near,i=e.far,r=this._cameraXR,a=this._cameraL,l=this._cameraR;r.near=l.near=a.near=n,r.far=l.far=a.far=i,r.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==r.near||this._currentDepthFar!==r.far)&&(t.updateRenderState({depthNear:r.near,depthFar:r.far}),this._currentDepthNear=r.near,this._currentDepthFar=r.far),r.layers.mask=e.layers.mask|6,a.layers.mask=r.layers.mask&3,l.layers.mask=r.layers.mask&5;const u=e.parent,h=r.cameras;xB(r,u);for(let p=0;p<h.length;p++)xB(h[p],u);h.length===2?Pne(r,a,l):r.projectionMatrix.copy(a.projectionMatrix),One(e,r,u)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new p0,this._controllers[e]=t),t}}function Pne(s,e,t){vB.setFromMatrixPosition(e.matrixWorld),_B.setFromMatrixPosition(t.matrixWorld);const n=vB.distanceTo(_B),i=e.projectionMatrix.elements,r=t.projectionMatrix.elements,a=i[14]/(i[10]-1),l=i[14]/(i[10]+1),u=(i[9]+1)/i[5],h=(i[9]-1)/i[5],p=(i[8]-1)/i[0],g=(r[8]+1)/r[0],y=a*p,_=a*g,S=n/(-p+g),A=S*-p;if(e.matrixWorld.decompose(s.position,s.quaternion,s.scale),s.translateX(A),s.translateZ(S),s.matrixWorld.compose(s.position,s.quaternion,s.scale),s.matrixWorldInverse.copy(s.matrixWorld).invert(),i[10]===-1)s.projectionMatrix.copy(e.projectionMatrix),s.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const E=a+S,b=l+S,C=y-A,w=_+(n-A),D=u*l/b*E,P=h*l/b*E;s.projectionMatrix.makePerspective(C,w,D,P,E,b),s.projectionMatrixInverse.copy(s.projectionMatrix).invert()}}
3982function xB(s,e){e===null?s.matrixWorld.copy(s.matrix):s.matrixWorld.multiplyMatrices(e.matrixWorld,s.matrix),s.matrixWorldInverse.copy(s.matrixWorld).invert()}function One(s,e,t){t===null?s.matrix.copy(e.matrixWorld):(s.matrix.copy(t.matrixWorld),s.matrix.invert(),s.matrix.multiply(e.matrixWorld)),s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),s.projectionMatrix.copy(e.projectionMatrix),s.projectionMatrixInverse.copy(e.projectionMatrixInverse),s.isPerspectiveCamera&&(s.fov=im*2*Math.atan(1/s.projectionMatrix.elements[5]),s.zoom=1)}function Ine(s){const e=this._controllerInputSources.indexOf(s.inputSource);if(e===-1)return;const t=this._controllers[e];if(t!==void 0){const n=this.getReferenceSpace();t.update(s.inputSource,s.frame,n),t.dispatchEvent({type:s.type,data:s.inputSource})}}function Fne(){const s=this._session,e=this._renderer;s.removeEventListener("select",this._onSessionEvent),s.removeEventListener("selectstart",this._onSessionEvent),s.removeEventListener("selectend",this._onSessionEvent),s.removeEventListener("squeeze",this._onSessionEvent),s.removeEventListener("squeezestart",this._onSessionEvent),s.removeEventListener("squeezeend",this._onSessionEvent),s.removeEventListener("end",this._onSessionEnd),s.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){const n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,e._resetXRState(),this._session=null,this._xrRenderTarget=null,this._sessionUsesLayers===!0)for(const t of this._layers)t.renderTarget=new l0(t.pixelwidth,t.pixelheight,{format:Pi,type:ki,depthTexture:new Ta(t.pixelwidth,t.pixelheight,t.stencilBuffer?Ja:gi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?to:eo),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function Vne(s){const e=this._controllers,t=this._controllerInputSources;for(let n=0;n<s.removed.length;n++){const i=s.removed[n],r=t.indexOf(i);r>=0&&(t[r]=null,e[r].disconnect(i))}for(let n=0;n<s.added.length;n++){const i=s.added[n];let r=t.indexOf(i);if(r===-1){for(let l=0;l<e.length;l++)if(l>=t.length){t.push(i),r=l;break}else if(t[l]===null){t[l]=i,r=l;break}if(r===-1)break}const a=e[r];a&&a.connect(i)}}function zne(s){return s.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(s.translation,s.quaternion),width:s.width/2,height:s.height/2,space:this._referenceSpace,viewPixelWidth:s.pixelwidth,viewPixelHeight:s.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(s.translation,s.quaternion),radius:s.radius,centralAngle:s.centralAngle,aspectRatio:s.aspectRatio,space:this._referenceSpace,viewPixelWidth:s.pixelwidth,viewPixelHeight:s.pixelheight,clearOnAccess:!1})}function Gne(s,e){if(e===void 0)return;const t=this._cameraXR,n=this._renderer,i=n.backend,r=this._glBaseLayer,a=this.getReferenceSpace(),l=e.getViewerPose(a);if(this._xrFrame=e,l!==null){const u=l.views;this._glBaseLayer!==null&&i.setXRTarget(r.framebuffer);let h=!1;u.length!==t.cameras.length&&(t.cameras.length=0,h=!0);for(let p=0;p<u.length;p++){const g=u[p];let y;if(this._supportsLayers===!0){const S=this._glBinding.getViewSubImage(this._glProjLayer,g);y=S.viewport,p===0&&i.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else y=r.getViewport(g);let _=this._cameras[p];_===void 0&&(_=new ps,_.layers.enable(p),_.viewport=new kt,this._cameras[p]=_),_.matrix.fromArray(g.transform.matrix),_.matrix.decompose(_.position,_.quaternion,_.scale),_.projectionMatrix.fromArray(g.projectionMatrix),_.projectionMatrixInverse.copy(_.projectionMatrix).invert(),_.viewport.set(y.x,y.y,y.width,y.height),p===0&&(t.matrix.copy(_.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),h===!0&&t.cameras.push(_)}
3982n.setOutputRenderTarget(this._xrRenderTarget)}for(let u=0;u<this._controllers.length;u++){const h=this._controllerInputSources[u],p=this._controllers[u];h!==null&&p!==void 0&&p.update(h,e,a)}this._currentAnimationLoop&&this._currentAnimationLoop(s,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}const SB=new Jy,$g=new Ge,SR=new kt,bR=new dm,TR=new rx,yT=new Ot,Vc=new kt;class Hne{constructor(e,t={}){this.isRenderer=!0;const{logarithmicDepthBuffer:n=!1,alpha:i=!0,depth:r=!0,stencil:a=!1,antialias:l=!1,samples:u=0,getFallback:h=null,colorBufferType:p=As,multiview:g=!1}=t;this.domElement=e.getDomElement(),this.backend=e,this.samples=u||l===!0?4:0,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=i,this.logarithmicDepthBuffer=n,this.outputColorSpace=lr,this.toneMapping=Rr,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=r,this.stencil=a,this.info=new KZ,this.overrideNodes={modelViewMatrix:null,modelNormalViewMatrix:null},this.library=new wz,this.lighting=new Lne,this._getFallback=h,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new kt(0,0,this._width,this._height),this._scissor=new kt(0,0,this._width,this._height),this._scissorTest=!1,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quad=new GE(new ys),this._quad.material.name="Renderer_output",this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTarget=null;const y=this.alpha===!0?0:1;this._clearColor=new kw(0,0,0,y),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this._colorBufferType=p,this._initialized=!1,this._initPromise=null,this._compilationPromises=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,type:Y0},this.xr=new Bne(this,g),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(_,S,A)=>{await this.compileAsync(_,S);const E=this._renderLists.get(_,S),b=this._renderContexts.get(_,S,this._renderTarget),C=_.overrideMaterial||A.material,w=this._objects.get(A,C,_,S,E.lightsNode,b,b.clippingContext),{fragmentShader:D,vertexShader:P}=w.getNodeBuilderState();return{fragmentShader:D,vertexShader:P}}}}
3982async init(){if(this._initialized)throw new Error("Renderer: Backend has already been initialized.");return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(i){if(this._getFallback!==null)try{this.backend=n=this._getFallback(i),await n.init(this)}catch(r){t(r);return}else{t(i);return}}this._nodes=new Cne(this,n),this._animation=new zZ(this._nodes,this.info),this._attributes=new YZ(n),this._background=new Wte(this,this._nodes),this._geometries=new jZ(this._attributes,this.info),this._textures=new cQ(this,n,this.info),this._pipelines=new JZ(n,this._nodes),this._bindings=new eQ(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new qZ(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new iQ(this.lighting),this._bundles=new Dne,this._renderContexts=new lQ,this._animation.start(),this._initialized=!0,e(this)}),this._initPromise)}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();const i=this._nodes.nodeFrame,r=i.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,u=this._compilationPromises,h=e.isScene===!0?e:SB;n===null&&(n=e);const p=this._renderTarget,g=this._renderContexts.get(n,t,p),y=this._activeMipmapLevel,_=[];this._currentRenderContext=g,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=_,i.renderId++,i.update(),g.depth=this.depth,g.stencil=this.stencil,g.clippingContext||(g.clippingContext=new vM),g.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,p);const S=this._renderLists.get(e,t);if(S.begin(),this._projectObject(e,t,0,S,g.clippingContext),n!==e&&n.traverseVisible(function(w){w.isLight&&w.layers.test(t.layers)&&S.pushLight(w)}),S.finish(),p!==null){this._textures.updateRenderTarget(p,y);const w=this._textures.get(p);g.textures=w.textures,g.depthTexture=w.depthTexture}else g.textures=null,g.depthTexture=null;this._background.update(h,S,g);const A=S.opaque,E=S.transparent,b=S.transparentDoublePass,C=S.lightsNode;this.opaque===!0&&A.length>0&&this._renderObjects(A,t,h,C),this.transparent===!0&&E.length>0&&this._renderTransparents(E,b,t,h,C),i.renderId=r,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._compilationPromises=u,this._handleObjectFunction=this._renderObjectDirect,await Promise.all(_)}async renderAsync(e,t){this._initialized===!1&&await this.init(),this._renderScene(e,t)}async waitForGPU(){await this.backend.waitForGPU()}set highPrecision(e){e===!0?(this.overrideNodes.modelViewMatrix=oN,this.overrideNodes.modelNormalViewMatrix=lN):this.highPrecision&&(this.overrideNodes.modelViewMatrix=null,this.overrideNodes.modelNormalViewMatrix=null)}get highPrecision(){return this.overrideNodes.modelViewMatrix===oN&&this.overrideNodes.modelNormalViewMatrix===lN}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getColorBufferType(){return this._colorBufferType}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost: 3983 3984Message: ${e.message}`;e.reason&&(t+=` 3985Reason: ${e.reason}`),console.error(t),this._isDeviceLost=!0}_renderBundle(e,t,n){const{bundleGroup:i,camera:r,renderList:a}=e,l=this._currentRenderContext,u=this._bundles.get(i,r),h=this.backend.get(u);h.renderContexts===void 0&&(h.renderContexts=new Set);const p=i.version!==h.version,g=h.renderContexts.has(l)===!1||p;if(h.renderContexts.add(l),g){this.backend.beginBundle(l),(h.renderObjects===void 0||p)&&(h.renderObjects=[]),this._currentRenderBundle=u;const{transparentDoublePass:y,transparent:_,opaque:S}=a;this.opaque===!0&&S.length>0&&this._renderObjects(S,r,t,n),this.transparent===!0&&_.length>0&&this._renderTransparents(_,y,r,t,n),this._currentRenderBundle=null,this.backend.finishBundle(l,u),h.version=i.version}else{const{renderObjects:y}=h;for(let _=0,S=y.length;_<S;_++){const A=y[_];this._nodes.needsRefresh(A)&&(this._nodes.updateBefore(A),this._nodes.updateForRender(A),this._bindings.updateForRender(A),this._nodes.updateAfter(A))}}this.backend.addBundle(l,u)}render(e,t){if(this._initialized===!1)return console.warn("THREE.Renderer: .render() called before the backend is initialized. Try using .renderAsync() instead."),this.renderAsync(e,t);this._renderScene(e,t)}_getFrameBufferTarget(){const{currentToneMapping:e,currentColorSpace:t}=this,n=e!==Rr,i=t!==Kt.workingColorSpace;if(n===!1&&i===!1)return null;const{width:r,height:a}=this.getDrawingBufferSize($g),{depth:l,stencil:u}=this;let h=this._frameBufferTarget;h===null&&(h=new Ql(r,a,{depthBuffer:l,stencilBuffer:u,type:this._colorBufferType,format:Pi,colorSpace:Kt.workingColorSpace,generateMipmaps:!1,minFilter:hi,magFilter:hi,samples:this.samples}),h.isPostProcessingRenderTarget=!0,this._frameBufferTarget=h);
3985const p=this.getOutputRenderTarget();return h.depthBuffer=l,h.stencilBuffer=u,p!==null?h.setSize(p.width,p.height,p.depth):h.setSize(r,a,1),h.viewport.copy(this._viewport),h.scissor.copy(this._scissor),h.viewport.multiplyScalar(this._pixelRatio),h.scissor.multiplyScalar(this._pixelRatio),h.scissorTest=this._scissorTest,h.multiview=p!==null?p.multiview:!1,h.resolveDepthBuffer=p!==null?p.resolveDepthBuffer:!0,h._autoAllocateDepthBuffer=p!==null?p._autoAllocateDepthBuffer:!1,h}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;const i=n?this._getFrameBufferTarget():null,r=this._nodes.nodeFrame,a=r.renderId,l=this._currentRenderContext,u=this._currentRenderObjectFunction,h=e.isScene===!0?e:SB,p=this._renderTarget||this._outputRenderTarget,g=this._activeCubeFace,y=this._activeMipmapLevel;let _;i!==null?(_=i,this.setRenderTarget(_)):_=p;const S=this._renderContexts.get(e,t,_);this._currentRenderContext=S,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,r.renderId=this.info.calls;const A=this.coordinateSystem,E=this.xr;if(t.coordinateSystem!==A&&E.isPresenting===!1&&(t.coordinateSystem=A,t.updateProjectionMatrix(),t.isArrayCamera))for(const se of t.cameras)se.coordinateSystem=A,se.updateProjectionMatrix();e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),E.enabled===!0&&E.isPresenting===!0&&(E.cameraAutoUpdate===!0&&E.updateCamera(t),t=E.getCamera());let b=this._viewport,C=this._scissor,w=this._pixelRatio;_!==null&&(b=_.viewport,C=_.scissor,w=1),this.getDrawingBufferSize($g),SR.set(0,0,$g.width,$g.height);const D=b.minDepth===void 0?0:b.minDepth,P=b.maxDepth===void 0?1:b.maxDepth;S.viewportValue.copy(b).multiplyScalar(w).floor(),S.viewportValue.width>>=y,S.viewportValue.height>>=y,S.viewportValue.minDepth=D,S.viewportValue.maxDepth=P,S.viewport=S.viewportValue.equals(SR)===!1,S.scissorValue.copy(C).multiplyScalar(w).floor(),S.scissor=this._scissorTest&&S.scissorValue.equals(SR)===!1,S.scissorValue.width>>=y,S.scissorValue.height>>=y,S.clippingContext||(S.clippingContext=new vM),S.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,_);const I=t.isArrayCamera?TR:bR;t.isArrayCamera||(yT.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),I.setFromProjectionMatrix(yT,t.coordinateSystem,t.reversedDepth));const F=this._renderLists.get(e,t);if(F.begin(),this._projectObject(e,t,0,F,S.clippingContext),F.finish(),this.sortObjects===!0&&F.sort(this._opaqueSort,this._transparentSort),_!==null){this._textures.updateRenderTarget(_,y);const se=this._textures.get(_);S.textures=se.textures,S.depthTexture=se.depthTexture,S.width=se.width,S.height=se.height,S.renderTarget=_,S.depth=_.depthBuffer,S.stencil=_.stencilBuffer}else S.textures=null,S.depthTexture=null,S.width=$g.width,S.height=$g.height,S.depth=this.depth,S.stencil=this.stencil;S.width>>=y,S.height>>=y,S.activeCubeFace=g,S.activeMipmapLevel=y,S.occlusionQueryCount=F.occlusionQueryCount,S.scissorValue.max(Vc.set(0,0,0,0)),S.scissorValue.x+S.scissorValue.width>S.width&&(S.scissorValue.width=Math.max(S.width-S.scissorValue.x,0)),S.scissorValue.y+S.scissorValue.height>S.height&&(S.scissorValue.height=Math.max(S.height-S.scissorValue.y,0)),this._background.update(h,F,S),S.camera=t,this.backend.beginRender(S);const{bundles:z,lightsNode:B,transparentDoublePass:O,transparent:W,opaque:ee}=F;return z.length>0&&this._renderBundles(z,h,B),this.opaque===!0&&ee.length>0&&this._renderObjects(ee,t,h,B),this.transparent===!0&&W.length>0&&this._renderTransparents(W,O,t,h,B),this.backend.finishRender(S),r.renderId=a,this._currentRenderContext=l,this._currentRenderObjectFunction=u,i!==null&&(this.setRenderTarget(p,g,y),this._renderOutput(_)),h.onAfterRender(this,e,t,_),S}_setXRLayerSize(e,t){this._width=e,this._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){const t=this._quad;this._nodes.hasOutputChange(e.texture)&&(t.material.fragmentNode=this._nodes.getOutputNode(e.texture),t.material.needsUpdate=!0);const n=this.autoClear,i=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(t,t.camera,!1),this.autoClear=n,this.xr.enabled=i}getMaxAnisotropy(){return this.backend.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}async getArrayBufferAsync(e){return await this.backend.getArrayBufferAsync(e)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._initialized&&this.backend.updateSize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._initialized&&this.backend.updateSize())}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){const t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,i){const r=this._scissor;
3985e.isVector4?r.copy(e):r.set(e,t,n,i)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e,this.backend.setScissorTest(e)}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,i,r=0,a=1){const l=this._viewport;e.isVector4?l.copy(e):l.set(e,t,n,i),l.minDepth=r,l.maxDepth=a}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)return console.warn("THREE.Renderer: .clear() called before the backend is initialized. Try using .clearAsync() instead."),this.clearAsync(e,t,n);const i=this._renderTarget||this._getFrameBufferTarget();let r=null;if(i!==null){this._textures.updateRenderTarget(i);const a=this._textures.get(i);r=this._renderContexts.getForClear(i),r.textures=a.textures,r.depthTexture=a.depthTexture,r.width=a.width,r.height=a.height,r.renderTarget=i,r.depth=i.depthBuffer,r.stencil=i.stencilBuffer,r.clearColorValue=this.backend.getClearColor(),r.activeCubeFace=this.getActiveCubeFace(),r.activeMipmapLevel=this.getActiveMipmapLevel()}this.backend.clear(e,t,n,r),i!==null&&this._renderTarget===null&&this._renderOutput(i)}clearColor(){return this.clear(!0,!1,!1)}clearDepth(){return this.clear(!1,!0,!1)}clearStencil(){return this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){this._initialized===!1&&await this.init(),this.clear(e,t,n)}async clearColorAsync(){this.clearAsync(!0,!1,!1)}async clearDepthAsync(){this.clearAsync(!1,!0,!1)}async clearStencilAsync(){this.clearAsync(!1,!1,!0)}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:Rr}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:Kt.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){this._initialized===!0&&(this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose(),this._frameBufferTarget!==null&&this._frameBufferTarget.dispose(),Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})),this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null),this._frameBufferTarget.dispose(),this._frameBufferTarget=null}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return console.warn("THREE.Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e);const n=this._nodes.nodeFrame,i=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls;const r=this.backend,a=this._pipelines,l=this._bindings,u=this._nodes,h=Array.isArray(e)?e:[e];if(h[0]===void 0||h[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");r.beginCompute(e);for(const p of h){if(a.has(p)===!1){const _=()=>{p.removeEventListener("dispose",_),a.delete(p),l.delete(p),u.delete(p)};p.addEventListener("dispose",_);const S=p.onInitFunction;S!==null&&S.call(p,{renderer:this})}u.updateForCompute(p),l.updateForCompute(p);const g=l.getForCompute(p),y=a.getForCompute(p,g);r.compute(e,p,g,y,t)}r.finishCompute(e),n.renderId=i}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return this._initialized===!1&&await this.init(),this.backend.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){return this._initialized===!1?(console.warn("THREE.Renderer: .hasFeature() called before the backend is initialized. Try using .hasFeatureAsync() instead."),!1):this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){this._initialized===!1&&await this.init(),this._textures.updateTexture(e)}initTexture(e){this._initialized===!1&&console.warn("THREE.Renderer: .initTexture() called before the backend is initialized. Try using .initTextureAsync() instead."),this._textures.updateTexture(e)}
3985copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=Vc.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Vc.copy(t).floor();else{console.error("THREE.Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Vc.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,i;n!==null?i=n.renderTarget:(i=this._renderTarget||this._getFrameBufferTarget(),i!==null&&(this._textures.updateRenderTarget(i),n=this._textures.get(i))),this._textures.updateTexture(e,{renderTarget:i}),this.backend.copyFramebufferToTexture(e,n,t)}copyTextureToTexture(e,t,n=null,i=null,r=0,a=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,i,r,a)}async readRenderTargetPixelsAsync(e,t,n,i,r,a=0,l=0){return this.backend.copyTextureToBuffer(e.textures[a],t,n,i,r,l)}_projectObject(e,t,n,i,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(r=r.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)i.pushLight(e);else if(e.isSprite){const u=t.isArrayCamera?TR:bR;if(!e.frustumCulled||u.intersectsSprite(e,t)){this.sortObjects===!0&&Vc.setFromMatrixPosition(e.matrixWorld).applyMatrix4(yT);const{geometry:h,material:p}=e;p.visible&&i.push(e,h,p,n,Vc.z,null,r)}}else if(e.isLineLoop)console.error("THREE.Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){const u=t.isArrayCamera?TR:bR;if(!e.frustumCulled||u.intersectsObject(e,t)){const{geometry:h,material:p}=e;if(this.sortObjects===!0&&(h.boundingSphere===null&&h.computeBoundingSphere(),Vc.copy(h.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(yT)),Array.isArray(p)){const g=h.groups;for(let y=0,_=g.length;y<_;y++){const S=g[y],A=p[S.materialIndex];A&&A.visible&&i.push(e,h,A,n,Vc.z,S,r)}}else p.visible&&i.push(e,h,p,n,Vc.z,null,r)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){const u=i;i=this._renderLists.get(e,t),i.begin(),u.pushBundle({bundleGroup:e,camera:t,renderList:i}),i.finish()}const l=e.children;for(let u=0,h=l.length;u<h;u++)this._projectObject(l[u],t,n,i,r)}_renderBundles(e,t,n){for(const i of e)this._renderBundle(i,t,n)}_renderTransparents(e,t,n,i,r){if(t.length>0){for(const{material:a}of t)a.side=yi;this._renderObjects(t,n,i,r,"backSide");for(const{material:a}of t)a.side=Za;this._renderObjects(e,n,i,r);for(const{material:a}of t)a.side=br}else this._renderObjects(e,n,i,r)}_renderObjects(e,t,n,i,r=null){for(let a=0,l=e.length;a<l;a++){const{object:u,geometry:h,material:p,group:g,clippingContext:y}=e[a];this._currentRenderObjectFunction(u,n,t,h,p,g,i,y,r)}}renderObject(e,t,n,i,r,a,l,u=null,h=null){let p,g,y;if(e.onBeforeRender(this,t,n,i,r,a),r.allowOverride===!0&&t.overrideMaterial!==null){const _=t.overrideMaterial;r.positionNode&&r.positionNode.isNode&&(p=_.positionNode,_.positionNode=r.positionNode),_.alphaTest=r.alphaTest,_.alphaMap=r.alphaMap,_.transparent=r.transparent||r.transmission>0,_.isShadowPassMaterial&&(_.side=r.shadowSide===null?r.side:r.shadowSide,r.depthNode&&r.depthNode.isNode&&(y=_.depthNode,_.depthNode=r.depthNode),r.castShadowNode&&r.castShadowNode.isNode&&(g=_.colorNode,_.colorNode=r.castShadowNode),r.castShadowPositionNode&&r.castShadowPositionNode.isNode&&(p=_.positionNode,_.positionNode=r.castShadowPositionNode)),r=_}r.transparent===!0&&r.side===br&&r.forceSinglePass===!1?(r.side=yi,this._handleObjectFunction(e,r,t,n,l,a,u,"backSide"),r.side=Za,this._handleObjectFunction(e,r,t,n,l,a,u,h),r.side=br):this._handleObjectFunction(e,r,t,n,l,a,u,h),p!==void 0&&(t.overrideMaterial.positionNode=p),y!==void 0&&(t.overrideMaterial.depthNode=y),g!==void 0&&(t.overrideMaterial.colorNode=g),e.onAfterRender(this,t,n,i,r,a)}_renderObjectDirect(e,t,n,i,r,a,l,u){const h=this._objects.get(e,t,n,i,r,this._currentRenderContext,l,u);h.drawRange=e.geometry.drawRange,h.group=a;const p=this._nodes.needsRefresh(h);p&&(this._nodes.updateBefore(h),this._geometries.updateForRender(h),this._nodes.updateForRender(h),this._bindings.updateForRender(h)),this._pipelines.updateForRender(h),this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(h),h.bundle=this._currentRenderBundle.bundleGroup),this.backend.draw(h,this.info),p&&this._nodes.updateAfter(h)}_createObjectPipeline(e,t,n,i,r,a,l,u){const h=this._objects.get(e,t,n,i,r,this._currentRenderContext,l,u);h.drawRange=e.geometry.drawRange,h.group=a,this._nodes.updateBefore(h),this._geometries.updateForRender(h),this._nodes.updateForRender(h),this._bindings.updateForRender(h),this._pipelines.getForRender(h,this._compilationPromises),this._nodes.updateAfter(h)}get compile(){return this.compileAsync}}class Dz{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}clone(){return Object.assign(new this.constructor,this)}}function kne(s){return s+(vd-s%vd)%vd}class Uz extends Dz{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t}get byteLength(){return kne(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}}class Lz extends Uz{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let qne=0;class Bz extends Lz{constructor(e,t){super("UniformBuffer_"+qne++,e?e.value:null),this.nodeUniform=e,this.groupNode=t}get buffer(){return this.nodeUniform.value}}
3985class Wne extends Lz{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[]}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){const t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){const e=this.bytesPerElement;let t=0;for(let n=0,i=this.uniforms.length;n<i;n++){const r=this.uniforms[n],a=r.boundary,l=r.itemSize*e,u=t%vd,h=u%a,p=u+h;t+=h,p!==0&&vd-p<l&&(t+=vd-p),r.offset=t/e,t+=l}return Math.ceil(t/vd)*vd}update(){let e=!1;for(const t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);console.error("THREE.WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset,a=e.getType();if(n[r]!==i){const l=this._getBufferForType(a);l[r]=n[r]=i,t=!0}return t}updateVector2(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset,a=e.getType();if(n[r+0]!==i.x||n[r+1]!==i.y){const l=this._getBufferForType(a);l[r+0]=n[r+0]=i.x,l[r+1]=n[r+1]=i.y,t=!0}return t}updateVector3(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset,a=e.getType();if(n[r+0]!==i.x||n[r+1]!==i.y||n[r+2]!==i.z){const l=this._getBufferForType(a);l[r+0]=n[r+0]=i.x,l[r+1]=n[r+1]=i.y,l[r+2]=n[r+2]=i.z,t=!0}return t}updateVector4(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset,a=e.getType();if(n[r+0]!==i.x||n[r+1]!==i.y||n[r+2]!==i.z||n[r+4]!==i.w){const l=this._getBufferForType(a);l[r+0]=n[r+0]=i.x,l[r+1]=n[r+1]=i.y,l[r+2]=n[r+2]=i.z,l[r+3]=n[r+3]=i.w,t=!0}return t}updateColor(e){let t=!1;const n=this.values,i=e.getValue(),r=e.offset;if(n[r+0]!==i.r||n[r+1]!==i.g||n[r+2]!==i.b){const a=this.buffer;a[r+0]=n[r+0]=i.r,a[r+1]=n[r+1]=i.g,a[r+2]=n[r+2]=i.b,t=!0}return t}updateMatrix3(e){let t=!1;const n=this.values,i=e.getValue().elements,r=e.offset;if(n[r+0]!==i[0]||n[r+1]!==i[1]||n[r+2]!==i[2]||n[r+4]!==i[3]||n[r+5]!==i[4]||n[r+6]!==i[5]||n[r+8]!==i[6]||n[r+9]!==i[7]||n[r+10]!==i[8]){const a=this.buffer;a[r+0]=n[r+0]=i[0],a[r+1]=n[r+1]=i[1],a[r+2]=n[r+2]=i[2],a[r+4]=n[r+4]=i[3],a[r+5]=n[r+5]=i[4],a[r+6]=n[r+6]=i[5],a[r+8]=n[r+8]=i[6],a[r+9]=n[r+9]=i[7],a[r+10]=n[r+10]=i[8],t=!0}return t}updateMatrix4(e){let t=!1;const n=this.values,i=e.getValue().elements,r=e.offset;return Yne(n,i,r)===!1&&(this.buffer.set(i,r),Xne(n,i,r),t=!0),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}}function Xne(s,e,t){for(let n=0,i=e.length;n<i;n++)s[t+n]=e[n]}function Yne(s,e,t){for(let n=0,i=e.length;n<i;n++)if(s[t+n]!==e[n])return!1;return!0}let jne=0;class Pz extends Wne{constructor(e,t){super(e),this.id=jne++,this.groupNode=t,this.isNodeUniformsGroup=!0}}class Oz extends Dz{constructor(e,t){super(e),this.texture=t,this.version=t?t.version:0,this.generation=null,this.isSampler=!0}set texture(e){if(this._texture===e)return;const t=()=>{this._texture=null,this.generation=null,this.version=0};this._texture&&this._texture.removeEventListener("dispose",t),this._texture=e,this.generation=null,this.version=0,this._texture&&this._texture.addEventListener("dispose",t)}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}clone(){const e=super.clone();return e._texture=null,e.texture=this.texture,e}}let Kne=0;class Zne extends Oz{constructor(e,t){super(e,t),this.id=Kne++,this.store=!1,this.isSampledTexture=!0}}class YE extends Zne{constructor(e,t,n,i=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=i}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update(
3985)}}class Iz extends YE{constructor(e,t,n,i=null){super(e,t,n,i),this.isSampledCubeTexture=!0}}class bN extends YE{constructor(e,t,n,i=null){super(e,t,n,i),this.isSampledTexture3D=!0}}const bB={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint"},Qne={low:"lowp",medium:"mediump",high:"highp"},TB={swizzleAssign:!0,storageBuffer:!1},MB={perspective:"smooth",linear:"noperspective"},EB={centroid:"centroid"},AB=` 3986precision highp float; 3987precision highp int; 3988precision highp sampler2D; 3989precision highp sampler3D; 3990precision highp samplerCube; 3991precision highp sampler2DArray; 3992 3993precision highp usampler2D; 3994precision highp usampler3D; 3995precision highp usamplerCube; 3996precision highp usampler2DArray; 3997 3998precision highp isampler2D; 3999precision highp isampler3D; 4000precision highp isamplerCube; 4001precision highp isampler2DArray; 4002 4003precision lowp sampler2DShadow; 4004precision lowp sampler2DArrayShadow; 4005precision lowp samplerCubeShadow; 4006`;class $ne extends Nz{constructor(e,t){super(e,t,new Nne),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==va}getMethod(e){return bB[e]||e}getBitcastMethod(e,t){return bB[`bitcast_${t}_${e}`]}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),i=[];for(const a of t.inputs)i.push(this.getType(a.type)+" "+a.name);return`${this.getType(t.type)} ${t.name}( ${i.join(", ")} ) { 4007 4008 ${n.vars} 4009 4010${n.code} 4011 return ${n.result}; 4012 4013}`}setupPBO(e){const t=e.value;if(t.pbo===void 0){const n=t.array,i=t.count*t.itemSize,{itemSize:r}=t,a=t.array.constructor.name.toLowerCase().includes("int");let l=a?Od:um;r===2?l=a?cm:Wu:r===3?l=a?pP:Qy:r===4&&(l=a?hm:Pi);const u={Float32Array:Bi,Uint8Array:ki,Uint16Array:$o,Uint32Array:gi,Int8Array:Ed,Int16Array:Ad,Int32Array:Zs,Uint8ClampedArray:ki},h=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(i/r))));let p=Math.ceil(i/r/h);h*p*r<i&&p++;const g=h*p*r,y=new n.constructor(g);y.set(n,0),t.array=y;const _=new Xl(t.array,h,p,l,u[t.array.constructor.name]||Bi);_.needsUpdate=!0,_.isPBOTexture=!0;const S=new nc(_,null,null);S.setPrecision("high"),t.pboNode=S,t.pbo=S.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?t.charAt(0)+"_"+e.name:super.getPropertyName(e,t)}generatePBO(e){const{node:t,indexNode:n}=e,i=t.value;if(this.renderer.backend.has(i)){const p=this.renderer.backend.get(i);p.pbo=i.pbo}const r=this.getUniformFromNode(i.pboNode,"texture",this.shaderStage,this.context.nodeName),a=this.getPropertyName(r);this.increaseUsage(n);const l=n.build(this,"uint"),u=this.getDataFromNode(e);let h=u.propertyName;if(h===void 0){const p=this.getVarFromNode(e);h=this.getPropertyName(p);const g=this.getDataFromNode(t);let y=g.propertySizeName;y===void 0&&(y=h+"Size",this.getVarFromNode(t,y,"uint"),this.addLineFlowCode(`${y} = uint( textureSize( ${a}, 0 ).x )`,e),g.propertySizeName=y);const{itemSize:_}=i,S="."+ym.join("").slice(0,_),A=`ivec2(${l} % ${y}, ${l} / ${y})`,E=this.generateTextureLoad(null,a,A,null,null,"0");let b="vec4";i.pbo.type===gi?b="uvec4":i.pbo.type===Zs&&(b="ivec4"),this.addLineFlowCode(`${h} = ${b}(${E})${S}`,e),u.propertyName=h}return h}generateTextureLoad(e,t,n,i,r,a="0"){let l;return i?r?l=`texelFetchOffset( ${t}, ivec3( ${n}, ${i} ), ${a}, ${r} )`:l=`texelFetch( ${t}, ivec3( ${n}, ${i} ), ${a} )`:r?l=`texelFetchOffset( ${t}, ${n}, ${a}, ${r} )`:l=`texelFetch( ${t}, ${n}, ${a} )`,e!==null&&e.isDepthTexture&&(l+=".x"),l}generateTexture(e,t,n,i,r){return i&&(n=`vec3( ${n}, ${i} )`),e.isDepthTexture?r?`textureOffset( ${t}, ${n}, ${r} ).x`:`texture( ${t}, ${n} ).x`:r?`textureOffset( ${t}, ${n}, ${r} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,i,r){return r?`textureLodOffset( ${t}, ${n}, ${i}, ${r} )`:`textureLod( ${t}, ${n}, ${i} )`}generateTextureBias(e,t,n,i,r){return r?`textureOffset( ${t}, ${n}, ${r}, ${i} )`:`texture( ${t}, ${n}, ${i} )`}generateTextureGrad(e,t,n,i,r){return r?`textureGradOffset( ${t}, ${n}, ${i[0]}, ${i[1]}, ${r} )`:`textureGrad( ${t}, ${n}, ${i[0]}, ${i[1]} )`}generateTextureCompare(e,t,n,i,r,a,l=this.shaderStage){if(l==="fragment")return r?a?`textureOffset( ${t}, vec4( ${n}, ${r}, ${i} ), ${a} )`:`texture( ${t}, vec4( ${n}, ${r}, ${i} ) )`:a?`textureOffset( ${t}, vec3( ${n}, ${i} ), ${a} )`:`texture( ${t}, vec3( ${n}, ${i} ) )`;console.error(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${l} shader.`)}getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const i of n)t.push(`${this.getVar(i.type,i.name,i.count)}
4013;`);return t.join(` 4014 `)}getUniforms(e){const t=this.uniforms[e],n=[],i={};for(const a of t){let l=null,u=!1;if(a.type==="texture"||a.type==="texture3D"){const p=a.node.value;let g="";(p.isDataTexture===!0||p.isData3DTexture===!0)&&(p.type===gi?g="u":p.type===Zs&&(g="i")),a.type==="texture3D"&&p.isArrayTexture===!1?l=`${g}sampler3D ${a.name};`:p.compareFunction?p.isArrayTexture===!0?l=`sampler2DArrayShadow ${a.name};`:l=`sampler2DShadow ${a.name};`:p.isArrayTexture===!0||p.isDataArrayTexture===!0||p.isCompressedArrayTexture===!0?l=`${g}sampler2DArray ${a.name};`:l=`${g}sampler2D ${a.name};`}else if(a.type==="cubeTexture")l=`samplerCube ${a.name};`;else if(a.type==="buffer"){const p=a.node,g=this.getType(p.bufferType),y=p.bufferCount,_=y>0?y:"";l=`${p.name} { 4015 ${g} ${a.name}[${_}]; 4016}; 4017`}else l=`${this.getVectorType(a.type)} ${this.getPropertyName(a,e)};`,u=!0;const h=a.node.precision;if(h!==null&&(l=Qne[h]+" "+l),u){l=" "+l;const p=a.groupNode.name;(i[p]||(i[p]=[])).push(l)}else l="uniform "+l,n.push(l)}let r="";for(const a in i){const l=i[a];r+=this._getGLSLUniformStruct(e+"_"+a,l.join(` 4018`))+` 4019`}return r+=n.join(` 4020`),r}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Zs){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);const i=n.array;i instanceof Uint32Array||i instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){const n=this.getAttributesArray();let i=0;for(const r of n)t+=`layout( location = ${i++} ) in ${r.type} ${r.name}; 4021`}return t}getStructMembers(e){const t=[];for(const n of e.members)t.push(` ${n.type} ${n.name};`);return t.join(` 4022`)}getStructs(e){const t=[],n=this.structs[e],i=[];for(const r of n)if(r.output)for(const a of r.members)i.push(`layout( location = ${a.index} ) out ${a.type} ${a.name};`);else{let a="struct "+r.name+` { 4023`;a+=this.getStructMembers(r),a+=` 4024}; 4025`,t.push(a)}return i.length===0&&i.push("layout( location = 0 ) out vec4 fragColor;"),` 4026`+i.join(` 4027`)+` 4028 4029`+t.join(` 4030`)}getVaryings(e){let t="";const n=this.varyings;if(e==="vertex"||e==="compute")for(const i of n){e==="compute"&&(i.needsInterpolation=!0);const r=this.getType(i.type);if(i.needsInterpolation)if(i.interpolationType){const a=MB[i.interpolationType]||i.interpolationType,l=EB[i.interpolationSampling]||"";t+=`${a} ${l} out ${r} ${i.name}; 4031`}else{const a=r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":"";t+=`${a}out ${r} ${i.name}; 4032`}else t+=`${r} ${i.name}; 4033`}else if(e==="fragment"){for(const i of n)if(i.needsInterpolation){const r=this.getType(i.type);if(i.interpolationType){const a=MB[i.interpolationType]||i.interpolationType,l=EB[i.interpolationSampling]||"";t+=`${a} ${l} in ${r} ${i.name}; 4034`}else{const a=r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":"";t+=`${a}in ${r} ${i.name}; 4035`}}}for(const i of this.builtins[e])t+=`${i}; 4036`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((n,i)=>n*i,1)}u`}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":null}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,n=this.shaderStage){const i=this.extensions[n]||(this.extensions[n]=new Map);i.has(e)===!1&&i.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if(e==="vertex"){const i=this.renderer.backend.extensions;this.object.isBatchedMesh&&i.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const n=this.extensions[e];if(n!==void 0)for(const{name:i,behavior:r}of n.values())t.push(`#extension ${i} : ${r}`);return t.join(` 4037`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=TB[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){const i=this.renderer.backend.extensions;i.has(n)&&(i.get(n),t=!0)}TB[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}
4037enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let n=0;n<e.length;n++){const i=e[n],r=this.getPropertyName(i.attributeNode);r&&(t+=`${i.varyingName} = ${r}; 4038 `)}return t}_getGLSLUniformStruct(e,t){return` 4039layout( std140 ) uniform ${e} { 4040${t} 4041};`}_getGLSLVertexCode(e){return`#version 300 es 4042 4043${this.getSignature()} 4044 4045// extensions 4046${e.extensions} 4047 4048// precision 4049${AB} 4050 4051// uniforms 4052${e.uniforms} 4053 4054// varyings 4055${e.varyings} 4056 4057// attributes 4058${e.attributes} 4059 4060// codes 4061${e.codes} 4062 4063void main() { 4064 4065 // vars 4066 ${e.vars} 4067 4068 // transforms 4069 ${e.transforms} 4070 4071 // flow 4072 ${e.flow} 4073 4074 gl_PointSize = 1.0; 4075 4076} 4077`}_getGLSLFragmentCode(e){return`#version 300 es 4078 4079${this.getSignature()} 4080 4081// extensions 4082${e.extensions} 4083 4084// precision 4085${AB} 4086 4087// uniforms 4088${e.uniforms} 4089 4090// varyings 4091${e.varyings} 4092 4093// codes 4094${e.codes} 4095 4096// structs 4097${e.structs} 4098 4099void main() { 4100 4101 // vars 4102 ${e.vars} 4103 4104 // flow 4105 ${e.flow} 4106 4107} 4108`}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){let n=`// code 4109 4110`;n+=this.flowCode[t];const i=this.flowNodes[t],r=i[i.length-1];for(const l of i){const u=this.getFlowData(l),h=l.name;h&&(n.length>0&&(n+=` 4111`),n+=` // flow -> ${h} 4112 `),n+=`${u.code} 4113 `,l===r&&t!=="compute"&&(n+=`// result 4114 `,t==="vertex"?(n+="gl_Position = ",n+=`${u.result};`):t==="fragment"&&(l.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${u.result};`)))}const a=e[t];a.extensions=this.getExtensions(t),a.uniforms=this.getUniforms(t),a.attributes=this.getAttributes(t),a.varyings=this.getVaryings(t),a.vars=this.getVars(t),a.structs=this.getStructs(t),a.codes=this.getCodes(t),a.transforms=this.getTransforms(t),a.flow=n}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,i=null){const r=super.getUniformFromNode(e,t,n,i),a=this.getDataFromNode(e,n,this.globalCache);let l=a.uniformGPU;if(l===void 0){const u=e.groupNode,h=u.name,p=this.getBindGroupArray(h,n);if(t==="texture")l=new YE(r.name,r.node,u),p.push(l);else if(t==="cubeTexture")l=new Iz(r.name,r.node,u),p.push(l);else if(t==="texture3D")l=new bN(r.name,r.node,u),p.push(l);else if(t==="buffer"){e.name=`NodeBuffer_${e.id}`,r.name=`buffer${e.id}`;const g=new Bz(e,u);g.name=e.name,p.push(g),l=g}else{const g=this.uniformGroups[n]||(this.uniformGroups[n]={});let y=g[h];y===void 0&&(y=new Pz(n+"_"+h,u),g[h]=y,p.push(y)),l=this.getNodeUniform(r,t),y.addUniform(l)}a.uniformGPU=l}return r}}let MR=null,Jg=null;class Fz{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={render:null,compute:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}createSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}getTimestampUID(e){const t=this.get(e);let n=e.isComputeNode===!0?"c":"r";return n+=":"+t.frameCalls+":"+e.id,n}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){qr("WebGPURenderer: Timestamp tracking is disabled.");return}const t=this.timestampQueryPool[e];if(!t){qr(`WebGPURenderer: No timestamp query pool for type '${e}' found.`);return}const n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async waitForGPU(){}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return MR=MR||new Ge,this.renderer.getDrawingBufferSize(MR)}setScissorTest(){}getClearColor(){const e=this.renderer;return Jg=Jg||new kw,e.getClearColor(Jg),Jg.getRGB(Jg),Jg}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:$N(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Ky} webgpu`),this.domElement=e),e}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}dispose(){}}let Jne=0;class eie{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}}class tie{constructor(e){this.backend=e}createAttribute(e,t){const n=this.backend,{gl:i}=n,r=e.array,a=e.usage||i.STATIC_DRAW,l=e.isInterleavedBufferAttribute?e.data:e,u=n.get(l);let h=u.bufferGPU;h===void 0&&(h=this._createBuffer(i,t,r,a),u.bufferGPU=h,u.bufferType=t,u.version=l.version);let p;if(r instanceof Float32Array)p=i.FLOAT;else if(typeof Float16Array<"u"&&r instanceof Float16Array)p=i.HALF_FLOAT;else if(r instanceof Uint16Array)e.isFloat16BufferAttribute?p=i.HALF_FLOAT:p=i.UNSIGNED_SHORT;else if(r instanceof Int16Array)p=i.SHORT;else if(r instanceof Uint32Array)p=i.UNSIGNED_INT;else if(r instanceof Int32Array)p=i.INT;else if(r instanceof Int8Array)p=i.BYTE;else if(r instanceof Uint8Array)p=i.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)p=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+r);let g={bufferGPU:h,bufferType:t,type:p,byteLength:r.byteLength,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:p===i.INT||p===i.UNSIGNED_INT||e.gpuType===Zs,id:Jne++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const y=this._createBuffer(i,t,r,a);g=new eie(g,y)}n.set(e,g)}updateAttribute(e){const t=this.backend,{gl:n}=t,i=e.array,r=e.isInterleavedBufferAttribute?e.data:e,a=t.get(r),l=a.bufferType,u=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(l,a.bufferGPU),u.length===0)n.bufferSubData(l,0,i);else{for(let h=0,p=u.length;h<p;h++){const g=u[h];n.bufferSubData(l,g.start*i.BYTES_PER_ELEMENT,i,g.start,g.count)}r.clearUpdateRanges()}n.bindBuffer(l,null),a.version=r.version}destroyAttribute(e){const t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);const i=t.get(e);n.deleteBuffer(i.bufferGPU),t.delete(e)}async getArrayBufferAsync(e){const t=this.backend,{gl:n}=t,i=e.isInterleavedBufferAttribute?e.data:e,{bufferGPU:r}=t.get(i),a=e.array,l=a.byteLength;n.bindBuffer(n.COPY_READ_BUFFER,r);const u=n.createBuffer();n.bindBuffer(n.COPY_WRITE_BUFFER,u),n.bufferData(n.COPY_WRITE_BUFFER,l,n.STREAM_READ),n.copyBufferSubData(n.COPY_READ_BUFFER,n.COPY_WRITE_BUFFER,0,0,l),await t.utils._clientWaitAsync();const h=new e.array.constructor(a.length);return n.bindBuffer(n.COPY_WRITE_BUFFER,u),n.getBufferSubData(n.COPY_WRITE_BUFFER,0,h),n.deleteBuffer(u),n.bindBuffer(n.COPY_READ_BUFFER,null),n.bindBuffer(n.COPY_WRITE_BUFFER,null),h.buffer}_createBuffer(e,t,n,i){const r=e.createBuffer();return e.bindBuffer(t,r),e.bufferData(t,n,i),e.bindBuffer(t,null),r}}let ER,e0;
4114class nie{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){const e=this.gl;ER={[Tr]:e.FUNC_ADD,[MM]:e.FUNC_SUBTRACT,[EM]:e.FUNC_REVERSE_SUBTRACT},e0={[Gu]:e.ZERO,[AM]:e.ONE,[RM]:e.SRC_COLOR,[by]:e.SRC_ALPHA,[LM]:e.SRC_ALPHA_SATURATE,[DM]:e.DST_COLOR,[CM]:e.DST_ALPHA,[NM]:e.ONE_MINUS_SRC_COLOR,[Ty]:e.ONE_MINUS_SRC_ALPHA,[UM]:e.ONE_MINUS_DST_COLOR,[wM]:e.ONE_MINUS_DST_ALPHA};const t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new kt().fromArray(t),this.currentViewport=new kt().fromArray(n),this._tempVec4=new kt}enable(e){const{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){const{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){const{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){const{gl:t}=this;e!==PN?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===qT?t.cullFace(t.BACK):e===ON?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){const{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setBlending(e,t,n,i,r,a,l,u){const{gl:h}=this;if(e===Qa){this.currentBlendingEnabled===!0&&(this.disable(h.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(h.BLEND),this.currentBlendingEnabled=!0),e!==bp){if(e!==this.currentBlending||u!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==Tr||this.currentBlendEquationAlpha!==Tr)&&(h.blendEquation(h.FUNC_ADD),this.currentBlendEquation=Tr,this.currentBlendEquationAlpha=Tr),u)switch(e){case $a:h.blendFuncSeparate(h.ONE,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA);break;case Dp:h.blendFunc(h.ONE,h.ONE);break;case Up:h.blendFuncSeparate(h.ZERO,h.ONE_MINUS_SRC_COLOR,h.ZERO,h.ONE);break;case Lp:h.blendFuncSeparate(h.DST_COLOR,h.ONE_MINUS_SRC_ALPHA,h.ZERO,h.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",e);break}else switch(e){case $a:h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA);break;case Dp:h.blendFuncSeparate(h.SRC_ALPHA,h.ONE,h.ONE,h.ONE);break;case Up:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Lp:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=u}return}r=r||t,a=a||n,l=l||i,(t!==this.currentBlendEquation||r!==this.currentBlendEquationAlpha)&&(h.blendEquationSeparate(ER[t],ER[r]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=r),(n!==this.currentBlendSrc||i!==this.currentBlendDst||a!==this.currentBlendSrcAlpha||l!==this.currentBlendDstAlpha)&&(h.blendFuncSeparate(e0[n],e0[i],e0[a],e0[l]),this.currentBlendSrc=n,this.currentBlendDst=i,this.currentBlendSrcAlpha=a,this.currentBlendDstAlpha=l),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){const{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthFunc!==e){const{gl:t}=this;switch(e){case My:t.depthFunc(t.NEVER);break;case Ey:t.depthFunc(t.ALWAYS);break;case Ay:t.depthFunc(t.LESS);break;case th:t.depthFunc(t.LEQUAL);break;case Ry:t.depthFunc(t.EQUAL);break;case Ny:t.depthFunc(t.GEQUAL);break;case Cy:t.depthFunc(t.GREATER);break;case wy:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,i){const r=this._tempVec4.set(e,t,n,i);if(this.currentScissor.equals(r)===!1){const{gl:a}=this;a.scissor(r.x,r.y,r.z,r.w),this.currentScissor.copy(r)}}viewport(e,t,n,i){const r=this._tempVec4.set(e,t,n,i);if(this.currentViewport.equals(r)===!1){const{gl:a}=this;a.viewport(r.x,r.y,r.z,r.w),this.currentViewport.copy(r)}}setScissorTest(e){const t=this.gl;e?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST)}setStencilTest(e){const{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){const{gl:i}=this;e.side===br?this.disable(i.CULL_FACE):this.enable(i.CULL_FACE);let r=e.side===yi;t&&(r=!r),this.setFlipSided(r),e.blending===$a&&e.transparent===!1?this.setBlending(Qa):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);const a=e.stencilWrite;if(this.setStencilTest(a),a&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.samples>1?this.enable(i.SAMPLE_ALPHA_TO_COVERAGE):this.disable(i.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let u=0;u<8;u++)u<n?this.enable(12288+u):this.disable(12288+u)}setPolygonOffset(e,t,n){const{gl:i}=this;e?(this.enable(i.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(i.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(i.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){const n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){const e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){const{gl:n,currentBoundFramebuffers:i}=this;return i[e]!==t?(n.bindFramebuffer(e,t),i[e]=t,e===n.DRAW_FRAMEBUFFER&&(i[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(i[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){const{gl:n}=this;let i=[],r=!1;if(e.textures!==null){i=this.currentDrawbuffers.get(t),i===void 0&&(i=[],this.currentDrawbuffers.set(t,i));const a=e.textures;if(i.length!==a.length||i[0]!==n.COLOR_ATTACHMENT0){for(let l=0,u=a.length;l<u;l++)i[l]=n.COLOR_ATTACHMENT0+l;i.length=a.length,r=!0}}else i[0]!==n.BACK&&(i[0]=n.BACK,r=!0);r&&n.drawBuffers(i)}activeTexture(e){const{gl:t,currentTextureSlot:n,maxTextures:i}=this;e===void 0&&(e=t.TEXTURE0+i-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){const{gl:i,currentTextureSlot:r,currentBoundTextures:a,maxTextures:l}=this;n===void 0&&(r===null?n=i.TEXTURE0+l-1:n=r);let u=a[n];u===void 0&&(u={type:void 0,texture:void 0},a[n]=u),(u.type!==e||u.texture!==t)&&(r!==n&&(i.activeTexture(n),this.currentTextureSlot=n),i.bindTexture(e,t),u.type=e,u.texture=t)}bindBufferBase(e,t,n){const{gl:i}=this,r=`${e}-${t}`;return this.currentBoundBufferBases[r]!==n?(i.bindBufferBase(e,t,n),this.currentBoundBufferBases[r]=n,!0):!1}unbindTexture(){const{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,i=n[t];i!==void 0&&i.type!==void 0&&(e.bindTexture(i.type,null),i.type=void 0,i.texture=void 0)}}class iie{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=va){const{gl:n,extensions:i}=this;let r;const a=Kt.getTransfer(t);if(e===ki)return n.UNSIGNED_BYTE;if(e===Z0)return n.UNSIGNED_SHORT_4_4_4_4;if(e===Q0)return n.UNSIGNED_SHORT_5_5_5_1;if(e===$0)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===J0)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Ed)return n.BYTE;if(e===Ad)return n.SHORT;if(e===$o)return n.UNSIGNED_SHORT;if(e===Zs)return n.INT;if(e===gi)return n.UNSIGNED_INT;if(e===Bi)return n.FLOAT;if(e===As)return n.HALF_FLOAT;if(e===PM)return n.ALPHA;if(e===Qy)return n.RGB;if(e===Pi)return n.RGBA;if(e===eo)return n.DEPTH_COMPONENT;if(e===to)return n.DEPTH_STENCIL;if(e===um)return n.RED;if(e===Od)return n.RED_INTEGER;if(e===Wu)return n.RG;if(e===cm)return n.RG_INTEGER;if(e===hm)return n.RGBA_INTEGER;if(e===Xc||e===Yc||e===jc||e===Kc)if(a===Et)if(r=i.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(e===Xc)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Yc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===jc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Kc)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=i.get("WEBGL_compressed_texture_s3tc"),r!==null){if(e===Xc)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Yc)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===jc)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Kc)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===Dy||e===Uy||e===Ly||e===By)if(r=i.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(e===Dy)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===Uy)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===Ly)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===By)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===Bp||e===Pp||e===Op)if(r=i.get("WEBGL_compressed_texture_etc"),r!==null){if(e===Bp||e===Pp)return a===Et?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(e===Op)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(e===Ip||e===Fp||e===Vp||e===zp||e===Gp||e===Hp||e===kp||e===qp||e===Wp||e===Xp||e===Yp||e===jp||e===Kp||e===Zp)if(r=i.get("WEBGL_compressed_texture_astc"),r!==null){if(e===Ip)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===Fp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===Vp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===zp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===Gp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===Hp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;
4114if(e===kp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===qp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===Wp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===Xp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===Yp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===jp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===Kp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===Zp)return a===Et?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Qp)if(r=i.get("EXT_texture_compression_bptc"),r!==null){if(e===Qp)return a===Et?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(e===$p||e===Jp||e===em||e===tm)if(r=i.get("EXT_texture_compression_rgtc"),r!==null){if(e===$p)return r.COMPRESSED_RED_RGTC1_EXT;if(e===Jp)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===em)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===tm)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===Ja?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){const{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,i)=>{function r(){const a=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(a===e.WAIT_FAILED){e.deleteSync(t),i();return}if(a===e.TIMEOUT_EXPIRED){requestAnimationFrame(r);return}e.deleteSync(t),n()}r()})}}let RB=!1,vT,AR,NB;class sie{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},RB===!1&&(this._init(),RB=!0)}_init(){const e=this.gl;vT={[ih]:e.REPEAT,[Sa]:e.CLAMP_TO_EDGE,[sh]:e.MIRRORED_REPEAT},AR={[Ai]:e.NEAREST,[K0]:e.NEAREST_MIPMAP_NEAREST,[ql]:e.NEAREST_MIPMAP_LINEAR,[hi]:e.LINEAR,[Md]:e.LINEAR_MIPMAP_NEAREST,[Mr]:e.LINEAR_MIPMAP_LINEAR},NB={[IM]:e.NEVER,[HM]:e.ALWAYS,[ex]:e.LESS,[tx]:e.LEQUAL,[FM]:e.EQUAL,[GM]:e.GEQUAL,[VM]:e.GREATER,[zM]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,i,r=!1){const{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+e+"'")}let u=t;if(t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.UNSIGNED_SHORT&&(u=a.R16),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.UNSIGNED_SHORT&&(u=a.RG16),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB){const h=r?nm:Kt.getTransfer(i);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=a.RGB8),n===a.UNSIGNED_SHORT&&(u=a.RGB16),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I),n===a.UNSIGNED_BYTE&&(u=h===Et?a.SRGB8:a.RGB8),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5),n===a.UNSIGNED_INT_10F_11F_11F_REV&&(u=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA){const h=r?nm:Kt.getTransfer(i);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=a.RGBA8),n===a.UNSIGNED_SHORT&&(u=a.RGBA16),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I),n===a.UNSIGNED_BYTE&&(u=h===Et?a.SRGB8_ALPHA8:a.RGBA8),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)}
4114return t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_SHORT&&(u=a.DEPTH_COMPONENT16),n===a.UNSIGNED_INT&&(u=a.DEPTH_COMPONENT24),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){const{gl:n,extensions:i,backend:r}=this,a=Kt.getPrimaries(Kt.workingColorSpace),l=t.colorSpace===va?null:Kt.getPrimaries(t.colorSpace),u=t.colorSpace===va||a===l?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,u),n.texParameteri(e,n.TEXTURE_WRAP_S,vT[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,vT[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,vT[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,AR[t.magFilter]);const h=t.mipmaps!==void 0&&t.mipmaps.length>0,p=t.minFilter===hi&&h?Mr:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,AR[p]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,NB[t.compareFunction])),i.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===Ai||t.minFilter!==ql&&t.minFilter!==Mr||t.type===Bi&&i.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){const g=i.get("EXT_texture_filter_anisotropic");n.texParameterf(e,g.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,r.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:n,defaultTextures:i}=this,r=this.getGLTextureType(e);let a=i[r];a===void 0&&(a=t.createTexture(),n.state.bindTexture(r,a),t.texParameteri(r,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(r,t.TEXTURE_MAG_FILTER,t.NEAREST),i[r]=a),n.set(e,{textureGPU:a,glTextureType:r,isDefault:!0})}createTexture(e,t){const{gl:n,backend:i}=this,{levels:r,width:a,height:l,depth:u}=t,h=i.utils.convert(e.format,e.colorSpace),p=i.utils.convert(e.type),g=this.getInternalFormat(e.internalFormat,h,p,e.colorSpace,e.isVideoTexture),y=n.createTexture(),_=this.getGLTextureType(e);i.state.bindTexture(_,y),this.setTextureParameters(_,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,r,g,a,l,u):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,r,g,a,l,u):e.isVideoTexture||n.texStorage2D(_,r,g,a,l),i.set(e,{textureGPU:y,glTextureType:_,glFormat:h,glType:p,glInternalFormat:g})}copyBufferToTexture(e,t){const{gl:n,backend:i}=this,{textureGPU:r,glTextureType:a,glFormat:l,glType:u}=i.get(t),{width:h,height:p}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),i.state.bindTexture(a,r),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,h,p,l,u,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),i.state.unbindTexture()}updateTexture(e,t){const{gl:n}=this,{width:i,height:r}=t,{textureGPU:a,glTextureType:l,glFormat:u,glType:h,glInternalFormat:p}=this.backend.get(e);if(!(e.isRenderTargetTexture||a===void 0))if(this.backend.state.bindTexture(l,a),this.setTextureParameters(l,e),e.isCompressedTexture){const g=e.mipmaps,y=t.image;for(let _=0;_<g.length;_++){const S=g[_];e.isCompressedArrayTexture?e.format!==n.RGBA?u!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,_,0,0,0,S.width,S.height,y.depth,u,S.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,_,0,0,0,S.width,S.height,y.depth,u,h,S.data):u!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,_,0,0,S.width,S.height,u,S.data):console.warn("Unsupported compressed texture format")}}else if(e.isCubeTexture){const g=t.images,y=e.mipmaps;for(let _=0;_<6;_++){const S=_T(g[_]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_,0,0,0,i,r,u,h,S);for(let A=0;A<y.length;A++){const E=y[A],b=_T(E.images[_]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+_,A+1,0,0,b.width,b.height,u,h,b)}}}else if(e.isDataArrayTexture||e.isArrayTexture){const g=t.image;if(e.layerUpdates.size>0){const y=JT(g.width,g.height,e.format,e.type);for(const _ of e.layerUpdates){const S=g.data.subarray(_*y/g.data.BYTES_PER_ELEMENT,(_+1)*y/g.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,_,g.width,g.height,1,u,h,S)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,g.width,g.height,g.depth,u,h,g.data)}else if(e.isData3DTexture){const g=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,g.width,g.height,g.depth,u,h,g.data)}
4114else if(e.isVideoTexture)e.update(),n.texImage2D(l,0,p,u,h,t.image);else{const g=e.mipmaps;if(g.length>0)for(let y=0,_=g.length;y<_;y++){const S=g[y],A=_T(S);n.texSubImage2D(l,y,0,0,S.width,S.height,u,h,A)}else{const y=_T(t.image);n.texSubImage2D(l,0,0,0,i,r,u,h,y)}}}generateMipmaps(e){const{gl:t,backend:n}=this,{textureGPU:i,glTextureType:r}=n.get(e);n.state.bindTexture(r,i),t.generateMipmap(r)}deallocateRenderBuffers(e){const{gl:t,backend:n}=this;if(e){const i=n.get(e);if(i.renderBufferStorageSetup=void 0,i.framebuffers){for(const r in i.framebuffers)t.deleteFramebuffer(i.framebuffers[r]);delete i.framebuffers}if(i.depthRenderbuffer&&(t.deleteRenderbuffer(i.depthRenderbuffer),delete i.depthRenderbuffer),i.stencilRenderbuffer&&(t.deleteRenderbuffer(i.stencilRenderbuffer),delete i.stencilRenderbuffer),i.msaaFrameBuffer&&(t.deleteFramebuffer(i.msaaFrameBuffer),delete i.msaaFrameBuffer),i.msaaRenderbuffers){for(let r=0;r<i.msaaRenderbuffers.length;r++)t.deleteRenderbuffer(i.msaaRenderbuffers[r]);delete i.msaaRenderbuffers}}}destroyTexture(e){const{gl:t,backend:n}=this,{textureGPU:i,renderTarget:r}=n.get(e);this.deallocateRenderBuffers(r),t.deleteTexture(i),n.delete(e)}copyTextureToTexture(e,t,n=null,i=null,r=0,a=0){const{gl:l,backend:u}=this,{state:h}=this.backend,{textureGPU:p,glTextureType:g,glType:y,glFormat:_}=u.get(t);h.bindTexture(g,p);let S,A,E,b,C,w,D,P,I;const F=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)S=n.max.x-n.min.x,A=n.max.y-n.min.y,E=n.isBox3?n.max.z-n.min.z:1,b=n.min.x,C=n.min.y,w=n.isBox3?n.min.z:0;else{const fe=Math.pow(2,-r);S=Math.floor(F.width*fe),A=Math.floor(F.height*fe),e.isDataArrayTexture||e.isArrayTexture?E=F.depth:e.isData3DTexture?E=Math.floor(F.depth*fe):E=1,b=0,C=0,w=0}i!==null?(D=i.x,P=i.y,I=i.z):(D=0,P=0,I=0),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,t.flipY),l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),l.pixelStorei(l.UNPACK_ALIGNMENT,t.unpackAlignment);const z=l.getParameter(l.UNPACK_ROW_LENGTH),B=l.getParameter(l.UNPACK_IMAGE_HEIGHT),O=l.getParameter(l.UNPACK_SKIP_PIXELS),W=l.getParameter(l.UNPACK_SKIP_ROWS),ee=l.getParameter(l.UNPACK_SKIP_IMAGES);l.pixelStorei(l.UNPACK_ROW_LENGTH,F.width),l.pixelStorei(l.UNPACK_IMAGE_HEIGHT,F.height),l.pixelStorei(l.UNPACK_SKIP_PIXELS,b),l.pixelStorei(l.UNPACK_SKIP_ROWS,C),l.pixelStorei(l.UNPACK_SKIP_IMAGES,w);const se=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isRenderTargetTexture||e.isDepthTexture){const fe=u.get(e),pe=u.get(t),k=u.get(fe.renderTarget),Q=u.get(pe.renderTarget),J=k.framebuffers[fe.cacheKey],Se=Q.framebuffers[pe.cacheKey];h.bindFramebuffer(l.READ_FRAMEBUFFER,J),h.bindFramebuffer(l.DRAW_FRAMEBUFFER,Se);let K=l.COLOR_BUFFER_BIT;e.isDepthTexture&&(K=l.DEPTH_BUFFER_BIT),l.blitFramebuffer(b,C,S,A,D,P,S,A,K,l.NEAREST),h.bindFramebuffer(l.READ_FRAMEBUFFER,null),h.bindFramebuffer(l.DRAW_FRAMEBUFFER,null)}else se?e.isDataTexture||e.isData3DTexture?l.texSubImage3D(g,a,D,P,I,S,A,E,_,y,F.data):t.isCompressedArrayTexture?l.compressedTexSubImage3D(g,a,D,P,I,S,A,E,_,F.data):l.texSubImage3D(g,a,D,P,I,S,A,E,_,y,F):e.isDataTexture?l.texSubImage2D(g,a,D,P,S,A,_,y,F.data):e.isCompressedTexture?l.compressedTexSubImage2D(g,a,D,P,F.width,F.height,_,F.data):l.texSubImage2D(g,a,D,P,S,A,_,y,F);l.pixelStorei(l.UNPACK_ROW_LENGTH,z),l.pixelStorei(l.UNPACK_IMAGE_HEIGHT,B),l.pixelStorei(l.UNPACK_SKIP_PIXELS,O),l.pixelStorei(l.UNPACK_SKIP_ROWS,W),l.pixelStorei(l.UNPACK_SKIP_IMAGES,ee),a===0&&t.generateMipmaps&&l.generateMipmap(g),h.unbindTexture()}copyFramebufferToTexture(e,t,n){const{gl:i}=this,{state:r}=this.backend,{textureGPU:a}=this.backend.get(e),{x:l,y:u,z:h,w:p}=n,g=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,y=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(g){const _=l!==0||u!==0;let S,A;if(e.isDepthTexture===!0?(S=i.DEPTH_BUFFER_BIT,A=i.DEPTH_ATTACHMENT,t.stencil&&(S|=i.STENCIL_BUFFER_BIT)):(S=i.COLOR_BUFFER_BIT,A=i.COLOR_ATTACHMENT0),_){const E=this.backend.get(t.renderTarget),b=E.framebuffers[t.getCacheKey()],C=E.msaaFrameBuffer;r.bindFramebuffer(i.DRAW_FRAMEBUFFER,b),r.bindFramebuffer(i.READ_FRAMEBUFFER,C);const w=y-u-p;
vendor: 2,313 bytes, line 4114
4114i.blitFramebuffer(l,w,l+h,w+p,l,w,l+h,w+p,S,i.NEAREST),r.bindFramebuffer(i.READ_FRAMEBUFFER,b),r.bindTexture(i.TEXTURE_2D,a),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,l,w,h,p),r.unbindTexture()}else{const E=i.createFramebuffer();r.bindFramebuffer(i.DRAW_FRAMEBUFFER,E),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,A,i.TEXTURE_2D,a,0),i.blitFramebuffer(0,0,h,p,0,0,h,p,S,i.NEAREST),i.deleteFramebuffer(E)}}else r.bindTexture(i.TEXTURE_2D,a),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,l,y-p-u,h,p),r.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,i=!1){const{gl:r}=this,a=t.renderTarget,{depthTexture:l,depthBuffer:u,stencilBuffer:h,width:p,height:g}=a;if(r.bindRenderbuffer(r.RENDERBUFFER,e),u&&!h){let y=r.DEPTH_COMPONENT24;i===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(r.RENDERBUFFER,a.samples,y,p,g):n>0?(l&&l.isDepthTexture&&l.type===r.FLOAT&&(y=r.DEPTH_COMPONENT32F),r.renderbufferStorageMultisample(r.RENDERBUFFER,n,y,p,g)):r.renderbufferStorage(r.RENDERBUFFER,y,p,g),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,e)}else u&&h&&(n>0?r.renderbufferStorageMultisample(r.RENDERBUFFER,n,r.DEPTH24_STENCIL8,p,g):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,p,g),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,e));r.bindRenderbuffer(r.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,i,r,a){const{backend:l,gl:u}=this,{textureGPU:h,glFormat:p,glType:g}=this.backend.get(e),y=u.createFramebuffer();u.bindFramebuffer(u.READ_FRAMEBUFFER,y);const _=e.isCubeTexture?u.TEXTURE_CUBE_MAP_POSITIVE_X+a:u.TEXTURE_2D;u.framebufferTexture2D(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,_,h,0);const S=this._getTypedArrayType(g),A=this._getBytesPerTexel(g,p),b=i*r*A,C=u.createBuffer();u.bindBuffer(u.PIXEL_PACK_BUFFER,C),u.bufferData(u.PIXEL_PACK_BUFFER,b,u.STREAM_READ),u.readPixels(t,n,i,r,p,g,0),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),await l.utils._clientWaitAsync();const w=new S(b/S.BYTES_PER_ELEMENT);return u.bindBuffer(u.PIXEL_PACK_BUFFER,C),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,w),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),u.deleteFramebuffer(y),w}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;
4114if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:n}=this;let i=0;if(e===n.UNSIGNED_BYTE&&(i=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(i=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(i=4),t===n.RGBA)return i*4;if(t===n.RGB)return i*3;if(t===n.ALPHA)return i}}function _T(s){return s.isDataTexture?s.image.data:typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas?s:s.data}class rie{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class aie{constructor(e){this.backend=e,this.maxAnisotropy=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){const n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}}const CB={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBKIT_WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-bc",EXT_texture_compression_bptc:"texture-compression-bptc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class oie{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:n,mode:i,object:r,type:a,info:l,index:u}=this;u!==0?n.drawElements(i,t,a,e):n.drawArrays(i,e,t),l.update(r,t,1)}renderInstances(e,t,n){const{gl:i,mode:r,type:a,index:l,object:u,info:h}=this;n!==0&&(l!==0?i.drawElementsInstanced(r,t,a,e,n):i.drawArraysInstanced(r,e,t,n),h.update(u,t,n))}renderMultiDraw(e,t,n){const{extensions:i,mode:r,object:a,info:l}=this;if(n===0)return;const u=i.get("WEBGL_multi_draw");if(u===null)for(let h=0;h<n;h++)this.render(e[h],t[h]);else{this.index!==0?u.multiDrawElementsWEBGL(r,t,0,this.type,e,0,n):u.multiDrawArraysWEBGL(r,e,0,t,0,n);let h=0;for(let p=0;p<n;p++)h+=t[p];l.update(a,h,1)}}renderMultiDrawInstances(e,t,n,i){const{extensions:r,mode:a,object:l,info:u}=this;if(n===0)return;const h=r.get("WEBGL_multi_draw");if(h===null)for(let p=0;p<n;p++)this.renderInstances(e[p],t[p],i[p]);else{this.index!==0?h.multiDrawElementsInstancedWEBGL(a,t,0,this.type,e,0,i,0,n):h.multiDrawArraysInstancedWE
4114BGL(a,e,0,t,0,i,0,n);let p=0;for(let g=0;g<n;g++)p+=t[g]*i[g];u.update(l,p,1)}}}class Vz{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.pendingResolve=!1}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}}class lie extends Vz{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){console.warn("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let i=0;i<this.maxQueries;i++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return qr(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;const n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(i){console.error("Error in beginQuery:",i),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){console.error("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{const e=[];for(const[i,r]of this.queryStates)if(r==="ended"){const a=this.queries[i];e.push(this.resolveQuery(a))}if(e.length===0)return this.lastValue;const n=(await Promise.all(e)).reduce((i,r)=>i+r,0);return this.lastValue=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,n}catch(e){return console.error("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,i=!1;const r=()=>{n&&(clearTimeout(n),n=null)},a=u=>{i||(i=!0,r(),t(u))},l=()=>{if(this.isDisposed){a(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){a(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(l,1);return}const p=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(p)/1e6)}catch(u){console.error("Error checking query:",u),t(this.lastValue)}};l()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(const e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class wB extends Fz{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,n={antialias:e.samples>0,alpha:!0,depth:e.depth,stencil:e.stencil},i=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function r(a){a.preventDefault();const l={api:"WebGL",message:a.statusMessage||"Unknown reason",reason:null,originalEvent:a};e.onDeviceLost(l)}this._onContextLost=r,e.domElement.addEventListener("webglcontextlost",r,!1),this.gl=i,this.extensions=new rie(this),this.capabilities=new aie(this),this.attributeUtils=new tie(this),this.textureUtils=new sie(this),this.bufferRenderer=new oie(this),this.state=new nie(this),this.utils=new iie(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile")}get coordinateSystem(){return Er}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async waitForGPU(){await this.utils._clientWaitAsync()}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){const i=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:i.RGBA8}),n!==null){const r=e.stencilBuffer?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:r}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&console.warn("THREE.WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new lie(this.gl,e,2048));const n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){const{state:t}=this,n=this.get(e);if(n.frameCalls=this.renderer.info.render.frameCalls,e.viewport)this.updateViewport(e);else{const{width:r,height:a}=this.getDrawingBufferSize();t.viewport(0,0,r,a)}if(e.scissor){const{x:r,y:a,width:l,height:u}=e.scissorValue;t.scissor(r,e.height-u-a,l,u)}this.initTimestampQuery(pp.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);const i=e.occlusionQueryCount;i>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(i),n.occlusionQueryObjects=new Array(i),n.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:n}=this,i=this.get(e),r=i.previousContext;n.resetVertexState();const a=e.occlusionQueryCount;a>0&&(a>i.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const l=e.textures;if(l!==null)for(let u=0;u<l.length;u++){const h=l[u];h.generateMipmaps&&this.generateMipmaps(h)}if(this._currentContext=r,this._resolveRenderTarget(e),r!==null)if(this._setFramebuffer(r),r.viewport)this.updateViewport(r);else{const{width:u,height:h}=this.getDrawingBufferSize();n.viewport(0,0,u,h)}this.prepareTimestampBuffer(pp.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){const t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:i}=t;if(n&&i){const r=new WeakSet,{gl:a}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;const l=()=>{let u=0;for(let h=0;h<n.length;h++){const p=n[h];p!==null&&a.getQueryParameter(p,a.QUERY_RESULT_AVAILABLE)&&(a.getQueryParameter(p,a.QUERY_RESULT)===0&&r.add(i[h]),n[h]=null,a.deleteQuery(p),u++)}u<n.length?requestAnimationFrame(l):t.occluded=r};l()}}isOccluded(e,t){const n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){const{state:t}=this,{x:n,y:i,width:r,height:a}=e.viewportValue;t.viewport(n,e.height-a-i,r,a)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){const e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,i=null,r=!0,a=!0){const{gl:l,renderer:u}=this;i===null&&(i={textures:null,clearColorValue:this.getClearColor()});let h=0;if(e&&(h|=l.COLOR_BUFFER_BIT),t&&(h|=l.DEPTH_BUFFER_BIT),n&&(h|=l.STENCIL_BUFFER_BIT),h!==0){let p;i.clearColorValue?p=i.clearColorValue:p=this.getClearColor();const g=u.getClearDepth(),y=u.getClearStencil();if(t&&this.state.setDepthMask(!0),i.textures===null)l.clearColor(p.r,p.g,p.b,p.a),l.clear(h);else{if(r&&this._setFramebuffer(i),e)for(let _=0;_<i.textures.length;
4114_++)_===0?l.clearBufferfv(l.COLOR,_,[p.r,p.g,p.b,p.a]):l.clearBufferfv(l.COLOR,_,[0,0,0,1]);t&&n?l.clearBufferfi(l.DEPTH_STENCIL,0,g,y):t?l.clearBufferfv(l.DEPTH,0,[g]):n&&l.clearBufferiv(l.STENCIL,0,[y]),r&&a&&this._resolveRenderTarget(i)}}}beginCompute(e){const{state:t,gl:n}=this,i=this.get(e);i.frameCalls=this.renderer.info.compute.frameCalls,t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(pp.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,i,r=null){const{state:a,gl:l}=this;this.discard===!1&&(l.enable(l.RASTERIZER_DISCARD),this.discard=!0);const{programGPU:u,transformBuffers:h,attributes:p}=this.get(i),g=this._getVaoKey(p),y=this.vaoCache[g];y===void 0?this.vaoCache[g]=this._createVao(p):a.setVertexState(y),a.useProgram(u),this._bindUniforms(n);const _=this._getTransformFeedback(h);l.bindTransformFeedback(l.TRANSFORM_FEEDBACK,_),l.beginTransformFeedback(l.POINTS),r=r!==null?r:t.count,Array.isArray(r)&&(qr("WebGLBackend.compute(): The count parameter must be a single number, not an array."),r=r[0]),p[0].isStorageInstancedBufferAttribute?l.drawArraysInstanced(l.POINTS,0,1,r):l.drawArrays(l.POINTS,0,r),l.endTransformFeedback(),l.bindTransformFeedback(l.TRANSFORM_FEEDBACK,null);for(let S=0;S<h.length;S++){const A=h[S];A.pbo&&this.has(A.pbo)&&this.textureUtils.copyBufferToTexture(A.transformBuffer,A.pbo),A.switchBuffers()}}finishCompute(e){const t=this.gl;this.discard=!1,t.disable(t.RASTERIZER_DISCARD),this.prepareTimestampBuffer(pp.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}draw(e){const{object:t,pipeline:n,material:i,context:r,hardwareClippingPlanes:a}=e,{programGPU:l}=this.get(n),{gl:u,state:h}=this,p=this.get(r),g=e.getDrawParameters();if(g===null)return;this._bindUniforms(e.getBindings());const y=t.isMesh&&t.matrixWorld.determinant()<0;h.setMaterial(i,y,a),h.useProgram(l);const _=e.getAttributes(),S=this.get(_);let A=S.vaoGPU;if(A===void 0){const z=this._getVaoKey(_);A=this.vaoCache[z],A===void 0&&(A=this._createVao(_),this.vaoCache[z]=A,S.vaoGPU=A)}const E=e.getIndex(),b=E!==null?this.get(E).bufferGPU:null;h.setVertexState(A,b);const C=p.lastOcclusionObject;if(C!==t&&C!==void 0){if(C!==null&&C.occlusionTest===!0&&(u.endQuery(u.ANY_SAMPLES_PASSED),p.occlusionQueryIndex++),t.occlusionTest===!0){const z=u.createQuery();u.beginQuery(u.ANY_SAMPLES_PASSED,z),p.occlusionQueries[p.occlusionQueryIndex]=z,p.occlusionQueryObjects[p.occlusionQueryIndex]=t}p.lastOcclusionObject=t}const w=this.bufferRenderer;t.isPoints?w.mode=u.POINTS:t.isLineSegments?w.mode=u.LINES:t.isLine?w.mode=u.LINE_STRIP:t.isLineLoop?w.mode=u.LINE_LOOP:i.wireframe===!0?(h.setLineWidth(i.wireframeLinewidth*this.renderer.getPixelRatio()),w.mode=u.LINES):w.mode=u.TRIANGLES;const{vertexCount:D,instanceCount:P}=g;let{firstVertex:I}=g;if(w.object=t,E!==null){I*=E.array.BYTES_PER_ELEMENT;const z=this.get(E);w.index=E.count,w.type=z.type}else w.index=0;const F=()=>{t.isBatchedMesh?t._multiDrawInstances!==null?(qr("THREE.WebGLBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),w.renderMultiDrawInstances(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount,t._multiDrawInstances)):this.hasFeature("WEBGL_multi_draw")?w.renderMultiDraw(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount):qr("THREE.WebGLRenderer: WEBGL_multi_draw not supported."):P>1?w.renderInstances(I,D,P):w.render(I,D)};if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){const z=this.get(e.camera),B=e.camera.cameras,O=e.getBindingGroup("cameraIndex").bindings[0];if(z.indexesGPU===void 0||z.indexesGPU.length!==B.length){const k=new Uint32Array([0,0,0,0]),Q=[];for(let J=0,Se=B.length;J<Se;J++){const K=u.createBuffer();k[0]=J,u.bindBuffer(u.UNIFORM_BUFFER,K),u.bufferData(u.UNIFORM_BUFFER,k,u.STATIC_DRAW),Q.push(K)}z.indexesGPU=Q}const W=this.get(O),ee=this.renderer.getPixelRatio(),se=this._currentContext.renderTarget,fe=this._isRenderCameraDepthArray(this._currentContext),pe=this._currentContext.activeCubeFace;if(fe){const k=this.get(se.depthTexture);if(k.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){k.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;const{stencilBuffer:Q}=se;for(let J=0,Se=B.length;J<Se;J++)this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J,this._setFramebuffer(this._currentContext),this.clear(!1,!0,Q,this._currentContext,!1,!1);this.renderer._activeCubeFace=pe,this._currentContext.activeCubeFace=pe}}for(let k=0,Q=B.length;k<Q;k++){const J=B[k];
4114if(t.layers.test(J.layers)){fe&&(this.renderer._activeCubeFace=k,this._currentContext.activeCubeFace=k,this._setFramebuffer(this._currentContext));const Se=J.viewport;if(Se!==void 0){const K=Se.x*ee,oe=Se.y*ee,we=Se.width*ee,Ie=Se.height*ee;h.viewport(Math.floor(K),Math.floor(e.context.height-Ie-oe),Math.floor(we),Math.floor(Ie))}h.bindBufferBase(u.UNIFORM_BUFFER,W.index,z.indexesGPU[k]),F()}this._currentContext.activeCubeFace=pe,this.renderer._activeCubeFace=pe}}else F()}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e){this.textureUtils.destroyTexture(e)}async copyTextureToBuffer(e,t,n,i,r,a){return this.textureUtils.copyTextureToBuffer(e,t,n,i,r,a)}createSampler(){}destroySampler(){}createNodeBuilder(e,t){return new $ne(e,t)}createProgram(e){const t=this.gl,{stage:n,code:i}=e,r=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(r,i),t.compileShader(r),this.set(e,{shaderGPU:r})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){const n=this.gl,i=e.pipeline,{fragmentProgram:r,vertexProgram:a}=i,l=n.createProgram(),u=this.get(r).shaderGPU,h=this.get(a).shaderGPU;if(n.attachShader(l,u),n.attachShader(l,h),n.linkProgram(l),this.set(i,{programGPU:l,fragmentShader:u,vertexShader:h}),t!==null&&this.parallel){const p=new Promise(g=>{const y=this.parallel,_=()=>{n.getProgramParameter(l,y.COMPLETION_STATUS_KHR)?(this._completeCompile(e,i),g()):requestAnimationFrame(_)};_()});t.push(p);return}this._completeCompile(e,i)}_handleSource(e,t){const n=e.split(` 4115`),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let l=r;l<a;l++){const u=l+1;i.push(`${u===t?">":" "} ${u}: ${n[l]}`)}return i.join(` 4116`)}
4116_getShaderErrors(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),a=(e.getShaderInfoLog(t)||"").trim();if(i&&a==="")return"";const l=/ERROR: 0:(\d+)/.exec(a);if(l){const u=parseInt(l[1]);return n.toUpperCase()+` 4117 4118`+a+` 4119 4120`+this._handleSource(e.getShaderSource(t),u)}else return a}_logProgramError(e,t,n){if(this.renderer.debug.checkShaderErrors){const i=this.gl,a=(i.getProgramInfoLog(e)||"").trim();if(i.getProgramParameter(e,i.LINK_STATUS)===!1)if(typeof this.renderer.debug.onShaderError=="function")this.renderer.debug.onShaderError(i,e,n,t);else{const l=this._getShaderErrors(i,n,"vertex"),u=this._getShaderErrors(i,t,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(e,i.VALIDATE_STATUS)+` 4121 4122Program Info Log: `+a+` 4123`+l+` 4124`+u)}else a!==""&&console.warn("THREE.WebGLProgram: Program Info Log:",a)}}_completeCompile(e,t){const{state:n,gl:i}=this,r=this.get(t),{programGPU:a,fragmentShader:l,vertexShader:u}=r;i.getProgramParameter(a,i.LINK_STATUS)===!1&&this._logProgramError(a,l,u),n.useProgram(a);const h=e.getBindings();this._setupBindings(h,a),this.set(t,{programGPU:a})}createComputePipeline(e,t){const{state:n,gl:i}=this,r={stage:"fragment",code:`#version 300 es 4125precision highp float; 4126void main() {}`};this.createProgram(r);const{computeProgram:a}=e,l=i.createProgram(),u=this.get(r).shaderGPU,h=this.get(a).shaderGPU,p=a.transforms,g=[],y=[];for(let E=0;E<p.length;E++){const b=p[E];g.push(b.varyingName),y.push(b.attributeNode)}i.attachShader(l,u),i.attachShader(l,h),i.transformFeedbackVaryings(l,g,i.SEPARATE_ATTRIBS),i.linkProgram(l),i.getProgramParameter(l,i.LINK_STATUS)===!1&&this._logProgramError(l,u,h),n.useProgram(l),this._setupBindings(t,l);const _=a.attributes,S=[],A=[];for(let E=0;E<_.length;E++){const b=_[E].node.attribute;S.push(b),this.has(b)||this.attributeUtils.createAttribute(b,i.ARRAY_BUFFER)}for(let E=0;E<y.length;E++){const b=y[E].attribute;this.has(b)||this.attributeUtils.createAttribute(b,i.ARRAY_BUFFER);const C=this.get(b);A.push(C)}this.set(e,{programGPU:l,transformBuffers:A,attributes:S})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,i=0;for(const r of t){this.set(r,{textures:i,uniformBuffers:n});for(const a of r.bindings)a.isUniformBuffer&&n++,a.isSampledTexture&&i++}}this.updateBindings(e,t)}updateBindings(e){const{gl:t}=this,n=this.get(e);let i=n.uniformBuffers,r=n.textures;for(const a of e.bindings){const l=this.get(a);if(a.isUniformsGroup||a.isUniformBuffer){const u=a.buffer;let{bufferGPU:h}=this.get(u);h===void 0?(h=t.createBuffer(),t.bindBuffer(t.UNIFORM_BUFFER,h),t.bufferData(t.UNIFORM_BUFFER,u,t.DYNAMIC_DRAW),this.set(u,{bufferGPU:h})):(t.bindBuffer(t.UNIFORM_BUFFER,h),t.bufferSubData(t.UNIFORM_BUFFER,0,u)),l.index=i++,l.bufferGPU=h,this.set(a,l)}else if(a.isSampledTexture){const{textureGPU:u,glTextureType:h}=this.get(a.texture);l.index=r++,l.textureGPU=u,l.glTextureType=h,this.set(a,l)}}}updateBinding(e){const t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){const i=this.get(e).bufferGPU,r=e.buffer;t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,t.DYNAMIC_DRAW)}}createIndexAttribute(e){const t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;const t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){const t=Object.keys(CB).filter(i=>CB[i]===e),n=this.extensions;for(let i=0;i<t.length;i++)if(n.has(t[i]))return!0;return!1}getMaxAnisotropy(){return this.capabilities.getMaxAnisotropy()}copyTextureToTexture(e,t,n=null,i=null,r=0,a=0){this.textureUtils.copyTextureToTexture(e,t,n,i,r,a)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}_setFramebuffer(e){const{gl:t,state:n}=this;let i=null;if(e.textures!==null){const r=e.renderTarget,a=this.get(r),{samples:l,depthBuffer:u,stencilBuffer:h}
vendor: 14,003 bytes, line 4126
4126=r,p=r.isWebGLCubeRenderTarget===!0,g=r.isRenderTarget3D===!0,y=r.depth>1,_=r.isXRRenderTarget===!0,S=_===!0&&r._hasExternalTextures===!0;let A=a.msaaFrameBuffer,E=a.depthRenderbuffer;const b=this.extensions.get("WEBGL_multisampled_render_to_texture"),C=this.extensions.get("OVR_multiview2"),w=this._useMultisampledExtension(r),D=LV(e);let P;if(p?(a.cubeFramebuffers||(a.cubeFramebuffers={}),P=a.cubeFramebuffers[D]):_&&S===!1?P=this._xrFramebuffer:(a.framebuffers||(a.framebuffers={}),P=a.framebuffers[D]),P===void 0){P=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,P);const I=e.textures,F=[];if(p){a.cubeFramebuffers[D]=P;const{textureGPU:B}=this.get(I[0]),O=this.renderer._activeCubeFace,W=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+O,B,W)}else{a.framebuffers[D]=P;for(let B=0;B<I.length;B++){const O=I[B],W=this.get(O);W.renderTarget=e.renderTarget,W.cacheKey=D;const ee=t.COLOR_ATTACHMENT0+B;if(r.multiview)C.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,ee,W.textureGPU,0,l,0,2);else if(g||y){const se=this.renderer._activeCubeFace,fe=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,ee,W.textureGPU,fe,se)}else if(w)b.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ee,t.TEXTURE_2D,W.textureGPU,0,l);else{const se=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,ee,t.TEXTURE_2D,W.textureGPU,se)}}}const z=h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(r._autoAllocateDepthBuffer===!0){const B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,w),a.xrDepthRenderbuffer=B,F.push(h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,z,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){F.push(h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);const B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=D,r.multiview)C.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,z,B.textureGPU,0,l,0,2);else if(S&&w)b.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,z,t.TEXTURE_2D,B.textureGPU,0,l);else if(e.depthTexture.isArrayTexture){const O=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,z,B.textureGPU,0,O)}else t.framebufferTexture2D(t.FRAMEBUFFER,z,t.TEXTURE_2D,B.textureGPU,0)}a.depthInvalidationArray=F}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,P);const F=this.renderer._activeCubeFace,z=this.get(e.depthTexture),B=h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,z.textureGPU,0,F)}if((_||w||r.multiview)&&r._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,P);const F=this.get(e.textures[0]);r.multiview?C.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,F.textureGPU,0,l,0,2):w?b.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0);const z=h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(r._autoAllocateDepthBuffer===!0){const B=a.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,z,t.RENDERBUFFER,B)}else{const B=this.get(e.depthTexture);r.multiview?C.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,z,B.textureGPU,0,l,0,2):w?b.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,z,t.TEXTURE_2D,B.textureGPU,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,z,t.TEXTURE_2D,B.textureGPU,0)}}}if(l>0&&w===!1&&!r.multiview){if(A===void 0){const I=[];A=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,A);const F=[],z=e.textures;for(let B=0;B<z.length;B++){F[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,F[B]),I.push(t.COLOR_ATTACHMENT0+B);const O=e.textures[B],W=this.get(O);t.renderbufferStorageMultisample(t.RENDERBUFFER,l,W.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,F[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),a.msaaFrameBuffer=A,a.msaaRenderbuffers=F,u&&E===void 0){E=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(E,e,l),a.depthRenderbuffer=E;const B=h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;I.push(B)}a.invalidationArray=I}i=a.msaaFrameBuffer}else i=P;n.drawBuffers(e,P)}n.bindFramebuffer(t.FRAMEBUFFER,i)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){const i=this.get(e[n]);t+=":"+i.id}return t}_createVao(e){const{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let i=0;i<e.length;i++){const r=e[i],a=this.get(r);t.bindBuffer(t.ARRAY_BUFFER,a.bufferGPU),t.enableVertexAttribArray(i);let l,u;r.isInterleavedBufferAttribute===!0?(l=r.data.stride*a.bytesPerElement,u=r.offset*a.bytesPerElement):(l=0,u=0),a.isInteger?t.vertexAttribIPointer(i,r.itemSize,a.type,l,u):t.vertexAttribPointer(i,r.itemSize,a.type,r.normalized,l,u),r.isInstancedBufferAttribute&&!r.isInterleavedBufferAttribute?t.vertexAttribDivisor(i,r.meshPerAttribute):r.isInterleavedBufferAttribute&&r.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(i,r.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let r=0;r<e.length;r++)t+=":"+e[r].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;const{gl:i}=this;n=i.createTransformFeedback(),i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,n);for(let r=0;r<e.length;r++){const a=e[r];i.bindBufferBase(i.TRANSFORM_FEEDBACK_BUFFER,r,a.transformBuffer)}return i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){const n=this.gl;for(const i of e)for(const r of i.bindings){const l=this.get(r).index;if(r.isUniformsGroup||r.isUniformBuffer){const u=n.getUniformBlockIndex(t,r.name);n.uniformBlockBinding(t,u,l)}else if(r.isSampledTexture){const u=n.getUniformLocation(t,r.name);n.uniform1i(u,l)}}}_bindUniforms(e){const{gl:t,state:n}=this;for(const i of e)for(const r of i.bindings){const a=this.get(r),l=a.index;r.isUniformsGroup||r.isUniformBuffer?n.bindBufferBase(t.UNIFORM_BUFFER,l,a.bufferGPU):r.isSampledTexture&&n.bindTexture(a.glTextureType,a.textureGPU,t.TEXTURE0+l)}}_resolveRenderTarget(e){const{gl:t,state:n}=this,i=e.renderTarget;if(e.textures!==null&&i){const r=this.get(i);if(i.samples>0&&this._useMultisampledExtension(i)===!1){const a=r.framebuffers[e.getCacheKey()];let l=t.COLOR_BUFFER_BIT;i.resolveDepthBuffer&&(i.depthBuffer&&(l|=t.DEPTH_BUFFER_BIT),i.stencilBuffer&&i.resolveStencilBuffer&&(l|=t.STENCIL_BUFFER_BIT));const u=r.msaaFrameBuffer,h=r.msaaRenderbuffers,p=e.textures,g=p.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,u),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,a),g)for(let y=0;y<p.length;y++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.TEXTURE_2D,null,0);for(let y=0;y<p.length;y++){if(g){const{textureGPU:_}=this.get(p[y]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h[y]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,_,0)}if(e.scissor){const{x:_,y:S,width:A,height:E}=e.scissorValue,b=e.height-E-S;t.blitFramebuffer(_,b,_+A,b+E,_,b,_+A,b+E,l,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,l,t.NEAREST)}if(g)for(let y=0;y<p.length;y++){const{textureGPU:_}=this.get(p[y]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.RENDERBUFFER,h[y]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.TEXTURE_2D,_,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,r.invalidationArray)}else if(i.resolveDepthBuffer===!1&&r.framebuffers){const a=r.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,a),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,r.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const cy={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list",TriangleStrip:"triangle-strip"},Sr={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},ga={Store:"store"},si={Load:"load",Clear:"clear"},DB={CCW:"ccw",CW:"cw"},UB={None:"none",Back:"back"},qy={Uint16:"uint16",Uint32:"uint32"},re={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},RR={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},cp={Linear:"linear",Nearest:"nearest"},Vn={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},sp={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},LB={None:0,All:15},dd={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},NR={Storage:"storage",ReadOnlyStorage:"read-only-storage"},CR={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},BB={NonFiltering:"non-filtering",Comparison:"comparison"},rp={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},PB={TwoD:"2d",ThreeD:"3d"},Ps={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},uie={All:"all"},xT={Vertex:"vertex",Instance:"instance"},TN={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"};class cie extends Oz{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){this.texture=this.textureNode.value}}class hie extends Uz{constructor(e,t){super(e,t?t.array:null),this.attribute=t,this.isStorageBuffer=!0}}let die=0;class fie extends hie{constructor(e,t){super("StorageBuffer_"+die++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Ar.READ_WRITE,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class pie extends kd{constructor(e){super(),this.device=e;const t=`
4127struct VarysStruct { 4128 @builtin( position ) Position: vec4<f32>, 4129 @location( 0 ) vTex : vec2<f32> 4130}; 4131 4132@vertex 4133fn main( @builtin( vertex_index ) vertexIndex : u32 ) -> VarysStruct { 4134 4135 var Varys : VarysStruct; 4136 4137 var pos = array< vec2<f32>, 4 >( 4138 vec2<f32>( -1.0, 1.0 ), 4139 vec2<f32>( 1.0, 1.0 ), 4140 vec2<f32>( -1.0, -1.0 ), 4141 vec2<f32>( 1.0, -1.0 ) 4142 ); 4143 4144 var tex = array< vec2<f32>, 4 >( 4145 vec2<f32>( 0.0, 0.0 ), 4146 vec2<f32>( 1.0, 0.0 ), 4147 vec2<f32>( 0.0, 1.0 ), 4148 vec2<f32>( 1.0, 1.0 ) 4149 ); 4150 4151 Varys.vTex = tex[ vertexIndex ]; 4152 Varys.Position = vec4<f32>( pos[ vertexIndex ], 0.0, 1.0 ); 4153 4154 return Varys; 4155 4156} 4157`,n=` 4158@group( 0 ) @binding( 0 ) 4159var imgSampler : sampler; 4160 4161@group( 0 ) @binding( 1 ) 4162var img : texture_2d<f32>; 4163 4164@fragment 4165fn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> { 4166 4167 return textureSample( img, imgSampler, vTex ); 4168 4169} 4170`,i=` 4171@group( 0 ) @binding( 0 ) 4172var imgSampler : sampler; 4173 4174@group( 0 ) @binding( 1 ) 4175var img : texture_2d<f32>; 4176 4177@fragment 4178fn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> { 4179 4180 return textureSample( img, imgSampler, vec2( vTex.x, 1.0 - vTex.y ) ); 4181 4182} 4183`;this.mipmapSampler=e.createSampler({minFilter:cp.Linear}),this.flipYSampler=e.createSampler({minFilter:cp.Nearest}),this.transferPipelines={},this.flipYPipelines={},this.mipmapVertexShaderModule=e.createShaderModule({label:"mipmapVertex",code:t}),this.mipmapFragmentShaderModule=e.createShaderModule({label:"mipmapFragment",code:n}),this.flipYFragmentShaderModule=e.createShaderModule({label:"flipYFragment",code:i})}getTransferPipeline(e){let t=this.transferPipelines[e];return t===void 0&&(t=this.device.createRenderPipeline({label:`mipmap-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.mipmapFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:cy.TriangleStrip,stripIndexFormat:qy.Uint32},layout:"auto"}),this.transferPipelines[e]=t),t}getFlipYPipeline(e){let t=this.flipYPipelines[e];return t===void 0&&(t=this.device.createRenderPipeline({label:`flipY-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.flipYFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:cy.TriangleStrip,stripIndexFormat:qy.Uint32},layout:"auto"}),this.flipYPipelines[e]=t),t}flipY(e,t,n=0){const i=t.format,{width:r,height:a}=t.size,l=this.getTransferPipeline(i),u=this.getFlipYPipeline(i),h=this.device.createTexture({size:{width:r,height:a,depthOrArrayLayers:1},format:i,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),p=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:Ps.TwoD,baseArrayLayer:n}),g=h.createView({baseMipLevel:0,mipLevelCount:1,dimension:Ps.TwoD,baseArrayLayer:0}),y=this.device.createCommandEncoder({}),_=(S,A,E)=>{const b=S.getBindGroupLayout(0),C=this.device.createBindGroup({layout:b,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:A}]}),w=y.beginRenderPass({colorAttachments:[{view:E,loadOp:si.Clear,storeOp:ga.Store,clearValue:[0,0,0,0]}]});w.setPipeline(S),w.setBindGroup(0,C),w.draw(4,1,0,0),w.end()};_(l,p,g),_(u,g,p),this.device.queue.submit([y.finish()]),h.destroy()}generateMipmaps(e,t,n=0){const i=this.get(e);i.useCount===void 0&&(i.useCount=0,i.layers=[]);const r=i.layers[n]||this._mipmapCreateBundles(e,t,n),a=this.device.createCommandEncoder({});this._mipmapRunBundles(a,r),this.device.queue.submit([a.finish()]),i.useCount!==0&&(i.layers[n]=r),i.useCount++}_mipmapCreateBundles(e,t,n){const i=this.getTransferPipeline(t.format),r=i.getBindGroupLayout(0);let a=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:Ps.TwoD,baseArrayLayer:n});const l=[];for(let u=1;u<t.mipLevelCount;u++){const h=this.device.createBindGroup({layout:r,entries:[{binding:0,resource:this.mipmapSampler},{binding:1,resource:a}]}),p=e.createView({baseMipLevel:u,mipLevelCount:1,dimension:Ps.TwoD,baseArrayLayer:n}),g={colorAttachments:[{view:p,loadOp:si.Clear,storeOp:ga.Store,clearValue:[0,0,0,0]}]},y=this.device.createRenderBundleEncoder({colorFormats:[t.format]});y.setPipeline(i),y.setBindGroup(0,h),y.draw(4,1,0,0),l.push({renderBundles:[y.finish()],passDescriptor:g}),a=p}return l}_mipmapRunBundles(e,t){const n=t.length;for(let i=0;i<n;i++){const r=t[i],a=e.beginRenderPass(r.passDescriptor);a.executeBundles(r.renderBundles),a.end()}}}const mie={[IM]:"never",[ex]:"less",[FM]:"equal",[tx]:"less-equal",[VM]:"greater",[GM]:"greater-equal",[HM]:"always",[zM]:"not-equal"},gie=[0,1,3,2,4,5];class yie{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this.colorBuffer=null,this.depthTexture=new Ta,this.depthTexture.name="depthBuffer"}createSampler(e){const t=this.backend,n=t.device,i=t.get(e),r={addressModeU:this._convertAddressMode(e.wrapS),addressModeV:this._convertAddressMode(e.wrapT),addressModeW:this._convertAddressMode(e.wrapR),magFilter:this._convertFilterMode(e.magFilter),minFilter:this._convertFilterMode(e.minFilter),mipmapFilter:this._convertFilterMode(e.minFilter),maxAnisotropy:1};r.magFilter===cp.Linear&&r.minFilter===cp.Linear&&r.mipmapFilter===cp.Linear&&(r.maxAnisotropy=e.anisotropy),e.isDepthTexture&&e.compareFunction!==null&&(r.compare=mie[e.compareFunction]),i.sampler=n.createSampler(r)}createDefaultTexture(e){let t;const n=MN(e);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}
4183createTexture(e,t={}){const n=this.backend,i=n.get(e);if(i.initialized)throw new Error("WebGPUTextureUtils: Texture already initialized.");if(e.isExternalTexture){i.texture=e.sourceTexture,i.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);const{width:r,height:a,depth:l,levels:u}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());const h=this._getDimension(e),p=e.internalFormat||t.format||MN(e,n.device);i.format=p;const{samples:g,primarySamples:y,isMSAA:_}=n.utils.getTextureSampleData(e);let S=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(S|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&p!==re.RGB9E5UFloat&&(S|=GPUTextureUsage.RENDER_ATTACHMENT);const A={label:e.name,size:{width:r,height:a,depthOrArrayLayers:l},mipLevelCount:u,sampleCount:y,dimension:h,format:p,usage:S};if(p===void 0){console.warn("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}if(e.isCubeTexture&&(A.textureBindingViewDimension=Ps.Cube),i.texture=n.device.createTexture(A),_){const E=Object.assign({},A);E.label=E.label+"-msaa",E.sampleCount=g,E.mipLevelCount=1,i.msaaTexture=n.device.createTexture(E)}i.initialized=!0,i.textureDescriptorGPU=A}destroyTexture(e){const t=this.backend,n=t.get(e);n.texture!==void 0&&n.texture.destroy(),n.msaaTexture!==void 0&&n.msaaTexture.destroy(),t.delete(e)}destroySampler(e){const n=this.backend.get(e);delete n.sampler}generateMipmaps(e){const t=this.backend.get(e);if(e.isCubeTexture)for(let n=0;n<6;n++)this._generateMipmaps(t.texture,t.textureDescriptorGPU,n);else{const n=e.image.depth||1;for(let i=0;i<n;i++)this._generateMipmaps(t.texture,t.textureDescriptorGPU,i)}}getColorBuffer(){this.colorBuffer&&this.colorBuffer.destroy();const e=this.backend,{width:t,height:n}=e.getDrawingBufferSize();return this.colorBuffer=e.device.createTexture({label:"colorBuffer",size:{width:t,height:n,depthOrArrayLayers:1},sampleCount:e.utils.getSampleCount(e.renderer.samples),format:e.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC}),this.colorBuffer}getDepthBuffer(e=!0,t=!1){const n=this.backend,{width:i,height:r}=n.getDrawingBufferSize(),a=this.depthTexture,l=n.get(a).texture;let u,h;if(t?(u=to,h=Ja):e&&(u=eo,h=gi),l!==void 0){if(a.image.width===i&&a.image.height===r&&a.format===u&&a.type===h)return l;this.destroyTexture(a)}return a.name="depthBuffer",a.format=u,a.type=h,a.image.width=i,a.image.height=r,this.createTexture(a,{width:i,height:r}),n.get(a).texture}updateTexture(e,t){const n=this.backend.get(e),i=e.mipmaps,{textureDescriptorGPU:r}=n;if(!(e.isRenderTargetTexture||r===void 0)){if(e.isDataTexture)if(i.length>0)for(let a=0,l=i.length;a<l;a++){const u=i[a];this._copyBufferToTexture(u,n.texture,r,0,e.flipY,0,a)}else this._copyBufferToTexture(t.image,n.texture,r,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)for(let a=0;a<t.image.depth;a++)this._copyBufferToTexture(t.image,n.texture,r,a,e.flipY,a);else if(e.isCompressedTexture||e.isCompressedArrayTexture)this._copyCompressedBufferToTexture(e.mipmaps,n.texture,r);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,r);else if(i.length>0)for(let a=0,l=i.length;a<l;a++){const u=i[a];this._copyImageToTexture(u,n.texture,r,0,e.flipY,e.premultiplyAlpha,a)}else this._copyImageToTexture(t.image,n.texture,r,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,i,r,a){const l=this.backend.device,u=this.backend.get(e),h=u.texture,p=u.textureDescriptorGPU.format,g=this._getBytesPerTexel(p);let y=i*g;y=Math.ceil(y/256)*256;const _=l.createBuffer({size:(r-1)*y+i*g,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),S=l.createCommandEncoder();S.copyTextureToBuffer({texture:h,origin:{x:t,y:n,z:a}},{buffer:_,bytesPerRow:y},{width:i,height:r});const A=this._getTypedArrayType(p);l.queue.submit([S.finish()]),await _.mapAsync(GPUMapMode.READ);const E=_.getMappedRange();return new A(E)}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){const n=new qi;n.minFilter=Ai,n.magFilter=Ai,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){const n=new Id;n.minFilter=Ai,n.magFilter=Ai,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){const i=e.images,r=e.mipmaps;for(let a=0;a<6;a++){const l=i[a],u=e.flipY===!0?gie[a]:a;l.isDataTexture?this._copyBufferToTexture(l.image,t,n,u,e.flipY):this._copyImageToTexture(l,t,n,u,e.flipY,e.premultiplyAlpha);for(let h=0;h<r.length;h++){const g=r[h].images[a];g.isDataTexture?this._copyBufferToTexture(g.image,t,n,u,e.flipY,0,h+1):this._copyImageToTexture(g,t,n,u,e.flipY,e.premultiplyAlpha,h+1)}}}_copyImageToTexture(e,t,n,i,r,a,l=0){const u=this.backend.device,h=l>0?e.width:n.size.width,p=l>0?e.height:n.size.height;u.queue.copyExternalImageToTexture({source:e,flipY:r},{texture:t,mipLevel:l,origin:{x:0,y:0,z:i},premultipliedAlpha:a},{width:h,height:p,depthOrArrayLayers:1})}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new pie(this.backend.device)),e}_generateMipmaps(e,t,n=0){this._getPassUtils().generateMipmaps(e,t,n)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,i,r,a=0,l=0){const u=this.backend.device,h=e.data,p=this._getBytesPerTexel(n.format),g=e.width*p;u.queue.writeTexture({texture:t,mipLevel:l,origin:{x:0,y:0,z:i}}
4183,h,{offset:e.width*e.height*p*a,bytesPerRow:g},{width:e.width,height:e.height,depthOrArrayLayers:1}),r===!0&&this._flipY(t,n,i)}_copyCompressedBufferToTexture(e,t,n){const i=this.backend.device,r=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1;for(let l=0;l<e.length;l++){const u=e[l],h=u.width,p=u.height,g=a?n.size.depthOrArrayLayers:1,y=Math.ceil(h/r.width)*r.byteLength,_=y*Math.ceil(p/r.height);for(let S=0;S<g;S++)i.queue.writeTexture({texture:t,mipLevel:l,origin:{x:0,y:0,z:S}},u.data,{offset:S*_,bytesPerRow:y,rowsPerImage:Math.ceil(p/r.height)},{width:Math.ceil(h/r.width)*r.width,height:Math.ceil(p/r.height)*r.height,depthOrArrayLayers:1})}}_getBlockData(e){if(e===re.BC1RGBAUnorm||e===re.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===re.BC2RGBAUnorm||e===re.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===re.BC3RGBAUnorm||e===re.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===re.BC4RUnorm||e===re.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===re.BC5RGUnorm||e===re.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===re.BC6HRGBUFloat||e===re.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===re.BC7RGBAUnorm||e===re.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===re.ETC2RGB8Unorm||e===re.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===re.ETC2RGB8A1Unorm||e===re.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===re.ETC2RGBA8Unorm||e===re.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===re.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===re.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===re.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===re.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===re.ASTC4x4Unorm||e===re.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===re.ASTC5x4Unorm||e===re.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===re.ASTC5x5Unorm||e===re.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===re.ASTC6x5Unorm||e===re.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===re.ASTC6x6Unorm||e===re.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===re.ASTC8x5Unorm||e===re.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===re.ASTC8x6Unorm||e===re.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===re.ASTC8x8Unorm||e===re.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===re.ASTC10x5Unorm||e===re.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===re.ASTC10x6Unorm||e===re.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===re.ASTC10x8Unorm||e===re.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===re.ASTC10x10Unorm||e===re.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===re.ASTC12x10Unorm||e===re.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===re.ASTC12x12Unorm||e===re.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=RR.ClampToEdge;return e===ih?t=RR.Repeat:e===sh&&(t=RR.MirrorRepeat),t}_convertFilterMode(e){let t=cp.Linear;return(e===Ai||e===K0||e===ql)&&(t=cp.Nearest),t}_getBytesPerTexel(e){if(e===re.R8Unorm||e===re.R8Snorm||e===re.R8Uint||e===re.R8Sint)return 1;if(e===re.R16Uint||e===re.R16Sint||e===re.R16Float||e===re.RG8Unorm||e===re.RG8Snorm||e===re.RG8Uint||e===re.RG8Sint)return 2;if(e===re.R32Uint||e===re.R32Sint||e===re.R32Float||e===re.RG16Uint||e===re.RG16Sint||e===re.RG16Float||e===re.RGBA8Unorm||e===re.RGBA8UnormSRGB||e===re.RGBA8Snorm||e===re.RGBA8Uint||e===re.RGBA8Sint||e===re.BGRA8Unorm||e===re.BGRA8UnormSRGB||e===re.RGB9E5UFloat||e===re.RGB10A2Unorm||e===re.RG11B10UFloat||e===re.Depth32Float||e===re.Depth24Plus||e===re.Depth24PlusStencil8||e===re.Depth32FloatStencil8)return 4;if(e===re.RG32Uint||e===re.RG32Sint||e===re.RG32Float||e===re.RGBA16Uint||e===re.RGBA16Sint||e===re.RGBA16Float)return 8;if(e===re.RGBA32Uint||e===re.RGBA32Sint||e===re.RGBA32Float)return 16}_getTypedArrayType(e){if(e===re.R8Uint)return Uint8Array;
4183if(e===re.R8Sint)return Int8Array;if(e===re.R8Unorm)return Uint8Array;if(e===re.R8Snorm)return Int8Array;if(e===re.RG8Uint)return Uint8Array;if(e===re.RG8Sint)return Int8Array;if(e===re.RG8Unorm)return Uint8Array;if(e===re.RG8Snorm)return Int8Array;if(e===re.RGBA8Uint)return Uint8Array;if(e===re.RGBA8Sint)return Int8Array;if(e===re.RGBA8Unorm||e===re.RGBA8UnormSRGB)return Uint8Array;if(e===re.RGBA8Snorm)return Int8Array;if(e===re.R16Uint)return Uint16Array;if(e===re.R16Sint)return Int16Array;if(e===re.RG16Uint)return Uint16Array;if(e===re.RG16Sint)return Int16Array;if(e===re.RGBA16Uint)return Uint16Array;if(e===re.RGBA16Sint)return Int16Array;if(e===re.R16Float||e===re.RG16Float||e===re.RGBA16Float)return Uint16Array;if(e===re.R32Uint)return Uint32Array;if(e===re.R32Sint)return Int32Array;if(e===re.R32Float)return Float32Array;if(e===re.RG32Uint)return Uint32Array;if(e===re.RG32Sint)return Int32Array;if(e===re.RG32Float)return Float32Array;if(e===re.RGBA32Uint)return Uint32Array;if(e===re.RGBA32Sint)return Int32Array;if(e===re.RGBA32Float)return Float32Array;if(e===re.BGRA8Unorm||e===re.BGRA8UnormSRGB)return Uint8Array;
4183if(e===re.RGB10A2Unorm||e===re.RGB9E5UFloat||e===re.RG11B10UFloat)return Uint32Array;if(e===re.Depth32Float)return Float32Array;if(e===re.Depth24Plus||e===re.Depth24PlusStencil8)return Uint32Array;if(e===re.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=PB.ThreeD:t=PB.TwoD,t}}function MN(s,e=null){const t=s.format,n=s.type,i=s.colorSpace,r=Kt.getTransfer(i);let a;if(s.isCompressedTexture===!0||s.isCompressedArrayTexture===!0)switch(t){case Xc:case Yc:a=r===Et?re.BC1RGBAUnormSRGB:re.BC1RGBAUnorm;break;case jc:a=r===Et?re.BC2RGBAUnormSRGB:re.BC2RGBAUnorm;break;case Kc:a=r===Et?re.BC3RGBAUnormSRGB:re.BC3RGBAUnorm;break;case $p:a=re.BC4RUnorm;break;case Jp:a=re.BC4RSnorm;break;case em:a=re.BC5RGUnorm;break;case tm:a=re.BC5RGSnorm;break;case Qp:a=r===Et?re.BC7RGBAUnormSRGB:re.BC7RGBAUnorm;break;case Pp:case Bp:a=r===Et?re.ETC2RGB8UnormSRGB:re.ETC2RGB8Unorm;break;case Op:a=r===Et?re.ETC2RGBA8UnormSRGB:re.ETC2RGBA8Unorm;break;case Ip:a=r===Et?re.ASTC4x4UnormSRGB:re.ASTC4x4Unorm;break;case Fp:a=r===Et?re.ASTC5x4UnormSRGB:re.ASTC5x4Unorm;break;case Vp:a=r===Et?re.ASTC5x5UnormSRGB:re.ASTC5x5Unorm;break;case zp:a=r===Et?re.ASTC6x5UnormSRGB:re.ASTC6x5Unorm;break;case Gp:a=r===Et?re.ASTC6x6UnormSRGB:re.ASTC6x6Unorm;break;case Hp:a=r===Et?re.ASTC8x5UnormSRGB:re.ASTC8x5Unorm;break;case kp:a=r===Et?re.ASTC8x6UnormSRGB:re.ASTC8x6Unorm;break;case qp:a=r===Et?re.ASTC8x8UnormSRGB:re.ASTC8x8Unorm;break;case Wp:a=r===Et?re.ASTC10x5UnormSRGB:re.ASTC10x5Unorm;break;case Xp:a=r===Et?re.ASTC10x6UnormSRGB:re.ASTC10x6Unorm;break;case Yp:a=r===Et?re.ASTC10x8UnormSRGB:re.ASTC10x8Unorm;break;case jp:a=r===Et?re.ASTC10x10UnormSRGB:re.ASTC10x10Unorm;break;case Kp:a=r===Et?re.ASTC12x10UnormSRGB:re.ASTC12x10Unorm;break;case Zp:a=r===Et?re.ASTC12x12UnormSRGB:re.ASTC12x12Unorm;break;case Pi:a=r===Et?re.RGBA8UnormSRGB:re.RGBA8Unorm;break;default:console.error("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Pi:switch(n){case Ed:a=re.RGBA8Snorm;break;case Ad:a=re.RGBA16Sint;break;case $o:a=re.RGBA16Uint;break;case gi:a=re.RGBA32Uint;break;case Zs:a=re.RGBA32Sint;break;case ki:a=r===Et?re.RGBA8UnormSRGB:re.RGBA8Unorm;break;case As:a=re.RGBA16Float;break;case Bi:a=re.RGBA32Float;break;default:console.error("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Qy:switch(n){case $0:a=re.RGB9E5UFloat;break;case J0:a=re.RG11B10UFloat;break;default:console.error("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case um:switch(n){case Ed:a=re.R8Snorm;break;case Ad:a=re.R16Sint;break;case $o:a=re.R16Uint;break;case gi:a=re.R32Uint;break;case Zs:a=re.R32Sint;break;case ki:a=re.R8Unorm;break;case As:a=re.R16Float;break;case Bi:a=re.R32Float;break;default:console.error("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Wu:switch(n){case Ed:a=re.RG8Snorm;break;case Ad:a=re.RG16Sint;break;case $o:a=re.RG16Uint;break;case gi:a=re.RG32Uint;break;case Zs:a=re.RG32Sint;break;case ki:a=re.RG8Unorm;break;case As:a=re.RG16Float;break;case Bi:a=re.RG32Float;break;default:console.error("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case eo:switch(n){case $o:a=re.Depth16Unorm;break;case gi:a=re.Depth24Plus;break;case Bi:a=re.Depth32Float;break;default:console.error("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case to:switch(n){case Ja:a=re.Depth24PlusStencil8;break;case Bi:e&&e.features.has(TN.Depth32FloatStencil8)===!1&&console.error('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=re.Depth32FloatStencil8;break;default:console.error("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case Od:switch(n){case Zs:a=re.R32Sint;break;case gi:a=re.R32Uint;break;default:console.error("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case cm:switch(n){case Zs:a=re.RG32Sint;break;case gi:a=re.RG32Uint;break;default:console.error("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n
4183)}break;case hm:switch(n){case Zs:a=re.RGBA32Sint;break;case gi:a=re.RGBA32Uint;break;default:console.error("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:console.error("WebGPURenderer: Unsupported texture format.",t)}return a}const vie=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,_ie=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,OB={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},xie=s=>{s=s.trim();const e=s.match(vie);if(e!==null&&e.length===4){const t=e[2],n=[];let i=null;for(;(i=_ie.exec(t))!==null;)n.push({name:i[1],type:i[2]});const r=[];for(let p=0;p<n.length;p++){const{name:g,type:y}=n[p];let _=y;_.startsWith("ptr")?_="pointer":(_.startsWith("texture")&&(_=y.split("<")[0]),_=OB[_]),r.push(new i2(_,g))}const a=s.substring(e[0].length),l=e[3]||"void",u=e[1]!==void 0?e[1]:"";
4183return{type:OB[l]||l,inputs:r,name:u,inputsCode:t,blockCode:a,outputType:l}}else throw new Error("FunctionNode: Function is not a WGSL code.")};class Sie extends r2{constructor(e){const{type:t,inputs:n,name:i,inputsCode:r,blockCode:a,outputType:l}=xie(e);super(t,n,i),this.inputsCode=r,this.blockCode=a,this.outputType=l}getCode(e=this.name){const t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class bie extends Cz{parseFunction(e){return new Sie(e)}}const ey=typeof self<"u"?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},Tie={[Ar.READ_ONLY]:"read",[Ar.WRITE_ONLY]:"write",[Ar.READ_WRITE]:"read_write"},IB={[ih]:"repeat",[Sa]:"clamp",[sh]:"mirror"},ST={vertex:ey?ey.VERTEX:1,fragment:ey?ey.FRAGMENT:2,compute:ey?ey.COMPUTE:4},FB={instance:!0,swizzleAssign:!1,storageBuffer:!0},Mie={"^^":"tsl_xor"},Eie={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},VB={},t0={tsl_xor:new Gr("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Gr("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Gr("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Gr("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Gr("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Gr("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Gr("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Gr("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new Gr("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new Gr("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Gr("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new Gr("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new Gr(` 4184fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f { 4185 4186 let res = vec2f( iRes ); 4187 4188 let uvScaled = coord * res; 4189 let uvWrapping = ( ( uvScaled % res ) + res ) % res; 4190 4191 // https://www.shadertoy.com/view/WtyXRy 4192 4193 let uv = uvWrapping - 0.5; 4194 let iuv = floor( uv ); 4195 let f = fract( uv ); 4196 4197 let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level ); 4198 let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level ); 4199 let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level ); 4200 let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level ); 4201 4202 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y ); 4203 4204} 4205`)},Aie={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>"};let zz="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(zz+=`diagnostic( off, derivative_uniformity ); 4206`);class Rie extends Nz{constructor(e,t){super(e,t,new bie),this.uniformGroups={},this.builtins={},this.directives={},this.scopedArrays=new Map}_generateTextureSample(e,t,n,i,r,a=this.shaderStage){return a==="fragment"?i?r?`textureSample( ${t}, ${t}_sampler, ${n}, ${i}, ${r} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${i} )`:r?`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",i)}generateTextureSampleLevel(e,t,n,i,r,a){return this.isUnfilterable(e)===!1?a?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,a,i):this.generateTextureLod(e,t,n,r,a,i)}generateWrapFunction(e){const t=`tsl_coord_${IB[e.wrapS]}S_${IB[e.wrapT]}_${e.isData3DTexture?"3d":"2d"}T`;let n=VB[t];if(n===void 0){const i=[],r=e.isData3DTexture?"vec3f":"vec2f";let a=`fn ${t}( coord : ${r} ) -> ${r} { 4207 4208 return ${r}( 4209`;const l=(u,h)=>{u===ih?(i.push(t0.repeatWrapping_float),a+=` tsl_repeatWrapping_float( coord.${h}
4209 )`):u===Sa?(i.push(t0.clampWrapping_float),a+=` tsl_clampWrapping_float( coord.${h} )`):u===sh?(i.push(t0.mirrorWrapping_float),a+=` tsl_mirrorWrapping_float( coord.${h} )`):(a+=` coord.${h}`,console.warn(`WebGPURenderer: Unsupported texture wrap type "${u}" for vertex shader.`))};l(e.wrapS,"x"),a+=`, 4210`,l(e.wrapT,"y"),e.isData3DTexture&&(a+=`, 4211`,l(e.wrapR,"z")),a+=` 4212 ); 4213 4214} 4215`,VB[t]=n=new Gr(a,i)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){const i=this.getDataFromNode(e,this.shaderStage,this.globalCache);i.dimensionsSnippet===void 0&&(i.dimensionsSnippet={});let r=i.dimensionsSnippet[n];if(i.dimensionsSnippet[n]===void 0){let a,l;const{primarySamples:u}=this.renderer.backend.utils.getTextureSampleData(e),h=u>1;e.isData3DTexture?l="vec3<u32>":l="vec2<u32>",h||e.isStorageTexture?a=t:a=`${t}${n?`, u32( ${n} )`:""}`,r=new wT(new DT(`textureDimensions( ${a} )`,l)),i.dimensionsSnippet[n]=r,(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)&&(i.arrayLayerCount=new wT(new DT(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(i.cubeFaceCount=new wT(new DT("6u","u32")))}return r.build(this)}generateFilteredTexture(e,t,n,i,r="0u"){this._include("biquadraticTexture");const a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,r);return i&&(n=`${n} + vec2<f32>(${i}) / ${l}`),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${r} ) )`}generateTextureLod(e,t,n,i,r,a="0u"){const l=this.generateWrapFunction(e),u=this.generateTextureDimension(e,t,a),h=e.isData3DTexture?"vec3":"vec2";r&&(n=`${n} + ${h}<f32>(${r}) / ${h}<f32>( ${u} )`);const p=`${h}<u32>( ${l}( ${n} ) * ${h}<f32>( ${u} ) )`;return this.generateTextureLoad(e,t,p,i,null,a)}generateTextureLoad(e,t,n,i,r,a="0u"){let l;return r&&(n=`${n} + ${r}`),i?l=`textureLoad( ${t}, ${n}, ${i}, u32( ${a} ) )`:(l=`textureLoad( ${t}, ${n}, u32( ${a} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(l+=".x")),l}generateTextureStore(e,t,n,i,r){let a;return i?a=`textureStore( ${t}, ${n}, ${i}, ${r} )`:a=`textureStore( ${t}, ${n}, ${r} )`,a}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.isDataTexture===!0&&e.type===Bi||this.isSampleCompare(e)===!1&&e.minFilter===Ai&&e.magFilter===Ai||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,i,r,a=this.shaderStage){let l=null;return this.isUnfilterable(e)?l=this.generateTextureLod(e,t,n,i,r,"0",a):l=this._generateTextureSample(e,t,n,i,r,a),l}generateTextureGrad(e,t,n,i,r,a,l=this.shaderStage){if(l==="fragment")return a?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${i[0]}, ${i[1]}, ${a} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${i[0]}, ${i[1]} )`;console.error(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${l} shader.`)}generateTextureCompare(e,t,n,i,r,a,l=this.shaderStage){if(l==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?a?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${i}, ${a} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${i} )`:a?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${i}, ${a} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${i} )`;console.error(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${l} shader.`)}generateTextureLevel(e,t,n,i,r,a){return this.isUnfilterable(e)===!1?a?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,a,i):this.generateTextureLod(e,t,n,r,a,i)}generateTextureBias(e,t,n,i,r,a,l=this.shaderStage){if(l==="fragment")return a?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${i}, ${a} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${i} )`;console.error(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${l} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){const n=e.name,i=e.type;return i==="texture"||i==="cubeTexture"||i==="storageTexture"||i==="texture3D"?n:i==="buffer"||i==="storageBuffer"||i==="indirectStorageBuffer"?this.isCu
4215stomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=Mie[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(console.warn("WebGPURenderer: Atomic operations are only supported in compute shaders."),Ar.READ_WRITE):Ar.READ_ONLY:e.access}getStorageAccess(e,t){return Tie[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,i=null){const r=super.getUniformFromNode(e,t,n,i),a=this.getDataFromNode(e,n,this.globalCache);if(a.uniformGPU===void 0){let l;const u=e.groupNode,h=u.name,p=this.getBindGroupArray(h,n);if(t==="texture"||t==="cubeTexture"||t==="storageTexture"||t==="texture3D"){let g=null;const y=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?g=new bN(r.name,r.node,u,y):g=new YE(r.name,r.node,u,y):t==="cubeTexture"?g=new Iz(r.name,r.node,u,y):t==="texture3D"&&(g=new bN(r.name,r.node,u,y)),g.store=e.isStorageTextureNode===!0,g.setVisibility(ST[n]),this.isUnfilterable(e.value)===!1&&g.store===!1){const _=new cie(`${r.name}_sampler`,r.node,u);_.setVisibility(ST[n]),p.push(_,g),l=[_,g]}else p.push(g),l=[g]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){const g=t==="buffer"?Bz:fie,y=new g(e,u);y.setVisibility(ST[n]),p.push(y),l=y,r.name=i||"NodeBuffer_"+r.id}else{const g=this.uniformGroups[n]||(this.uniformGroups[n]={});let y=g[h];y===void 0&&(y=new Pz(h,u),y.setVisibility(ST[n]),g[h]=y,p.push(y)),l=this.getNodeUniform(r,t),y.addUniform(l)}a.uniformGPU=l}return r}getBuiltin(e,t,n,i=this.shaderStage){const r=this.builtins[i]||(this.builtins[i]=new Map);return r.has(e)===!1&&r.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),i=[];for(const a of t.inputs)i.push(a.name+" : "+this.getType(a.type));let r=`fn ${t.name}( ${i.join(", ")} ) -> ${this.getType(t.type)} { 4216${n.vars} 4217${n.code} 4218`;return n.result&&(r+=` return ${n.result}; 4219`),r+=` 4220} 4221`,r}getInstanceIndex(){return this.shaderStage==="vertex"?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4<f32>")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],n=this.directives[e];if(n!==void 0)for(const i of n)t.push(`enable ${i};`);return t.join(` 4222`)}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array<f32, ${e} >`,"vertex")}getBuiltins(e){const t=[],n=this.builtins[e];if(n!==void 0)for(const{name:i,property:r,type:a}of n.values())t.push(`@builtin( ${i} ) ${r} : ${a}`);return t.join(`, 4223 `)}getScopedArray(e,t,n,i){return this.scopedArrays.has(e)===!1&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:n,bufferCount:i}),e}getScopedArrays(e){if(e!=="compute")return;const t=[];for(const{name:n,scope:i,bufferType:r,bufferCount:a}of this.scopedArrays.values()){const l=this.getType(r);t.push(`var<${i}> ${n}: array< ${l}, ${a} >;`)}return t.join(` 4224`)}getAttributes(e){const t=[];if(e==="compute"&&(this.getBuiltin("global_invocation_id","globalId","vec3<u32>","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3<u32>","attribute"),this.getBuiltin("local_invocation_id","localId","vec3<u32>","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3<u32>","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),e==="vertex"||e==="compute"){const n=this.getBuiltins("attribute");
4224n&&t.push(n);const i=this.getAttributesArray();for(let r=0,a=i.length;r<a;r++){const l=i[r],u=l.name,h=this.getType(l.type);t.push(`@location( ${r} ) ${u} : ${h}`)}}return t.join(`, 4225 `)}getStructMembers(e){const t=[];for(const n of e.members){const i=e.output?"@location( "+n.index+" ) ":"";let r=this.getType(n.type);n.atomic&&(r="atomic< "+r+" >"),t.push(` ${i+n.name} : ${r}`)}return e.output&&t.push(` ${this.getBuiltins("output")}`),t.join(`, 4226`)}getStructs(e){let t="";const n=this.structs[e];if(n.length>0){const i=[];for(const r of n){let a=`struct ${r.name} { 4227`;a+=this.getStructMembers(r),a+=` 4228};`,i.push(a)}t=` 4229`+i.join(` 4230 4231`)+` 4232`}return t}getVar(e,t,n=null){let i=`var ${t} : `;return n!==null?i+=this.generateArrayDeclaration(e,n):i+=this.getType(e),i}getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const i of n)t.push(` ${this.getVar(i.type,i.name,i.count)};`);return` 4233${t.join(` 4234`)} 4235`}getVaryings(e){const t=[];if(e==="vertex"&&this.getBuiltin("position","Vertex","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){const r=this.varyings,a=this.vars[e];for(let l=0;l<r.length;l++){const u=r[l];if(u.needsInterpolation){let h=`@location( ${l} )`;if(u.interpolationType){const p=u.interpolationSampling!==null?`, ${u.interpolationSampling} )`:" )";h+=` @interpolate( ${u.interpolationType}${p}`}else/^(int|uint|ivec|uvec)/.test(u.type)&&(h+=` @interpolate( ${this.renderer.backend.compatibilityMode?"flat, either":"flat"} )`);t.push(`${h} ${u.name} : ${this.getType(u.type)}`)}else e==="vertex"&&a.includes(u)===!1&&a.push(u)}}const n=this.getBuiltins(e);n&&t.push(n);const i=t.join(`, 4236 `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+i):i}isCustomStruct(e){const t=e.value,n=e.node,i=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,r=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return i&&!r}getUniforms(e){const t=this.uniforms[e],n=[],i=[],r=[],a={};for(const u of t){const h=u.groupNode.name,p=this.bindingsIndexes[h];if(u.type==="texture"||u.type==="cubeTexture"||u.type==="storageTexture"||u.type==="texture3D"){const g=u.node.value;this.isUnfilterable(g)===!1&&u.node.isStorageTextureNode!==!0&&(this.isSampleCompare(g)?n.push(`@binding( ${p.binding++} ) @group( ${p.group} ) var ${u.name}_sampler : sampler_comparison;`):n.push(`@binding( ${p.binding++} ) @group( ${p.group} ) var ${u.name}_sampler : sampler;`));let y,_="";const{primarySamples:S}=this.renderer.backend.utils.getTextureSampleData(g);if(S>1&&(_="_multisampled"),g.isCubeTexture===!0)y="texture_cube<f32>";else if(g.isDepthTexture===!0)this.renderer.backend.compatibilityMode&&g.compareFunction===null?y=`texture${_}_2d<f32>`:y=`texture_depth${_}_2d${g.isArrayTexture===!0?"_array":""}`;else if(u.node.isStorageTextureNode===!0){const A=MN(g),E=this.getStorageAccess(u.node,e),b=u.node.value.is3DTexture,C=u.node.value.isArrayTexture;y=`texture_storage_${b?"3d":`2d${C?"_array":""}`}<${A}, ${E}>`}else if(g.isArrayTexture===!0||g.isDataArrayTexture===!0||g.isCompressedArrayTexture===!0)y="texture_2d_array<f32>";else if(g.is3DTexture===!0||g.isData3DTexture===!0)y="texture_3d<f32>";else{const A=this.getComponentTypeFromTexture(g).charAt(0);y=`texture${_}_2d<${A}32>`}n.push(`@binding( ${p.binding++} ) @group( ${p.group} ) var ${u.name} : ${y};`)}else if(u.type==="buffer"||u.type==="storageBuffer"||u.type==="indirectStorageBuffer"){const g=u.node,y=this.getType(g.getNodeType(this)),_=g.bufferCount,S=_>0&&u.type==="buffer"?", "+_:"",A=g.isStorageBufferNode?`storage, ${this.getStorageAccess(g,e)}`:"uniform";if(this.isCustomStruct(u))i.push(`@binding( ${p.binding++} ) @group( ${p.group} ) var<${A}> ${u.name} : ${y};`);else{const b=` value : array< ${g.isAtomic?`atomic<${y}>`:`${y}`}${S} >`;i.push(this._getWGSLStructBinding(u.name,b,A,p.binding++,p.group))}}else{const g=this.getType(this.getVectorType(u.type)),y=u.groupNode.name;(a[y]||(a[y]={index:p.binding++,id:p.group,snippets:[]})).snippets.push(` ${u.name} : ${g}`)}}for(const u in a){const h=a[u];r.push(this._getWGSLStructBinding(u,h.snippets.join(`, 4237`),"uniform",h.index,h.id))}let l=n.join(` 4238`);return l+=i.join(` 4239`),l+=r.join(` 4240`),l}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){this.shaderStage=t;const n=e[t];n.uniforms=this.getUniforms(t),n.attributes=this.getAttributes(t),n.varyings=this.getVaryings(t),n.structs=this.getStructs(t),n.vars=this.getVars(t),n.codes=this.getCodes(t),n.directives=this.getDirectives(t),n.scopedArrays=this.getScopedArrays(t);let i=`// code 4241 4242`;i+=this.flowCode[t];const r=this.flowNodes[t],a=r[r.length-1],l=a.outputNode,u=l!==void 0&&l.isOutputStructNode===!0;for(const h of r){const p=this.getFlowData(h),g=h.name;if(g&&(i.length>0&&(i+=` 4243`),i+=` // flow -> ${g} 4244`),i+=`${p.code} 4245 `,h===a&&t!=="compute"){if(i+=`// result 4246 4247 `,t==="vertex")i+=`varyings.Vertex = ${p.result};`;else if(t==="fragment")if(u)n.returnType=l.getNodeType(this),n.structs+="var<private> output : "+n.returnType+";",i+=`return ${p.result};`;else{let y=" @location(0) color: vec4<f32>";const _=this.getBuiltins("output");_&&(y+=`, 4248 `+_),n.returnType="OutputStruct",n.structs+=this._getWGSLStruct("OutputStruct",y),n.structs+=` 4249var<private> output : OutputStruct;`,i+=`output.color = ${p.result}; 4250 4251 return output;`}}}n.flow=i}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{const t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}
4251getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return Eie[e]||e}isAvailable(e){let t=FB[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),FB[e]=t),t}_getWGSLMethod(e){return t0[e]!==void 0&&this._include(e),Aie[e]}_include(e){const t=t0[e];return t.build(this),this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(t),t}_getWGSLVertexCode(e){return`${this.getSignature()} 4252// directives 4253${e.directives} 4254 4255// structs 4256${e.structs} 4257 4258// uniforms 4259${e.uniforms} 4260 4261// varyings 4262${e.varyings} 4263var<private> varyings : VaryingsStruct; 4264 4265// codes 4266${e.codes} 4267 4268@vertex 4269fn main( ${e.attributes} ) -> VaryingsStruct { 4270 4271 // vars 4272 ${e.vars} 4273 4274 // flow 4275 ${e.flow} 4276 4277 return varyings; 4278 4279} 4280`}_getWGSLFragmentCode(e){return`${this.getSignature()} 4281// global 4282${zz} 4283 4284// structs 4285${e.structs} 4286 4287// uniforms 4288${e.uniforms} 4289 4290// codes 4291${e.codes} 4292 4293@fragment 4294fn main( ${e.varyings} ) -> ${e.returnType} { 4295 4296 // vars 4297 ${e.vars} 4298 4299 // flow 4300 ${e.flow} 4301 4302} 4303`}_getWGSLComputeCode(e,t){const[n,i,r]=t;
4303return`${this.getSignature()} 4304// directives 4305${e.directives} 4306 4307// system 4308var<private> instanceIndex : u32; 4309 4310// locals 4311${e.scopedArrays} 4312 4313// structs 4314${e.structs} 4315 4316// uniforms 4317${e.uniforms} 4318 4319// codes 4320${e.codes} 4321 4322@compute @workgroup_size( ${n}, ${i}, ${r} ) 4323fn main( ${e.attributes} ) { 4324 4325 // system 4326 instanceIndex = globalId.x 4327 + globalId.y * ( ${n} * numWorkgroups.x ) 4328 + globalId.z * ( ${n} * numWorkgroups.x ) * ( ${i} * numWorkgroups.y ); 4329 4330 // vars 4331 ${e.vars} 4332 4333 // flow 4334 ${e.flow} 4335 4336} 4337`}_getWGSLStruct(e,t){return` 4338struct ${e} { 4339${t} 4340};`}_getWGSLStructBinding(e,t,n,i=0,r=0){const a=e+"Struct";return`${this._getWGSLStruct(a,t)} 4341@binding( ${i} ) @group( ${r} ) 4342var<${n}> ${e} : ${a};`}}class Nie{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.depth&&e.stencil?t=re.Depth24PlusStencil8:e.depth&&(t=re.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const r=this.backend.renderer,a=r.getRenderTarget();t=a?a.samples:r.samples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return cy.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return cy.LineList;if(e.isLine)return cy.LineStrip;if(e.isMesh)return cy.TriangleList}getSampleCount(e){return e>=4?4:1}
4342getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.samples)}getPreferredCanvasFormat(){const e=this.backend.parameters.outputType;if(e===void 0)return navigator.gpu.getPreferredCanvasFormat();if(e===ki)return re.BGRA8Unorm;if(e===As)return re.RGBA16Float;throw new Error("Unsupported outputType")}}const Gz=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&Gz.set(Float16Array,["float16"]);const Cie=new Map([[JN,["float16"]]]),wie=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class Die{constructor(e){this.backend=e}createAttribute(e,t){const n=this._getBufferAttribute(e),i=this.backend,r=i.get(n);let a=r.buffer;if(a===void 0){const l=i.device;let u=n.array;if(e.normalized===!1){if(u.constructor===Int16Array||u.constructor===Int8Array)u=new Int32Array(u);else if((u.constructor===Uint16Array||u.constructor===Uint8Array)&&(u=new Uint32Array(u),t&GPUBufferUsage.INDEX))for(let g=0;g<u.length;g++)u[g]===65535&&(u[g]=4294967295)}if(n.array=u,(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3){u=new u.constructor(n.count*4);for(let g=0;g<n.count;g++)u.set(n.array.subarray(g*3,g*3+3),g*4);n.itemSize=4,n.array=u,r._force3to4BytesAlignment=!0}const h=u.byteLength,p=h+(4-h%4)%4;a=l.createBuffer({label:n.name,size:p,usage:t,mappedAtCreation:!0}),new u.constructor(a.getMappedRange()).set(u),a.unmap(),r.buffer=a}}updateAttribute(e){const t=this._getBufferAttribute(e),n=this.backend,i=n.device,r=n.get(t),a=n.get(t).buffer;let l=t.array;if(r._force3to4BytesAlignment===!0){l=new l.constructor(t.count*4);for(let p=0;p<t.count;p++)l.set(t.array.subarray(p*3,p*3+3),p*4);t.array=l}const u=this._isTypedArray(l),h=t.updateRanges;if(h.length===0)i.queue.writeBuffer(a,0,l,0);else{const p=u?1:l.BYTES_PER_ELEMENT;for(let g=0,y=h.length;g<y;g++){const _=h[g];let S,A;if(r._force3to4BytesAlignment===!0){const b=Math.floor(_.start/3),C=Math.ceil(_.count/3);S=b*4*p,A=C*4*p}else S=_.start*p,A=_.count*p;const E=S*(u?l.BYTES_PER_ELEMENT:1);i.queue.writeBuffer(a,E,l,S,A)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){const t=e.getAttributes(),n=new Map;for(let i=0;i<t.length;i++){const r=t[i],a=r.array.BYTES_PER_ELEMENT,l=this._getBufferAttribute(r);let u=n.get(l);if(u===void 0){let g,y;r.isInterleavedBufferAttribute===!0?(g=r.data.stride*a,y=r.data.isInstancedInterleavedBuffer?xT.Instance:xT.Vertex):(g=r.itemSize*a,y=r.isInstancedBufferAttribute?xT.Instance:xT.Vertex),r.normalized===!1&&(r.array.constructor===Int16Array||r.array.constructor===Uint16Array)&&(g=4),u={arrayStride:g,attributes:[],stepMode:y},n.set(l,u)}const h=this._getVertexFormat(r),p=r.isInterleavedBufferAttribute===!0?r.offset*a:0;u.attributes.push({shaderLocation:i,offset:p,format:h})}return Array.from(n.values())}destroyAttribute(e){const t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e){const t=this.backend,n=t.device,r=t.get(this._getBufferAttribute(e)).buffer,a=r.size,l=n.createBuffer({label:`${e.name}_readback`,size:a,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),u=n.createCommandEncoder({label:`readback_encoder_${e.name}`});u.copyBufferToBuffer(r,0,l,0,a);const h=u.finish();n.queue.submit([h]),await l.mapAsync(GPUMapMode.READ);const p=l.getMappedRange(),g=new e.array.constructor(p.slice(0));return l.unmap(),g.buffer}_getVertexFormat(e){const{itemSize:t,normalized:n}=e,i=e.array.constructor,r=e.constructor;let a;if(t===1)a=wie.get(i);else{const u=(Cie.get(r)||Gz.get(i))[n?1:0];if(u){const h=i.BYTES_PER_ELEMENT*t,g=Math.floor((h+3)/4)*4/i.BYTES_PER_ELEMENT;if(g%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");a=`${u}x${g}`}}return a||console.error("THREE.WebGPUAttributeUtils: Vertex format not supported yet."),a}_isTypedArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}class Uie{constructor(e){this.backend=e,this.bindGroupLayoutCache=new WeakMap}createBindingsLayout(e){const t=this.backend,n=t.device,i=[];let r=0;for(const a of e.bindings){const l={binding:r++,visibility:a.visibility};if(a.isUniformBuffer||a.isStorageBuffer){const u={};a.isStorageBuffer&&(a.visibility&4&&(a.access===Ar.READ_WRITE||a.access===Ar.WRITE_ONLY)?u.type=NR.Storage:u.type=NR.ReadOnlyStorage),l.buffer=u}else if(a.isSampledTexture&&a.store){const u={};u.format=this.backend.get(a.texture).texture.format;const h=a.access;h===Ar.READ_WRITE?u.access=CR.ReadWrite:h===Ar.WRITE_ONLY?u.access=CR.WriteOnly:u.access=CR.ReadOnly,a.texture.isArrayTexture?u.viewDimension=Ps.TwoDArray:a.texture.is3DTexture&&(u.viewDimension=Ps.ThreeD),l.storageTexture=u}else if(a.isSampledTexture){const u={},{primarySamples:h}=t.utils.getTextureSampleData(a.texture);if(h>
43421&&(u.multisampled=!0,a.texture.isDepthTexture||(u.sampleType=rp.UnfilterableFloat)),a.texture.isDepthTexture)t.compatibilityMode&&a.texture.compareFunction===null?u.sampleType=rp.UnfilterableFloat:u.sampleType=rp.Depth;else if(a.texture.isDataTexture||a.texture.isDataArrayTexture||a.texture.isData3DTexture){const p=a.texture.type;p===Zs?u.sampleType=rp.SInt:p===gi?u.sampleType=rp.UInt:p===Bi&&(this.backend.hasFeature("float32-filterable")?u.sampleType=rp.Float:u.sampleType=rp.UnfilterableFloat)}a.isSampledCubeTexture?u.viewDimension=Ps.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?u.viewDimension=Ps.TwoDArray:a.isSampledTexture3D&&(u.viewDimension=Ps.ThreeD),l.texture=u}else if(a.isSampler){const u={};a.texture.isDepthTexture&&(a.texture.compareFunction!==null?u.type=BB.Comparison:t.compatibilityMode&&(u.type=BB.NonFiltering)),l.sampler=u}else console.error(`WebGPUBindingUtils: Unsupported binding "${a}".`);i.push(l)}return n.createBindGroupLayout({entries:i})}createBindings(e,t,n,i=0){const{backend:r,bindGroupLayoutCache:a}=this,l=r.get(e);let u=a.get(e.bindingsReference);u===void 0&&(u=this.createBindingsLayout(e),a.set(e.bindingsReference,u));let h;n>0&&(l.groups===void 0&&(l.groups=[],l.versions=[]),l.versions[n]===i&&(h=l.groups[n])),h===void 0&&(h=this.createBindGroup(e,u),n>0&&(l.groups[n]=h,l.versions[n]=i)),l.group=h,l.layout=u}updateBinding(e){const t=this.backend,n=t.device,i=e.buffer,r=t.get(e).buffer;n.queue.writeBuffer(r,0,i,0)}createBindGroupIndex(e,t){const i=this.backend.device,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,a=e[0],l=i.createBuffer({label:"bindingCameraIndex_"+a,size:16,usage:r});i.queue.writeBuffer(l,0,e,0);const u=[{binding:0,resource:{buffer:l}}];return i.createBindGroup({label:"bindGroupCameraIndex_"+a,layout:t,entries:u})}createBindGroup(e,t){const n=this.backend,i=n.device;let r=0;const a=[];for(const l of e.bindings){if(l.isUniformBuffer){const u=n.get(l);if(u.buffer===void 0){const h=l.byteLength,p=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,g=i.createBuffer({label:"bindingBuffer_"+l.name,size:h,usage:p});u.buffer=g}a.push({binding:r,resource:{buffer:u.buffer}})}else if(l.isStorageBuffer){const u=n.get(l);if(u.buffer===void 0){const h=l.attribute;u.buffer=n.get(h).buffer}a.push({binding:r,resource:{buffer:u.buffer}})}else if(l.isSampledTexture){const u=n.get(l.texture);let h;if(u.externalTexture!==void 0)h=i.importExternalTexture({source:u.externalTexture});else{const p=l.store?1:u.texture.mipLevelCount;let g=`view-${u.texture.width}-${u.texture.height}`;if(u.texture.depthOrArrayLayers>1&&(g+=`-${u.texture.depthOrArrayLayers}`),g+=`-${p}`,h=u[g],h===void 0){const y=uie.All;let _;l.isSampledCubeTexture?_=Ps.Cube:l.isSampledTexture3D?_=Ps.ThreeD:l.texture.isArrayTexture||l.texture.isDataArrayTexture||l.texture.isCompressedArrayTexture?_=Ps.TwoDArray:_=Ps.TwoD,h=u[g]=u.texture.createView({aspect:y,dimension:_,mipLevelCount:p})}}a.push({binding:r,resource:h})}else if(l.isSampler){const u=n.get(l.texture);a.push({binding:r,resource:u.sampler})}r++}return i.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:a})}}class Lie{constructor(e){this.backend=e,this._activePipelines=new WeakMap}setPipeline(e,t){this._activePipelines.get(e)!==t&&(e.setPipeline(t),this._activePipelines.set(e,t))}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:n,material:i,geometry:r,pipeline:a}=e,{vertexProgram:l,fragmentProgram:u}=a,h=this.backend,p=h.device,g=h.utils,y=h.get(a),_=[];for(const se of e.getBindings()){const fe=h.get(se);_.push(fe.layout)}const S=h.attributeUtils.createShaderVertexBuffers(e);let A;i.blending!==Qa&&(i.blending!==$a||i.transparent!==!1)&&(A=this._getBlending(i));let E={};i.stencilWrite===!0&&(E={compare:this._getStencilCompare(i),failOp:this._getStencilOperation(i.stencilFail),depthFailOp:this._getStencilOperation(i.stencilZFail),passOp:this._getStencilOperation(i.stencilZPass)});const b=this._getColorWriteMask(i),C=[];if(e.context.textures!==null){const se=e.context.textures;for(let fe=0;fe<se.length;fe++){const pe=g.getTextureFormatGPU(se[fe]);C.push({format:pe,blend:A,writeMask:b})}}else{const se=g.getCurrentColorFormat(e.context);C.push({format:se,blend:A,writeMask:b})}const w=h.get(l).module,D=h.get(u).module,P=this._getPrimitiveState(n,r,i),I=this._getDepthCompare(i),F=g.getCurrentDepthStencilFormat(e.context),z=this._getSampleC
4342ount(e.context),B={label:`renderPipeline_${i.name||i.type}_${i.id}`,vertex:Object.assign({},w,{buffers:S}),fragment:Object.assign({},D,{targets:C}),primitive:P,multisample:{count:z,alphaToCoverageEnabled:i.alphaToCoverage&&z>1},layout:p.createPipelineLayout({bindGroupLayouts:_})},O={},W=e.context.depth,ee=e.context.stencil;if((W===!0||ee===!0)&&(W===!0&&(O.format=F,O.depthWriteEnabled=i.depthWrite,O.depthCompare=I),ee===!0&&(O.stencilFront=E,O.stencilBack={},O.stencilReadMask=i.stencilFuncMask,O.stencilWriteMask=i.stencilWriteMask),i.polygonOffset===!0&&(O.depthBias=i.polygonOffsetUnits,O.depthBiasSlopeScale=i.polygonOffsetFactor,O.depthBiasClamp=0),B.depthStencil=O),t===null)y.pipeline=p.createRenderPipeline(B);else{const se=new Promise(fe=>{p.createRenderPipelineAsync(B).then(pe=>{y.pipeline=pe,fe()})});t.push(se)}}createBundleEncoder(e,t="renderBundleEncoder"){const n=this.backend,{utils:i,device:r}=n,a=i.getCurrentDepthStencilFormat(e),l=i.getCurrentColorFormat(e),u=this._getSampleCount(e),h={label:t,colorFormats:[l],depthStencilFormat:a,sampleCount:u};return r.createRenderBundleEncoder(h)}createComputePipeline(e,t){const n=this.backend,i=n.device,r=n.get(e.computeProgram).module,a=n.get(e),l=[];for(const u of t){const h=n.get(u);l.push(h.layout)}a.pipeline=i.createComputePipeline({compute:r,layout:i.createPipelineLayout({bindGroupLayouts:l})})}_getBlending(e){let t,n;const i=e.blending,r=e.blendSrc,a=e.blendDst,l=e.blendEquation;if(i===bp){const u=e.blendSrcAlpha!==null?e.blendSrcAlpha:r,h=e.blendDstAlpha!==null?e.blendDstAlpha:a,p=e.blendEquationAlpha!==null?e.blendEquationAlpha:l;t={srcFactor:this._getBlendFactor(r),dstFactor:this._getBlendFactor(a),operation:this._getBlendOperation(l)},n={srcFactor:this._getBlendFactor(u),dstFactor:this._getBlendFactor(h),operation:this._getBlendOperation(p)}}else{const u=e.premultipliedAlpha,h=(p,g,y,_)=>{t={srcFactor:p,dstFactor:g,operation:sp.Add},n={srcFactor:y,dstFactor:_,operation:sp.Add}};if(u)switch(i){case $a:h(Vn.One,Vn.OneMinusSrcAlpha,Vn.One,Vn.OneMinusSrcAlpha);break;case Dp:h(Vn.One,Vn.One,Vn.One,Vn.One);break;case Up:h(Vn.Zero,Vn.OneMinusSrc,Vn.Zero,Vn.One);break;case Lp:h(Vn.Dst,Vn.OneMinusSrcAlpha,Vn.Zero,Vn.One);break}else switch(i){case $a:h(Vn.SrcAlpha,Vn.OneMinusSrcAlpha,Vn.One,Vn.OneMinusSrcAlpha);break;case Dp:h(Vn.SrcAlpha,Vn.One,Vn.One,Vn.One);break;case Up:console.error("THREE.WebGPURenderer: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Lp:console.error("THREE.WebGPURenderer: MultiplyBlending requires material.premultipliedAlpha = true");break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};console.error("THREE.WebGPURenderer: Invalid blending: ",i)}_getBlendFactor(e){let t;switch(e){case Gu:t=Vn.Zero;break;case AM:t=Vn.One;break;case RM:t=Vn.Src;break;case NM:t=Vn.OneMinusSrc;break;case by:t=Vn.SrcAlpha;break;case Ty:t=Vn.OneMinusSrcAlpha;break;case DM:t=Vn.Dst;break;case UM:t=Vn.OneMinusDst;break;case CM:t=Vn.DstAlpha;break;case wM:t=Vn.OneMinusDstAlpha;break;case LM:t=Vn.SrcAlphaSaturated;break;case WZ:t=Vn.Constant;break;case XZ:t=Vn.OneMinusConstant;break;default:console.error("THREE.WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const n=e.stencilFunc;switch(n){case RP:t=Sr.Never;break;case jT:t=Sr.Always;break;case NP:t=Sr.Less;break;case wP:t=Sr.LessEqual;break;case CP:t=Sr.Equal;break;case LP:t=Sr.GreaterEqual;break;case DP:t=Sr.Greater;break;case UP:t=Sr.NotEqual;break;default:console.error("THREE.WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case fd:t=dd.Keep;break;case xP:t=dd.Zero;break;case SP:t=dd.Replace;break;case AP:t=dd.Invert;break;case bP:t=dd.IncrementClamp;break;case TP:t=dd.DecrementClamp;break;case MP:t=dd.IncrementWrap;break;case EP:t=dd.DecrementWrap;break;default:console.error("THREE.WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case Tr:t=sp.Add;break;case MM:t=sp.Subtract;break;case EM:t=sp.ReverseSubtract;break;case FN:t=sp.Min;break;case VN:t=sp.Max;break;default:console.error("THREE.WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){const i={},r=this.backend.utils;
4342i.topology=r.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(i.stripIndexFormat=t.index.array instanceof Uint16Array?qy.Uint16:qy.Uint32);let a=n.side===yi;return e.isMesh&&e.matrixWorld.determinant()<0&&(a=!a),i.frontFace=a===!0?DB.CW:DB.CCW,i.cullMode=n.side===br?UB.None:UB.Back,i}_getColorWriteMask(e){return e.colorWrite===!0?LB.All:LB.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=Sr.Always;else{const n=e.depthFunc;switch(n){case My:t=Sr.Never;break;case Ey:t=Sr.Always;break;case Ay:t=Sr.Less;break;case th:t=Sr.LessEqual;break;case Ry:t=Sr.Equal;break;case Ny:t=Sr.GreaterEqual;break;case Cy:t=Sr.Greater;break;case wy:t=Sr.NotEqual;break;default:console.error("THREE.WebGPUPipelineUtils: Invalid depth function.",n)}}return t}}class Bie extends Vz{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxQueries,label:`queryset_global_timestamp_${t}`});const i=this.maxQueries*8;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:i,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:i,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return qr(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();const i=this.device.createCommandEncoder();i.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),i.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);const r=i.finish();if(this.device.queue.submit([r]),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;const a=new BigUint64Array(this.resultBuffer.getMappedRange(0,n));let l=0;for(const[,u]of e){const h=a[u],p=a[u+1],g=Number(p-h)/1e6;l+=g}return this.resultBuffer.unmap(),this.lastValue=l,l}catch(e){return console.error("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){console.error("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){console.error("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}}class Pie extends Fz{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.compatibilityMode=e.compatibilityMode===void 0?!1:e.compatibilityMode,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=this.parameters.compatibilityMode,this.device=null,this.context=null,this.colorBuffer=null,this.defaultRenderPassdescriptor=null,this.utils=new Nie(this),this.attributeUtils=new Die(this),this.bindingUtils=new Uie(this),this.pipelineUtils=new Lie(this),this.textureUtils=new yie(this),this.occludedResolveCache=new Map}async init(e){await super.init(e);const t=this.parameters;let n;if(t.device===void 0){const l={powerPreference:t.powerPreference,featureLevel:t.compatibilityMode?"compatibility":void 0},u=typeof navigator<"u"?await navigator.gpu.requestAdapter(l):null;if(u===null)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const h=Object.values(TN),p=[];for(const y of h)u.features.has(y)&&p.push(y);const g={requiredFeatures:p,requiredLimits:t.requiredLimits};n=await u.requestDevice(g)}else n=t.device;n.lost.then(l=>{const u={api:"WebGPU",message:l.message||"Unknown reason",reason:l.reason||null,originalEvent:l};e.onDeviceLost(u)});const i=t.context!==void 0?t.context:e.domElement.getContext("webgpu");this.device=n,this.context=i;const r=t.alpha?"premultiplied":"opaque",a=Kt.getToneMappingMode(this.renderer.outputColorSpace);this.context.configure({device:this.device,format:this.utils.getPreferredCanvasF
4342ormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:r,toneMapping:{mode:a}}),this.trackTimestamp=this.trackTimestamp&&this.hasFeature(TN.TimestampQuery),this.updateSize()}get coordinateSystem(){return rl}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.defaultRenderPassdescriptor;if(e===null){const n=this.renderer;e={colorAttachments:[{view:null}]},(this.renderer.depth===!0||this.renderer.stencil===!0)&&(e.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(n.depth,n.stencil).createView()});const i=e.colorAttachments[0];this.renderer.samples>0?i.view=this.colorBuffer.createView():i.resolveTarget=void 0,this.defaultRenderPassdescriptor=e}const t=e.colorAttachments[0];return this.renderer.samples>0?t.resolveTarget=this.context.getCurrentTexture().createView():t.view=this.context.getCurrentTexture().createView(),e}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){const n=e.renderTarget,i=this.get(n);let r=i.descriptors;(r===void 0||i.width!==n.width||i.height!==n.height||i.samples!==n.samples)&&(r={},i.descriptors=r);const a=e.getCacheKey();let l=r[a];if(l===void 0){const h=e.textures,p=[];let g;const y=this._isRenderCameraDepthArray(e);for(let _=0;_<h.length;_++){const S=this.get(h[_]),A={label:`colorAttachment_${_}`,baseMipLevel:e.activeMipmapLevel,mipLevelCount:1,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1,dimension:Ps.TwoD};if(n.isRenderTarget3D)g=e.activeCubeFace,A.baseArrayLayer=0,A.dimension=Ps.ThreeD,A.depthOrArrayLayers=h[_].image.depth;else if(n.isRenderTarget&&h[_].image.depth>1)if(y===!0){const E=e.camera.cameras;for(let b=0;b<E.length;b++){const C={...A,baseArrayLayer:b,arrayLayerCount:1,dimension:Ps.TwoD},w=S.texture.createView(C);p.push({view:w,resolveTarget:void 0,depthSlice:void 0})}}else A.dimension=Ps.TwoDArray,A.depthOrArrayLayers=h[_].image.depth;if(y!==!0){const E=S.texture.createView(A);let b,C;S.msaaTexture!==void 0?(b=S.msaaTexture.createView(),C=E):(b=E,C=void 0),p.push({view:b,resolveTarget:C,depthSlice:g})}}if(l={textureViews:p},e.depth){const _=this.get(e.depthTexture),S={};e.depthTexture.isArrayTexture&&(S.dimension=Ps.TwoD,S.arrayLayerCount=1,S.baseArrayLayer=e.activeCubeFace),l.depthStencilView=_.texture.createView(S)}r[a]=l,i.width=n.width,i.height=n.height,i.samples=n.samples,i.activeMipmapLevel=e.activeMipmapLevel,i.activeCubeFace=e.activeCubeFace}const u={colorAttachments:[]};for(let h=0;h<l.textureViews.length;h++){const p=l.textureViews[h];let g={r:0,g:0,b:0,a:1};h===0&&t.clearValue&&(g=t.clearValue),u.colorAttachments.push({view:p.view,depthSlice:p.depthSlice,resolveTarget:p.resolveTarget,loadOp:t.loadOp||si.Load,storeOp:t.storeOp||ga.Store,clearValue:g})}return l.depthStencilView&&(u.depthStencilAttachment={view:l.depthStencilView}),u}beginRender(e){const t=this.get(e);t.frameCalls=this.renderer.info.render.frameCalls;const n=this.device,i=e.occlusionQueryCount;let r;i>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,r=n.createQuerySet({type:"occlusion",count:i,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=r,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(i),t.lastOcclusionObject=null);let a;e.textures===null?a=this._getDefaultRenderPassDescriptor():a=this._getRenderPassDescriptor(e,{loadOp:si.Load}),this.initTimestampQuery(pp.RENDER,this.getTimestampUID(e),a),a.occlusionQuerySet=r;const l=a.depthStencilAttachment;if(e.textures!==null){const h=a.colorAttachments;for(let p=0;p<h.length;p++){const g=h[p];e.clearColor?(g.clearValue=p===0?e.clearColorValue:{r:0,g:0,b:0,a:1},g.loadOp=si.Clear):g.loadOp=si.Load,g.storeOp=ga.Store}}else{const h=a.colorAttachments[0];e.clearColor?(h.clearValue=e.clearColorValue,h.loadOp=si.Clear):h.loadOp=si.Load,h.storeOp=ga.Store}e.depth&&(e.clearDepth?(l.depthClearValue=e.clearDepthValue,l.depthLoadOp=si.Clear):l.depthLoadOp=si.Load,l.depthStoreOp=ga.Store),e.stencil&&(e.clearStencil?(l.stencilClearValue=e.clearStencilValue,l.stencilLoadOp=si.Clear):l.stencilLoadOp=si.Load,l.stencilStoreOp=ga.Store);const u=n.createCommandEncoder({label:"renderContext_"+e.id});if(this._isRenderCameraDepthArray(e)===!0){const h=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==h.length?this._createDepthLayerDescriptors(e,t,a,h):this._updateDepthLayerDescriptors(e,t,h),t.bundleEncoders=[],t.bundleSets=[];for(let p=0;p<h.length;p++){const g=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+p),y={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(g),t.bundleSets.push(y)}t.currentPass=null}else{const h=u.beginRenderPass(a);if(t.currentPass=h,e.viewport&&this.updateViewport(e),e.scissor){const{x:p,y:g,width:y,height:_}=e.scissorValue;
4342h.setScissorRect(p,g,y,_)}}t.descriptor=a,t.encoder=u,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createDepthLayerDescriptors(e,t,n,i){const r=n.depthStencilAttachment;t.layerDescriptors=[];const a=this.get(e.depthTexture);a.viewCache||(a.viewCache=[]);for(let l=0;l<i.length;l++){const u={...n,colorAttachments:[{...n.colorAttachments[0],view:n.colorAttachments[l].view}]};if(n.depthStencilAttachment){const h=l;a.viewCache[h]||(a.viewCache[h]=a.texture.createView({dimension:Ps.TwoD,baseArrayLayer:l,arrayLayerCount:1})),u.depthStencilAttachment={view:a.viewCache[h],depthLoadOp:r.depthLoadOp||si.Clear,depthStoreOp:r.depthStoreOp||ga.Store,depthClearValue:r.depthClearValue||1},e.stencil&&(u.depthStencilAttachment.stencilLoadOp=r.stencilLoadOp,u.depthStencilAttachment.stencilStoreOp=r.stencilStoreOp,u.depthStencilAttachment.stencilClearValue=r.stencilClearValue)}else u.depthStencilAttachment={...r};t.layerDescriptors.push(u)}}_updateDepthLayerDescriptors(e,t,n){for(let i=0;i<n.length;i++){const r=t.layerDescriptors[i];if(r.depthStencilAttachment){const a=r.depthStencilAttachment;e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=si.Clear):a.depthLoadOp=si.Load),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=si.Clear):a.stencilLoadOp=si.Load)}}}finishRender(e){const t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();const i=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){const r=[];for(let a=0;a<t.bundleEncoders.length;a++){const l=t.bundleEncoders[a];r.push(l.finish())}for(let a=0;a<t.layerDescriptors.length;a++)if(a<r.length){const l=t.layerDescriptors[a],u=i.beginRenderPass(l);if(e.viewport){const{x:h,y:p,width:g,height:y,minDepth:_,maxDepth:S}=e.viewportValue;u.setViewport(h,p,g,y,_,S)}if(e.scissor){const{x:h,y:p,width:g,height:y}=e.scissorValue;u.setScissorRect(h,p,g,y)}u.executeBundles([r[a]]),u.end()}}else t.currentPass&&t.currentPass.end();if(n>0){const r=n*8;let a=this.occludedResolveCache.get(r);a===void 0&&(a=this.device.createBuffer({size:r,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(r,a));const l=this.device.createBuffer({size:r,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,a,0),t.encoder.copyBufferToBuffer(a,0,l,0,r),t.occlusionQueryBuffer=l,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),e.textures!==null){const r=e.textures;for(let a=0;a<r.length;a++){const l=r[a];l.generateMipmaps===!0&&this.textureUtils.generateMipmaps(l)}}}isOccluded(e,t){const n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){const t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:i}=t;if(n&&i){const r=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);const a=n.getMappedRange(),l=new BigUint64Array(a);for(let u=0;u<i.length;u++)l[u]===BigInt(0)&&r.add(i[u]);n.destroy(),t.occluded=r}}updateViewport(e){const{currentPass:t}=this.get(e),{x:n,y:i,width:r,height:a,minDepth:l,maxDepth:u}=e.viewportValue;t.setViewport(n,i,r,a,l,u)}getClearColor(){const e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,i=null){const r=this.device,a=this.renderer;let l=[],u,h,p,g;if(e){const S=this.getClearColor();h={r:S.r,g:S.g,b:S.b,a:S.a}}if(i===null){p=a.depth,g=a.stencil;const S=this._getDefaultRenderPassDescriptor();if(e){l=S.colorAttachments;const A=l[0];A.clearValue=h,A.loadOp=si.Clear,A.storeOp=ga.Store}(p||g)&&(u=S.depthStencilAttachment)}else{p=i.depth,g=i.stencil;const S={loadOp:e?si.Clear:si.Load,clearValue:e?h:void 0};p&&(S.depthLoadOp=t?si.Clear:si.Load,S.depthClearValue=t?a.getClearDepth():void 0,S.depthStoreOp=ga.Store),g&&(S.stencilLoadOp=n?si.Clear:si.Load,S.stencilClearValue=n?a.getClearStencil():void 0,S.stencilStoreOp=ga.Store);const A=this._getRenderPassDescriptor(i,S);l=A.colorAttachments,u=A.depthStencilAttachment}p&&u&&(t?(u.depthLoadOp=si.Clear,u.depthClearValue=a.getClearDepth(),u.depthStoreOp=ga.Store):(u.depthLoadOp=si.Load,u.depthStoreOp=ga.Store)),g&&u&&(n?(u.stencilLoadOp=si.Clear,u.stencilClearValue=a.getClearStencil(),u.stencilStoreOp=ga.Store):(u.stencilLoadOp=si.Load,u.stencilStoreOp=ga.Store));const y=r.createCommandEncoder({label:"clear"});y.beginRenderPass({colorAttachments:l,depthStencilAttachment:u}).end(),r.queue.submit([y.finish()])}beginCompute(e){const t=this.get(e);t.frameCalls=this.renderer.info.compute.frameCalls;const n={label:"computeGroup_"+e.id};this.initTimestampQuery(pp.COMPUTE,this.getTimestampUID(e),n),t.cmdEncoderGPU=this.device.createCommandEncoder({label:"computeGroup_"+e.id}),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(n)}compute(e,t,n,i,r=null){const a=this.get(t),{passEncoderGPU:l}=this.get(e),u=this.get(i).pipeline;this.pipelineUtils.setPipeline(l,u);for(let p=0,g=n.length;p<g;p++){const y=n[p],_=this.get(y);l.setBindGroup(p,_.group)}let h;
4342if(r===null&&(r=t.count),typeof r=="number"){const p=r;if(a.dispatchSize===void 0||a.count!==p){a.dispatchSize=[0,1,1],a.count=p;const g=t.workgroupSize;let y=g[0];for(let A=1;A<g.length;A++)y*=g[A];const _=Math.ceil(p/y),S=this.device.limits.maxComputeWorkgroupsPerDimension;h=[_,1,1],_>S&&(h[0]=Math.min(_,S),h[1]=Math.ceil(_/S)),a.dispatchSize=h}h=a.dispatchSize}else h=r;l.dispatchWorkgroups(h[0],h[1]||1,h[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}async waitForGPU(){await this.device.queue.onSubmittedWorkDone()}draw(e,t){const{object:n,material:i,context:r,pipeline:a}=e,l=e.getBindings(),u=this.get(r),h=this.get(a).pipeline,p=e.getIndex(),g=p!==null,y=e.getDrawParameters();if(y===null)return;const _=(A,E)=>{this.pipelineUtils.setPipeline(A,h),E.pipeline=h;const b=E.bindingGroups;for(let w=0,D=l.length;w<D;w++){const P=l[w],I=this.get(P);b[P.index]!==P.id&&(A.setBindGroup(P.index,I.group),b[P.index]=P.id)}if(g===!0&&E.index!==p){const w=this.get(p).buffer,D=p.array instanceof Uint16Array?qy.Uint16:qy.Uint32;A.setIndexBuffer(w,D),E.index=p}const C=e.getVertexBuffers();for(let w=0,D=C.length;w<D;w++){const P=C[w];if(E.attributes[w]!==P){const I=this.get(P).buffer;A.setVertexBuffer(w,I),E.attributes[w]=P}}r.stencil===!0&&i.stencilWrite===!0&&u.currentStencilRef!==i.stencilRef&&(A.setStencilReference(i.stencilRef),u.currentStencilRef=i.stencilRef)},S=(A,E)=>{if(_(A,E),n.isBatchedMesh===!0){const b=n._multiDrawStarts,C=n._multiDrawCounts,w=n._multiDrawCount,D=n._multiDrawInstances;D!==null&&qr("THREE.WebGPUBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.");for(let P=0;P<w;P++){const I=D?D[P]:1,F=I>1?0:P;g===!0?A.drawIndexed(C[P],I,b[P]/p.array.BYTES_PER_ELEMENT,0,F):A.draw(C[P],I,b[P],F),t.update(n,C[P],I)}}else if(g===!0){const{vertexCount:b,instanceCount:C,firstVertex:w}=y,D=e.getIndirect();if(D!==null){const P=this.get(D).buffer;A.drawIndexedIndirect(P,0)}else A.drawIndexed(b,C,w,0,0);t.update(n,b,C)}else{const{vertexCount:b,instanceCount:C,firstVertex:w}=y,D=e.getIndirect();if(D!==null){const P=this.get(D).buffer;A.drawIndirect(P,0)}else A.draw(b,C,w,0);t.update(n,b,C)}};if(e.camera.isArrayCamera&&e.camera.cameras.length>0){const A=this.get(e.camera),E=e.camera.cameras,b=e.getBindingGroup("cameraIndex");if(A.indexesGPU===void 0||A.indexesGPU.length!==E.length){const w=this.get(b),D=[],P=new Uint32Array([0,0,0,0]);for(let I=0,F=E.length;I<F;I++){P[0]=I;const z=this.bindingUtils.createBindGroupIndex(P,w.layout);D.push(z)}A.indexesGPU=D}const C=this.renderer.getPixelRatio();for(let w=0,D=E.length;w<D;w++){const P=E[w];if(n.layers.test(P.layers)){const I=P.viewport;let F=u.currentPass,z=u.currentSets;if(u.bundleEncoders){const B=u.bundleEncoders[w],O=u.bundleSets[w];F=B,z=O}I&&F.setViewport(Math.floor(I.x*C),Math.floor(I.y*C),Math.floor(I.width*C),Math.floor(I.height*C),r.viewportValue.minDepth,r.viewportValue.maxDepth),b&&A.indexesGPU&&(F.setBindGroup(b.index,A.indexesGPU[w]),z.bindingGroups[b.index]=b.id),S(F,z)}}}else if(u.currentPass){if(u.occlusionQuerySet!==void 0){const A=u.lastOcclusionObject;A!==n&&(A!==null&&A.occlusionTest===!0&&(u.currentPass.endOcclusionQuery(),u.occlusionQueryIndex++),n.occlusionTest===!0&&(u.currentPass.beginOcclusionQuery(u.occlusionQueryIndex),u.occlusionQueryObjects[u.occlusionQueryIndex]=n),u.lastOcclusionObject=n)}S(u.currentPass,u.currentSets)}}needsRenderUpdate(e){const t=this.get(e),{object:n,material:i}=e,r=this.utils,a=r.getSampleCountRenderContext(e.context),l=r.getCurrentColorSpace(e.context),u=r.getCurrentColorFormat(e.context),h=r.getCurrentDepthStencilFormat(e.context),p=r.getPrimitiveTopology(n,i);let g=!1;return(t.material!==i||t.materialVersion!==i.version||t.transparent!==i.transparent||t.blending!==i.blending||t.premultipliedAlpha!==i.premultipliedAlpha||t.blendSrc!==i.blendSrc||t.blendDst!==i.blendDst||t.blendEquation!==i.blendEquation||t.blendSrcAlpha!==i.blendSrcAlpha||t.blendDstAlpha!==i.blendDstAlpha||t.blendEquationAlpha!==i.blendEquationAlpha||t.colorWrite!==i.colorWrite||t.depthWrite!==i.depthWrite||t.depthTest!==i.depthTest||t.depthFunc!==i.depthFunc||t.stencilWrite!==i.stencilWrite||t.stencilFunc!==i.stencilFunc||t.stencilFail!==i.stencilFail||t.stencilZFail!==i.stencilZFail||t.stencilZPass!==i.stencilZPass||t.stencilFuncMask!==i.stencilFuncMask||t.stencilWriteMask!==i.stencilWriteMask||t.side!==i.side||t.alphaToCoverage!==i.alphaToCoverage||t.sampleC
4342ount!==a||t.colorSpace!==l||t.colorFormat!==u||t.depthStencilFormat!==h||t.primitiveTopology!==p||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=i,t.materialVersion=i.version,t.transparent=i.transparent,t.blending=i.blending,t.premultipliedAlpha=i.premultipliedAlpha,t.blendSrc=i.blendSrc,t.blendDst=i.blendDst,t.blendEquation=i.blendEquation,t.blendSrcAlpha=i.blendSrcAlpha,t.blendDstAlpha=i.blendDstAlpha,t.blendEquationAlpha=i.blendEquationAlpha,t.colorWrite=i.colorWrite,t.depthWrite=i.depthWrite,t.depthTest=i.depthTest,t.depthFunc=i.depthFunc,t.stencilWrite=i.stencilWrite,t.stencilFunc=i.stencilFunc,t.stencilFail=i.stencilFail,t.stencilZFail=i.stencilZFail,t.stencilZPass=i.stencilZPass,t.stencilFuncMask=i.stencilFuncMask,t.stencilWriteMask=i.stencilWriteMask,t.side=i.side,t.alphaToCoverage=i.alphaToCoverage,t.sampleCount=a,t.colorSpace=l,t.colorFormat=u,t.depthStencilFormat=h,t.primitiveTopology=p,t.clippingContextCacheKey=e.clippingContextCacheKey,g=!0),g}getRenderCacheKey(e){const{object:t,material:n}=e,i=this.utils,r=e.context,a=t.isMesh&&t.matrixWorld.determinant()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,a,i.getSampleCountRenderContext(r),i.getCurrentColorSpace(r),i.getCurrentColorFormat(r),i.getCurrentDepthStencilFormat(r),i.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}createSampler(e){this.textureUtils.createSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e){this.textureUtils.destroyTexture(e)}async copyTextureToBuffer(e,t,n,i,r,a){return this.textureUtils.copyTextureToBuffer(e,t,n,i,r,a)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new Bie(this.device,e,2048));const i=this.timestampQueryPool[e],r=i.allocateQueriesForContext(t);n.timestampWrites={querySet:i.querySet,beginningOfPassWriteIndex:r,endOfPassWriteIndex:r+1}}createNodeBuilder(e,t){return new Rie(e,t)}createProgram(e){const t=this.get(e);t.module={module:this.device.createShaderModule({code:e.code,label:e.stage+(e.name!==""?`_${e.name}`:"")}),entryPoint:"main"}}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){const t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){const n=this.get(e),r=n.currentPass.finish();this.get(t).bundleGPU=r,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createBindings(e,t,n,i){this.bindingUtils.createBindings(e,t,n,i)}updateBindings(e,t,n,i){this.bindingUtils.createBindings(e,t,n,i)}updateBinding(e){this.bindingUtils.updateBinding(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.colorBuffer=this.textureUtils.getColorBuffer(),this.defaultRenderPassdescriptor=null}getMaxAnisotropy(){return 16}hasFeature(e){return this.device.features.has(e)}copyTextureToTexture(e,t,n=null,i=null,r=0,a=0){let l=0,u=0,h=0,p=0,g=0,y=0,_=e.image.width,S=e.image.height,A=1;n!==null&&(n.isBox3===!0?(p=n.min.x,g=n.min.y,y=n.min.z,_=n.max.x-n.min.x,S=n.max.y-n.min.y,A=n.max.z-n.min.z):(p=n.min.x,g=n.min.y,_=n.max.x-n.min.x,S=n.max.y-n.min.y,A=1)),i!==null&&(l=i.x,u=i.y,h=i.z||0);const E=this.device.createCommandEncoder({label:"copyTextureToTexture_"+e.id+"_"+t.id}),b=this.get(e).texture,C=this.get(t).texture;E.copyTextureToTexture({texture:b,mipLevel:r,origin:{x:p,y:g,z:y}},{texture:C,mipLevel:a,origin:{x:l,y:u,z:h}},[_,S,A]),this.device.queue.submit([E.finish()]),a===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){const i=this.get(t);let r=null;t.renderTarget?e.isDepthTexture?r=this.get(t.depthTexture).texture:r=this.get(t.textures[0]).texture:e.isDepthTexture?r=this.textureUtils.getDepthBuffer(t.depth,t.stencil):r=this.context.getCurrentTexture();const a=this.get(e).texture;if(r.format!==a.format){console.error("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",r.format,a.format);return}let l;if(i.currentPass?(i.currentPass.end(),l=i.encoder):l=this.device.createCommandEncoder({label:"copyFramebufferToTexture_"+e.id}),l.copyTextureToTexture({texture:r,origin:[n.x,n.y,0]},{texture:a},[n.z,n.w]),i.currentPass){const{descriptor:u}=i;for(let h=0;h<u.colorAttachments.length;h++)u.colorAttachments[h].loadOp=si.Load;if(t.depth&&(u.depthStencilAttachment.depthLoadOp=si.Load),t.stencil&&(u.depthStencilAttachment.stencilLoadOp=si.Load),i.currentPass=l.beginRenderPass(u),i.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor){const{x:h,y:p,width:g,height:y}=t.scissorValue;
4342i.currentPass.setScissorRect(h,p,g,y)}}else this.device.queue.submit([l.finish()]);e.generateMipmaps&&this.textureUtils.generateMipmaps(e)}}class Oie extends cx{constructor(e,t,n,i,r,a){super(e,t,n,i,r,a),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class Iie extends cx{constructor(e,t,n,i,r,a){super(e,t,n,i,r,a),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}}class Fie extends wz{constructor(){super(),this.addMaterial(FK,"MeshPhongMaterial"),this.addMaterial(NV,"MeshStandardMaterial"),this.addMaterial(MZ,"MeshPhysicalMaterial"),this.addMaterial(NZ,"MeshToonMaterial"),this.addMaterial(pV,"MeshBasicMaterial"),this.addMaterial(OK,"MeshLambertMaterial"),this.addMaterial(RK,"MeshNormalMaterial"),this.addMaterial(wZ,"MeshMatcapMaterial"),this.addMaterial(xK,"LineBasicMaterial"),this.addMaterial(bK,"LineDashedMaterial"),this.addMaterial(PZ,"PointsMaterial"),this.addMaterial(wV,"SpriteMaterial"),this.addMaterial(VZ,"ShadowMaterial"),this.addLight(oee,EC),this.addLight(gne,AC),this.addLight(yne,NC),this.addLight(s2,cx),this.addLight(Sne,RC),this.addLight(bne,TC),this.addLight(Tne,CC),this.addLight(vne,Oie),this.addLight(xne,Iie),this.addToneMapping(jV,HN),this.addToneMapping(KV,kN),this.addToneMapping(ZV,qN),this.addToneMapping(QV,BM),this.addToneMapping($V,WN),this.addToneMapping(JV,XN)}}class Vie extends Hne{constructor(e={}){let t;e.forceWebGL?t=wB:(t=Pie,e.getFallback=()=>(console.warn("THREE.WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new wB(e)));const n=new t(e);super(n,e),this.library=new Fie,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}const zie=()=>{const{set:s}=Hr(e=>e);return ze.useEffect(()=>{s(e=>{const t={...e};return t.gl.outputColorSpace=Yl,t.gl.toneMapping=Rr,t})},[]),null},a2=({debug:s=!1,frameloop:e="always",orthographic:t=!1,children:n,...i})=>{const[r,a]=ze.useState("never");return Xe.jsxs(L7,{id:"__webgpucanvas",...i,frameloop:r,gl:async l=>{const u=new Vie(l);return await u.init(),a(e),u},children:[Xe.jsx(z7,{all:!0}),Xe.jsx(G7,{}),n,Xe.jsx(zie,{}),s?Xe.jsx(V7,{className:"fragments-supply__statsgl"}):null,Xe.jsx(O7,{makeDefault:!0,position:[0,0,1]})]})};/** 4343 * @license 4344 * Copyright 2010-2025 Three.js Authors 4345 * SPDX-License-Identifier: MIT 4346 */U.BRDF_GGX;U.BRDF_Lambert;U.BasicPointShadowFilter;U.BasicShadowFilter;U.Break;U.Const;U.Continue;U.DFGApprox;U.D_GGX;U.Discard;U.EPSILON;U.F_Schlick;const Wd=U.Fn;U.INFINITY;U.If;const jE=U.Loop;U.NodeAccess;U.NodeShaderStage;U.NodeType;U.NodeUpdateType;U.PCFShadowFilter;U.PCFSoftShadowFilter;const Wy=U.PI;U.PI2;U.PointShadowFilter;U.Return;U.Schlick_to_F0;U.ScriptableNodeResources;U.ShaderNode;U.Stack;U.Switch;U.TBNViewMatrix;U.VSMShadowFilter;U.V_GGX_SmithCorrelated;U.Var;U.VarIntent;const zB=U.abs;U.acesFilmicToneMapping;U.acos;const bT=U.add;U.addMethodChaining;U.addNodeElement;U.agxToneMapping;U.all;U.alphaT;U.and;U.anisotropy;U.anisotropyB;U.anisotropyT;U.any;U.append;U.array;U.arrayBuffer;U.asin;U.assign;U.atan;U.atan2;U.atomicAdd;U.atomicAnd;U.atomicFunc;U.atomicLoad;U.atomicMax;U.atomicMin;U.atomicOr;U.atomicStore;U.atomicSub;U.atomicXor;U.attenuationColor;U.attenuationDistance;U.attribute;U.attributeArray;U.backgroundBlurriness;U.backgroundIntensity;U.backgroundRotation;U.batch;U.bentNormalView;U.billboarding;U.bitAnd;U.bitNot;U.bitOr;U.bitXor;U.bitangentGeometry;U.bitangentLocal;U.bitangentView;U.bitangentWorld;U.bitcast;U.blendBurn;U.blendColor;U.blendDodge;U.blendOverlay;U.blendScreen;U.blur;U.bool;U.buffer;U.bufferAttribute;U.bumpMap;U.burn;U.builtin;U.bvec2;U.bvec3;U.bvec4;U.bypass;U.cache;U.call;U.cameraFar;U.cameraIndex;U.cameraNear;U.cameraNormalMatrix;U.cameraPosition;U.cameraProjectionMatrix;U.cameraProjectionMatrixInverse;U.cameraViewMatrix;U.cameraViewport;U.cameraWorldMatrix;U.cbrt;U.cdl;U.ceil;U.checker;U.cineonToneMapping;U.clamp;U.clearcoat;U.clearcoatNormalView;U.clearcoatRoughness;U.code;U.color;U.colorSpaceToWorking;U.colorToDirection;U.compute;U.computeKernel;U.computeSkinning;U.context;U.convert;U.convertColorSpace;U.convertToTexture;const KE=U.cos;U.cross;U.cubeTexture;U.cubeTextureBase;U.cubeToUV;U.dFdx;U.dFdy;U.dashSize;U.debug;U.decrement;U.decrementBefore;U.defaultBuildStages;U.defaultShaderStages;U.defined;U.degrees;
4346U.deltaTime;U.densityFog;U.densityFogFactor;U.depth;U.depthPass;U.determinant;U.difference;U.diffuseColor;U.directPointLight;U.directionToColor;U.directionToFaceDirection;U.dispersion;U.distance;const o2=U.div;U.dodge;const Gie=U.dot;U.drawIndex;U.dynamicBufferAttribute;U.element;U.emissive;U.equal;U.equals;U.equirectUV;U.exp;U.exp2;U.expression;U.faceDirection;U.faceForward;U.faceforward;const Pd=U.float;U.floatBitsToInt;U.floatBitsToUint;const Hie=U.floor;U.fog;const Hz=U.fract;U.frameGroup;U.frameId;U.frontFacing;U.fwidth;U.gain;U.gapSize;U.getConstNodeType;U.getCurrentStack;U.getDirection;U.getDistanceAttenuation;U.getGeometryRoughness;U.getNormalFromDepth;U.getParallaxCorrectNormal;U.getRoughness;U.getScreenPosition;U.getShIrradianceAt;U.getShadowMaterial;U.getShadowRenderObjectFunction;U.getTextureIndex;U.getViewPosition;U.globalId;U.glsl;U.glslFn;U.grayscale;U.greaterThan;U.greaterThanEqual;U.hash;U.highpModelNormalViewMatrix;U.highpModelViewMatrix;U.hue;U.increment;U.incrementBefore;U.instance;U.instanceIndex;U.instancedArray;U.instancedBufferAttribute;U.instancedDynamicBufferAttribute;U.instancedMesh;U.int;U.intBitsToFloat;U.inverse;U.inverseSqrt;U.inversesqrt;U.invocationLocalIndex;U.invocationSubgroupIndex;U.ior;U.iridescence;U.iridescenceIOR;U.iridescenceThickness;U.ivec2;U.ivec3;U.ivec4;U.js;U.label;const l2=U.length;U.lengthSq;U.lessThan;U.lessThanEqual;U.lightPosition;U.lightProjectionUV;U.lightShadowMatrix;U.lightTargetDirection;U.lightTargetPosition;U.lightViewPosition;U.lightingContext;U.lights;U.linearDepth;U.linearToneMapping;U.localId;U.log;U.log2;U.logarithmicDepthToViewZ;U.luminance;U.mat2;U.mat3;U.mat4;U.matcapUV;U.materialAO;U.materialAlphaTest;U.materialAnisotropy;U.materialAnisotropyVector;U.materialAttenuationColor;U.materialAttenuationDistance;U.materialClearcoat;U.materialClearcoatNormal;U.materialClearcoatRoughness;U.materialColor;U.materialDispersion;U.materialEmissive;U.materialEnvIntensity;U.materialEnvRotation;U.materialIOR;U.materialIridescence;U.materialIridescenceIOR;U.materialIridescenceThickness;U.materialLightMap;U.materialLineDashOffset;U.materialLineDashSize;U.materialLineGapSize;U.materialLineScale;U.materialLineWidth;U.materialMetalness;U.materialNormal;U.materialOpacity;U.materialPointSize;U.materialReference;U.materialReflectivity;U.materialRefractionRatio;U.materialRotation;U.materialRoughness;U.materialSheen;U.materialSheenRoughness;U.materialShininess;U.materialSpecular;U.materialSpecularColor;U.materialSpecularIntensity;U.materialSpecularStrength;U.materialThickness;U.materialTransmission;const u2=U.max;U.maxMipLevel;U.mediumpModelViewMatrix;U.metalness;U.min;U.mix;U.mixElement;U.mod;U.modInt;U.modelDirection;U.modelNormalMatrix;U.modelPosition;U.modelRadius;U.modelScale;U.modelViewMatrix;U.modelViewPosition;U.modelViewProjection;U.modelWorldMatrix;U.modelWorldMatrixInverse;U.morphReference;U.mrt;const Zi=U.mul;U.mx_aastep;U.mx_add;U.mx_atan2;U.mx_cell_noise_float;U.mx_contrast;U.mx_divide;U.mx_fractal_noise_float;U.mx_fractal_noise_vec2;U.mx_fractal_noise_vec3;U.mx_fractal_noise_vec4;U.mx_frame;U.mx_heighttonormal;U.mx_hsvtorgb;U.mx_ifequal;U.mx_ifgreater;U.mx_ifgreatereq;U.mx_invert;U.mx_modulo;U.mx_multiply;U.mx_noise_float;U.mx_noise_vec3;U.mx_noise_vec4;U.mx_place2d;U.mx_power;U.mx_ramp4;U.mx_ramplr;U.mx_ramptb;U.mx_rgbtohsv;U.mx_rotate2d;U.mx_rotate3d;U.mx_safepower;U.mx_separate;U.mx_splitlr;U.mx_splittb;U.mx_srgb_texture_to_lin_rec709;U.mx_subtract;U.mx_timer;U.mx_transform_uv;U.mx_unifiednoise2d;U.mx_unifiednoise3d;U.mx_worley_noise_float;U.mx_worley_noise_vec2;U.mx_worley_noise_vec3;U.negate;U.neutralToneMapping;U.nodeArray;U.nodeImmutable;U.nodeObject;U.nodeObjectIntent;U.nodeObjects;U.nodeProxy;U.nodeProxyIntent;U.normalFlat;U.normalGeometry;U.normalLocal;U.normalMap;U.normalView;U.normalViewGeometry;U.normalWorld;U.normalWorldGeometry;U.normalize;U.not;U.notEqual;U.numWorkgroups;U.objectDirection;U.objectGroup;U.objectPosition;U.objectRadius;U.objectScale;U.objectViewPosition;U.objectWorldMatrix;U.OnObjectUpdate;U.OnMaterialUpdate;const kie=U.oneMinus;U.or;U.orthographicDepthToViewZ;U.oscSawtooth;U.oscSine;U.oscSquare;U.oscTriangle;U.output;U.outputStruct;U.overlay;U.overloadingFn;U.parabola;U.parallaxDirection;U.parallaxUV;U.parameter;U.pass;U.passTexture;U.pcurve;U.perspectiveDepthToViewZ;U.pmremTexture;U.pointShadow;U.pointUV;U.pointWidth;U.positionGeometry;
4346U.positionLocal;U.positionPrevious;U.positionView;U.positionViewDirection;U.positionWorld;U.positionWorldDirection;U.posterize;const ZE=U.pow;U.pow2;U.pow3;U.pow4;U.premultiplyAlpha;U.property;U.radians;U.rand;U.range;U.rangeFog;U.rangeFogFactor;U.reciprocal;U.reference;U.referenceBuffer;U.reflect;U.reflectVector;U.reflectView;U.reflector;U.refract;U.refractVector;U.refractView;U.reinhardToneMapping;U.remap;U.remapClamp;U.renderGroup;U.renderOutput;U.rendererReference;U.rotate;U.rotateUV;U.roughness;U.round;U.rtt;U.sRGBTransferEOTF;U.sRGBTransferOETF;U.sample;U.sampler;U.samplerComparison;U.saturate;U.saturation;U.screen;U.screenCoordinate;U.screenDPR;const Xy=U.screenSize;U.screenUV;U.scriptable;U.scriptableValue;const qie=U.select;U.setCurrentStack;U.setName;U.shaderStages;U.shadow;U.shadowPositionWorld;U.shapeCircle;U.sharedUniformGroup;U.sheen;U.sheenRoughness;U.shiftLeft;U.shiftRight;U.shininess;U.sign;const Jc=U.sin;U.sinc;U.skinning;U.smoothstep;U.smoothstepElement;U.specularColor;U.specularF90;U.spherizeUV;U.split;U.spritesheetUV;U.sqrt;U.stack;U.step;U.stepElement;U.storage;U.storageBarrier;U.storageObject;U.storageTexture;U.string;U.struct;U.sub;U.subgroupAdd;U.subgroupAll;U.subgroupAnd;U.subgroupAny;U.subgroupBallot;U.subgroupBroadcast;U.subgroupBroadcastFirst;U.subBuild;U.subgroupElect;U.subgroupExclusiveAdd;U.subgroupExclusiveMul;U.subgroupInclusiveAdd;U.subgroupInclusiveMul;U.subgroupIndex;U.subgroupMax;U.subgroupMin;U.subgroupMul;U.subgroupOr;U.subgroupShuffle;U.subgroupShuffleDown;U.subgroupShuffleUp;U.subgroupShuffleXor;U.subgroupSize;U.subgroupXor;U.tan;U.tangentGeometry;U.tangentLocal;U.tangentView;U.tangentWorld;U.texture;U.texture3D;U.textureBarrier;U.textureBicubic;U.textureBicubicLevel;U.textureCubeUV;U.textureLoad;U.textureSize;U.textureStore;U.thickness;const Ax=U.time;U.toneMapping;U.toneMappingExposure;U.toonOutlinePass;U.transformDirection;U.transformNormal;U.transformNormalToView;U.transformedClearcoatNormalView;U.transformedNormalView;U.transformedNormalWorld;U.transmission;U.transpose;U.triNoise3D;U.triplanarTexture;U.triplanarTextures;U.trunc;U.uint;U.uintBitsToFloat;U.uniform;const c2=U.uniformArray;U.uniformCubeTexture;U.uniformGroup;U.uniformFlow;U.uniformTexture;U.unpremultiplyAlpha;U.userData;const cv=U.uv;U.uvec2;U.uvec3;U.uvec4;U.varying;U.varyingProperty;const lm=U.vec2,Xa=U.vec3;U.vec4;U.vectorComponents;U.velocity;U.vertexColor;U.vertexIndex;U.vertexStage;U.vibrance;U.viewZToLogarithmicDepth;U.viewZToOrthographicDepth;U.viewZToPerspectiveDepth;U.viewport;U.viewportCoordinate;U.viewportDepthTexture;U.viewportLinearDepth;U.viewportMipTexture;U.viewportResolution;U.viewportSafeUV;U.viewportSharedTexture;U.viewportSize;U.viewportTexture;U.viewportUV;U.wgsl;U.wgslFn;U.workgroupArray;U.workgroupBarrier;U.workgroupId;U.workingToColorSpace;U.xor;const Wie=({colorNode:s,onFrame:e})=>{const t=new pV({transparent:!0}),n=cv(),i=s||Xa(n,Jc(Ax));t.colorNode=i;const{width:r,height:a}=Hr(l=>l.viewport);return z3(l=>{e&&e(t,l)}),Xe.jsx("mesh",{material:t,scale:[r,a,1],children:Xe.jsx("planeGeometry",{args:[1,1]})})},h2=({colorNode:s=void 0,onFrame:e=void 0,children:t})=>Xe.jsx(Xe.Fragment,{children:t||Xe.jsx(Wie,{colorNode:s,onFrame:e})}),Xie=A0("/catalog")({component:Yie}),wR=[{id:"mesh5",title:"Mesh 5",description:"Animated mesh gradient"},{id:"mesh6",title:"Mesh 6",description:"Warped mesh gradient"},{id:"mesh7",title:"Mesh 7",description:"Distorted gradient"},{id:"flare-1",title:"Flare 1",description:"Fractionated gradient"}];function Yie(){const[s,e]=ze.useState(wR[0].id),[t,n]=ze.useState(!1),[i,r]=ze.useState(null),a=wR.find(h=>h.id===s);ze.useEffect(()=>{(async()=>{try{const p=await wH(Object.assign({
4346"../sketches/flare-1.ts":()=>ab(()=>Promise.resolve().then(()=>d2),void 0),
4346"../sketches/mesh5.ts":()=>ab(()=>Promise.resolve().then(()=>f2),void 0),
4346"../sketches/mesh6.ts":()=>ab(()=>Promise.resolve().then(()=>p2),void 0),
4346"../sketches/mesh7.ts":()=>ab(()=>Promise.resolve().then(()=>m2),void 0)
4346}),`../sketches/${s}.ts`,3);p.default&&r(p.default())}catch(p){console.error("Failed to load fragment:",p),r(null)}})()},[s]);const l=()=>`<!-- Embed ${a?.title} --> 4347<div id="fragment-${s}"></div> 4348<script type="module"> 4349 // Copy the fragment code from fragments-lab/src/sketches/${s}.ts 4350 // and include Three.js WebGPU dependencies 4351 // Visit https://your-domain.vercel.app/sketches/${s} for the live version 4352<\/script> 4353 4354<!-- Or use iframe embed: --> 4355<iframe 4356 src="https://your-domain.vercel.app/sketches/${s}" 4357 width="100%" 4358 height="600px" 4359 style="border: none;"> 4360</iframe>`,u=async()=>{try{await navigator.clipboard.writeText(l()),n(!0),setTimeout(()=>n(!1),2e3)}catch(h){console.error("Failed to copy:",h)}};return Xe.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",flexDirection:"column",background:"#000"},children:[Xe.jsxs("div",{style:{position:"absolute",top:"20px",left:"20px",zIndex:10,background:"rgba(0, 0, 0, 0.8)",backdropFilter:"blur(10px)",borderRadius:"12px",padding:"16px",border:"1px solid rgba(255, 255, 255, 0.1)",minWidth:"250px"},children:[Xe.jsx("h3",{style:{margin:"0 0 12px 0",color:"#fff",fontSize:"14px",fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase"},children:"Select Fragment"}),Xe.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:wR.map(h=>Xe.jsxs("button",{onClick:()=>e(h.id),style:{padding:"10px 12px",background:s===h.id?"rgba(100, 150, 255, 0.3)":"rgba(255, 255, 255, 0.05)",border:s===h.id?"1px solid rgba(100, 150, 255, 0.5)":"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"8px",color:"#fff",cursor:"pointer",textAlign:"left",transition:"all 0.2s ease",fontSize:"13px"},onMouseEnter:p=>{s!==h.id&&(p.currentTarget.style.background="rgba(255, 255, 255, 0.1)")},onMouseLeave:p=>{s!==h.id&&(p.currentTarget.style.background="rgba(255, 255, 255, 0.05)")},children:[Xe.jsx("div",{style:{fontWeight:600},children:h.title}),Xe.jsx("div",{style:{fontSize:"11px",opacity:.7,marginTop:"2px"},children:h.description})]},h.id))})]}),Xe.jsx("button",{onClick:u,style:{position:"absolute",bottom:"20px",left:"20px",zIndex:10,padding:"14px 24px",background:t?"rgba(50, 200, 100, 0.3)":"rgba(100, 150, 255, 0.3)",border:t?"1px solid rgba(50, 200, 100, 0.5)":"1px solid rgba(100, 150, 255, 0.5)",borderRadius:"8px",color:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:600,backdropFilter:"blur(10px)",transition:"all 0.2s ease",letterSpacing:"0.03em"},onMouseEnter:h=>{t||(h.currentTarget.style.background="rgba(100, 150, 255, 0.4)")},onMouseLeave:h=>{t||(h.currentTarget.style.background="rgba(100, 150, 255, 0.3)")},children:t?"â Copied!":"ð Copy Embed Code"}),Xe.jsx("div",{style:{position:"absolute",inset:0},children:Xe.jsx(ze.Suspense,{fallback:null,children:Xe.jsx(a2,{style:{position:"fixed",inset:0,pointerEvents:"none"},eventPrefix:"client",children:i&&Xe.jsx(h2,{colorNode:i})})})})]})}const kz=Wd(([s,e,t,n,i,r=Pd(6.28318)])=>e.add(t.mul(KE(r.mul(n.mul(s).add(i)))))),Yy=Wd(([s,e=Pd(.5)])=>{const t=cv().sub(e);return qie(s.x.greaterThan(s.y),lm(t.x.mul(s.x.div(s.y)),t.y),lm(t.x,t.y.mul(s.y.div(s.x))))}),Rx=Wd(([s])=>Hz(Jc(Gie(s,lm(12.9898,78.233))).mul(43758.5453123)));/** 4361 * @license Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) 4362 * 4363 * This sketch is licensed under CC BY-NC-SA 4.0. You are free to: 4364 * - Share and adapt this work 4365 * - Use modified versions commercially 4366 * 4367 * Under these conditions: 4368 * - Attribution: Credit Ben McCormick (phobon) and link to this project 4369 * - NonCommercial: Don't sell the original, unmodified sketch 4370 * - ShareAlike: Distribute derivatives under the same license 4371 */const qz=Wd(()=>{const s=Yy(Xy),e=cv().toVar(),t=Xa(0).toVar(),n=Xa(.5,.5,.5),i=Xa(.5,.5,.5),r=Xa(2,1,0),a=Xa(.5,.2,.25),l=12,u=Hie(s.y.mul(l)),h=Jc(e.y.mul(Wy));jE({start:0,end:l},({i:g})=>{const y=Zi(u.mul(g),.005),_=lm(s.x,s.y.add(y).add(Zi(h,.05))),S=kie(zB(_.x.mul(1.5))).add(zB(_.y.mul(1.5))),A=kz(e.y.mul(.25),n,i,r,a);t.assign(A.mul(S))});const p=Rx(e).mul(.1);return t.addAssign(p),t}),d2=Object.freeze(Object.defineProperty({__proto__:null,default:qz},Symbol.toStringTag,{value:"Module"}));/** 4372 * Mesh 5 - Simplified WebGPU mesh gradient 4373 * Adapted from fragments.supply 4374 * 4375 * @license CC BY-NC-SA 4.0 4376 * Attribution: Ben McCormick (phobon) - https://fragments.supply 4377 */const jie=c2([new lt("#fff9bf"),new lt("#f8a097"),new lt("#b7dbf9"),new lt("#20b2aa")]),Kie=Wd(()=>{const s=Yy(Xy),e=cv().toVar(),t=Xa(0).toVar(),n=Pd(0).toVar(),i=Ax.mul(.1);jE({start:0,end:4},({i:l})=>{const u=Pd(l),h=Zi(u,Wy),p=Jc(Zi(i,Zi(u,.75)).add(h)),g=KE(Zi(i,2).add(Zi(h,2.5))),y=lm(p,g),_=jie.element(l),S=l2(s.sub(y)),A=ZE(S,4.2),E=o2(1,u2(.01,A));t.addAssign(_.mul(E)),n.addAssign(E)}),t.divAssign(n);const a=Rx(e).mul(.1);return t.addAssign(a),t}),f2=Object.freeze(Object.defineProperty({__proto__:null,default:Kie},Symbol.toStringTag,{value:"Module"}));/** 4378 * Mesh 6 - Warped mesh gradient 4379 * Adapted from fragments.supply 4380 * 4381 * @license CC BY-NC-SA 4.0 4382 * Attribution: Ben McCormick (phobon) - https://fragments.supply 4383 */const Zie=c2([new lt("#ffd4e5"),new lt("#a1c4fd"),new lt("#ffeaa7"),new lt("#55efc4")]),Qie=Wd(()=>{const s=Yy(Xy),e=cv().toVar(),t=Xa(0).toVar(),n=Pd(0).toVar(),i=Ax.mul(.15);jE({start:0,end:4},({i:l})=>{const u=Pd(l),h=Zi(u,Zi(Wy,.5)).add(i),p=Zi(.5,Jc(Zi(i,Zi(u,.3)))),g=Zi(p,KE(h)),y=Zi(p,Jc(h)),_=lm(g,y),S=Zie.element(l),A=l2(s.sub(_)),E=Zi(A,Jc(Zi(i,2).add(Zi(u,Wy)))),b=ZE(u2(.1,E),3.5),C=o2(1,b);t.addAssign(S.mul(C)),n.addAssign(C)}),t.divAssign(n);const a=Rx(e).mul(.08);return t.addAssign(a),t}),p2=Object.freeze(Object.defineProperty({__proto__:null,default:Qie},Symbol.toStringTag,{value:"Module"}));/** 4384 * Mesh 7 - Distorted gradient 4385 * Adapted from fragments.supply 4386 * 4387 * @license CC BY-NC-SA 4.0 4388 * Attribution: Ben McCormick (phobon) - https://fragments.supply 4389 */const $ie=c2([new lt("#667eea"),new lt("#764ba2"),new lt("#f093fb"),new lt("#4facfe")]),Jie=Wd(()=>{const s=Yy(Xy),e=cv().toVar(),t=Xa(0).toVar(),n=Pd(0).toVar(),i=Ax.mul(.2);jE({start:0,end:4},({i:l})=>{const u=Pd(l),h=Zi(u,Zi(Wy,.5)),p=Jc(bT(i,h)).mul(.6),g=KE(bT(Zi(i,1.3),Zi(h,1.5))).mul(.6),y=lm(p,g),_=$ie.element(l),S=l2(s.sub(y)),A=Zi(Jc(bT(Zi(i,3),Zi(u,Wy))),.2),E=ZE(u2(.05,bT(S,A)),4),b=o2(1,E);t.addAssign(_.mul(b)),n.addAssign(b)}),t.divAssign(n);const a=Rx(e).mul(.12);return t.addAssign(a),t}),m2=Object.freeze(Object.defineProperty({__proto__:null,default:Jie},Symbol.toStringTag,{value:"Module"}));/**
4390 * @license Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) 4391 * 4392 * This sketch is licensed under CC BY-NC-SA 4.0. You are free to: 4393 * - Share and adapt this work 4394 * - Use modified versions commercially 4395 * 4396 * Under these conditions: 4397 * - Attribution: Credit Ben McCormick (phobon) and link to this project 4398 * - NonCommercial: Don't sell the original, unmodified sketch 4399 * - ShareAlike: Distribute derivatives under the same license 4400 */const GB=Wd(()=>{const s=Yy(Xy).toVar(),e=Yy(Xy).toVar(),t=Xa(0).toVar(),n=Xa(.5,.5,.5),i=Xa(.5,.5,.5),r=Xa(1,1,.5),a=Xa(.8,.9,.3),l=kz(e.y.add(.5).add(Ax.mul(.01)),n,i,r,a),u=Hz(s.y.mul(24)).mul(.3);t.assign(l.add(ZE(u,2)));const h=Rx(s).mul(.2);return t.addAssign(h),t}),Wz=Object.freeze(Object.defineProperty({__proto__:null,dawn1:GB,default:GB},Symbol.toStringTag,{value:"Module"}));function Xz(){const s=ze.useRef(null),[e,t]=ze.useState(!1),[n,i]=ze.useState([]);return ze.useEffect(()=>{const a=Object.keys(Object.assign({"../../sketches/flare-1.ts":d2,"../../sketches/mesh5.ts":f2,"../../sketches/mesh6.ts":p2,"../../sketches/mesh7.ts":m2,"../../sketches/nested/dawn-1.ts":Wz})).map(l=>{const u=l.replace("../../sketches/","").replace(".ts",""),h=`/sketches/${u}`;return{name:u.split("/").pop()||u,path:`/${u}`,url:h}});i(a)},[]),ze.useEffect(()=>{function r(a){s.current&&!s.current.contains(a.target)&&t(!1)}return e&&document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[e]),Xe.jsx("div",{className:"sketches-overlay",children:Xe.jsxs("div",{className:"sketches-toggle",ref:s,children:[Xe.jsx("button",{onClick:()=>t(!e),className:"sketches-toggle__button",children:"Sketches"}),e&&Xe.jsx("div",{className:"sketches-dropdown",children:Xe.jsx("div",{className:"sketches-dropdown__content",children:Xe.jsx("div",{className:"sketches-list",children:Xe.jsx("div",{className:"sketches-list__grid",children:n.map(r=>Xe.jsxs(BN,{to:r.url,className:"sketch-card",children:[Xe.jsx("h3",{className:"sketch-card__title",children:r.name}),Xe.jsx("div",{className:"sketch-card__path",children:r.path})]},r.path))})})})})]})})}const ese=A0("/")({component:tse});function tse(){const s=ze.useRef(null);return Xe.jsxs("section",{className:"fragments-boilerplate__main__canvas",ref:s,children:[Xe.jsx(ze.Suspense,{fallback:null,children:Xe.jsx(a2,{style:{position:"fixed",inset:0,pointerEvents:"none"},eventSource:s,eventPrefix:"client",children:Xe.jsx(h2,{colorNode:qz()})})}),Xe.jsx(Xz,{})]})}const Yz=A0("/sketches/$")({component:nse});function nse(){const{_splat:s}=Yz.useParams(),[e,t]=ze.useState({}),[n,i]=ze.useState(!1),r=new URLSearchParams(window.location.search).get("embed")==="true",a=Object.assign({"../sketches/flare-1.ts":d2,"../sketches/mesh5.ts":f2,"../sketches/mesh6.ts":p2,"../sketches/mesh7.ts":m2,"../sketches/nested/dawn-1.ts":Wz});ze.useEffect(()=>{const g=`../sketches/${s}.ts`,y=a[g];y?t({colorNode:y.default}):console.error("Sketch not found:",s)},[s]);const l=ze.useRef(null),{colorNode:u}=e,h=()=>{const g=window.location.origin;return`<!-- Embed ${s} fragment - Fixed Height --> 4401<iframe 4402 src="${g}/sketches/${s}?embed=true" 4403 width="100%" 4404 height="600px" 4405 frameborder="0" 4406 style="border: none; display: block;"> 4407</iframe> 4408 4409<!-- For container with 100vh - use height: 100% --> 4410<iframe 4411 src="${g}/sketches/${s}?embed=true" 4412 frameborder="0" 4413 style="width: 100%; height: 100%; border: none; display: block;"> 4414</iframe> 4415 4416<!-- For full viewport (position: absolute parent) --> 4417<iframe 4418 src="${g}/sketches/${s}?embed=true" 4419 frameborder="0" 4420 style="position: absolute; inset: 0; width: 100%; height: 100%; border: none;"> 4421</iframe>`},p=async()=>{try{await navigator.clipboard.writeText(h()),i(!0),setTimeout(()=>i(!1),2e3)}catch(g){console.error("Failed to copy:",g)}};return Xe.jsxs("section",{className:"fragments-boilerplate__main__canvas",ref:l,children:[Xe.jsx(ze.Suspense,{fallback:null,children:u?Xe.jsx(a2,{style:{position:"fixed",inset:0,pointerEvents:"none"},eventSource:l,eventPrefix:"client",children:Xe.jsx(h2,{colorNode:u()})}):null}),!r&&Xe.jsx(Xz,{}),!r&&Xe.jsx("button",{onClick:p,style:{position:"fixed",top:"20px",left:"190px",zIndex:10,padding:"12px 20px",background:n?"#16a34a":"#000",border:"none",borderRadius:"0",color:"#fff",cursor:"pointer",fontSize:"13px",fontWeight:600,transition:"all 0.2s ease",letterSpacing:"0.03em",fontFamily:"inherit"},onMouseEnter:g=>{n||(g.currentTarget.style.background="#1a1a1a")},onMouseLeave:g=>{n||(g.currentTarget.style.background="#000")},children:n?"â Copied!":"ð Copy Embed Code"})]})}const ise=Xie.update({id:"/catalog",path:"/catalog",getParentRoute:()=>TM}),sse=ese.update({id:"/",path:"/",getParentRoute:()=>TM}),rse=Yz.update({id:"/sketches/$",path:"/sketches/$",getParentRoute:()=>TM}),ase={IndexRoute:sse,CatalogRoute:ise,SketchesSplatRoute:rse},ose=TM._addFileChildren(ase)._addFileTypes(),lse=bH({routeTree:ose,defaultNotFoundComponent:()=>Xe.jsxs("div",{children:[Xe.jsx("h1",{children:"404 - Not Found"}),Xe.jsx("p",{children:"The page doesn't exist"})]})}),HB=document.getElementById("root");HB.innerHTML||HG.createRoot(HB).render(Xe.jsx(ze.StrictMode,{children:Xe.jsx(EH,{router:lse})}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.