(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function S7(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var $b={exports:{}},$p={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var BC;function TF(){if(BC)return $p;BC=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,r,s){var a=null;if(s!==void 0&&(a=""+s),r.key!==void 0&&(a=""+r.key),"key"in r){s={};for(var l in r)l!=="key"&&(s[l]=r[l])}else s=r;return r=s.ref,{$$typeof:i,type:n,key:a,ref:r!==void 0?r:null,props:s}}return $p.Fragment=e,$p.jsx=t,$p.jsxs=t,$p}var OC;function wF(){return OC||(OC=1,$b.exports=TF()),$b.exports}var k=wF(),Xb={exports:{}},Xp={},Yb={exports:{}},Qb={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var IC;function MF(){return IC||(IC=1,(function(i){function e(Q,ae){var de=Q.length;Q.push(ae);e:for(;0<de;){var Te=de-1>>>1,be=Q[Te];if(0<r(be,ae))Q[Te]=ae,Q[de]=be,de=Te;else break e}}function t(Q){return Q.length===0?null:Q[0]}function n(Q){if(Q.length===0)return null;var ae=Q[0],de=Q.pop();if(de!==ae){Q[0]=de;e:for(var Te=0,be=Q.length,ue=be>>>1;Te<ue;){var we=2*(Te+1)-1,We=Q[we],Ne=we+1,ze=Q[Ne];if(0>r(We,de))Ne<be&&0>r(ze,We)?(Q[Te]=ze,Q[Ne]=de,Te=Ne):(Q[Te]=We,Q[we]=de,Te=we);else if(Ne<be&&0>r(ze,de))Q[Te]=ze,Q[Ne]=de,Te=Ne;else break e}}return ae}function r(Q,ae){var de=Q.sortIndex-ae.sortIndex;return de!==0?de:Q.id-ae.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;i.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();i.unstable_now=function(){return a.now()-l}}var u=[],h=[],m=1,v=null,x=3,S=!1,w=!1,R=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function O(Q){for(var ae=t(h);ae!==null;){if(ae.callback===null)n(h);else if(ae.startTime<=Q)n(h),ae.sortIndex=ae.expirationTime,e(u,ae);else break;ae=t(h)}}function G(Q){if(R=!1,O(Q),!w)if(t(u)!==null)w=!0,q||(q=!0,ee());else{var ae=t(h);ae!==null&&ne(G,ae.startTime-Q)}}var q=!1,z=-1,j=5,F=-1;function V(){return C?!0:!(i.unstable_now()-F<j)}function Y(){if(C=!1,q){var Q=i.unstable_now();F=Q;var ae=!0;try{e:{w=!1,R&&(R=!1,B(z),z=-1),S=!0;var de=x;try{t:{for(O(Q),v=t(u);v!==null&&!(v.expirationTime>Q&&V());){var Te=v.callback;if(typeof Te=="function"){v.callback=null,x=v.priorityLevel;var be=Te(v.expirationTime<=Q);if(Q=i.unstable_now(),typeof be=="function"){v.callback=be,O(Q),ae=!0;break t}v===t(u)&&n(u),O(Q)}else n(u);v=t(u)}if(v!==null)ae=!0;else{var ue=t(h);ue!==null&&ne(G,ue.startTime-Q),ae=!1}}break e}finally{v=null,x=de,S=!1}ae=void 0}}finally{ae?ee():q=!1}}}var ee;if(typeof L=="function")ee=function(){L(Y)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,re=te.port2;te.port1.onmessage=Y,ee=function(){re.postMessage(null)}}else ee=function(){E(Y,0)};function ne(Q,ae){z=E(function(){Q(i.unstable_now())},ae)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(Q){Q.callback=null},i.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<Q?Math.floor(1e3/Q):5},i.unstable_getCurrentPriorityLevel=function(){return x},i.unstable_next=function(Q){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var de=x;x=ae;try{return Q()}finally{x=de}},i.unstable_requestPaint=function(){C=!0},i.unstable_runWithPriority=function(Q,ae){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var de=x;x=Q;try{return ae()}finally{x=de}},i.unstable_scheduleCallback=function(Q,ae,de){var Te=i.unstable_now();switch(typeof de=="object"&&de!==null?(de=de.delay,de=typeof de=="number"&&0<de?Te+de:Te):de=Te,Q){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=de+be,Q={id:m++,callback:ae,priorityLevel:Q,startTime:de,expirationTime:be,sortIndex:-1},de>Te?(Q.sortIndex=de,e(h,Q),t(u)===null&&Q===t(h)&&(R?(B(z),z=-1):R=!0,ne(G,de-Te))):(Q.sortIndex=be,e(u,Q),w||S||(w=!0,q||(q=!0,ee()))),Q},i.unstable_shouldYield=V,i.unstable_wrapCallback=function(Q){var ae=x;return function(){var de=x;x=ae;try{return Q.apply(this,arguments)}finally{x=de}}}})(Qb)),Qb}var FC;function EF(){return FC||(FC=1,Yb.exports=MF()),Yb.exports}var Kb={exports:{}},Jn={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var kC;function CF(){if(kC)return Jn;kC=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=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"),m=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.iterator;function S(ue){return ue===null||typeof ue!="object"?null:(ue=x&&ue[x]||ue["@@iterator"],typeof ue=="function"?ue:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,C={};function E(ue,we,We){this.props=ue,this.context=we,this.refs=C,this.updater=We||w}E.prototype.isReactComponent={},E.prototype.setState=function(ue,we){if(typeof ue!="object"&&typeof ue!="function"&&ue!=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,ue,we,"setState")},E.prototype.forceUpdate=function(ue){this.updater.enqueueForceUpdate(this,ue,"forceUpdate")};function B(){}B.prototype=E.prototype;function L(ue,we,We){this.props=ue,this.context=we,this.refs=C,this.updater=We||w}var O=L.prototype=new B;O.constructor=L,R(O,E.prototype),O.isPureReactComponent=!0;var G=Array.isArray;function q(){}var z={H:null,A:null,T:null,S:null},j=Object.prototype.hasOwnProperty;function F(ue,we,We){var Ne=We.ref;return{$$typeof:i,type:ue,key:we,ref:Ne!==void 0?Ne:null,props:We}}function V(ue,we){return F(ue.type,we,ue.props)}function Y(ue){return typeof ue=="object"&&ue!==null&&ue.$$typeof===i}function ee(ue){var we={"=":"=0",":":"=2"};return"$"+ue.replace(/[=:]/g,function(We){return we[We]})}var te=/\/+/g;function re(ue,we){return typeof ue=="object"&&ue!==null&&ue.key!=null?ee(""+ue.key):we.toString(36)}function ne(ue){switch(ue.status){case"fulfilled":return ue.value;case"rejected":throw ue.reason;default:switch(typeof ue.status=="string"?ue.then(q,q):(ue.status="pending",ue.then(function(we){ue.status==="pending"&&(ue.status="fulfilled",ue.value=we)},function(we){ue.status==="pending"&&(ue.status="rejected",ue.reason=we)})),ue.status){case"fulfilled":return ue.value;case"rejected":throw ue.reason}}throw ue}function Q(ue,we,We,Ne,ze){var Se=typeof ue;(Se==="undefined"||Se==="boolean")&&(ue=null);var Ce=!1;if(ue===null)Ce=!0;else switch(Se){case"bigint":case"string":case"number":Ce=!0;break;case"object":switch(ue.$$typeof){case i:case e:Ce=!0;break;case m:return Ce=ue._init,Q(Ce(ue._payload),we,We,Ne,ze)}}if(Ce)return ze=ze(ue),Ce=Ne===""?"."+re(ue,0):Ne,G(ze)?(We="",Ce!=null&&(We=Ce.replace(te,"$&/")+"/"),Q(ze,we,We,"",function(wt){return wt})):ze!=null&&(Y(ze)&&(ze=V(ze,We+(ze.key==null||ue&&ue.key===ze.key?"":(""+ze.key).replace(te,"$&/")+"/")+Ce)),we.push(ze)),1;Ce=0;var dt=Ne===""?".":Ne+":";if(G(ue))for(var At=0;At<ue.length;At++)Ne=ue[At],Se=dt+re(Ne,At),Ce+=Q(Ne,we,We,Se,ze);else if(At=S(ue),typeof At=="function")for(ue=At.call(ue),At=0;!(Ne=ue.next()).done;)Ne=Ne.value,Se=dt+re(Ne,At++),Ce+=Q(Ne,we,We,Se,ze);else if(Se==="object"){if(typeof ue.then=="function")return Q(ne(ue),we,We,Ne,ze);throw we=String(ue),Error("Objects are not valid as a React child (found: "+(we==="[object Object]"?"object with keys {"+Object.keys(ue).join(", ")+"}":we)+"). If you meant to render a collection of children, use an array instead.")}return Ce}function ae(ue,we,We){if(ue==null)return ue;var Ne=[],ze=0;return Q(ue,Ne,"","",function(Se){return we.call(We,Se,ze++)}),Ne}function de(ue){if(ue._status===-1){var we=ue._result;we=we(),we.then(function(We){(ue._status===0||ue._status===-1)&&(ue._status=1,ue._result=We)},function(We){(ue._status===0||ue._status===-1)&&(ue._status=2,ue._result=We)}),ue._status===-1&&(ue._status=0,ue._result=we)}if(ue._status===1)return ue._result.default;throw ue._result}var Te=typeof reportError=="function"?reportError:function(ue){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var we=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof ue=="object"&&ue!==null&&typeof ue.message=="string"?String(ue.message):String(ue),error:ue});if(!window.dispatchEvent(we))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",ue);return}console.error(ue)},be={map:ae,forEach:function(ue,we,We){ae(ue,function(){we.apply(this,arguments)},We)},count:function(ue){var we=0;return ae(ue,function(){we++}),we},toArray:function(ue){return ae(ue,function(we){return we})||[]},only:function(ue){if(!Y(ue))throw Error("React.Children.only expected to receive a single React element child.");return ue}};return Jn.Activity=v,Jn.Children=be,Jn.Component=E,Jn.Fragment=t,Jn.Profiler=r,Jn.PureComponent=L,Jn.StrictMode=n,Jn.Suspense=u,Jn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Jn.__COMPILER_RUNTIME={__proto__:null,c:function(ue){return z.H.useMemoCache(ue)}},Jn.cache=function(ue){return function(){return ue.apply(null,arguments)}},Jn.cacheSignal=function(){return null},Jn.cloneElement=function(ue,we,We){if(ue==null)throw Error("The argument must be a React element, but you passed "+ue+".");var Ne=R({},ue.props),ze=ue.key;if(we!=null)for(Se in we.key!==void 0&&(ze=""+we.key),we)!j.call(we,Se)||Se==="key"||Se==="__self"||Se==="__source"||Se==="ref"&&we.ref===void 0||(Ne[Se]=we[Se]);var Se=arguments.length-2;if(Se===1)Ne.children=We;else if(1<Se){for(var Ce=Array(Se),dt=0;dt<Se;dt++)Ce[dt]=arguments[dt+2];Ne.children=Ce}return F(ue.type,ze,Ne)},Jn.createContext=function(ue){return ue={$$typeof:a,_currentValue:ue,_currentValue2:ue,_threadCount:0,Provider:null,Consumer:null},ue.Provider=ue,ue.Consumer={$$typeof:s,_context:ue},ue},Jn.createElement=function(ue,we,We){var Ne,ze={},Se=null;if(we!=null)for(Ne in we.key!==void 0&&(Se=""+we.key),we)j.call(we,Ne)&&Ne!=="key"&&Ne!=="__self"&&Ne!=="__source"&&(ze[Ne]=we[Ne]);var Ce=arguments.length-2;if(Ce===1)ze.children=We;else if(1<Ce){for(var dt=Array(Ce),At=0;At<Ce;At++)dt[At]=arguments[At+2];ze.children=dt}if(ue&&ue.defaultProps)for(Ne in Ce=ue.defaultProps,Ce)ze[Ne]===void 0&&(ze[Ne]=Ce[Ne]);return F(ue,Se,ze)},Jn.createRef=function(){return{current:null}},Jn.forwardRef=function(ue){return{$$typeof:l,render:ue}},Jn.isValidElement=Y,Jn.lazy=function(ue){return{$$typeof:m,_payload:{_status:-1,_result:ue},_init:de}},Jn.memo=function(ue,we){return{$$typeof:h,type:ue,compare:we===void 0?null:we}},Jn.startTransition=function(ue){var we=z.T,We={};z.T=We;try{var Ne=ue(),ze=z.S;ze!==null&&ze(We,Ne),typeof Ne=="object"&&Ne!==null&&typeof Ne.then=="function"&&Ne.then(q,Te)}catch(Se){Te(Se)}finally{we!==null&&We.types!==null&&(we.types=We.types),z.T=we}},Jn.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Jn.use=function(ue){return z.H.use(ue)},Jn.useActionState=function(ue,we,We){return z.H.useActionState(ue,we,We)},Jn.useCallback=function(ue,we){return z.H.useCallback(ue,we)},Jn.useContext=function(ue){return z.H.useContext(ue)},Jn.useDebugValue=function(){},Jn.useDeferredValue=function(ue,we){return z.H.useDeferredValue(ue,we)},Jn.useEffect=function(ue,we){return z.H.useEffect(ue,we)},Jn.useEffectEvent=function(ue){return z.H.useEffectEvent(ue)},Jn.useId=function(){return z.H.useId()},Jn.useImperativeHandle=function(ue,we,We){return z.H.useImperativeHandle(ue,we,We)},Jn.useInsertionEffect=function(ue,we){return z.H.useInsertionEffect(ue,we)},Jn.useLayoutEffect=function(ue,we){return z.H.useLayoutEffect(ue,we)},Jn.useMemo=function(ue,we){return z.H.useMemo(ue,we)},Jn.useOptimistic=function(ue,we){return z.H.useOptimistic(ue,we)},Jn.useReducer=function(ue,we,We){return z.H.useReducer(ue,we,We)},Jn.useRef=function(ue){return z.H.useRef(ue)},Jn.useState=function(ue){return z.H.useState(ue)},Jn.useSyncExternalStore=function(ue,we,We){return z.H.useSyncExternalStore(ue,we,We)},Jn.useTransition=function(){return z.H.useTransition()},Jn.version="19.2.4",Jn}var zC;function _w(){return zC||(zC=1,Kb.exports=CF()),Kb.exports}var Zb={exports:{}},Zs={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var GC;function RF(){if(GC)return Zs;GC=1;var i=_w();function e(u){var h="https://react.dev/errors/"+u;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)h+="&args[]="+encodeURIComponent(arguments[m])}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},r=Symbol.for("react.portal");function s(u,h,m){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:v==null?null:""+v,children:u,containerInfo:h,implementation:m}}var a=i.__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 Zs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Zs.createPortal=function(u,h){var m=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 s(u,h,null,m)},Zs.flushSync=function(u){var h=a.T,m=n.p;try{if(a.T=null,n.p=2,u)return u()}finally{a.T=h,n.p=m,n.d.f()}},Zs.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))},Zs.prefetchDNS=function(u){typeof u=="string"&&n.d.D(u)},Zs.preinit=function(u,h){if(typeof u=="string"&&h&&typeof h.as=="string"){var m=h.as,v=l(m,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,S=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;m==="style"?n.d.S(u,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:v,integrity:x,fetchPriority:S}):m==="script"&&n.d.X(u,{crossOrigin:v,integrity:x,fetchPriority:S,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Zs.preinitModule=function(u,h){if(typeof u=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var m=l(h.as,h.crossOrigin);n.d.M(u,{crossOrigin:m,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)},Zs.preload=function(u,h){if(typeof u=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var m=h.as,v=l(m,h.crossOrigin);n.d.L(u,m,{crossOrigin:v,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})}},Zs.preloadModule=function(u,h){if(typeof u=="string")if(h){var m=l(h.as,h.crossOrigin);n.d.m(u,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else n.d.m(u)},Zs.requestFormReset=function(u){n.d.r(u)},Zs.unstable_batchedUpdates=function(u,h){return u(h)},Zs.useFormState=function(u,h,m){return a.H.useFormState(u,h,m)},Zs.useFormStatus=function(){return a.H.useHostTransitionStatus()},Zs.version="19.2.4",Zs}var qC;function NF(){if(qC)return Zb.exports;qC=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),Zb.exports=RF(),Zb.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var VC;function DF(){if(VC)return Xp;VC=1;var i=EF(),e=_w(),t=NF();function n(o){var c="https://react.dev/errors/"+o;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)c+="&args[]="+encodeURIComponent(arguments[g])}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 r(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var c=o,g=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(g=c.return),o=c.return;while(o)}return c.tag===3?g: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(o.tag===31){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function u(o){if(s(o)!==o)throw Error(n(188))}function h(o){var c=o.alternate;if(!c){if(c=s(o),c===null)throw Error(n(188));return c!==o?null:o}for(var g=o,b=c;;){var D=g.return;if(D===null)break;var P=D.alternate;if(P===null){if(b=D.return,b!==null){g=b;continue}break}if(D.child===P.child){for(P=D.child;P;){if(P===g)return u(D),o;if(P===b)return u(D),c;P=P.sibling}throw Error(n(188))}if(g.return!==b.return)g=D,b=P;else{for(var $=!1,se=D.child;se;){if(se===g){$=!0,g=D,b=P;break}if(se===b){$=!0,b=D,g=P;break}se=se.sibling}if(!$){for(se=P.child;se;){if(se===g){$=!0,g=P,b=D;break}if(se===b){$=!0,b=P,g=D;break}se=se.sibling}if(!$)throw Error(n(189))}}if(g.alternate!==b)throw Error(n(190))}if(g.tag!==3)throw Error(n(188));return g.stateNode.current===g?o:c}function m(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o;for(o=o.child;o!==null;){if(c=m(o),c!==null)return c;o=o.sibling}return null}var v=Object.assign,x=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),L=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),V=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function ee(o){return o===null||typeof o!="object"?null:(o=Y&&o[Y]||o["@@iterator"],typeof o=="function"?o:null)}var te=Symbol.for("react.client.reference");function re(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===te?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case R:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case G:return"Suspense";case q:return"SuspenseList";case F:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case w:return"Portal";case L:return o.displayName||"Context";case B:return(o._context.displayName||"Context")+".Consumer";case O:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case z:return c=o.displayName||null,c!==null?c:re(o.type)||"Memo";case j:c=o._payload,o=o._init;try{return re(o(c))}catch{}}return null}var ne=Array.isArray,Q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,de={pending:!1,data:null,method:null,action:null},Te=[],be=-1;function ue(o){return{current:o}}function we(o){0>be||(o.current=Te[be],Te[be]=null,be--)}function We(o,c){be++,Te[be]=o.current,o.current=c}var Ne=ue(null),ze=ue(null),Se=ue(null),Ce=ue(null);function dt(o,c){switch(We(Se,c),We(ze,o),We(Ne,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?rC(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=rC(c),o=sC(c,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}we(Ne),We(Ne,o)}function At(){we(Ne),we(ze),we(Se)}function wt(o){o.memoizedState!==null&&We(Ce,o);var c=Ne.current,g=sC(c,o.type);c!==g&&(We(ze,o),We(Ne,g))}function Ft(o){ze.current===o&&(we(Ne),we(ze)),Ce.current===o&&(we(Ce),Vp._currentValue=de)}var $e,rt;function ce(o){if($e===void 0)try{throw Error()}catch(g){var c=g.stack.trim().match(/\n( *(at )?)/);$e=c&&c[1]||"",rt=-1<g.stack.indexOf(`
    at`)?" (<anonymous>)":-1<g.stack.indexOf("@")?"@unknown:0:0":""}return`
`+$e+o+rt}var Gt=!1;function ht(o,c){if(!o||Gt)return"";Gt=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var b={DetermineComponentFrameRoot:function(){try{if(c){var Et=function(){throw Error()};if(Object.defineProperty(Et.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Et,[])}catch(it){var et=it}Reflect.construct(o,[],Et)}else{try{Et.call()}catch(it){et=it}o.call(Et.prototype)}}else{try{throw Error()}catch(it){et=it}(Et=o())&&typeof Et.catch=="function"&&Et.catch(function(){})}}catch(it){if(it&&et&&typeof it.stack=="string")return[it.stack,et.stack]}return[null,null]}};b.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var D=Object.getOwnPropertyDescriptor(b.DetermineComponentFrameRoot,"name");D&&D.configurable&&Object.defineProperty(b.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var P=b.DetermineComponentFrameRoot(),$=P[0],se=P[1];if($&&se){var De=$.split(`
`),Je=se.split(`
`);for(D=b=0;b<De.length&&!De[b].includes("DetermineComponentFrameRoot");)b++;for(;D<Je.length&&!Je[D].includes("DetermineComponentFrameRoot");)D++;if(b===De.length||D===Je.length)for(b=De.length-1,D=Je.length-1;1<=b&&0<=D&&De[b]!==Je[D];)D--;for(;1<=b&&0<=D;b--,D--)if(De[b]!==Je[D]){if(b!==1||D!==1)do if(b--,D--,0>D||De[b]!==Je[D]){var ft=`
`+De[b].replace(" at new "," at ");return o.displayName&&ft.includes("<anonymous>")&&(ft=ft.replace("<anonymous>",o.displayName)),ft}while(1<=b&&0<=D);break}}}finally{Gt=!1,Error.prepareStackTrace=g}return(g=o?o.displayName||o.name:"")?ce(g):""}function Pt(o,c){switch(o.tag){case 26:case 27:case 5:return ce(o.type);case 16:return ce("Lazy");case 13:return o.child!==c&&c!==null?ce("Suspense Fallback"):ce("Suspense");case 19:return ce("SuspenseList");case 0:case 15:return ht(o.type,!1);case 11:return ht(o.type.render,!1);case 1:return ht(o.type,!0);case 31:return ce("Activity");default:return""}}function yt(o){try{var c="",g=null;do c+=Pt(o,g),g=o,o=o.return;while(o);return c}catch(b){return`
Error generating stack: `+b.message+`
`+b.stack}}var en=Object.prototype.hasOwnProperty,xt=i.unstable_scheduleCallback,fe=i.unstable_cancelCallback,X=i.unstable_shouldYield,le=i.unstable_requestPaint,Re=i.unstable_now,pe=i.unstable_getCurrentPriorityLevel,Me=i.unstable_ImmediatePriority,nt=i.unstable_UserBlockingPriority,lt=i.unstable_NormalPriority,Ot=i.unstable_LowPriority,jt=i.unstable_IdlePriority,pt=i.log,Yt=i.unstable_setDisableYieldValue,rn=null,$t=null;function kt(o){if(typeof pt=="function"&&Yt(o),$t&&typeof $t.setStrictMode=="function")try{$t.setStrictMode(rn,o)}catch{}}var Vt=Math.clz32?Math.clz32:me,Nn=Math.log,_i=Math.LN2;function me(o){return o>>>=0,o===0?32:31-(Nn(o)/_i|0)|0}var bt=256,tt=262144,St=4194304;function qt(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:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;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 Ht(o,c,g){var b=o.pendingLanes;if(b===0)return 0;var D=0,P=o.suspendedLanes,$=o.pingedLanes;o=o.warmLanes;var se=b&134217727;return se!==0?(b=se&~P,b!==0?D=qt(b):($&=se,$!==0?D=qt($):g||(g=se&~o,g!==0&&(D=qt(g))))):(se=b&~P,se!==0?D=qt(se):$!==0?D=qt($):g||(g=b&~o,g!==0&&(D=qt(g)))),D===0?0:c!==0&&c!==D&&(c&P)===0&&(P=D&-D,g=c&-c,P>=g||P===32&&(g&4194048)!==0)?c:D}function xn(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function qi(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 rr(){var o=St;return St<<=1,(St&62914560)===0&&(St=4194304),o}function pn(o){for(var c=[],g=0;31>g;g++)c.push(o);return c}function $i(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Jr(o,c,g,b,D,P){var $=o.pendingLanes;o.pendingLanes=g,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=g,o.entangledLanes&=g,o.errorRecoveryDisabledLanes&=g,o.shellSuspendCounter=0;var se=o.entanglements,De=o.expirationTimes,Je=o.hiddenUpdates;for(g=$&~g;0<g;){var ft=31-Vt(g),Et=1<<ft;se[ft]=0,De[ft]=-1;var et=Je[ft];if(et!==null)for(Je[ft]=null,ft=0;ft<et.length;ft++){var it=et[ft];it!==null&&(it.lane&=-536870913)}g&=~Et}b!==0&&Ze(o,b,0),P!==0&&D===0&&o.tag!==0&&(o.suspendedLanes|=P&~($&~c))}function Ze(o,c,g){o.pendingLanes|=c,o.suspendedLanes&=~c;var b=31-Vt(c);o.entangledLanes|=c,o.entanglements[b]=o.entanglements[b]|1073741824|g&261930}function vt(o,c){var g=o.entangledLanes|=c;for(o=o.entanglements;g;){var b=31-Vt(g),D=1<<b;D&c|o[b]&c&&(o[b]|=c),g&=~D}}function zt(o,c){var g=c&-c;return g=(g&42)!==0?1:at(g),(g&(o.suspendedLanes|c))!==0?0:g}function at(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 d(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function J(){var o=ae.p;return o!==0?o:(o=window.event,o===void 0?32:CC(o.type))}function $n(o,c){var g=ae.p;try{return ae.p=o,c()}finally{ae.p=g}}var Gn=Math.random().toString(36).slice(2),Xn="__reactFiber$"+Gn,un="__reactProps$"+Gn,qn="__reactContainer$"+Gn,Hs="__reactEvents$"+Gn,li="__reactListeners$"+Gn,Fn="__reactHandles$"+Gn,cs="__reactResources$"+Gn,Ma="__reactMarker$"+Gn;function Ul(o){delete o[Xn],delete o[un],delete o[Hs],delete o[li],delete o[Fn]}function oe(o){var c=o[Xn];if(c)return c;for(var g=o.parentNode;g;){if(c=g[qn]||g[Xn]){if(g=c.alternate,c.child!==null||g!==null&&g.child!==null)for(o=fC(o);o!==null;){if(g=o[Xn])return g;o=fC(o)}return c}o=g,g=o.parentNode}return null}function Fe(o){if(o=o[Xn]||o[qn]){var c=o.tag;if(c===5||c===6||c===13||c===31||c===26||c===27||c===3)return o}return null}function Qe(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o.stateNode;throw Error(n(33))}function Xe(o){var c=o[cs];return c||(c=o[cs]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function ke(o){o[Ma]=!0}var It=new Set,Xt={};function mt(o,c){Z(o,c),Z(o+"Capture",c)}function Z(o,c){for(Xt[o]=c,o=0;o<c.length;o++)It.add(c[o])}var Bt=RegExp("^[: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][: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]*$"),bn={},fn={};function ui(o){return en.call(fn,o)?!0:en.call(bn,o)?!1:Bt.test(o)?fn[o]=!0:(bn[o]=!0,!1)}function ci(o,c,g){if(ui(c))if(g===null)o.removeAttribute(c);else{switch(typeof g){case"undefined":case"function":case"symbol":o.removeAttribute(c);return;case"boolean":var b=c.toLowerCase().slice(0,5);if(b!=="data-"&&b!=="aria-"){o.removeAttribute(c);return}}o.setAttribute(c,""+g)}}function yi(o,c,g){if(g===null)o.removeAttribute(c);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(c);return}o.setAttribute(c,""+g)}}function K(o,c,g,b){if(b===null)o.removeAttribute(g);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(g);return}o.setAttributeNS(c,g,""+b)}}function Un(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function mn(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function yr(o,c,g){var b=Object.getOwnPropertyDescriptor(o.constructor.prototype,c);if(!o.hasOwnProperty(c)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var D=b.get,P=b.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return D.call(this)},set:function($){g=""+$,P.call(this,$)}}),Object.defineProperty(o,c,{enumerable:b.enumerable}),{getValue:function(){return g},setValue:function($){g=""+$},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function hi(o){if(!o._valueTracker){var c=mn(o)?"checked":"value";o._valueTracker=yr(o,c,""+o[c])}}function bs(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var g=c.getValue(),b="";return o&&(b=mn(o)?o.checked?"true":"false":o.value),o=b,o!==g?(c.setValue(o),!0):!1}function fa(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var ye=/[\n"\\]/g;function ot(o){return o.replace(ye,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function Nt(o,c,g,b,D,P,$,se){o.name="",$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?o.type=$:o.removeAttribute("type"),c!=null?$==="number"?(c===0&&o.value===""||o.value!=c)&&(o.value=""+Un(c)):o.value!==""+Un(c)&&(o.value=""+Un(c)):$!=="submit"&&$!=="reset"||o.removeAttribute("value"),c!=null?cn(o,$,Un(c)):g!=null?cn(o,$,Un(g)):b!=null&&o.removeAttribute("value"),D==null&&P!=null&&(o.defaultChecked=!!P),D!=null&&(o.checked=D&&typeof D!="function"&&typeof D!="symbol"),se!=null&&typeof se!="function"&&typeof se!="symbol"&&typeof se!="boolean"?o.name=""+Un(se):o.removeAttribute("name")}function Jt(o,c,g,b,D,P,$,se){if(P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(o.type=P),c!=null||g!=null){if(!(P!=="submit"&&P!=="reset"||c!=null)){hi(o);return}g=g!=null?""+Un(g):"",c=c!=null?""+Un(c):g,se||c===o.value||(o.value=c),o.defaultValue=c}b=b??D,b=typeof b!="function"&&typeof b!="symbol"&&!!b,o.checked=se?o.checked:!!b,o.defaultChecked=!!b,$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"&&(o.name=$),hi(o)}function cn(o,c,g){c==="number"&&fa(o.ownerDocument)===o||o.defaultValue===""+g||(o.defaultValue=""+g)}function Yn(o,c,g,b){if(o=o.options,c){c={};for(var D=0;D<g.length;D++)c["$"+g[D]]=!0;for(g=0;g<o.length;g++)D=c.hasOwnProperty("$"+o[g].value),o[g].selected!==D&&(o[g].selected=D),D&&b&&(o[g].defaultSelected=!0)}else{for(g=""+Un(g),c=null,D=0;D<o.length;D++){if(o[D].value===g){o[D].selected=!0,b&&(o[D].defaultSelected=!0);return}c!==null||o[D].disabled||(c=o[D])}c!==null&&(c.selected=!0)}}function xi(o,c,g){if(c!=null&&(c=""+Un(c),c!==o.value&&(o.value=c),g==null)){o.defaultValue!==c&&(o.defaultValue=c);return}o.defaultValue=g!=null?""+Un(g):""}function js(o,c,g,b){if(c==null){if(b!=null){if(g!=null)throw Error(n(92));if(ne(b)){if(1<b.length)throw Error(n(93));b=b[0]}g=b}g==null&&(g=""),c=g}g=Un(c),o.defaultValue=g,b=o.textContent,b===g&&b!==""&&b!==null&&(o.value=b),hi(o)}function pi(o,c){if(c){var g=o.firstChild;if(g&&g===o.lastChild&&g.nodeType===3){g.nodeValue=c;return}}o.textContent=c}var Pr=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 Ei(o,c,g){var b=c.indexOf("--")===0;g==null||typeof g=="boolean"||g===""?b?o.setProperty(c,""):c==="float"?o.cssFloat="":o[c]="":b?o.setProperty(c,g):typeof g!="number"||g===0||Pr.has(c)?c==="float"?o.cssFloat=g:o[c]=(""+g).trim():o[c]=g+"px"}function Zh(o,c,g){if(c!=null&&typeof c!="object")throw Error(n(62));if(o=o.style,g!=null){for(var b in g)!g.hasOwnProperty(b)||c!=null&&c.hasOwnProperty(b)||(b.indexOf("--")===0?o.setProperty(b,""):b==="float"?o.cssFloat="":o[b]="");for(var D in c)b=c[D],c.hasOwnProperty(D)&&g[D]!==b&&Ei(o,D,b)}else for(var P in c)c.hasOwnProperty(P)&&Ei(o,P,c[P])}function Bl(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 nl=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"],["colorRendering","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"]]),Bi=/^[\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 Wc(o){return Bi.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Po(){}var ep=null;function tp(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var $c=null,Ru=null;function SA(o){var c=Fe(o);if(c&&(o=c.stateNode)){var g=o[un]||null;e:switch(o=c.stateNode,c.type){case"input":if(Nt(o,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name),c=g.name,g.type==="radio"&&c!=null){for(g=o;g.parentNode;)g=g.parentNode;for(g=g.querySelectorAll('input[name="'+ot(""+c)+'"][type="radio"]'),c=0;c<g.length;c++){var b=g[c];if(b!==o&&b.form===o.form){var D=b[un]||null;if(!D)throw Error(n(90));Nt(b,D.value,D.defaultValue,D.defaultValue,D.checked,D.defaultChecked,D.type,D.name)}}for(c=0;c<g.length;c++)b=g[c],b.form===o.form&&bs(b)}break e;case"textarea":xi(o,g.value,g.defaultValue);break e;case"select":c=g.value,c!=null&&Yn(o,!!g.multiple,c,!1)}}}var Jh=!1;function s1(o,c,g){if(Jh)return o(c,g);Jh=!0;try{var b=o(c);return b}finally{if(Jh=!1,($c!==null||Ru!==null)&&(K1(),$c&&(c=$c,o=Ru,Ru=$c=null,SA(c),o)))for(c=0;c<o.length;c++)SA(o[c])}}function ef(o,c){var g=o.stateNode;if(g===null)return null;var b=g[un]||null;if(b===null)return null;g=b[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":(b=!b.disabled)||(o=o.type,b=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!b;break e;default:o=!1}if(o)return null;if(g&&typeof g!="function")throw Error(n(231,c,typeof g));return g}var il=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),TA=!1;if(il)try{var tf={};Object.defineProperty(tf,"passive",{get:function(){TA=!0}}),window.addEventListener("test",tf,tf),window.removeEventListener("test",tf,tf)}catch{TA=!1}var Lo=null,nf=null,wA=null;function np(){if(wA)return wA;var o,c=nf,g=c.length,b,D="value"in Lo?Lo.value:Lo.textContent,P=D.length;for(o=0;o<g&&c[o]===D[o];o++);var $=g-o;for(b=1;b<=$&&c[g-b]===D[P-b];b++);return wA=D.slice(o,1<b?1-b:void 0)}function rf(o){var c=o.keyCode;return"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 sf(){return!0}function a1(){return!1}function Ws(o){function c(g,b,D,P,$){this._reactName=g,this._targetInst=D,this.type=b,this.nativeEvent=P,this.target=$,this.currentTarget=null;for(var se in o)o.hasOwnProperty(se)&&(g=o[se],this[se]=g?g(P):P[se]);return this.isDefaultPrevented=(P.defaultPrevented!=null?P.defaultPrevented:P.returnValue===!1)?sf:a1,this.isPropagationStopped=a1,this}return v(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var g=this.nativeEvent;g&&(g.preventDefault?g.preventDefault():typeof g.returnValue!="unknown"&&(g.returnValue=!1),this.isDefaultPrevented=sf)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=sf)},persist:function(){},isPersistent:sf}),c}var Nu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},MA=Ws(Nu),Lr=v({},Nu,{view:0,detail:0}),Du=Ws(Lr),hs,af,Xc,Pu=v({},Lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rp,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!==Xc&&(Xc&&o.type==="mousemove"?(hs=o.screenX-Xc.screenX,af=o.screenY-Xc.screenY):af=hs=0,Xc=o),hs)},movementY:function(o){return"movementY"in o?o.movementY:af}}),o1=Ws(Pu),cx=v({},Pu,{dataTransfer:0}),hx=Ws(cx),l1=v({},Lr,{relatedTarget:0}),Yc=Ws(l1),Lu=v({},Nu,{animationName:0,elapsedTime:0,pseudoElement:0}),u1=Ws(Lu),c1=v({},Nu,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),EA=Ws(c1),Uu=v({},Nu,{data:0}),rl=Ws(Uu),h1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},f1={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"},ip={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function fx(o){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(o):(o=ip[o])?!!c[o]:!1}function rp(){return fx}var A1=v({},Lr,{key:function(o){if(o.key){var c=h1[o.key]||o.key;if(c!=="Unidentified")return c}return o.type==="keypress"?(o=rf(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?f1[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rp,charCode:function(o){return o.type==="keypress"?rf(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?rf(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Ax=Ws(A1),dx=v({},Pu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),d1=Ws(dx),px=v({},Lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rp}),mx=Ws(px),p1=v({},Nu,{propertyName:0,elapsedTime:0,pseudoElement:0}),gx=Ws(p1),vx=v({},Pu,{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}),CA=Ws(vx),_x=v({},Nu,{newState:0,oldState:0}),yx=Ws(_x),xx=[9,13,27,32],Bu=il&&"CompositionEvent"in window,of=null;il&&"documentMode"in document&&(of=document.documentMode);var sp=il&&"TextEvent"in window&&!of,ap=il&&(!Bu||of&&8<of&&11>=of),Ou=" ",m1=!1;function RA(o,c){switch(o){case"keyup":return xx.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function op(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Qc=!1;function g1(o,c){switch(o){case"compositionend":return op(c);case"keypress":return c.which!==32?null:(m1=!0,Ou);case"textInput":return o=c.data,o===Ou&&m1?null:o;default:return null}}function bx(o,c){if(Qc)return o==="compositionend"||!Bu&&RA(o,c)?(o=np(),wA=nf=Lo=null,Qc=!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 ap&&c.locale!=="ko"?null:c.data;default:return null}}var Sx={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 NA(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c==="input"?!!Sx[o.type]:c==="textarea"}function v1(o,c,g,b){$c?Ru?Ru.push(b):Ru=[b]:$c=b,c=r2(c,"onChange"),0<c.length&&(g=new MA("onChange","change",null,g,b),o.push({event:g,listeners:c}))}var Iu=null,Fu=null;function lf(o){Z8(o,0)}function Ci(o){var c=Qe(o);if(bs(c))return o}function _1(o,c){if(o==="change")return c}var lp=!1;if(il){var DA;if(il){var up="oninput"in document;if(!up){var y1=document.createElement("div");y1.setAttribute("oninput","return;"),up=typeof y1.oninput=="function"}DA=up}else DA=!1;lp=DA&&(!document.documentMode||9<document.documentMode)}function x1(){Iu&&(Iu.detachEvent("onpropertychange",b1),Fu=Iu=null)}function b1(o){if(o.propertyName==="value"&&Ci(Fu)){var c=[];v1(c,Fu,o,tp(o)),s1(lf,c)}}function $s(o,c,g){o==="focusin"?(x1(),Iu=c,Fu=g,Iu.attachEvent("onpropertychange",b1)):o==="focusout"&&x1()}function cp(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Ci(Fu)}function ku(o,c){if(o==="click")return Ci(c)}function Tx(o,c){if(o==="input"||o==="change")return Ci(c)}function hp(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var Aa=typeof Object.is=="function"?Object.is:hp;function Ss(o,c){if(Aa(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var g=Object.keys(o),b=Object.keys(c);if(g.length!==b.length)return!1;for(b=0;b<g.length;b++){var D=g[b];if(!en.call(c,D)||!Aa(o[D],c[D]))return!1}return!0}function PA(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function LA(o,c){var g=PA(o);o=0;for(var b;g;){if(g.nodeType===3){if(b=o+g.textContent.length,o<=c&&b>=c)return{node:g,offset:c-o};o=b}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=PA(g)}}function zu(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?zu(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function Ol(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var c=fa(o.document);c instanceof o.HTMLIFrameElement;){try{var g=typeof c.contentWindow.location.href=="string"}catch{g=!1}if(g)o=c.contentWindow;else break;c=fa(o.document)}return c}function Il(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 wx=il&&"documentMode"in document&&11>=document.documentMode,Gu=null,fp=null,qu=null,Ap=!1;function S1(o,c,g){var b=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;Ap||Gu==null||Gu!==fa(b)||(b=Gu,"selectionStart"in b&&Il(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),qu&&Ss(qu,b)||(qu=b,b=r2(fp,"onSelect"),0<b.length&&(c=new MA("onSelect","select",null,c,g),o.push({event:c,listeners:b}),c.target=Gu)))}function sl(o,c){var g={};return g[o.toLowerCase()]=c.toLowerCase(),g["Webkit"+o]="webkit"+c,g["Moz"+o]="moz"+c,g}var Vu={animationend:sl("Animation","AnimationEnd"),animationiteration:sl("Animation","AnimationIteration"),animationstart:sl("Animation","AnimationStart"),transitionrun:sl("Transition","TransitionRun"),transitionstart:sl("Transition","TransitionStart"),transitioncancel:sl("Transition","TransitionCancel"),transitionend:sl("Transition","TransitionEnd")},uf={},Kc={};il&&(Kc=document.createElement("div").style,"AnimationEvent"in window||(delete Vu.animationend.animation,delete Vu.animationiteration.animation,delete Vu.animationstart.animation),"TransitionEvent"in window||delete Vu.transitionend.transition);function Ea(o){if(uf[o])return uf[o];if(!Vu[o])return o;var c=Vu[o],g;for(g in c)if(c.hasOwnProperty(g)&&g in Kc)return uf[o]=c[g];return o}var Xs=Ea("animationend"),T1=Ea("animationiteration"),Zc=Ea("animationstart"),Mx=Ea("transitionrun"),Ex=Ea("transitionstart"),Cx=Ea("transitioncancel"),dp=Ea("transitionend"),w1=new Map,pp="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(" ");pp.push("scrollEnd");function oo(o,c){w1.set(o,c),mt(c,[o])}var Hu=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)},da=[],Fl=0,mp=0;function UA(){for(var o=Fl,c=mp=Fl=0;c<o;){var g=da[c];da[c++]=null;var b=da[c];da[c++]=null;var D=da[c];da[c++]=null;var P=da[c];if(da[c++]=null,b!==null&&D!==null){var $=b.pending;$===null?D.next=D:(D.next=$.next,$.next=D),b.pending=D}P!==0&&M1(g,D,P)}}function BA(o,c,g,b){da[Fl++]=o,da[Fl++]=c,da[Fl++]=g,da[Fl++]=b,mp|=b,o.lanes|=b,o=o.alternate,o!==null&&(o.lanes|=b)}function gp(o,c,g,b){return BA(o,c,g,b),OA(o)}function ju(o,c){return BA(o,null,null,c),OA(o)}function M1(o,c,g){o.lanes|=g;var b=o.alternate;b!==null&&(b.lanes|=g);for(var D=!1,P=o.return;P!==null;)P.childLanes|=g,b=P.alternate,b!==null&&(b.childLanes|=g),P.tag===22&&(o=P.stateNode,o===null||o._visibility&1||(D=!0)),o=P,P=P.return;return o.tag===3?(P=o.stateNode,D&&c!==null&&(D=31-Vt(g),o=P.hiddenUpdates,b=o[D],b===null?o[D]=[c]:b.push(c),c.lane=g|536870912),P):null}function OA(o){if(50<Op)throw Op=0,gb=null,Error(n(185));for(var c=o.return;c!==null;)o=c,c=o.return;return o.tag===3?o.stateNode:null}var Wu={};function Rx(o,c,g,b){this.tag=o,this.key=g,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=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ys(o,c,g,b){return new Rx(o,c,g,b)}function lo(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Uo(o,c){var g=o.alternate;return g===null?(g=Ys(o.tag,c,o.key,o.mode),g.elementType=o.elementType,g.type=o.type,g.stateNode=o.stateNode,g.alternate=o,o.alternate=g):(g.pendingProps=c,g.type=o.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=o.flags&65011712,g.childLanes=o.childLanes,g.lanes=o.lanes,g.child=o.child,g.memoizedProps=o.memoizedProps,g.memoizedState=o.memoizedState,g.updateQueue=o.updateQueue,c=o.dependencies,g.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},g.sibling=o.sibling,g.index=o.index,g.ref=o.ref,g.refCleanup=o.refCleanup,g}function E1(o,c){o.flags&=65011714;var g=o.alternate;return g===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=g.childLanes,o.lanes=g.lanes,o.child=g.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=g.memoizedProps,o.memoizedState=g.memoizedState,o.updateQueue=g.updateQueue,o.type=g.type,c=g.dependencies,o.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),o}function IA(o,c,g,b,D,P){var $=0;if(b=o,typeof o=="function")lo(o)&&($=1);else if(typeof o=="string")$=fF(o,g,Ne.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case F:return o=Ys(31,g,c,D),o.elementType=F,o.lanes=P,o;case R:return $u(g.children,D,P,c);case C:$=8,D|=24;break;case E:return o=Ys(12,g,c,D|2),o.elementType=E,o.lanes=P,o;case G:return o=Ys(13,g,c,D),o.elementType=G,o.lanes=P,o;case q:return o=Ys(19,g,c,D),o.elementType=q,o.lanes=P,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case L:$=10;break e;case B:$=9;break e;case O:$=11;break e;case z:$=14;break e;case j:$=16,b=null;break e}$=29,g=Error(n(130,o===null?"null":typeof o,"")),b=null}return c=Ys($,g,c,D),c.elementType=o,c.type=b,c.lanes=P,c}function $u(o,c,g,b){return o=Ys(7,o,b,c),o.lanes=g,o}function vp(o,c,g){return o=Ys(6,o,null,c),o.lanes=g,o}function C1(o){var c=Ys(18,null,null,0);return c.stateNode=o,c}function Bo(o,c,g){return c=Ys(4,o.children!==null?o.children:[],o.key,c),c.lanes=g,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}var FA=new WeakMap;function Ca(o,c){if(typeof o=="object"&&o!==null){var g=FA.get(o);return g!==void 0?g:(c={value:o,source:c,stack:yt(c)},FA.set(o,c),c)}return{value:o,source:c,stack:yt(c)}}var al=[],Xu=0,kA=null,cf=0,Ts=[],pa=0,Ra=null,Na=1,Da="";function Oo(o,c){al[Xu++]=cf,al[Xu++]=kA,kA=o,cf=c}function hf(o,c,g){Ts[pa++]=Na,Ts[pa++]=Da,Ts[pa++]=Ra,Ra=o;var b=Na;o=Da;var D=32-Vt(b)-1;b&=~(1<<D),g+=1;var P=32-Vt(c)+D;if(30<P){var $=D-D%5;P=(b&(1<<$)-1).toString(32),b>>=$,D-=$,Na=1<<32-Vt(c)+D|g<<D|b,Da=P+o}else Na=1<<P|g<<D|b,Da=o}function zA(o){o.return!==null&&(Oo(o,1),hf(o,1,0))}function _p(o){for(;o===kA;)kA=al[--Xu],al[Xu]=null,cf=al[--Xu],al[Xu]=null;for(;o===Ra;)Ra=Ts[--pa],Ts[pa]=null,Da=Ts[--pa],Ts[pa]=null,Na=Ts[--pa],Ts[pa]=null}function R1(o,c){Ts[pa++]=Na,Ts[pa++]=Da,Ts[pa++]=Ra,Na=c.id,Da=c.overflow,Ra=o}var fs=null,sr=null,mi=!1,kl=null,Pa=!1,yp=Error(n(519));function zl(o){var c=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ol(Ca(c,o)),yp}function xp(o){var c=o.stateNode,g=o.type,b=o.memoizedProps;switch(c[Xn]=o,c[un]=b,g){case"dialog":vi("cancel",c),vi("close",c);break;case"iframe":case"object":case"embed":vi("load",c);break;case"video":case"audio":for(g=0;g<Fp.length;g++)vi(Fp[g],c);break;case"source":vi("error",c);break;case"img":case"image":case"link":vi("error",c),vi("load",c);break;case"details":vi("toggle",c);break;case"input":vi("invalid",c),Jt(c,b.value,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name,!0);break;case"select":vi("invalid",c);break;case"textarea":vi("invalid",c),js(c,b.value,b.defaultValue,b.children)}g=b.children,typeof g!="string"&&typeof g!="number"&&typeof g!="bigint"||c.textContent===""+g||b.suppressHydrationWarning===!0||nC(c.textContent,g)?(b.popover!=null&&(vi("beforetoggle",c),vi("toggle",c)),b.onScroll!=null&&vi("scroll",c),b.onScrollEnd!=null&&vi("scrollend",c),b.onClick!=null&&(c.onclick=Po),c=!0):c=!1,c||zl(o,!0)}function bp(o){for(fs=o.return;fs;)switch(fs.tag){case 5:case 31:case 13:Pa=!1;return;case 27:case 3:Pa=!0;return;default:fs=fs.return}}function ar(o){if(o!==fs)return!1;if(!mi)return bp(o),mi=!0,!1;var c=o.tag,g;if((g=c!==3&&c!==27)&&((g=c===5)&&(g=o.type,g=!(g!=="form"&&g!=="button")||Pb(o.type,o.memoizedProps)),g=!g),g&&sr&&zl(o),bp(o),c===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));sr=hC(o)}else if(c===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));sr=hC(o)}else c===27?(c=sr,uh(o.type)?(o=Ib,Ib=null,sr=o):sr=c):sr=fs?zo(o.stateNode.nextSibling):null;return!0}function Yu(){sr=fs=null,mi=!1}function Sp(){var o=kl;return o!==null&&(Oa===null?Oa=o:Oa.push.apply(Oa,o),kl=null),o}function ol(o){kl===null?kl=[o]:kl.push(o)}var Qs=ue(null),Qu=null,ll=null;function ul(o,c,g){We(Qs,c._currentValue),c._currentValue=g}function Io(o){o._currentValue=Qs.current,we(Qs)}function GA(o,c,g){for(;o!==null;){var b=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,b!==null&&(b.childLanes|=c)):b!==null&&(b.childLanes&c)!==c&&(b.childLanes|=c),o===g)break;o=o.return}}function qA(o,c,g,b){var D=o.child;for(D!==null&&(D.return=o);D!==null;){var P=D.dependencies;if(P!==null){var $=D.child;P=P.firstContext;e:for(;P!==null;){var se=P;P=D;for(var De=0;De<c.length;De++)if(se.context===c[De]){P.lanes|=g,se=P.alternate,se!==null&&(se.lanes|=g),GA(P.return,g,o),b||($=null);break e}P=se.next}}else if(D.tag===18){if($=D.return,$===null)throw Error(n(341));$.lanes|=g,P=$.alternate,P!==null&&(P.lanes|=g),GA($,g,o),$=null}else $=D.child;if($!==null)$.return=D;else for($=D;$!==null;){if($===o){$=null;break}if(D=$.sibling,D!==null){D.return=$.return,$=D;break}$=$.return}D=$}}function Ku(o,c,g,b){o=null;for(var D=c,P=!1;D!==null;){if(!P){if((D.flags&524288)!==0)P=!0;else if((D.flags&262144)!==0)break}if(D.tag===10){var $=D.alternate;if($===null)throw Error(n(387));if($=$.memoizedProps,$!==null){var se=D.type;Aa(D.pendingProps.value,$.value)||(o!==null?o.push(se):o=[se])}}else if(D===Ce.current){if($=D.alternate,$===null)throw Error(n(387));$.memoizedState.memoizedState!==D.memoizedState.memoizedState&&(o!==null?o.push(Vp):o=[Vp])}D=D.return}o!==null&&qA(c,o,g,b),c.flags|=262144}function VA(o){for(o=o.firstContext;o!==null;){if(!Aa(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Zu(o){Qu=o,ll=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function As(o){return cl(Qu,o)}function HA(o,c){return Qu===null&&Zu(o),cl(o,c)}function cl(o,c){var g=c._currentValue;if(c={context:c,memoizedValue:g,next:null},ll===null){if(o===null)throw Error(n(308));ll=c,o.dependencies={lanes:0,firstContext:c},o.flags|=524288}else ll=ll.next=c;return g}var Fo=typeof AbortController<"u"?AbortController:function(){var o=[],c=this.signal={aborted:!1,addEventListener:function(g,b){o.push(b)}};this.abort=function(){c.aborted=!0,o.forEach(function(g){return g()})}},An=i.unstable_scheduleCallback,Ks=i.unstable_NormalPriority,Qt={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ur(){return{controller:new Fo,data:new Map,refCount:0}}function Jc(o){o.refCount--,o.refCount===0&&An(Ks,function(){o.controller.abort()})}var Ju=null,ko=0,eh=0,fr=null;function th(o,c){if(Ju===null){var g=Ju=[];ko=0,eh=Sb(),fr={status:"pending",value:void 0,then:function(b){g.push(b)}}}return ko++,c.then(ec,ec),c}function ec(){if(--ko===0&&Ju!==null){fr!==null&&(fr.status="fulfilled");var o=Ju;Ju=null,eh=0,fr=null;for(var c=0;c<o.length;c++)(0,o[c])()}}function N1(o,c){var g=[],b={status:"pending",value:null,reason:null,then:function(D){g.push(D)}};return o.then(function(){b.status="fulfilled",b.value=c;for(var D=0;D<g.length;D++)(0,g[D])(c)},function(D){for(b.status="rejected",b.reason=D,D=0;D<g.length;D++)(0,g[D])(void 0)}),b}var Mt=Q.S;Q.S=function(o,c){M8=Re(),typeof c=="object"&&c!==null&&typeof c.then=="function"&&th(o,c),Mt!==null&&Mt(o,c)};var Dt=ue(null);function ff(){var o=Dt.current;return o!==null?o:or.pooledCache}function Af(o,c){c===null?We(Dt,Dt.current):We(Dt,c.pool)}function df(){var o=ff();return o===null?null:{parent:Qt._currentValue,pool:o}}var hl=Error(n(460)),Gl=Error(n(474)),uo=Error(n(542)),pf={then:function(){}};function fl(o){return o=o.status,o==="fulfilled"||o==="rejected"}function A(o,c,g){switch(g=o[g],g===void 0?o.push(c):g!==c&&(c.then(Po,Po),c=g),c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,y(o),o;default:if(typeof c.status=="string")c.then(Po,Po);else{if(o=or,o!==null&&100<o.shellSuspendCounter)throw Error(n(482));o=c,o.status="pending",o.then(function(b){if(c.status==="pending"){var D=c;D.status="fulfilled",D.value=b}},function(b){if(c.status==="pending"){var D=c;D.status="rejected",D.reason=b}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,y(o),o}throw p=c,hl}}function f(o){try{var c=o._init;return c(o._payload)}catch(g){throw g!==null&&typeof g=="object"&&typeof g.then=="function"?(p=g,hl):g}}var p=null;function _(){if(p===null)throw Error(n(459));var o=p;return p=null,o}function y(o){if(o===hl||o===uo)throw Error(n(483))}var T=null,M=0;function N(o){var c=M;return M+=1,T===null&&(T=[]),A(T,o,c)}function U(o,c){c=c.props.ref,o.ref=c!==void 0?c:null}function I(o,c){throw c.$$typeof===x?Error(n(525)):(o=Object.prototype.toString.call(c),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o)))}function H(o){function c(Ve,Oe){if(o){var Ke=Ve.deletions;Ke===null?(Ve.deletions=[Oe],Ve.flags|=16):Ke.push(Oe)}}function g(Ve,Oe){if(!o)return null;for(;Oe!==null;)c(Ve,Oe),Oe=Oe.sibling;return null}function b(Ve){for(var Oe=new Map;Ve!==null;)Ve.key!==null?Oe.set(Ve.key,Ve):Oe.set(Ve.index,Ve),Ve=Ve.sibling;return Oe}function D(Ve,Oe){return Ve=Uo(Ve,Oe),Ve.index=0,Ve.sibling=null,Ve}function P(Ve,Oe,Ke){return Ve.index=Ke,o?(Ke=Ve.alternate,Ke!==null?(Ke=Ke.index,Ke<Oe?(Ve.flags|=67108866,Oe):Ke):(Ve.flags|=67108866,Oe)):(Ve.flags|=1048576,Oe)}function $(Ve){return o&&Ve.alternate===null&&(Ve.flags|=67108866),Ve}function se(Ve,Oe,Ke,Tt){return Oe===null||Oe.tag!==6?(Oe=vp(Ke,Ve.mode,Tt),Oe.return=Ve,Oe):(Oe=D(Oe,Ke),Oe.return=Ve,Oe)}function De(Ve,Oe,Ke,Tt){var Sn=Ke.type;return Sn===R?ft(Ve,Oe,Ke.props.children,Tt,Ke.key):Oe!==null&&(Oe.elementType===Sn||typeof Sn=="object"&&Sn!==null&&Sn.$$typeof===j&&f(Sn)===Oe.type)?(Oe=D(Oe,Ke.props),U(Oe,Ke),Oe.return=Ve,Oe):(Oe=IA(Ke.type,Ke.key,Ke.props,null,Ve.mode,Tt),U(Oe,Ke),Oe.return=Ve,Oe)}function Je(Ve,Oe,Ke,Tt){return Oe===null||Oe.tag!==4||Oe.stateNode.containerInfo!==Ke.containerInfo||Oe.stateNode.implementation!==Ke.implementation?(Oe=Bo(Ke,Ve.mode,Tt),Oe.return=Ve,Oe):(Oe=D(Oe,Ke.children||[]),Oe.return=Ve,Oe)}function ft(Ve,Oe,Ke,Tt,Sn){return Oe===null||Oe.tag!==7?(Oe=$u(Ke,Ve.mode,Tt,Sn),Oe.return=Ve,Oe):(Oe=D(Oe,Ke),Oe.return=Ve,Oe)}function Et(Ve,Oe,Ke){if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number"||typeof Oe=="bigint")return Oe=vp(""+Oe,Ve.mode,Ke),Oe.return=Ve,Oe;if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case S:return Ke=IA(Oe.type,Oe.key,Oe.props,null,Ve.mode,Ke),U(Ke,Oe),Ke.return=Ve,Ke;case w:return Oe=Bo(Oe,Ve.mode,Ke),Oe.return=Ve,Oe;case j:return Oe=f(Oe),Et(Ve,Oe,Ke)}if(ne(Oe)||ee(Oe))return Oe=$u(Oe,Ve.mode,Ke,null),Oe.return=Ve,Oe;if(typeof Oe.then=="function")return Et(Ve,N(Oe),Ke);if(Oe.$$typeof===L)return Et(Ve,HA(Ve,Oe),Ke);I(Ve,Oe)}return null}function et(Ve,Oe,Ke,Tt){var Sn=Oe!==null?Oe.key:null;if(typeof Ke=="string"&&Ke!==""||typeof Ke=="number"||typeof Ke=="bigint")return Sn!==null?null:se(Ve,Oe,""+Ke,Tt);if(typeof Ke=="object"&&Ke!==null){switch(Ke.$$typeof){case S:return Ke.key===Sn?De(Ve,Oe,Ke,Tt):null;case w:return Ke.key===Sn?Je(Ve,Oe,Ke,Tt):null;case j:return Ke=f(Ke),et(Ve,Oe,Ke,Tt)}if(ne(Ke)||ee(Ke))return Sn!==null?null:ft(Ve,Oe,Ke,Tt,null);if(typeof Ke.then=="function")return et(Ve,Oe,N(Ke),Tt);if(Ke.$$typeof===L)return et(Ve,Oe,HA(Ve,Ke),Tt);I(Ve,Ke)}return null}function it(Ve,Oe,Ke,Tt,Sn){if(typeof Tt=="string"&&Tt!==""||typeof Tt=="number"||typeof Tt=="bigint")return Ve=Ve.get(Ke)||null,se(Oe,Ve,""+Tt,Sn);if(typeof Tt=="object"&&Tt!==null){switch(Tt.$$typeof){case S:return Ve=Ve.get(Tt.key===null?Ke:Tt.key)||null,De(Oe,Ve,Tt,Sn);case w:return Ve=Ve.get(Tt.key===null?Ke:Tt.key)||null,Je(Oe,Ve,Tt,Sn);case j:return Tt=f(Tt),it(Ve,Oe,Ke,Tt,Sn)}if(ne(Tt)||ee(Tt))return Ve=Ve.get(Ke)||null,ft(Oe,Ve,Tt,Sn,null);if(typeof Tt.then=="function")return it(Ve,Oe,Ke,N(Tt),Sn);if(Tt.$$typeof===L)return it(Ve,Oe,Ke,HA(Oe,Tt),Sn);I(Oe,Tt)}return null}function ln(Ve,Oe,Ke,Tt){for(var Sn=null,Di=null,hn=Oe,oi=Oe=0,Si=null;hn!==null&&oi<Ke.length;oi++){hn.index>oi?(Si=hn,hn=null):Si=hn.sibling;var Pi=et(Ve,hn,Ke[oi],Tt);if(Pi===null){hn===null&&(hn=Si);break}o&&hn&&Pi.alternate===null&&c(Ve,hn),Oe=P(Pi,Oe,oi),Di===null?Sn=Pi:Di.sibling=Pi,Di=Pi,hn=Si}if(oi===Ke.length)return g(Ve,hn),mi&&Oo(Ve,oi),Sn;if(hn===null){for(;oi<Ke.length;oi++)hn=Et(Ve,Ke[oi],Tt),hn!==null&&(Oe=P(hn,Oe,oi),Di===null?Sn=hn:Di.sibling=hn,Di=hn);return mi&&Oo(Ve,oi),Sn}for(hn=b(hn);oi<Ke.length;oi++)Si=it(hn,Ve,oi,Ke[oi],Tt),Si!==null&&(o&&Si.alternate!==null&&hn.delete(Si.key===null?oi:Si.key),Oe=P(Si,Oe,oi),Di===null?Sn=Si:Di.sibling=Si,Di=Si);return o&&hn.forEach(function(dh){return c(Ve,dh)}),mi&&Oo(Ve,oi),Sn}function Pn(Ve,Oe,Ke,Tt){if(Ke==null)throw Error(n(151));for(var Sn=null,Di=null,hn=Oe,oi=Oe=0,Si=null,Pi=Ke.next();hn!==null&&!Pi.done;oi++,Pi=Ke.next()){hn.index>oi?(Si=hn,hn=null):Si=hn.sibling;var dh=et(Ve,hn,Pi.value,Tt);if(dh===null){hn===null&&(hn=Si);break}o&&hn&&dh.alternate===null&&c(Ve,hn),Oe=P(dh,Oe,oi),Di===null?Sn=dh:Di.sibling=dh,Di=dh,hn=Si}if(Pi.done)return g(Ve,hn),mi&&Oo(Ve,oi),Sn;if(hn===null){for(;!Pi.done;oi++,Pi=Ke.next())Pi=Et(Ve,Pi.value,Tt),Pi!==null&&(Oe=P(Pi,Oe,oi),Di===null?Sn=Pi:Di.sibling=Pi,Di=Pi);return mi&&Oo(Ve,oi),Sn}for(hn=b(hn);!Pi.done;oi++,Pi=Ke.next())Pi=it(hn,Ve,oi,Pi.value,Tt),Pi!==null&&(o&&Pi.alternate!==null&&hn.delete(Pi.key===null?oi:Pi.key),Oe=P(Pi,Oe,oi),Di===null?Sn=Pi:Di.sibling=Pi,Di=Pi);return o&&hn.forEach(function(SF){return c(Ve,SF)}),mi&&Oo(Ve,oi),Sn}function er(Ve,Oe,Ke,Tt){if(typeof Ke=="object"&&Ke!==null&&Ke.type===R&&Ke.key===null&&(Ke=Ke.props.children),typeof Ke=="object"&&Ke!==null){switch(Ke.$$typeof){case S:e:{for(var Sn=Ke.key;Oe!==null;){if(Oe.key===Sn){if(Sn=Ke.type,Sn===R){if(Oe.tag===7){g(Ve,Oe.sibling),Tt=D(Oe,Ke.props.children),Tt.return=Ve,Ve=Tt;break e}}else if(Oe.elementType===Sn||typeof Sn=="object"&&Sn!==null&&Sn.$$typeof===j&&f(Sn)===Oe.type){g(Ve,Oe.sibling),Tt=D(Oe,Ke.props),U(Tt,Ke),Tt.return=Ve,Ve=Tt;break e}g(Ve,Oe);break}else c(Ve,Oe);Oe=Oe.sibling}Ke.type===R?(Tt=$u(Ke.props.children,Ve.mode,Tt,Ke.key),Tt.return=Ve,Ve=Tt):(Tt=IA(Ke.type,Ke.key,Ke.props,null,Ve.mode,Tt),U(Tt,Ke),Tt.return=Ve,Ve=Tt)}return $(Ve);case w:e:{for(Sn=Ke.key;Oe!==null;){if(Oe.key===Sn)if(Oe.tag===4&&Oe.stateNode.containerInfo===Ke.containerInfo&&Oe.stateNode.implementation===Ke.implementation){g(Ve,Oe.sibling),Tt=D(Oe,Ke.children||[]),Tt.return=Ve,Ve=Tt;break e}else{g(Ve,Oe);break}else c(Ve,Oe);Oe=Oe.sibling}Tt=Bo(Ke,Ve.mode,Tt),Tt.return=Ve,Ve=Tt}return $(Ve);case j:return Ke=f(Ke),er(Ve,Oe,Ke,Tt)}if(ne(Ke))return ln(Ve,Oe,Ke,Tt);if(ee(Ke)){if(Sn=ee(Ke),typeof Sn!="function")throw Error(n(150));return Ke=Sn.call(Ke),Pn(Ve,Oe,Ke,Tt)}if(typeof Ke.then=="function")return er(Ve,Oe,N(Ke),Tt);if(Ke.$$typeof===L)return er(Ve,Oe,HA(Ve,Ke),Tt);I(Ve,Ke)}return typeof Ke=="string"&&Ke!==""||typeof Ke=="number"||typeof Ke=="bigint"?(Ke=""+Ke,Oe!==null&&Oe.tag===6?(g(Ve,Oe.sibling),Tt=D(Oe,Ke),Tt.return=Ve,Ve=Tt):(g(Ve,Oe),Tt=vp(Ke,Ve.mode,Tt),Tt.return=Ve,Ve=Tt),$(Ve)):g(Ve,Oe)}return function(Ve,Oe,Ke,Tt){try{M=0;var Sn=er(Ve,Oe,Ke,Tt);return T=null,Sn}catch(hn){if(hn===hl||hn===uo)throw hn;var Di=Ys(29,hn,null,Ve.mode);return Di.lanes=Tt,Di.return=Ve,Di}finally{}}}var ie=H(!0),ge=H(!1),Ae=!1;function ve(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pe(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 Ie(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ye(o,c,g){var b=o.updateQueue;if(b===null)return null;if(b=b.shared,(Oi&2)!==0){var D=b.pending;return D===null?c.next=c:(c.next=D.next,D.next=c),b.pending=c,c=OA(o),M1(o,null,g),c}return BA(o,b,c,g),OA(o)}function qe(o,c,g){if(c=c.updateQueue,c!==null&&(c=c.shared,(g&4194048)!==0)){var b=c.lanes;b&=o.pendingLanes,g|=b,c.lanes=g,vt(o,g)}}function Ge(o,c){var g=o.updateQueue,b=o.alternate;if(b!==null&&(b=b.updateQueue,g===b)){var D=null,P=null;if(g=g.firstBaseUpdate,g!==null){do{var $={lane:g.lane,tag:g.tag,payload:g.payload,callback:null,next:null};P===null?D=P=$:P=P.next=$,g=g.next}while(g!==null);P===null?D=P=c:P=P.next=c}else D=P=c;g={baseState:b.baseState,firstBaseUpdate:D,lastBaseUpdate:P,shared:b.shared,callbacks:b.callbacks},o.updateQueue=g;return}o=g.lastBaseUpdate,o===null?g.firstBaseUpdate=c:o.next=c,g.lastBaseUpdate=c}var Le=!1;function Lt(){if(Le){var o=fr;if(o!==null)throw o}}function sn(o,c,g,b){Le=!1;var D=o.updateQueue;Ae=!1;var P=D.firstBaseUpdate,$=D.lastBaseUpdate,se=D.shared.pending;if(se!==null){D.shared.pending=null;var De=se,Je=De.next;De.next=null,$===null?P=Je:$.next=Je,$=De;var ft=o.alternate;ft!==null&&(ft=ft.updateQueue,se=ft.lastBaseUpdate,se!==$&&(se===null?ft.firstBaseUpdate=Je:se.next=Je,ft.lastBaseUpdate=De))}if(P!==null){var Et=D.baseState;$=0,ft=Je=De=null,se=P;do{var et=se.lane&-536870913,it=et!==se.lane;if(it?(bi&et)===et:(b&et)===et){et!==0&&et===eh&&(Le=!0),ft!==null&&(ft=ft.next={lane:0,tag:se.tag,payload:se.payload,callback:null,next:null});e:{var ln=o,Pn=se;et=c;var er=g;switch(Pn.tag){case 1:if(ln=Pn.payload,typeof ln=="function"){Et=ln.call(er,Et,et);break e}Et=ln;break e;case 3:ln.flags=ln.flags&-65537|128;case 0:if(ln=Pn.payload,et=typeof ln=="function"?ln.call(er,Et,et):ln,et==null)break e;Et=v({},Et,et);break e;case 2:Ae=!0}}et=se.callback,et!==null&&(o.flags|=64,it&&(o.flags|=8192),it=D.callbacks,it===null?D.callbacks=[et]:it.push(et))}else it={lane:et,tag:se.tag,payload:se.payload,callback:se.callback,next:null},ft===null?(Je=ft=it,De=Et):ft=ft.next=it,$|=et;if(se=se.next,se===null){if(se=D.shared.pending,se===null)break;it=se,se=it.next,it.next=null,D.lastBaseUpdate=it,D.shared.pending=null}}while(!0);ft===null&&(De=Et),D.baseState=De,D.firstBaseUpdate=Je,D.lastBaseUpdate=ft,P===null&&(D.shared.lanes=0),rh|=$,o.lanes=$,o.memoizedState=Et}}function tn(o,c){if(typeof o!="function")throw Error(n(191,o));o.call(c)}function Bn(o,c){var g=o.callbacks;if(g!==null)for(o.callbacks=null,o=0;o<g.length;o++)tn(g[o],c)}var En=ue(null),Qn=ue(0);function Tn(o,c){o=uc,We(Qn,o),We(En,c),uc=o|c.baseLanes}function on(){We(Qn,uc),We(En,En.current)}function Ut(){uc=Qn.current,we(En),we(Qn)}var vn=ue(null),ii=null;function wn(o){var c=o.alternate;We(Hr,Hr.current&1),We(vn,o),ii===null&&(c===null||En.current!==null||c.memoizedState!==null)&&(ii=o)}function Ri(o){We(Hr,Hr.current),We(vn,o),ii===null&&(ii=o)}function ws(o){o.tag===22?(We(Hr,Hr.current),We(vn,o),ii===null&&(ii=o)):Al()}function Al(){We(Hr,Hr.current),We(vn,vn.current)}function co(o){we(vn),ii===o&&(ii=null),we(Hr)}var Hr=ue(0);function D1(o){for(var c=o;c!==null;){if(c.tag===13){var g=c.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||Bb(g)||Ob(g)))return c}else if(c.tag===19&&(c.memoizedProps.revealOrder==="forwards"||c.memoizedProps.revealOrder==="backwards"||c.memoizedProps.revealOrder==="unstable_legacy-backwards"||c.memoizedProps.revealOrder==="together")){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}var tc=0,ri=null,Zi=null,es=null,P1=!1,jA=!1,mf=!1,L1=0,Tp=0,WA=null,AI=0;function Br(){throw Error(n(321))}function Nx(o,c){if(c===null)return!1;for(var g=0;g<c.length&&g<o.length;g++)if(!Aa(o[g],c[g]))return!1;return!0}function Dx(o,c,g,b,D,P){return tc=P,ri=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Q.H=o===null||o.memoizedState===null?I4:Wx,mf=!1,P=g(b,D),mf=!1,jA&&(P=n4(c,g,b,D)),t4(o),P}function t4(o){Q.H=Ep;var c=Zi!==null&&Zi.next!==null;if(tc=0,es=Zi=ri=null,P1=!1,Tp=0,WA=null,c)throw Error(n(300));o===null||ts||(o=o.dependencies,o!==null&&VA(o)&&(ts=!0))}function n4(o,c,g,b){ri=o;var D=0;do{if(jA&&(WA=null),Tp=0,jA=!1,25<=D)throw Error(n(301));if(D+=1,es=Zi=null,o.updateQueue!=null){var P=o.updateQueue;P.lastEffect=null,P.events=null,P.stores=null,P.memoCache!=null&&(P.memoCache.index=0)}Q.H=F4,P=c(g,b)}while(jA);return P}function dI(){var o=Q.H,c=o.useState()[0];return c=typeof c.then=="function"?wp(c):c,o=o.useState()[0],(Zi!==null?Zi.memoizedState:null)!==o&&(ri.flags|=1024),c}function Px(){var o=L1!==0;return L1=0,o}function Lx(o,c,g){c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~g}function Ux(o){if(P1){for(o=o.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}P1=!1}tc=0,es=Zi=ri=null,jA=!1,Tp=L1=0,WA=null}function ma(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return es===null?ri.memoizedState=es=o:es=es.next=o,es}function jr(){if(Zi===null){var o=ri.alternate;o=o!==null?o.memoizedState:null}else o=Zi.next;var c=es===null?ri.memoizedState:es.next;if(c!==null)es=c,Zi=o;else{if(o===null)throw ri.alternate===null?Error(n(467)):Error(n(310));Zi=o,o={memoizedState:Zi.memoizedState,baseState:Zi.baseState,baseQueue:Zi.baseQueue,queue:Zi.queue,next:null},es===null?ri.memoizedState=es=o:es=es.next=o}return es}function U1(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wp(o){var c=Tp;return Tp+=1,WA===null&&(WA=[]),o=A(WA,o,c),c=ri,(es===null?c.memoizedState:es.next)===null&&(c=c.alternate,Q.H=c===null||c.memoizedState===null?I4:Wx),o}function B1(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return wp(o);if(o.$$typeof===L)return As(o)}throw Error(n(438,String(o)))}function Bx(o){var c=null,g=ri.updateQueue;if(g!==null&&(c=g.memoCache),c==null){var b=ri.alternate;b!==null&&(b=b.updateQueue,b!==null&&(b=b.memoCache,b!=null&&(c={data:b.data.map(function(D){return D.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),g===null&&(g=U1(),ri.updateQueue=g),g.memoCache=c,g=c.data[c.index],g===void 0)for(g=c.data[c.index]=Array(o),b=0;b<o;b++)g[b]=V;return c.index++,g}function nc(o,c){return typeof c=="function"?c(o):c}function O1(o){var c=jr();return Ox(c,Zi,o)}function Ox(o,c,g){var b=o.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=g;var D=o.baseQueue,P=b.pending;if(P!==null){if(D!==null){var $=D.next;D.next=P.next,P.next=$}c.baseQueue=D=P,b.pending=null}if(P=o.baseState,D===null)o.memoizedState=P;else{c=D.next;var se=$=null,De=null,Je=c,ft=!1;do{var Et=Je.lane&-536870913;if(Et!==Je.lane?(bi&Et)===Et:(tc&Et)===Et){var et=Je.revertLane;if(et===0)De!==null&&(De=De.next={lane:0,revertLane:0,gesture:null,action:Je.action,hasEagerState:Je.hasEagerState,eagerState:Je.eagerState,next:null}),Et===eh&&(ft=!0);else if((tc&et)===et){Je=Je.next,et===eh&&(ft=!0);continue}else Et={lane:0,revertLane:Je.revertLane,gesture:null,action:Je.action,hasEagerState:Je.hasEagerState,eagerState:Je.eagerState,next:null},De===null?(se=De=Et,$=P):De=De.next=Et,ri.lanes|=et,rh|=et;Et=Je.action,mf&&g(P,Et),P=Je.hasEagerState?Je.eagerState:g(P,Et)}else et={lane:Et,revertLane:Je.revertLane,gesture:Je.gesture,action:Je.action,hasEagerState:Je.hasEagerState,eagerState:Je.eagerState,next:null},De===null?(se=De=et,$=P):De=De.next=et,ri.lanes|=Et,rh|=Et;Je=Je.next}while(Je!==null&&Je!==c);if(De===null?$=P:De.next=se,!Aa(P,o.memoizedState)&&(ts=!0,ft&&(g=fr,g!==null)))throw g;o.memoizedState=P,o.baseState=$,o.baseQueue=De,b.lastRenderedState=P}return D===null&&(b.lanes=0),[o.memoizedState,b.dispatch]}function Ix(o){var c=jr(),g=c.queue;if(g===null)throw Error(n(311));g.lastRenderedReducer=o;var b=g.dispatch,D=g.pending,P=c.memoizedState;if(D!==null){g.pending=null;var $=D=D.next;do P=o(P,$.action),$=$.next;while($!==D);Aa(P,c.memoizedState)||(ts=!0),c.memoizedState=P,c.baseQueue===null&&(c.baseState=P),g.lastRenderedState=P}return[P,b]}function i4(o,c,g){var b=ri,D=jr(),P=mi;if(P){if(g===void 0)throw Error(n(407));g=g()}else g=c();var $=!Aa((Zi||D).memoizedState,g);if($&&(D.memoizedState=g,ts=!0),D=D.queue,zx(a4.bind(null,b,D,o),[o]),D.getSnapshot!==c||$||es!==null&&es.memoizedState.tag&1){if(b.flags|=2048,$A(9,{destroy:void 0},s4.bind(null,b,D,g,c),null),or===null)throw Error(n(349));P||(tc&127)!==0||r4(b,c,g)}return g}function r4(o,c,g){o.flags|=16384,o={getSnapshot:c,value:g},c=ri.updateQueue,c===null?(c=U1(),ri.updateQueue=c,c.stores=[o]):(g=c.stores,g===null?c.stores=[o]:g.push(o))}function s4(o,c,g,b){c.value=g,c.getSnapshot=b,o4(c)&&l4(o)}function a4(o,c,g){return g(function(){o4(c)&&l4(o)})}function o4(o){var c=o.getSnapshot;o=o.value;try{var g=c();return!Aa(o,g)}catch{return!0}}function l4(o){var c=ju(o,2);c!==null&&Ia(c,o,2)}function Fx(o){var c=ma();if(typeof o=="function"){var g=o;if(o=g(),mf){kt(!0);try{g()}finally{kt(!1)}}}return c.memoizedState=c.baseState=o,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nc,lastRenderedState:o},c}function u4(o,c,g,b){return o.baseState=g,Ox(o,Zi,typeof b=="function"?b:nc)}function pI(o,c,g,b,D){if(k1(o))throw Error(n(485));if(o=c.action,o!==null){var P={payload:D,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function($){P.listeners.push($)}};Q.T!==null?g(!0):P.isTransition=!1,b(P),g=c.pending,g===null?(P.next=c.pending=P,c4(c,P)):(P.next=g.next,c.pending=g.next=P)}}function c4(o,c){var g=c.action,b=c.payload,D=o.state;if(c.isTransition){var P=Q.T,$={};Q.T=$;try{var se=g(D,b),De=Q.S;De!==null&&De($,se),h4(o,c,se)}catch(Je){kx(o,c,Je)}finally{P!==null&&$.types!==null&&(P.types=$.types),Q.T=P}}else try{P=g(D,b),h4(o,c,P)}catch(Je){kx(o,c,Je)}}function h4(o,c,g){g!==null&&typeof g=="object"&&typeof g.then=="function"?g.then(function(b){f4(o,c,b)},function(b){return kx(o,c,b)}):f4(o,c,g)}function f4(o,c,g){c.status="fulfilled",c.value=g,A4(c),o.state=g,c=o.pending,c!==null&&(g=c.next,g===c?o.pending=null:(g=g.next,c.next=g,c4(o,g)))}function kx(o,c,g){var b=o.pending;if(o.pending=null,b!==null){b=b.next;do c.status="rejected",c.reason=g,A4(c),c=c.next;while(c!==b)}o.action=null}function A4(o){o=o.listeners;for(var c=0;c<o.length;c++)(0,o[c])()}function d4(o,c){return c}function p4(o,c){if(mi){var g=or.formState;if(g!==null){e:{var b=ri;if(mi){if(sr){t:{for(var D=sr,P=Pa;D.nodeType!==8;){if(!P){D=null;break t}if(D=zo(D.nextSibling),D===null){D=null;break t}}P=D.data,D=P==="F!"||P==="F"?D:null}if(D){sr=zo(D.nextSibling),b=D.data==="F!";break e}}zl(b)}b=!1}b&&(c=g[0])}}return g=ma(),g.memoizedState=g.baseState=c,b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:d4,lastRenderedState:c},g.queue=b,g=U4.bind(null,ri,b),b.dispatch=g,b=Fx(!1),P=jx.bind(null,ri,!1,b.queue),b=ma(),D={state:c,dispatch:null,action:o,pending:null},b.queue=D,g=pI.bind(null,ri,D,P,g),D.dispatch=g,b.memoizedState=o,[c,g,!1]}function m4(o){var c=jr();return g4(c,Zi,o)}function g4(o,c,g){if(c=Ox(o,c,d4)[0],o=O1(nc)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var b=wp(c)}catch($){throw $===hl?uo:$}else b=c;c=jr();var D=c.queue,P=D.dispatch;return g!==c.memoizedState&&(ri.flags|=2048,$A(9,{destroy:void 0},mI.bind(null,D,g),null)),[b,P,o]}function mI(o,c){o.action=c}function v4(o){var c=jr(),g=Zi;if(g!==null)return g4(c,g,o);jr(),c=c.memoizedState,g=jr();var b=g.queue.dispatch;return g.memoizedState=o,[c,b,!1]}function $A(o,c,g,b){return o={tag:o,create:g,deps:b,inst:c,next:null},c=ri.updateQueue,c===null&&(c=U1(),ri.updateQueue=c),g=c.lastEffect,g===null?c.lastEffect=o.next=o:(b=g.next,g.next=o,o.next=b,c.lastEffect=o),o}function _4(){return jr().memoizedState}function I1(o,c,g,b){var D=ma();ri.flags|=o,D.memoizedState=$A(1|c,{destroy:void 0},g,b===void 0?null:b)}function F1(o,c,g,b){var D=jr();b=b===void 0?null:b;var P=D.memoizedState.inst;Zi!==null&&b!==null&&Nx(b,Zi.memoizedState.deps)?D.memoizedState=$A(c,P,g,b):(ri.flags|=o,D.memoizedState=$A(1|c,P,g,b))}function y4(o,c){I1(8390656,8,o,c)}function zx(o,c){F1(2048,8,o,c)}function gI(o){ri.flags|=4;var c=ri.updateQueue;if(c===null)c=U1(),ri.updateQueue=c,c.events=[o];else{var g=c.events;g===null?c.events=[o]:g.push(o)}}function x4(o){var c=jr().memoizedState;return gI({ref:c,nextImpl:o}),function(){if((Oi&2)!==0)throw Error(n(440));return c.impl.apply(void 0,arguments)}}function b4(o,c){return F1(4,2,o,c)}function S4(o,c){return F1(4,4,o,c)}function T4(o,c){if(typeof c=="function"){o=o();var g=c(o);return function(){typeof g=="function"?g():c(null)}}if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function w4(o,c,g){g=g!=null?g.concat([o]):null,F1(4,4,T4.bind(null,c,o),g)}function Gx(){}function M4(o,c){var g=jr();c=c===void 0?null:c;var b=g.memoizedState;return c!==null&&Nx(c,b[1])?b[0]:(g.memoizedState=[o,c],o)}function E4(o,c){var g=jr();c=c===void 0?null:c;var b=g.memoizedState;if(c!==null&&Nx(c,b[1]))return b[0];if(b=o(),mf){kt(!0);try{o()}finally{kt(!1)}}return g.memoizedState=[b,c],b}function qx(o,c,g){return g===void 0||(tc&1073741824)!==0&&(bi&261930)===0?o.memoizedState=c:(o.memoizedState=g,o=C8(),ri.lanes|=o,rh|=o,g)}function C4(o,c,g,b){return Aa(g,c)?g:En.current!==null?(o=qx(o,g,b),Aa(o,c)||(ts=!0),o):(tc&42)===0||(tc&1073741824)!==0&&(bi&261930)===0?(ts=!0,o.memoizedState=g):(o=C8(),ri.lanes|=o,rh|=o,c)}function R4(o,c,g,b,D){var P=ae.p;ae.p=P!==0&&8>P?P:8;var $=Q.T,se={};Q.T=se,jx(o,!1,c,g);try{var De=D(),Je=Q.S;if(Je!==null&&Je(se,De),De!==null&&typeof De=="object"&&typeof De.then=="function"){var ft=N1(De,b);Mp(o,c,ft,Ao(o))}else Mp(o,c,b,Ao(o))}catch(Et){Mp(o,c,{then:function(){},status:"rejected",reason:Et},Ao())}finally{ae.p=P,$!==null&&se.types!==null&&($.types=se.types),Q.T=$}}function vI(){}function Vx(o,c,g,b){if(o.tag!==5)throw Error(n(476));var D=N4(o).queue;R4(o,D,c,de,g===null?vI:function(){return D4(o),g(b)})}function N4(o){var c=o.memoizedState;if(c!==null)return c;c={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nc,lastRenderedState:de},next:null};var g={};return c.next={memoizedState:g,baseState:g,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nc,lastRenderedState:g},next:null},o.memoizedState=c,o=o.alternate,o!==null&&(o.memoizedState=c),c}function D4(o){var c=N4(o);c.next===null&&(c=o.alternate.memoizedState),Mp(o,c.next.queue,{},Ao())}function Hx(){return As(Vp)}function P4(){return jr().memoizedState}function L4(){return jr().memoizedState}function _I(o){for(var c=o.return;c!==null;){switch(c.tag){case 24:case 3:var g=Ao();o=Ie(g);var b=Ye(c,o,g);b!==null&&(Ia(b,c,g),qe(b,c,g)),c={cache:Ur()},o.payload=c;return}c=c.return}}function yI(o,c,g){var b=Ao();g={lane:b,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},k1(o)?B4(c,g):(g=gp(o,c,g,b),g!==null&&(Ia(g,o,b),O4(g,c,b)))}function U4(o,c,g){var b=Ao();Mp(o,c,g,b)}function Mp(o,c,g,b){var D={lane:b,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null};if(k1(o))B4(c,D);else{var P=o.alternate;if(o.lanes===0&&(P===null||P.lanes===0)&&(P=c.lastRenderedReducer,P!==null))try{var $=c.lastRenderedState,se=P($,g);if(D.hasEagerState=!0,D.eagerState=se,Aa(se,$))return BA(o,c,D,0),or===null&&UA(),!1}catch{}finally{}if(g=gp(o,c,D,b),g!==null)return Ia(g,o,b),O4(g,c,b),!0}return!1}function jx(o,c,g,b){if(b={lane:2,revertLane:Sb(),gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},k1(o)){if(c)throw Error(n(479))}else c=gp(o,g,b,2),c!==null&&Ia(c,o,2)}function k1(o){var c=o.alternate;return o===ri||c!==null&&c===ri}function B4(o,c){jA=P1=!0;var g=o.pending;g===null?c.next=c:(c.next=g.next,g.next=c),o.pending=c}function O4(o,c,g){if((g&4194048)!==0){var b=c.lanes;b&=o.pendingLanes,g|=b,c.lanes=g,vt(o,g)}}var Ep={readContext:As,use:B1,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useLayoutEffect:Br,useInsertionEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useSyncExternalStore:Br,useId:Br,useHostTransitionStatus:Br,useFormState:Br,useActionState:Br,useOptimistic:Br,useMemoCache:Br,useCacheRefresh:Br};Ep.useEffectEvent=Br;var I4={readContext:As,use:B1,useCallback:function(o,c){return ma().memoizedState=[o,c===void 0?null:c],o},useContext:As,useEffect:y4,useImperativeHandle:function(o,c,g){g=g!=null?g.concat([o]):null,I1(4194308,4,T4.bind(null,c,o),g)},useLayoutEffect:function(o,c){return I1(4194308,4,o,c)},useInsertionEffect:function(o,c){I1(4,2,o,c)},useMemo:function(o,c){var g=ma();c=c===void 0?null:c;var b=o();if(mf){kt(!0);try{o()}finally{kt(!1)}}return g.memoizedState=[b,c],b},useReducer:function(o,c,g){var b=ma();if(g!==void 0){var D=g(c);if(mf){kt(!0);try{g(c)}finally{kt(!1)}}}else D=c;return b.memoizedState=b.baseState=D,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:D},b.queue=o,o=o.dispatch=yI.bind(null,ri,o),[b.memoizedState,o]},useRef:function(o){var c=ma();return o={current:o},c.memoizedState=o},useState:function(o){o=Fx(o);var c=o.queue,g=U4.bind(null,ri,c);return c.dispatch=g,[o.memoizedState,g]},useDebugValue:Gx,useDeferredValue:function(o,c){var g=ma();return qx(g,o,c)},useTransition:function(){var o=Fx(!1);return o=R4.bind(null,ri,o.queue,!0,!1),ma().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,c,g){var b=ri,D=ma();if(mi){if(g===void 0)throw Error(n(407));g=g()}else{if(g=c(),or===null)throw Error(n(349));(bi&127)!==0||r4(b,c,g)}D.memoizedState=g;var P={value:g,getSnapshot:c};return D.queue=P,y4(a4.bind(null,b,P,o),[o]),b.flags|=2048,$A(9,{destroy:void 0},s4.bind(null,b,P,g,c),null),g},useId:function(){var o=ma(),c=or.identifierPrefix;if(mi){var g=Da,b=Na;g=(b&~(1<<32-Vt(b)-1)).toString(32)+g,c="_"+c+"R_"+g,g=L1++,0<g&&(c+="H"+g.toString(32)),c+="_"}else g=AI++,c="_"+c+"r_"+g.toString(32)+"_";return o.memoizedState=c},useHostTransitionStatus:Hx,useFormState:p4,useActionState:p4,useOptimistic:function(o){var c=ma();c.memoizedState=c.baseState=o;var g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=g,c=jx.bind(null,ri,!0,g),g.dispatch=c,[o,c]},useMemoCache:Bx,useCacheRefresh:function(){return ma().memoizedState=_I.bind(null,ri)},useEffectEvent:function(o){var c=ma(),g={impl:o};return c.memoizedState=g,function(){if((Oi&2)!==0)throw Error(n(440));return g.impl.apply(void 0,arguments)}}},Wx={readContext:As,use:B1,useCallback:M4,useContext:As,useEffect:zx,useImperativeHandle:w4,useInsertionEffect:b4,useLayoutEffect:S4,useMemo:E4,useReducer:O1,useRef:_4,useState:function(){return O1(nc)},useDebugValue:Gx,useDeferredValue:function(o,c){var g=jr();return C4(g,Zi.memoizedState,o,c)},useTransition:function(){var o=O1(nc)[0],c=jr().memoizedState;return[typeof o=="boolean"?o:wp(o),c]},useSyncExternalStore:i4,useId:P4,useHostTransitionStatus:Hx,useFormState:m4,useActionState:m4,useOptimistic:function(o,c){var g=jr();return u4(g,Zi,o,c)},useMemoCache:Bx,useCacheRefresh:L4};Wx.useEffectEvent=x4;var F4={readContext:As,use:B1,useCallback:M4,useContext:As,useEffect:zx,useImperativeHandle:w4,useInsertionEffect:b4,useLayoutEffect:S4,useMemo:E4,useReducer:Ix,useRef:_4,useState:function(){return Ix(nc)},useDebugValue:Gx,useDeferredValue:function(o,c){var g=jr();return Zi===null?qx(g,o,c):C4(g,Zi.memoizedState,o,c)},useTransition:function(){var o=Ix(nc)[0],c=jr().memoizedState;return[typeof o=="boolean"?o:wp(o),c]},useSyncExternalStore:i4,useId:P4,useHostTransitionStatus:Hx,useFormState:v4,useActionState:v4,useOptimistic:function(o,c){var g=jr();return Zi!==null?u4(g,Zi,o,c):(g.baseState=o,[o,g.queue.dispatch])},useMemoCache:Bx,useCacheRefresh:L4};F4.useEffectEvent=x4;function $x(o,c,g,b){c=o.memoizedState,g=g(b,c),g=g==null?c:v({},c,g),o.memoizedState=g,o.lanes===0&&(o.updateQueue.baseState=g)}var Xx={enqueueSetState:function(o,c,g){o=o._reactInternals;var b=Ao(),D=Ie(b);D.payload=c,g!=null&&(D.callback=g),c=Ye(o,D,b),c!==null&&(Ia(c,o,b),qe(c,o,b))},enqueueReplaceState:function(o,c,g){o=o._reactInternals;var b=Ao(),D=Ie(b);D.tag=1,D.payload=c,g!=null&&(D.callback=g),c=Ye(o,D,b),c!==null&&(Ia(c,o,b),qe(c,o,b))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var g=Ao(),b=Ie(g);b.tag=2,c!=null&&(b.callback=c),c=Ye(o,b,g),c!==null&&(Ia(c,o,g),qe(c,o,g))}};function k4(o,c,g,b,D,P,$){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(b,P,$):c.prototype&&c.prototype.isPureReactComponent?!Ss(g,b)||!Ss(D,P):!0}function z4(o,c,g,b){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(g,b),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(g,b),c.state!==o&&Xx.enqueueReplaceState(c,c.state,null)}function gf(o,c){var g=c;if("ref"in c){g={};for(var b in c)b!=="ref"&&(g[b]=c[b])}if(o=o.defaultProps){g===c&&(g=v({},g));for(var D in o)g[D]===void 0&&(g[D]=o[D])}return g}function G4(o){Hu(o)}function q4(o){console.error(o)}function V4(o){Hu(o)}function z1(o,c){try{var g=o.onUncaughtError;g(c.value,{componentStack:c.stack})}catch(b){setTimeout(function(){throw b})}}function H4(o,c,g){try{var b=o.onCaughtError;b(g.value,{componentStack:g.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(D){setTimeout(function(){throw D})}}function Yx(o,c,g){return g=Ie(g),g.tag=3,g.payload={element:null},g.callback=function(){z1(o,c)},g}function j4(o){return o=Ie(o),o.tag=3,o}function W4(o,c,g,b){var D=g.type.getDerivedStateFromError;if(typeof D=="function"){var P=b.value;o.payload=function(){return D(P)},o.callback=function(){H4(c,g,b)}}var $=g.stateNode;$!==null&&typeof $.componentDidCatch=="function"&&(o.callback=function(){H4(c,g,b),typeof D!="function"&&(sh===null?sh=new Set([this]):sh.add(this));var se=b.stack;this.componentDidCatch(b.value,{componentStack:se!==null?se:""})})}function xI(o,c,g,b,D){if(g.flags|=32768,b!==null&&typeof b=="object"&&typeof b.then=="function"){if(c=g.alternate,c!==null&&Ku(c,g,D,!0),g=vn.current,g!==null){switch(g.tag){case 31:case 13:return ii===null?Z1():g.alternate===null&&Or===0&&(Or=3),g.flags&=-257,g.flags|=65536,g.lanes=D,b===pf?g.flags|=16384:(c=g.updateQueue,c===null?g.updateQueue=new Set([b]):c.add(b),yb(o,b,D)),!1;case 22:return g.flags|=65536,b===pf?g.flags|=16384:(c=g.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([b])},g.updateQueue=c):(g=c.retryQueue,g===null?c.retryQueue=new Set([b]):g.add(b)),yb(o,b,D)),!1}throw Error(n(435,g.tag))}return yb(o,b,D),Z1(),!1}if(mi)return c=vn.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=D,b!==yp&&(o=Error(n(422),{cause:b}),ol(Ca(o,g)))):(b!==yp&&(c=Error(n(423),{cause:b}),ol(Ca(c,g))),o=o.current.alternate,o.flags|=65536,D&=-D,o.lanes|=D,b=Ca(b,g),D=Yx(o.stateNode,b,D),Ge(o,D),Or!==4&&(Or=2)),!1;var P=Error(n(520),{cause:b});if(P=Ca(P,g),Bp===null?Bp=[P]:Bp.push(P),Or!==4&&(Or=2),c===null)return!0;b=Ca(b,g),g=c;do{switch(g.tag){case 3:return g.flags|=65536,o=D&-D,g.lanes|=o,o=Yx(g.stateNode,b,o),Ge(g,o),!1;case 1:if(c=g.type,P=g.stateNode,(g.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||P!==null&&typeof P.componentDidCatch=="function"&&(sh===null||!sh.has(P))))return g.flags|=65536,D&=-D,g.lanes|=D,D=j4(D),W4(D,o,g,b),Ge(g,D),!1}g=g.return}while(g!==null);return!1}var Qx=Error(n(461)),ts=!1;function Ls(o,c,g,b){c.child=o===null?ge(c,null,g,b):ie(c,o.child,g,b)}function $4(o,c,g,b,D){g=g.render;var P=c.ref;if("ref"in b){var $={};for(var se in b)se!=="ref"&&($[se]=b[se])}else $=b;return Zu(c),b=Dx(o,c,g,$,P,D),se=Px(),o!==null&&!ts?(Lx(o,c,D),ic(o,c,D)):(mi&&se&&zA(c),c.flags|=1,Ls(o,c,b,D),c.child)}function X4(o,c,g,b,D){if(o===null){var P=g.type;return typeof P=="function"&&!lo(P)&&P.defaultProps===void 0&&g.compare===null?(c.tag=15,c.type=P,Y4(o,c,P,b,D)):(o=IA(g.type,null,b,c,c.mode,D),o.ref=c.ref,o.return=c,c.child=o)}if(P=o.child,!rb(o,D)){var $=P.memoizedProps;if(g=g.compare,g=g!==null?g:Ss,g($,b)&&o.ref===c.ref)return ic(o,c,D)}return c.flags|=1,o=Uo(P,b),o.ref=c.ref,o.return=c,c.child=o}function Y4(o,c,g,b,D){if(o!==null){var P=o.memoizedProps;if(Ss(P,b)&&o.ref===c.ref)if(ts=!1,c.pendingProps=b=P,rb(o,D))(o.flags&131072)!==0&&(ts=!0);else return c.lanes=o.lanes,ic(o,c,D)}return Kx(o,c,g,b,D)}function Q4(o,c,g,b){var D=b.children,P=o!==null?o.memoizedState:null;if(o===null&&c.stateNode===null&&(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),b.mode==="hidden"){if((c.flags&128)!==0){if(P=P!==null?P.baseLanes|g:g,o!==null){for(b=c.child=o.child,D=0;b!==null;)D=D|b.lanes|b.childLanes,b=b.sibling;b=D&~P}else b=0,c.child=null;return K4(o,c,P,g,b)}if((g&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},o!==null&&Af(c,P!==null?P.cachePool:null),P!==null?Tn(c,P):on(),ws(c);else return b=c.lanes=536870912,K4(o,c,P!==null?P.baseLanes|g:g,g,b)}else P!==null?(Af(c,P.cachePool),Tn(c,P),Al(),c.memoizedState=null):(o!==null&&Af(c,null),on(),Al());return Ls(o,c,D,g),c.child}function Cp(o,c){return o!==null&&o.tag===22||c.stateNode!==null||(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.sibling}function K4(o,c,g,b,D){var P=ff();return P=P===null?null:{parent:Qt._currentValue,pool:P},c.memoizedState={baseLanes:g,cachePool:P},o!==null&&Af(c,null),on(),ws(c),o!==null&&Ku(o,c,b,!0),c.childLanes=D,null}function G1(o,c){return c=V1({mode:c.mode,children:c.children},o.mode),c.ref=o.ref,o.child=c,c.return=o,c}function Z4(o,c,g){return ie(c,o.child,null,g),o=G1(c,c.pendingProps),o.flags|=2,co(c),c.memoizedState=null,o}function bI(o,c,g){var b=c.pendingProps,D=(c.flags&128)!==0;if(c.flags&=-129,o===null){if(mi){if(b.mode==="hidden")return o=G1(c,b),c.lanes=536870912,Cp(null,o);if(Ri(c),(o=sr)?(o=cC(o,Pa),o=o!==null&&o.data==="&"?o:null,o!==null&&(c.memoizedState={dehydrated:o,treeContext:Ra!==null?{id:Na,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},g=C1(o),g.return=c,c.child=g,fs=c,sr=null)):o=null,o===null)throw zl(c);return c.lanes=536870912,null}return G1(c,b)}var P=o.memoizedState;if(P!==null){var $=P.dehydrated;if(Ri(c),D)if(c.flags&256)c.flags&=-257,c=Z4(o,c,g);else if(c.memoizedState!==null)c.child=o.child,c.flags|=128,c=null;else throw Error(n(558));else if(ts||Ku(o,c,g,!1),D=(g&o.childLanes)!==0,ts||D){if(b=or,b!==null&&($=zt(b,g),$!==0&&$!==P.retryLane))throw P.retryLane=$,ju(o,$),Ia(b,o,$),Qx;Z1(),c=Z4(o,c,g)}else o=P.treeContext,sr=zo($.nextSibling),fs=c,mi=!0,kl=null,Pa=!1,o!==null&&R1(c,o),c=G1(c,b),c.flags|=4096;return c}return o=Uo(o.child,{mode:b.mode,children:b.children}),o.ref=c.ref,c.child=o,o.return=c,o}function q1(o,c){var g=c.ref;if(g===null)o!==null&&o.ref!==null&&(c.flags|=4194816);else{if(typeof g!="function"&&typeof g!="object")throw Error(n(284));(o===null||o.ref!==g)&&(c.flags|=4194816)}}function Kx(o,c,g,b,D){return Zu(c),g=Dx(o,c,g,b,void 0,D),b=Px(),o!==null&&!ts?(Lx(o,c,D),ic(o,c,D)):(mi&&b&&zA(c),c.flags|=1,Ls(o,c,g,D),c.child)}function J4(o,c,g,b,D,P){return Zu(c),c.updateQueue=null,g=n4(c,b,g,D),t4(o),b=Px(),o!==null&&!ts?(Lx(o,c,P),ic(o,c,P)):(mi&&b&&zA(c),c.flags|=1,Ls(o,c,g,P),c.child)}function e8(o,c,g,b,D){if(Zu(c),c.stateNode===null){var P=Wu,$=g.contextType;typeof $=="object"&&$!==null&&(P=As($)),P=new g(b,P),c.memoizedState=P.state!==null&&P.state!==void 0?P.state:null,P.updater=Xx,c.stateNode=P,P._reactInternals=c,P=c.stateNode,P.props=b,P.state=c.memoizedState,P.refs={},ve(c),$=g.contextType,P.context=typeof $=="object"&&$!==null?As($):Wu,P.state=c.memoizedState,$=g.getDerivedStateFromProps,typeof $=="function"&&($x(c,g,$,b),P.state=c.memoizedState),typeof g.getDerivedStateFromProps=="function"||typeof P.getSnapshotBeforeUpdate=="function"||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||($=P.state,typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount(),$!==P.state&&Xx.enqueueReplaceState(P,P.state,null),sn(c,b,P,D),Lt(),P.state=c.memoizedState),typeof P.componentDidMount=="function"&&(c.flags|=4194308),b=!0}else if(o===null){P=c.stateNode;var se=c.memoizedProps,De=gf(g,se);P.props=De;var Je=P.context,ft=g.contextType;$=Wu,typeof ft=="object"&&ft!==null&&($=As(ft));var Et=g.getDerivedStateFromProps;ft=typeof Et=="function"||typeof P.getSnapshotBeforeUpdate=="function",se=c.pendingProps!==se,ft||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(se||Je!==$)&&z4(c,P,b,$),Ae=!1;var et=c.memoizedState;P.state=et,sn(c,b,P,D),Lt(),Je=c.memoizedState,se||et!==Je||Ae?(typeof Et=="function"&&($x(c,g,Et,b),Je=c.memoizedState),(De=Ae||k4(c,g,De,b,et,Je,$))?(ft||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount()),typeof P.componentDidMount=="function"&&(c.flags|=4194308)):(typeof P.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=b,c.memoizedState=Je),P.props=b,P.state=Je,P.context=$,b=De):(typeof P.componentDidMount=="function"&&(c.flags|=4194308),b=!1)}else{P=c.stateNode,Pe(o,c),$=c.memoizedProps,ft=gf(g,$),P.props=ft,Et=c.pendingProps,et=P.context,Je=g.contextType,De=Wu,typeof Je=="object"&&Je!==null&&(De=As(Je)),se=g.getDerivedStateFromProps,(Je=typeof se=="function"||typeof P.getSnapshotBeforeUpdate=="function")||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||($!==Et||et!==De)&&z4(c,P,b,De),Ae=!1,et=c.memoizedState,P.state=et,sn(c,b,P,D),Lt();var it=c.memoizedState;$!==Et||et!==it||Ae||o!==null&&o.dependencies!==null&&VA(o.dependencies)?(typeof se=="function"&&($x(c,g,se,b),it=c.memoizedState),(ft=Ae||k4(c,g,ft,b,et,it,De)||o!==null&&o.dependencies!==null&&VA(o.dependencies))?(Je||typeof P.UNSAFE_componentWillUpdate!="function"&&typeof P.componentWillUpdate!="function"||(typeof P.componentWillUpdate=="function"&&P.componentWillUpdate(b,it,De),typeof P.UNSAFE_componentWillUpdate=="function"&&P.UNSAFE_componentWillUpdate(b,it,De)),typeof P.componentDidUpdate=="function"&&(c.flags|=4),typeof P.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof P.componentDidUpdate!="function"||$===o.memoizedProps&&et===o.memoizedState||(c.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||$===o.memoizedProps&&et===o.memoizedState||(c.flags|=1024),c.memoizedProps=b,c.memoizedState=it),P.props=b,P.state=it,P.context=De,b=ft):(typeof P.componentDidUpdate!="function"||$===o.memoizedProps&&et===o.memoizedState||(c.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||$===o.memoizedProps&&et===o.memoizedState||(c.flags|=1024),b=!1)}return P=b,q1(o,c),b=(c.flags&128)!==0,P||b?(P=c.stateNode,g=b&&typeof g.getDerivedStateFromError!="function"?null:P.render(),c.flags|=1,o!==null&&b?(c.child=ie(c,o.child,null,D),c.child=ie(c,null,g,D)):Ls(o,c,g,D),c.memoizedState=P.state,o=c.child):o=ic(o,c,D),o}function t8(o,c,g,b){return Yu(),c.flags|=256,Ls(o,c,g,b),c.child}var Zx={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jx(o){return{baseLanes:o,cachePool:df()}}function eb(o,c,g){return o=o!==null?o.childLanes&~g:0,c&&(o|=fo),o}function n8(o,c,g){var b=c.pendingProps,D=!1,P=(c.flags&128)!==0,$;if(($=P)||($=o!==null&&o.memoizedState===null?!1:(Hr.current&2)!==0),$&&(D=!0,c.flags&=-129),$=(c.flags&32)!==0,c.flags&=-33,o===null){if(mi){if(D?wn(c):Al(),(o=sr)?(o=cC(o,Pa),o=o!==null&&o.data!=="&"?o:null,o!==null&&(c.memoizedState={dehydrated:o,treeContext:Ra!==null?{id:Na,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},g=C1(o),g.return=c,c.child=g,fs=c,sr=null)):o=null,o===null)throw zl(c);return Ob(o)?c.lanes=32:c.lanes=536870912,null}var se=b.children;return b=b.fallback,D?(Al(),D=c.mode,se=V1({mode:"hidden",children:se},D),b=$u(b,D,g,null),se.return=c,b.return=c,se.sibling=b,c.child=se,b=c.child,b.memoizedState=Jx(g),b.childLanes=eb(o,$,g),c.memoizedState=Zx,Cp(null,b)):(wn(c),tb(c,se))}var De=o.memoizedState;if(De!==null&&(se=De.dehydrated,se!==null)){if(P)c.flags&256?(wn(c),c.flags&=-257,c=nb(o,c,g)):c.memoizedState!==null?(Al(),c.child=o.child,c.flags|=128,c=null):(Al(),se=b.fallback,D=c.mode,b=V1({mode:"visible",children:b.children},D),se=$u(se,D,g,null),se.flags|=2,b.return=c,se.return=c,b.sibling=se,c.child=b,ie(c,o.child,null,g),b=c.child,b.memoizedState=Jx(g),b.childLanes=eb(o,$,g),c.memoizedState=Zx,c=Cp(null,b));else if(wn(c),Ob(se)){if($=se.nextSibling&&se.nextSibling.dataset,$)var Je=$.dgst;$=Je,b=Error(n(419)),b.stack="",b.digest=$,ol({value:b,source:null,stack:null}),c=nb(o,c,g)}else if(ts||Ku(o,c,g,!1),$=(g&o.childLanes)!==0,ts||$){if($=or,$!==null&&(b=zt($,g),b!==0&&b!==De.retryLane))throw De.retryLane=b,ju(o,b),Ia($,o,b),Qx;Bb(se)||Z1(),c=nb(o,c,g)}else Bb(se)?(c.flags|=192,c.child=o.child,c=null):(o=De.treeContext,sr=zo(se.nextSibling),fs=c,mi=!0,kl=null,Pa=!1,o!==null&&R1(c,o),c=tb(c,b.children),c.flags|=4096);return c}return D?(Al(),se=b.fallback,D=c.mode,De=o.child,Je=De.sibling,b=Uo(De,{mode:"hidden",children:b.children}),b.subtreeFlags=De.subtreeFlags&65011712,Je!==null?se=Uo(Je,se):(se=$u(se,D,g,null),se.flags|=2),se.return=c,b.return=c,b.sibling=se,c.child=b,Cp(null,b),b=c.child,se=o.child.memoizedState,se===null?se=Jx(g):(D=se.cachePool,D!==null?(De=Qt._currentValue,D=D.parent!==De?{parent:De,pool:De}:D):D=df(),se={baseLanes:se.baseLanes|g,cachePool:D}),b.memoizedState=se,b.childLanes=eb(o,$,g),c.memoizedState=Zx,Cp(o.child,b)):(wn(c),g=o.child,o=g.sibling,g=Uo(g,{mode:"visible",children:b.children}),g.return=c,g.sibling=null,o!==null&&($=c.deletions,$===null?(c.deletions=[o],c.flags|=16):$.push(o)),c.child=g,c.memoizedState=null,g)}function tb(o,c){return c=V1({mode:"visible",children:c},o.mode),c.return=o,o.child=c}function V1(o,c){return o=Ys(22,o,null,c),o.lanes=0,o}function nb(o,c,g){return ie(c,o.child,null,g),o=tb(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function i8(o,c,g){o.lanes|=c;var b=o.alternate;b!==null&&(b.lanes|=c),GA(o.return,c,g)}function ib(o,c,g,b,D,P){var $=o.memoizedState;$===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:b,tail:g,tailMode:D,treeForkCount:P}:($.isBackwards=c,$.rendering=null,$.renderingStartTime=0,$.last=b,$.tail=g,$.tailMode=D,$.treeForkCount=P)}function r8(o,c,g){var b=c.pendingProps,D=b.revealOrder,P=b.tail;b=b.children;var $=Hr.current,se=($&2)!==0;if(se?($=$&1|2,c.flags|=128):$&=1,We(Hr,$),Ls(o,c,b,g),b=mi?cf:0,!se&&o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&i8(o,g,c);else if(o.tag===19)i8(o,g,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}switch(D){case"forwards":for(g=c.child,D=null;g!==null;)o=g.alternate,o!==null&&D1(o)===null&&(D=g),g=g.sibling;g=D,g===null?(D=c.child,c.child=null):(D=g.sibling,g.sibling=null),ib(c,!1,D,g,P,b);break;case"backwards":case"unstable_legacy-backwards":for(g=null,D=c.child,c.child=null;D!==null;){if(o=D.alternate,o!==null&&D1(o)===null){c.child=D;break}o=D.sibling,D.sibling=g,g=D,D=o}ib(c,!0,g,null,P,b);break;case"together":ib(c,!1,null,null,void 0,b);break;default:c.memoizedState=null}return c.child}function ic(o,c,g){if(o!==null&&(c.dependencies=o.dependencies),rh|=c.lanes,(g&c.childLanes)===0)if(o!==null){if(Ku(o,c,g,!1),(g&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,g=Uo(o,o.pendingProps),c.child=g,g.return=c;o.sibling!==null;)o=o.sibling,g=g.sibling=Uo(o,o.pendingProps),g.return=c;g.sibling=null}return c.child}function rb(o,c){return(o.lanes&c)!==0?!0:(o=o.dependencies,!!(o!==null&&VA(o)))}function SI(o,c,g){switch(c.tag){case 3:dt(c,c.stateNode.containerInfo),ul(c,Qt,o.memoizedState.cache),Yu();break;case 27:case 5:wt(c);break;case 4:dt(c,c.stateNode.containerInfo);break;case 10:ul(c,c.type,c.memoizedProps.value);break;case 31:if(c.memoizedState!==null)return c.flags|=128,Ri(c),null;break;case 13:var b=c.memoizedState;if(b!==null)return b.dehydrated!==null?(wn(c),c.flags|=128,null):(g&c.child.childLanes)!==0?n8(o,c,g):(wn(c),o=ic(o,c,g),o!==null?o.sibling:null);wn(c);break;case 19:var D=(o.flags&128)!==0;if(b=(g&c.childLanes)!==0,b||(Ku(o,c,g,!1),b=(g&c.childLanes)!==0),D){if(b)return r8(o,c,g);c.flags|=128}if(D=c.memoizedState,D!==null&&(D.rendering=null,D.tail=null,D.lastEffect=null),We(Hr,Hr.current),b)break;return null;case 22:return c.lanes=0,Q4(o,c,g,c.pendingProps);case 24:ul(c,Qt,o.memoizedState.cache)}return ic(o,c,g)}function s8(o,c,g){if(o!==null)if(o.memoizedProps!==c.pendingProps)ts=!0;else{if(!rb(o,g)&&(c.flags&128)===0)return ts=!1,SI(o,c,g);ts=(o.flags&131072)!==0}else ts=!1,mi&&(c.flags&1048576)!==0&&hf(c,cf,c.index);switch(c.lanes=0,c.tag){case 16:e:{var b=c.pendingProps;if(o=f(c.elementType),c.type=o,typeof o=="function")lo(o)?(b=gf(o,b),c.tag=1,c=e8(null,c,o,b,g)):(c.tag=0,c=Kx(null,c,o,b,g));else{if(o!=null){var D=o.$$typeof;if(D===O){c.tag=11,c=$4(null,c,o,b,g);break e}else if(D===z){c.tag=14,c=X4(null,c,o,b,g);break e}}throw c=re(o)||o,Error(n(306,c,""))}}return c;case 0:return Kx(o,c,c.type,c.pendingProps,g);case 1:return b=c.type,D=gf(b,c.pendingProps),e8(o,c,b,D,g);case 3:e:{if(dt(c,c.stateNode.containerInfo),o===null)throw Error(n(387));b=c.pendingProps;var P=c.memoizedState;D=P.element,Pe(o,c),sn(c,b,null,g);var $=c.memoizedState;if(b=$.cache,ul(c,Qt,b),b!==P.cache&&qA(c,[Qt],g,!0),Lt(),b=$.element,P.isDehydrated)if(P={element:b,isDehydrated:!1,cache:$.cache},c.updateQueue.baseState=P,c.memoizedState=P,c.flags&256){c=t8(o,c,b,g);break e}else if(b!==D){D=Ca(Error(n(424)),c),ol(D),c=t8(o,c,b,g);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(sr=zo(o.firstChild),fs=c,mi=!0,kl=null,Pa=!0,g=ge(c,null,b,g),c.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling}else{if(Yu(),b===D){c=ic(o,c,g);break e}Ls(o,c,b,g)}c=c.child}return c;case 26:return q1(o,c),o===null?(g=mC(c.type,null,c.pendingProps,null))?c.memoizedState=g:mi||(g=c.type,o=c.pendingProps,b=s2(Se.current).createElement(g),b[Xn]=c,b[un]=o,Us(b,g,o),ke(b),c.stateNode=b):c.memoizedState=mC(c.type,o.memoizedProps,c.pendingProps,o.memoizedState),null;case 27:return wt(c),o===null&&mi&&(b=c.stateNode=AC(c.type,c.pendingProps,Se.current),fs=c,Pa=!0,D=sr,uh(c.type)?(Ib=D,sr=zo(b.firstChild)):sr=D),Ls(o,c,c.pendingProps.children,g),q1(o,c),o===null&&(c.flags|=4194304),c.child;case 5:return o===null&&mi&&((D=b=sr)&&(b=JI(b,c.type,c.pendingProps,Pa),b!==null?(c.stateNode=b,fs=c,sr=zo(b.firstChild),Pa=!1,D=!0):D=!1),D||zl(c)),wt(c),D=c.type,P=c.pendingProps,$=o!==null?o.memoizedProps:null,b=P.children,Pb(D,P)?b=null:$!==null&&Pb(D,$)&&(c.flags|=32),c.memoizedState!==null&&(D=Dx(o,c,dI,null,null,g),Vp._currentValue=D),q1(o,c),Ls(o,c,b,g),c.child;case 6:return o===null&&mi&&((o=g=sr)&&(g=eF(g,c.pendingProps,Pa),g!==null?(c.stateNode=g,fs=c,sr=null,o=!0):o=!1),o||zl(c)),null;case 13:return n8(o,c,g);case 4:return dt(c,c.stateNode.containerInfo),b=c.pendingProps,o===null?c.child=ie(c,null,b,g):Ls(o,c,b,g),c.child;case 11:return $4(o,c,c.type,c.pendingProps,g);case 7:return Ls(o,c,c.pendingProps,g),c.child;case 8:return Ls(o,c,c.pendingProps.children,g),c.child;case 12:return Ls(o,c,c.pendingProps.children,g),c.child;case 10:return b=c.pendingProps,ul(c,c.type,b.value),Ls(o,c,b.children,g),c.child;case 9:return D=c.type._context,b=c.pendingProps.children,Zu(c),D=As(D),b=b(D),c.flags|=1,Ls(o,c,b,g),c.child;case 14:return X4(o,c,c.type,c.pendingProps,g);case 15:return Y4(o,c,c.type,c.pendingProps,g);case 19:return r8(o,c,g);case 31:return bI(o,c,g);case 22:return Q4(o,c,g,c.pendingProps);case 24:return Zu(c),b=As(Qt),o===null?(D=ff(),D===null&&(D=or,P=Ur(),D.pooledCache=P,P.refCount++,P!==null&&(D.pooledCacheLanes|=g),D=P),c.memoizedState={parent:b,cache:D},ve(c),ul(c,Qt,D)):((o.lanes&g)!==0&&(Pe(o,c),sn(c,null,null,g),Lt()),D=o.memoizedState,P=c.memoizedState,D.parent!==b?(D={parent:b,cache:b},c.memoizedState=D,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=D),ul(c,Qt,b)):(b=P.cache,ul(c,Qt,b),b!==D.cache&&qA(c,[Qt],g,!0))),Ls(o,c,c.pendingProps.children,g),c.child;case 29:throw c.pendingProps}throw Error(n(156,c.tag))}function rc(o){o.flags|=4}function sb(o,c,g,b,D){if((c=(o.mode&32)!==0)&&(c=!1),c){if(o.flags|=16777216,(D&335544128)===D)if(o.stateNode.complete)o.flags|=8192;else if(P8())o.flags|=8192;else throw p=pf,Gl}else o.flags&=-16777217}function a8(o,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!xC(c))if(P8())o.flags|=8192;else throw p=pf,Gl}function H1(o,c){c!==null&&(o.flags|=4),o.flags&16384&&(c=o.tag!==22?rr():536870912,o.lanes|=c,KA|=c)}function Rp(o,c){if(!mi)switch(o.tailMode){case"hidden":c=o.tail;for(var g=null;c!==null;)c.alternate!==null&&(g=c),c=c.sibling;g===null?o.tail=null:g.sibling=null;break;case"collapsed":g=o.tail;for(var b=null;g!==null;)g.alternate!==null&&(b=g),g=g.sibling;b===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:b.sibling=null}}function Ar(o){var c=o.alternate!==null&&o.alternate.child===o.child,g=0,b=0;if(c)for(var D=o.child;D!==null;)g|=D.lanes|D.childLanes,b|=D.subtreeFlags&65011712,b|=D.flags&65011712,D.return=o,D=D.sibling;else for(D=o.child;D!==null;)g|=D.lanes|D.childLanes,b|=D.subtreeFlags,b|=D.flags,D.return=o,D=D.sibling;return o.subtreeFlags|=b,o.childLanes=g,c}function TI(o,c,g){var b=c.pendingProps;switch(_p(c),c.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ar(c),null;case 1:return Ar(c),null;case 3:return g=c.stateNode,b=null,o!==null&&(b=o.memoizedState.cache),c.memoizedState.cache!==b&&(c.flags|=2048),Io(Qt),At(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(o===null||o.child===null)&&(ar(c)?rc(c):o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Sp())),Ar(c),null;case 26:var D=c.type,P=c.memoizedState;return o===null?(rc(c),P!==null?(Ar(c),a8(c,P)):(Ar(c),sb(c,D,null,b,g))):P?P!==o.memoizedState?(rc(c),Ar(c),a8(c,P)):(Ar(c),c.flags&=-16777217):(o=o.memoizedProps,o!==b&&rc(c),Ar(c),sb(c,D,o,b,g)),null;case 27:if(Ft(c),g=Se.current,D=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==b&&rc(c);else{if(!b){if(c.stateNode===null)throw Error(n(166));return Ar(c),null}o=Ne.current,ar(c)?xp(c):(o=AC(D,b,g),c.stateNode=o,rc(c))}return Ar(c),null;case 5:if(Ft(c),D=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==b&&rc(c);else{if(!b){if(c.stateNode===null)throw Error(n(166));return Ar(c),null}if(P=Ne.current,ar(c))xp(c);else{var $=s2(Se.current);switch(P){case 1:P=$.createElementNS("http://www.w3.org/2000/svg",D);break;case 2:P=$.createElementNS("http://www.w3.org/1998/Math/MathML",D);break;default:switch(D){case"svg":P=$.createElementNS("http://www.w3.org/2000/svg",D);break;case"math":P=$.createElementNS("http://www.w3.org/1998/Math/MathML",D);break;case"script":P=$.createElement("div"),P.innerHTML="<script><\/script>",P=P.removeChild(P.firstChild);break;case"select":P=typeof b.is=="string"?$.createElement("select",{is:b.is}):$.createElement("select"),b.multiple?P.multiple=!0:b.size&&(P.size=b.size);break;default:P=typeof b.is=="string"?$.createElement(D,{is:b.is}):$.createElement(D)}}P[Xn]=c,P[un]=b;e:for($=c.child;$!==null;){if($.tag===5||$.tag===6)P.appendChild($.stateNode);else if($.tag!==4&&$.tag!==27&&$.child!==null){$.child.return=$,$=$.child;continue}if($===c)break e;for(;$.sibling===null;){if($.return===null||$.return===c)break e;$=$.return}$.sibling.return=$.return,$=$.sibling}c.stateNode=P;e:switch(Us(P,D,b),D){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}b&&rc(c)}}return Ar(c),sb(c,c.type,o===null?null:o.memoizedProps,c.pendingProps,g),null;case 6:if(o&&c.stateNode!=null)o.memoizedProps!==b&&rc(c);else{if(typeof b!="string"&&c.stateNode===null)throw Error(n(166));if(o=Se.current,ar(c)){if(o=c.stateNode,g=c.memoizedProps,b=null,D=fs,D!==null)switch(D.tag){case 27:case 5:b=D.memoizedProps}o[Xn]=c,o=!!(o.nodeValue===g||b!==null&&b.suppressHydrationWarning===!0||nC(o.nodeValue,g)),o||zl(c,!0)}else o=s2(o).createTextNode(b),o[Xn]=c,c.stateNode=o}return Ar(c),null;case 31:if(g=c.memoizedState,o===null||o.memoizedState!==null){if(b=ar(c),g!==null){if(o===null){if(!b)throw Error(n(318));if(o=c.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(557));o[Xn]=c}else Yu(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Ar(c),o=!1}else g=Sp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=g),o=!0;if(!o)return c.flags&256?(co(c),c):(co(c),null);if((c.flags&128)!==0)throw Error(n(558))}return Ar(c),null;case 13:if(b=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(D=ar(c),b!==null&&b.dehydrated!==null){if(o===null){if(!D)throw Error(n(318));if(D=c.memoizedState,D=D!==null?D.dehydrated:null,!D)throw Error(n(317));D[Xn]=c}else Yu(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Ar(c),D=!1}else D=Sp(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=D),D=!0;if(!D)return c.flags&256?(co(c),c):(co(c),null)}return co(c),(c.flags&128)!==0?(c.lanes=g,c):(g=b!==null,o=o!==null&&o.memoizedState!==null,g&&(b=c.child,D=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(D=b.alternate.memoizedState.cachePool.pool),P=null,b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(P=b.memoizedState.cachePool.pool),P!==D&&(b.flags|=2048)),g!==o&&g&&(c.child.flags|=8192),H1(c,c.updateQueue),Ar(c),null);case 4:return At(),o===null&&Eb(c.stateNode.containerInfo),Ar(c),null;case 10:return Io(c.type),Ar(c),null;case 19:if(we(Hr),b=c.memoizedState,b===null)return Ar(c),null;if(D=(c.flags&128)!==0,P=b.rendering,P===null)if(D)Rp(b,!1);else{if(Or!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(P=D1(o),P!==null){for(c.flags|=128,Rp(b,!1),o=P.updateQueue,c.updateQueue=o,H1(c,o),c.subtreeFlags=0,o=g,g=c.child;g!==null;)E1(g,o),g=g.sibling;return We(Hr,Hr.current&1|2),mi&&Oo(c,b.treeForkCount),c.child}o=o.sibling}b.tail!==null&&Re()>Y1&&(c.flags|=128,D=!0,Rp(b,!1),c.lanes=4194304)}else{if(!D)if(o=D1(P),o!==null){if(c.flags|=128,D=!0,o=o.updateQueue,c.updateQueue=o,H1(c,o),Rp(b,!0),b.tail===null&&b.tailMode==="hidden"&&!P.alternate&&!mi)return Ar(c),null}else 2*Re()-b.renderingStartTime>Y1&&g!==536870912&&(c.flags|=128,D=!0,Rp(b,!1),c.lanes=4194304);b.isBackwards?(P.sibling=c.child,c.child=P):(o=b.last,o!==null?o.sibling=P:c.child=P,b.last=P)}return b.tail!==null?(o=b.tail,b.rendering=o,b.tail=o.sibling,b.renderingStartTime=Re(),o.sibling=null,g=Hr.current,We(Hr,D?g&1|2:g&1),mi&&Oo(c,b.treeForkCount),o):(Ar(c),null);case 22:case 23:return co(c),Ut(),b=c.memoizedState!==null,o!==null?o.memoizedState!==null!==b&&(c.flags|=8192):b&&(c.flags|=8192),b?(g&536870912)!==0&&(c.flags&128)===0&&(Ar(c),c.subtreeFlags&6&&(c.flags|=8192)):Ar(c),g=c.updateQueue,g!==null&&H1(c,g.retryQueue),g=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(g=o.memoizedState.cachePool.pool),b=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(b=c.memoizedState.cachePool.pool),b!==g&&(c.flags|=2048),o!==null&&we(Dt),null;case 24:return g=null,o!==null&&(g=o.memoizedState.cache),c.memoizedState.cache!==g&&(c.flags|=2048),Io(Qt),Ar(c),null;case 25:return null;case 30:return null}throw Error(n(156,c.tag))}function wI(o,c){switch(_p(c),c.tag){case 1:return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return Io(Qt),At(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 26:case 27:case 5:return Ft(c),null;case 31:if(c.memoizedState!==null){if(co(c),c.alternate===null)throw Error(n(340));Yu()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 13:if(co(c),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(n(340));Yu()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return we(Hr),null;case 4:return At(),null;case 10:return Io(c.type),null;case 22:case 23:return co(c),Ut(),o!==null&&we(Dt),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 24:return Io(Qt),null;case 25:return null;default:return null}}function o8(o,c){switch(_p(c),c.tag){case 3:Io(Qt),At();break;case 26:case 27:case 5:Ft(c);break;case 4:At();break;case 31:c.memoizedState!==null&&co(c);break;case 13:co(c);break;case 19:we(Hr);break;case 10:Io(c.type);break;case 22:case 23:co(c),Ut(),o!==null&&we(Dt);break;case 24:Io(Qt)}}function Np(o,c){try{var g=c.updateQueue,b=g!==null?g.lastEffect:null;if(b!==null){var D=b.next;g=D;do{if((g.tag&o)===o){b=void 0;var P=g.create,$=g.inst;b=P(),$.destroy=b}g=g.next}while(g!==D)}}catch(se){Yi(c,c.return,se)}}function nh(o,c,g){try{var b=c.updateQueue,D=b!==null?b.lastEffect:null;if(D!==null){var P=D.next;b=P;do{if((b.tag&o)===o){var $=b.inst,se=$.destroy;if(se!==void 0){$.destroy=void 0,D=c;var De=g,Je=se;try{Je()}catch(ft){Yi(D,De,ft)}}}b=b.next}while(b!==P)}}catch(ft){Yi(c,c.return,ft)}}function l8(o){var c=o.updateQueue;if(c!==null){var g=o.stateNode;try{Bn(c,g)}catch(b){Yi(o,o.return,b)}}}function u8(o,c,g){g.props=gf(o.type,o.memoizedProps),g.state=o.memoizedState;try{g.componentWillUnmount()}catch(b){Yi(o,c,b)}}function Dp(o,c){try{var g=o.ref;if(g!==null){switch(o.tag){case 26:case 27:case 5:var b=o.stateNode;break;case 30:b=o.stateNode;break;default:b=o.stateNode}typeof g=="function"?o.refCleanup=g(b):g.current=b}}catch(D){Yi(o,c,D)}}function ql(o,c){var g=o.ref,b=o.refCleanup;if(g!==null)if(typeof b=="function")try{b()}catch(D){Yi(o,c,D)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof g=="function")try{g(null)}catch(D){Yi(o,c,D)}else g.current=null}function c8(o){var c=o.type,g=o.memoizedProps,b=o.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":g.autoFocus&&b.focus();break e;case"img":g.src?b.src=g.src:g.srcSet&&(b.srcset=g.srcSet)}}catch(D){Yi(o,o.return,D)}}function ab(o,c,g){try{var b=o.stateNode;$I(b,o.type,g,c),b[un]=c}catch(D){Yi(o,o.return,D)}}function h8(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&uh(o.type)||o.tag===4}function ob(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||h8(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&&uh(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 lb(o,c,g){var b=o.tag;if(b===5||b===6)o=o.stateNode,c?(g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g).insertBefore(o,c):(c=g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g,c.appendChild(o),g=g._reactRootContainer,g!=null||c.onclick!==null||(c.onclick=Po));else if(b!==4&&(b===27&&uh(o.type)&&(g=o.stateNode,c=null),o=o.child,o!==null))for(lb(o,c,g),o=o.sibling;o!==null;)lb(o,c,g),o=o.sibling}function j1(o,c,g){var b=o.tag;if(b===5||b===6)o=o.stateNode,c?g.insertBefore(o,c):g.appendChild(o);else if(b!==4&&(b===27&&uh(o.type)&&(g=o.stateNode),o=o.child,o!==null))for(j1(o,c,g),o=o.sibling;o!==null;)j1(o,c,g),o=o.sibling}function f8(o){var c=o.stateNode,g=o.memoizedProps;try{for(var b=o.type,D=c.attributes;D.length;)c.removeAttributeNode(D[0]);Us(c,b,g),c[Xn]=o,c[un]=g}catch(P){Yi(o,o.return,P)}}var sc=!1,ns=!1,ub=!1,A8=typeof WeakSet=="function"?WeakSet:Set,Ms=null;function MI(o,c){if(o=o.containerInfo,Nb=f2,o=Ol(o),Il(o)){if("selectionStart"in o)var g={start:o.selectionStart,end:o.selectionEnd};else e:{g=(g=o.ownerDocument)&&g.defaultView||window;var b=g.getSelection&&g.getSelection();if(b&&b.rangeCount!==0){g=b.anchorNode;var D=b.anchorOffset,P=b.focusNode;b=b.focusOffset;try{g.nodeType,P.nodeType}catch{g=null;break e}var $=0,se=-1,De=-1,Je=0,ft=0,Et=o,et=null;t:for(;;){for(var it;Et!==g||D!==0&&Et.nodeType!==3||(se=$+D),Et!==P||b!==0&&Et.nodeType!==3||(De=$+b),Et.nodeType===3&&($+=Et.nodeValue.length),(it=Et.firstChild)!==null;)et=Et,Et=it;for(;;){if(Et===o)break t;if(et===g&&++Je===D&&(se=$),et===P&&++ft===b&&(De=$),(it=Et.nextSibling)!==null)break;Et=et,et=Et.parentNode}Et=it}g=se===-1||De===-1?null:{start:se,end:De}}else g=null}g=g||{start:0,end:0}}else g=null;for(Db={focusedElem:o,selectionRange:g},f2=!1,Ms=c;Ms!==null;)if(c=Ms,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,Ms=o;else for(;Ms!==null;){switch(c=Ms,P=c.alternate,o=c.flags,c.tag){case 0:if((o&4)!==0&&(o=c.updateQueue,o=o!==null?o.events:null,o!==null))for(g=0;g<o.length;g++)D=o[g],D.ref.impl=D.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&P!==null){o=void 0,g=c,D=P.memoizedProps,P=P.memoizedState,b=g.stateNode;try{var ln=gf(g.type,D);o=b.getSnapshotBeforeUpdate(ln,P),b.__reactInternalSnapshotBeforeUpdate=o}catch(Pn){Yi(g,g.return,Pn)}}break;case 3:if((o&1024)!==0){if(o=c.stateNode.containerInfo,g=o.nodeType,g===9)Ub(o);else if(g===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Ub(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,Ms=o;break}Ms=c.return}}function d8(o,c,g){var b=g.flags;switch(g.tag){case 0:case 11:case 15:oc(o,g),b&4&&Np(5,g);break;case 1:if(oc(o,g),b&4)if(o=g.stateNode,c===null)try{o.componentDidMount()}catch($){Yi(g,g.return,$)}else{var D=gf(g.type,c.memoizedProps);c=c.memoizedState;try{o.componentDidUpdate(D,c,o.__reactInternalSnapshotBeforeUpdate)}catch($){Yi(g,g.return,$)}}b&64&&l8(g),b&512&&Dp(g,g.return);break;case 3:if(oc(o,g),b&64&&(o=g.updateQueue,o!==null)){if(c=null,g.child!==null)switch(g.child.tag){case 27:case 5:c=g.child.stateNode;break;case 1:c=g.child.stateNode}try{Bn(o,c)}catch($){Yi(g,g.return,$)}}break;case 27:c===null&&b&4&&f8(g);case 26:case 5:oc(o,g),c===null&&b&4&&c8(g),b&512&&Dp(g,g.return);break;case 12:oc(o,g);break;case 31:oc(o,g),b&4&&g8(o,g);break;case 13:oc(o,g),b&4&&v8(o,g),b&64&&(o=g.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(g=BI.bind(null,g),tF(o,g))));break;case 22:if(b=g.memoizedState!==null||sc,!b){c=c!==null&&c.memoizedState!==null||ns,D=sc;var P=ns;sc=b,(ns=c)&&!P?lc(o,g,(g.subtreeFlags&8772)!==0):oc(o,g),sc=D,ns=P}break;case 30:break;default:oc(o,g)}}function p8(o){var c=o.alternate;c!==null&&(o.alternate=null,p8(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&Ul(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 xr=null,La=!1;function ac(o,c,g){for(g=g.child;g!==null;)m8(o,c,g),g=g.sibling}function m8(o,c,g){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(rn,g)}catch{}switch(g.tag){case 26:ns||ql(g,c),ac(o,c,g),g.memoizedState?g.memoizedState.count--:g.stateNode&&(g=g.stateNode,g.parentNode.removeChild(g));break;case 27:ns||ql(g,c);var b=xr,D=La;uh(g.type)&&(xr=g.stateNode,La=!1),ac(o,c,g),zp(g.stateNode),xr=b,La=D;break;case 5:ns||ql(g,c);case 6:if(b=xr,D=La,xr=null,ac(o,c,g),xr=b,La=D,xr!==null)if(La)try{(xr.nodeType===9?xr.body:xr.nodeName==="HTML"?xr.ownerDocument.body:xr).removeChild(g.stateNode)}catch(P){Yi(g,c,P)}else try{xr.removeChild(g.stateNode)}catch(P){Yi(g,c,P)}break;case 18:xr!==null&&(La?(o=xr,lC(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,g.stateNode),sd(o)):lC(xr,g.stateNode));break;case 4:b=xr,D=La,xr=g.stateNode.containerInfo,La=!0,ac(o,c,g),xr=b,La=D;break;case 0:case 11:case 14:case 15:nh(2,g,c),ns||nh(4,g,c),ac(o,c,g);break;case 1:ns||(ql(g,c),b=g.stateNode,typeof b.componentWillUnmount=="function"&&u8(g,c,b)),ac(o,c,g);break;case 21:ac(o,c,g);break;case 22:ns=(b=ns)||g.memoizedState!==null,ac(o,c,g),ns=b;break;default:ac(o,c,g)}}function g8(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{sd(o)}catch(g){Yi(c,c.return,g)}}}function v8(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{sd(o)}catch(g){Yi(c,c.return,g)}}function EI(o){switch(o.tag){case 31:case 13:case 19:var c=o.stateNode;return c===null&&(c=o.stateNode=new A8),c;case 22:return o=o.stateNode,c=o._retryCache,c===null&&(c=o._retryCache=new A8),c;default:throw Error(n(435,o.tag))}}function W1(o,c){var g=EI(o);c.forEach(function(b){if(!g.has(b)){g.add(b);var D=OI.bind(null,o,b);b.then(D,D)}})}function Ua(o,c){var g=c.deletions;if(g!==null)for(var b=0;b<g.length;b++){var D=g[b],P=o,$=c,se=$;e:for(;se!==null;){switch(se.tag){case 27:if(uh(se.type)){xr=se.stateNode,La=!1;break e}break;case 5:xr=se.stateNode,La=!1;break e;case 3:case 4:xr=se.stateNode.containerInfo,La=!0;break e}se=se.return}if(xr===null)throw Error(n(160));m8(P,$,D),xr=null,La=!1,P=D.alternate,P!==null&&(P.return=null),D.return=null}if(c.subtreeFlags&13886)for(c=c.child;c!==null;)_8(c,o),c=c.sibling}var dl=null;function _8(o,c){var g=o.alternate,b=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:Ua(c,o),Ba(o),b&4&&(nh(3,o,o.return),Np(3,o),nh(5,o,o.return));break;case 1:Ua(c,o),Ba(o),b&512&&(ns||g===null||ql(g,g.return)),b&64&&sc&&(o=o.updateQueue,o!==null&&(b=o.callbacks,b!==null&&(g=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=g===null?b:g.concat(b))));break;case 26:var D=dl;if(Ua(c,o),Ba(o),b&512&&(ns||g===null||ql(g,g.return)),b&4){var P=g!==null?g.memoizedState:null;if(b=o.memoizedState,g===null)if(b===null)if(o.stateNode===null){e:{b=o.type,g=o.memoizedProps,D=D.ownerDocument||D;t:switch(b){case"title":P=D.getElementsByTagName("title")[0],(!P||P[Ma]||P[Xn]||P.namespaceURI==="http://www.w3.org/2000/svg"||P.hasAttribute("itemprop"))&&(P=D.createElement(b),D.head.insertBefore(P,D.querySelector("head > title"))),Us(P,b,g),P[Xn]=o,ke(P),b=P;break e;case"link":var $=_C("link","href",D).get(b+(g.href||""));if($){for(var se=0;se<$.length;se++)if(P=$[se],P.getAttribute("href")===(g.href==null||g.href===""?null:g.href)&&P.getAttribute("rel")===(g.rel==null?null:g.rel)&&P.getAttribute("title")===(g.title==null?null:g.title)&&P.getAttribute("crossorigin")===(g.crossOrigin==null?null:g.crossOrigin)){$.splice(se,1);break t}}P=D.createElement(b),Us(P,b,g),D.head.appendChild(P);break;case"meta":if($=_C("meta","content",D).get(b+(g.content||""))){for(se=0;se<$.length;se++)if(P=$[se],P.getAttribute("content")===(g.content==null?null:""+g.content)&&P.getAttribute("name")===(g.name==null?null:g.name)&&P.getAttribute("property")===(g.property==null?null:g.property)&&P.getAttribute("http-equiv")===(g.httpEquiv==null?null:g.httpEquiv)&&P.getAttribute("charset")===(g.charSet==null?null:g.charSet)){$.splice(se,1);break t}}P=D.createElement(b),Us(P,b,g),D.head.appendChild(P);break;default:throw Error(n(468,b))}P[Xn]=o,ke(P),b=P}o.stateNode=b}else yC(D,o.type,o.stateNode);else o.stateNode=vC(D,b,o.memoizedProps);else P!==b?(P===null?g.stateNode!==null&&(g=g.stateNode,g.parentNode.removeChild(g)):P.count--,b===null?yC(D,o.type,o.stateNode):vC(D,b,o.memoizedProps)):b===null&&o.stateNode!==null&&ab(o,o.memoizedProps,g.memoizedProps)}break;case 27:Ua(c,o),Ba(o),b&512&&(ns||g===null||ql(g,g.return)),g!==null&&b&4&&ab(o,o.memoizedProps,g.memoizedProps);break;case 5:if(Ua(c,o),Ba(o),b&512&&(ns||g===null||ql(g,g.return)),o.flags&32){D=o.stateNode;try{pi(D,"")}catch(ln){Yi(o,o.return,ln)}}b&4&&o.stateNode!=null&&(D=o.memoizedProps,ab(o,D,g!==null?g.memoizedProps:D)),b&1024&&(ub=!0);break;case 6:if(Ua(c,o),Ba(o),b&4){if(o.stateNode===null)throw Error(n(162));b=o.memoizedProps,g=o.stateNode;try{g.nodeValue=b}catch(ln){Yi(o,o.return,ln)}}break;case 3:if(l2=null,D=dl,dl=a2(c.containerInfo),Ua(c,o),dl=D,Ba(o),b&4&&g!==null&&g.memoizedState.isDehydrated)try{sd(c.containerInfo)}catch(ln){Yi(o,o.return,ln)}ub&&(ub=!1,y8(o));break;case 4:b=dl,dl=a2(o.stateNode.containerInfo),Ua(c,o),Ba(o),dl=b;break;case 12:Ua(c,o),Ba(o);break;case 31:Ua(c,o),Ba(o),b&4&&(b=o.updateQueue,b!==null&&(o.updateQueue=null,W1(o,b)));break;case 13:Ua(c,o),Ba(o),o.child.flags&8192&&o.memoizedState!==null!=(g!==null&&g.memoizedState!==null)&&(X1=Re()),b&4&&(b=o.updateQueue,b!==null&&(o.updateQueue=null,W1(o,b)));break;case 22:D=o.memoizedState!==null;var De=g!==null&&g.memoizedState!==null,Je=sc,ft=ns;if(sc=Je||D,ns=ft||De,Ua(c,o),ns=ft,sc=Je,Ba(o),b&8192)e:for(c=o.stateNode,c._visibility=D?c._visibility&-2:c._visibility|1,D&&(g===null||De||sc||ns||vf(o)),g=null,c=o;;){if(c.tag===5||c.tag===26){if(g===null){De=g=c;try{if(P=De.stateNode,D)$=P.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none";else{se=De.stateNode;var Et=De.memoizedProps.style,et=Et!=null&&Et.hasOwnProperty("display")?Et.display:null;se.style.display=et==null||typeof et=="boolean"?"":(""+et).trim()}}catch(ln){Yi(De,De.return,ln)}}}else if(c.tag===6){if(g===null){De=c;try{De.stateNode.nodeValue=D?"":De.memoizedProps}catch(ln){Yi(De,De.return,ln)}}}else if(c.tag===18){if(g===null){De=c;try{var it=De.stateNode;D?uC(it,!0):uC(De.stateNode,!1)}catch(ln){Yi(De,De.return,ln)}}}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;g===c&&(g=null),c=c.return}g===c&&(g=null),c.sibling.return=c.return,c=c.sibling}b&4&&(b=o.updateQueue,b!==null&&(g=b.retryQueue,g!==null&&(b.retryQueue=null,W1(o,g))));break;case 19:Ua(c,o),Ba(o),b&4&&(b=o.updateQueue,b!==null&&(o.updateQueue=null,W1(o,b)));break;case 30:break;case 21:break;default:Ua(c,o),Ba(o)}}function Ba(o){var c=o.flags;if(c&2){try{for(var g,b=o.return;b!==null;){if(h8(b)){g=b;break}b=b.return}if(g==null)throw Error(n(160));switch(g.tag){case 27:var D=g.stateNode,P=ob(o);j1(o,P,D);break;case 5:var $=g.stateNode;g.flags&32&&(pi($,""),g.flags&=-33);var se=ob(o);j1(o,se,$);break;case 3:case 4:var De=g.stateNode.containerInfo,Je=ob(o);lb(o,Je,De);break;default:throw Error(n(161))}}catch(ft){Yi(o,o.return,ft)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function y8(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var c=o;y8(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),o=o.sibling}}function oc(o,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)d8(o,c.alternate,c),c=c.sibling}function vf(o){for(o=o.child;o!==null;){var c=o;switch(c.tag){case 0:case 11:case 14:case 15:nh(4,c,c.return),vf(c);break;case 1:ql(c,c.return);var g=c.stateNode;typeof g.componentWillUnmount=="function"&&u8(c,c.return,g),vf(c);break;case 27:zp(c.stateNode);case 26:case 5:ql(c,c.return),vf(c);break;case 22:c.memoizedState===null&&vf(c);break;case 30:vf(c);break;default:vf(c)}o=o.sibling}}function lc(o,c,g){for(g=g&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var b=c.alternate,D=o,P=c,$=P.flags;switch(P.tag){case 0:case 11:case 15:lc(D,P,g),Np(4,P);break;case 1:if(lc(D,P,g),b=P,D=b.stateNode,typeof D.componentDidMount=="function")try{D.componentDidMount()}catch(Je){Yi(b,b.return,Je)}if(b=P,D=b.updateQueue,D!==null){var se=b.stateNode;try{var De=D.shared.hiddenCallbacks;if(De!==null)for(D.shared.hiddenCallbacks=null,D=0;D<De.length;D++)tn(De[D],se)}catch(Je){Yi(b,b.return,Je)}}g&&$&64&&l8(P),Dp(P,P.return);break;case 27:f8(P);case 26:case 5:lc(D,P,g),g&&b===null&&$&4&&c8(P),Dp(P,P.return);break;case 12:lc(D,P,g);break;case 31:lc(D,P,g),g&&$&4&&g8(D,P);break;case 13:lc(D,P,g),g&&$&4&&v8(D,P);break;case 22:P.memoizedState===null&&lc(D,P,g),Dp(P,P.return);break;case 30:break;default:lc(D,P,g)}c=c.sibling}}function cb(o,c){var g=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(g=o.memoizedState.cachePool.pool),o=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(o=c.memoizedState.cachePool.pool),o!==g&&(o!=null&&o.refCount++,g!=null&&Jc(g))}function hb(o,c){o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&Jc(o))}function pl(o,c,g,b){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)x8(o,c,g,b),c=c.sibling}function x8(o,c,g,b){var D=c.flags;switch(c.tag){case 0:case 11:case 15:pl(o,c,g,b),D&2048&&Np(9,c);break;case 1:pl(o,c,g,b);break;case 3:pl(o,c,g,b),D&2048&&(o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&Jc(o)));break;case 12:if(D&2048){pl(o,c,g,b),o=c.stateNode;try{var P=c.memoizedProps,$=P.id,se=P.onPostCommit;typeof se=="function"&&se($,c.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(De){Yi(c,c.return,De)}}else pl(o,c,g,b);break;case 31:pl(o,c,g,b);break;case 13:pl(o,c,g,b);break;case 23:break;case 22:P=c.stateNode,$=c.alternate,c.memoizedState!==null?P._visibility&2?pl(o,c,g,b):Pp(o,c):P._visibility&2?pl(o,c,g,b):(P._visibility|=2,XA(o,c,g,b,(c.subtreeFlags&10256)!==0||!1)),D&2048&&cb($,c);break;case 24:pl(o,c,g,b),D&2048&&hb(c.alternate,c);break;default:pl(o,c,g,b)}}function XA(o,c,g,b,D){for(D=D&&((c.subtreeFlags&10256)!==0||!1),c=c.child;c!==null;){var P=o,$=c,se=g,De=b,Je=$.flags;switch($.tag){case 0:case 11:case 15:XA(P,$,se,De,D),Np(8,$);break;case 23:break;case 22:var ft=$.stateNode;$.memoizedState!==null?ft._visibility&2?XA(P,$,se,De,D):Pp(P,$):(ft._visibility|=2,XA(P,$,se,De,D)),D&&Je&2048&&cb($.alternate,$);break;case 24:XA(P,$,se,De,D),D&&Je&2048&&hb($.alternate,$);break;default:XA(P,$,se,De,D)}c=c.sibling}}function Pp(o,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var g=o,b=c,D=b.flags;switch(b.tag){case 22:Pp(g,b),D&2048&&cb(b.alternate,b);break;case 24:Pp(g,b),D&2048&&hb(b.alternate,b);break;default:Pp(g,b)}c=c.sibling}}var Lp=8192;function YA(o,c,g){if(o.subtreeFlags&Lp)for(o=o.child;o!==null;)b8(o,c,g),o=o.sibling}function b8(o,c,g){switch(o.tag){case 26:YA(o,c,g),o.flags&Lp&&o.memoizedState!==null&&AF(g,dl,o.memoizedState,o.memoizedProps);break;case 5:YA(o,c,g);break;case 3:case 4:var b=dl;dl=a2(o.stateNode.containerInfo),YA(o,c,g),dl=b;break;case 22:o.memoizedState===null&&(b=o.alternate,b!==null&&b.memoizedState!==null?(b=Lp,Lp=16777216,YA(o,c,g),Lp=b):YA(o,c,g));break;default:YA(o,c,g)}}function S8(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 Up(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var g=0;g<c.length;g++){var b=c[g];Ms=b,w8(b,o)}S8(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)T8(o),o=o.sibling}function T8(o){switch(o.tag){case 0:case 11:case 15:Up(o),o.flags&2048&&nh(9,o,o.return);break;case 3:Up(o);break;case 12:Up(o);break;case 22:var c=o.stateNode;o.memoizedState!==null&&c._visibility&2&&(o.return===null||o.return.tag!==13)?(c._visibility&=-3,$1(o)):Up(o);break;default:Up(o)}}function $1(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var g=0;g<c.length;g++){var b=c[g];Ms=b,w8(b,o)}S8(o)}for(o=o.child;o!==null;){switch(c=o,c.tag){case 0:case 11:case 15:nh(8,c,c.return),$1(c);break;case 22:g=c.stateNode,g._visibility&2&&(g._visibility&=-3,$1(c));break;default:$1(c)}o=o.sibling}}function w8(o,c){for(;Ms!==null;){var g=Ms;switch(g.tag){case 0:case 11:case 15:nh(8,g,c);break;case 23:case 22:if(g.memoizedState!==null&&g.memoizedState.cachePool!==null){var b=g.memoizedState.cachePool.pool;b!=null&&b.refCount++}break;case 24:Jc(g.memoizedState.cache)}if(b=g.child,b!==null)b.return=g,Ms=b;else e:for(g=o;Ms!==null;){b=Ms;var D=b.sibling,P=b.return;if(p8(b),b===g){Ms=null;break e}if(D!==null){D.return=P,Ms=D;break e}Ms=P}}}var CI={getCacheForType:function(o){var c=As(Qt),g=c.data.get(o);return g===void 0&&(g=o(),c.data.set(o,g)),g},cacheSignal:function(){return As(Qt).controller.signal}},RI=typeof WeakMap=="function"?WeakMap:Map,Oi=0,or=null,gi=null,bi=0,Xi=0,ho=null,ih=!1,QA=!1,fb=!1,uc=0,Or=0,rh=0,_f=0,Ab=0,fo=0,KA=0,Bp=null,Oa=null,db=!1,X1=0,M8=0,Y1=1/0,Q1=null,sh=null,ds=0,ah=null,ZA=null,cc=0,pb=0,mb=null,E8=null,Op=0,gb=null;function Ao(){return(Oi&2)!==0&&bi!==0?bi&-bi:Q.T!==null?Sb():J()}function C8(){if(fo===0)if((bi&536870912)===0||mi){var o=tt;tt<<=1,(tt&3932160)===0&&(tt=262144),fo=o}else fo=536870912;return o=vn.current,o!==null&&(o.flags|=32),fo}function Ia(o,c,g){(o===or&&(Xi===2||Xi===9)||o.cancelPendingCommit!==null)&&(JA(o,0),oh(o,bi,fo,!1)),$i(o,g),((Oi&2)===0||o!==or)&&(o===or&&((Oi&2)===0&&(_f|=g),Or===4&&oh(o,bi,fo,!1)),Vl(o))}function R8(o,c,g){if((Oi&6)!==0)throw Error(n(327));var b=!g&&(c&127)===0&&(c&o.expiredLanes)===0||xn(o,c),D=b?PI(o,c):_b(o,c,!0),P=b;do{if(D===0){QA&&!b&&oh(o,c,0,!1);break}else{if(g=o.current.alternate,P&&!NI(g)){D=_b(o,c,!1),P=!1;continue}if(D===2){if(P=c,o.errorRecoveryDisabledLanes&P)var $=0;else $=o.pendingLanes&-536870913,$=$!==0?$:$&536870912?536870912:0;if($!==0){c=$;e:{var se=o;D=Bp;var De=se.current.memoizedState.isDehydrated;if(De&&(JA(se,$).flags|=256),$=_b(se,$,!1),$!==2){if(fb&&!De){se.errorRecoveryDisabledLanes|=P,_f|=P,D=4;break e}P=Oa,Oa=D,P!==null&&(Oa===null?Oa=P:Oa.push.apply(Oa,P))}D=$}if(P=!1,D!==2)continue}}if(D===1){JA(o,0),oh(o,c,0,!0);break}e:{switch(b=o,P=D,P){case 0:case 1:throw Error(n(345));case 4:if((c&4194048)!==c)break;case 6:oh(b,c,fo,!ih);break e;case 2:Oa=null;break;case 3:case 5:break;default:throw Error(n(329))}if((c&62914560)===c&&(D=X1+300-Re(),10<D)){if(oh(b,c,fo,!ih),Ht(b,0,!0)!==0)break e;cc=c,b.timeoutHandle=aC(N8.bind(null,b,g,Oa,Q1,db,c,fo,_f,KA,ih,P,"Throttled",-0,0),D);break e}N8(b,g,Oa,Q1,db,c,fo,_f,KA,ih,P,null,-0,0)}}break}while(!0);Vl(o)}function N8(o,c,g,b,D,P,$,se,De,Je,ft,Et,et,it){if(o.timeoutHandle=-1,Et=c.subtreeFlags,Et&8192||(Et&16785408)===16785408){Et={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Po},b8(c,P,Et);var ln=(P&62914560)===P?X1-Re():(P&4194048)===P?M8-Re():0;if(ln=dF(Et,ln),ln!==null){cc=P,o.cancelPendingCommit=ln(F8.bind(null,o,c,P,g,b,D,$,se,De,ft,Et,null,et,it)),oh(o,P,$,!Je);return}}F8(o,c,P,g,b,D,$,se,De)}function NI(o){for(var c=o;;){var g=c.tag;if((g===0||g===11||g===15)&&c.flags&16384&&(g=c.updateQueue,g!==null&&(g=g.stores,g!==null)))for(var b=0;b<g.length;b++){var D=g[b],P=D.getSnapshot;D=D.value;try{if(!Aa(P(),D))return!1}catch{return!1}}if(g=c.child,c.subtreeFlags&16384&&g!==null)g.return=c,c=g;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 oh(o,c,g,b){c&=~Ab,c&=~_f,o.suspendedLanes|=c,o.pingedLanes&=~c,b&&(o.warmLanes|=c),b=o.expirationTimes;for(var D=c;0<D;){var P=31-Vt(D),$=1<<P;b[P]=-1,D&=~$}g!==0&&Ze(o,g,c)}function K1(){return(Oi&6)===0?(Ip(0),!1):!0}function vb(){if(gi!==null){if(Xi===0)var o=gi.return;else o=gi,ll=Qu=null,Ux(o),T=null,M=0,o=gi;for(;o!==null;)o8(o.alternate,o),o=o.return;gi=null}}function JA(o,c){var g=o.timeoutHandle;g!==-1&&(o.timeoutHandle=-1,QI(g)),g=o.cancelPendingCommit,g!==null&&(o.cancelPendingCommit=null,g()),cc=0,vb(),or=o,gi=g=Uo(o.current,null),bi=c,Xi=0,ho=null,ih=!1,QA=xn(o,c),fb=!1,KA=fo=Ab=_f=rh=Or=0,Oa=Bp=null,db=!1,(c&8)!==0&&(c|=c&32);var b=o.entangledLanes;if(b!==0)for(o=o.entanglements,b&=c;0<b;){var D=31-Vt(b),P=1<<D;c|=o[D],b&=~P}return uc=c,UA(),g}function D8(o,c){ri=null,Q.H=Ep,c===hl||c===uo?(c=_(),Xi=3):c===Gl?(c=_(),Xi=4):Xi=c===Qx?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,ho=c,gi===null&&(Or=1,z1(o,Ca(c,o.current)))}function P8(){var o=vn.current;return o===null?!0:(bi&4194048)===bi?ii===null:(bi&62914560)===bi||(bi&536870912)!==0?o===ii:!1}function L8(){var o=Q.H;return Q.H=Ep,o===null?Ep:o}function U8(){var o=Q.A;return Q.A=CI,o}function Z1(){Or=4,ih||(bi&4194048)!==bi&&vn.current!==null||(QA=!0),(rh&134217727)===0&&(_f&134217727)===0||or===null||oh(or,bi,fo,!1)}function _b(o,c,g){var b=Oi;Oi|=2;var D=L8(),P=U8();(or!==o||bi!==c)&&(Q1=null,JA(o,c)),c=!1;var $=Or;e:do try{if(Xi!==0&&gi!==null){var se=gi,De=ho;switch(Xi){case 8:vb(),$=6;break e;case 3:case 2:case 9:case 6:vn.current===null&&(c=!0);var Je=Xi;if(Xi=0,ho=null,ed(o,se,De,Je),g&&QA){$=0;break e}break;default:Je=Xi,Xi=0,ho=null,ed(o,se,De,Je)}}DI(),$=Or;break}catch(ft){D8(o,ft)}while(!0);return c&&o.shellSuspendCounter++,ll=Qu=null,Oi=b,Q.H=D,Q.A=P,gi===null&&(or=null,bi=0,UA()),$}function DI(){for(;gi!==null;)B8(gi)}function PI(o,c){var g=Oi;Oi|=2;var b=L8(),D=U8();or!==o||bi!==c?(Q1=null,Y1=Re()+500,JA(o,c)):QA=xn(o,c);e:do try{if(Xi!==0&&gi!==null){c=gi;var P=ho;t:switch(Xi){case 1:Xi=0,ho=null,ed(o,c,P,1);break;case 2:case 9:if(fl(P)){Xi=0,ho=null,O8(c);break}c=function(){Xi!==2&&Xi!==9||or!==o||(Xi=7),Vl(o)},P.then(c,c);break e;case 3:Xi=7;break e;case 4:Xi=5;break e;case 7:fl(P)?(Xi=0,ho=null,O8(c)):(Xi=0,ho=null,ed(o,c,P,7));break;case 5:var $=null;switch(gi.tag){case 26:$=gi.memoizedState;case 5:case 27:var se=gi;if($?xC($):se.stateNode.complete){Xi=0,ho=null;var De=se.sibling;if(De!==null)gi=De;else{var Je=se.return;Je!==null?(gi=Je,J1(Je)):gi=null}break t}}Xi=0,ho=null,ed(o,c,P,5);break;case 6:Xi=0,ho=null,ed(o,c,P,6);break;case 8:vb(),Or=6;break e;default:throw Error(n(462))}}LI();break}catch(ft){D8(o,ft)}while(!0);return ll=Qu=null,Q.H=b,Q.A=D,Oi=g,gi!==null?0:(or=null,bi=0,UA(),Or)}function LI(){for(;gi!==null&&!X();)B8(gi)}function B8(o){var c=s8(o.alternate,o,uc);o.memoizedProps=o.pendingProps,c===null?J1(o):gi=c}function O8(o){var c=o,g=c.alternate;switch(c.tag){case 15:case 0:c=J4(g,c,c.pendingProps,c.type,void 0,bi);break;case 11:c=J4(g,c,c.pendingProps,c.type.render,c.ref,bi);break;case 5:Ux(c);default:o8(g,c),c=gi=E1(c,uc),c=s8(g,c,uc)}o.memoizedProps=o.pendingProps,c===null?J1(o):gi=c}function ed(o,c,g,b){ll=Qu=null,Ux(c),T=null,M=0;var D=c.return;try{if(xI(o,D,c,g,bi)){Or=1,z1(o,Ca(g,o.current)),gi=null;return}}catch(P){if(D!==null)throw gi=D,P;Or=1,z1(o,Ca(g,o.current)),gi=null;return}c.flags&32768?(mi||b===1?o=!0:QA||(bi&536870912)!==0?o=!1:(ih=o=!0,(b===2||b===9||b===3||b===6)&&(b=vn.current,b!==null&&b.tag===13&&(b.flags|=16384))),I8(c,o)):J1(c)}function J1(o){var c=o;do{if((c.flags&32768)!==0){I8(c,ih);return}o=c.return;var g=TI(c.alternate,c,uc);if(g!==null){gi=g;return}if(c=c.sibling,c!==null){gi=c;return}gi=c=o}while(c!==null);Or===0&&(Or=5)}function I8(o,c){do{var g=wI(o.alternate,o);if(g!==null){g.flags&=32767,gi=g;return}if(g=o.return,g!==null&&(g.flags|=32768,g.subtreeFlags=0,g.deletions=null),!c&&(o=o.sibling,o!==null)){gi=o;return}gi=o=g}while(o!==null);Or=6,gi=null}function F8(o,c,g,b,D,P,$,se,De){o.cancelPendingCommit=null;do e2();while(ds!==0);if((Oi&6)!==0)throw Error(n(327));if(c!==null){if(c===o.current)throw Error(n(177));if(P=c.lanes|c.childLanes,P|=mp,Jr(o,g,P,$,se,De),o===or&&(gi=or=null,bi=0),ZA=c,ah=o,cc=g,pb=P,mb=D,E8=b,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,II(lt,function(){return V8(),null})):(o.callbackNode=null,o.callbackPriority=0),b=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||b){b=Q.T,Q.T=null,D=ae.p,ae.p=2,$=Oi,Oi|=4;try{MI(o,c,g)}finally{Oi=$,ae.p=D,Q.T=b}}ds=1,k8(),z8(),G8()}}function k8(){if(ds===1){ds=0;var o=ah,c=ZA,g=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||g){g=Q.T,Q.T=null;var b=ae.p;ae.p=2;var D=Oi;Oi|=4;try{_8(c,o);var P=Db,$=Ol(o.containerInfo),se=P.focusedElem,De=P.selectionRange;if($!==se&&se&&se.ownerDocument&&zu(se.ownerDocument.documentElement,se)){if(De!==null&&Il(se)){var Je=De.start,ft=De.end;if(ft===void 0&&(ft=Je),"selectionStart"in se)se.selectionStart=Je,se.selectionEnd=Math.min(ft,se.value.length);else{var Et=se.ownerDocument||document,et=Et&&Et.defaultView||window;if(et.getSelection){var it=et.getSelection(),ln=se.textContent.length,Pn=Math.min(De.start,ln),er=De.end===void 0?Pn:Math.min(De.end,ln);!it.extend&&Pn>er&&($=er,er=Pn,Pn=$);var Ve=LA(se,Pn),Oe=LA(se,er);if(Ve&&Oe&&(it.rangeCount!==1||it.anchorNode!==Ve.node||it.anchorOffset!==Ve.offset||it.focusNode!==Oe.node||it.focusOffset!==Oe.offset)){var Ke=Et.createRange();Ke.setStart(Ve.node,Ve.offset),it.removeAllRanges(),Pn>er?(it.addRange(Ke),it.extend(Oe.node,Oe.offset)):(Ke.setEnd(Oe.node,Oe.offset),it.addRange(Ke))}}}}for(Et=[],it=se;it=it.parentNode;)it.nodeType===1&&Et.push({element:it,left:it.scrollLeft,top:it.scrollTop});for(typeof se.focus=="function"&&se.focus(),se=0;se<Et.length;se++){var Tt=Et[se];Tt.element.scrollLeft=Tt.left,Tt.element.scrollTop=Tt.top}}f2=!!Nb,Db=Nb=null}finally{Oi=D,ae.p=b,Q.T=g}}o.current=c,ds=2}}function z8(){if(ds===2){ds=0;var o=ah,c=ZA,g=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||g){g=Q.T,Q.T=null;var b=ae.p;ae.p=2;var D=Oi;Oi|=4;try{d8(o,c.alternate,c)}finally{Oi=D,ae.p=b,Q.T=g}}ds=3}}function G8(){if(ds===4||ds===3){ds=0,le();var o=ah,c=ZA,g=cc,b=E8;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?ds=5:(ds=0,ZA=ah=null,q8(o,o.pendingLanes));var D=o.pendingLanes;if(D===0&&(sh=null),d(g),c=c.stateNode,$t&&typeof $t.onCommitFiberRoot=="function")try{$t.onCommitFiberRoot(rn,c,void 0,(c.current.flags&128)===128)}catch{}if(b!==null){c=Q.T,D=ae.p,ae.p=2,Q.T=null;try{for(var P=o.onRecoverableError,$=0;$<b.length;$++){var se=b[$];P(se.value,{componentStack:se.stack})}}finally{Q.T=c,ae.p=D}}(cc&3)!==0&&e2(),Vl(o),D=o.pendingLanes,(g&261930)!==0&&(D&42)!==0?o===gb?Op++:(Op=0,gb=o):Op=0,Ip(0)}}function q8(o,c){(o.pooledCacheLanes&=c)===0&&(c=o.pooledCache,c!=null&&(o.pooledCache=null,Jc(c)))}function e2(){return k8(),z8(),G8(),V8()}function V8(){if(ds!==5)return!1;var o=ah,c=pb;pb=0;var g=d(cc),b=Q.T,D=ae.p;try{ae.p=32>g?32:g,Q.T=null,g=mb,mb=null;var P=ah,$=cc;if(ds=0,ZA=ah=null,cc=0,(Oi&6)!==0)throw Error(n(331));var se=Oi;if(Oi|=4,T8(P.current),x8(P,P.current,$,g),Oi=se,Ip(0,!1),$t&&typeof $t.onPostCommitFiberRoot=="function")try{$t.onPostCommitFiberRoot(rn,P)}catch{}return!0}finally{ae.p=D,Q.T=b,q8(o,c)}}function H8(o,c,g){c=Ca(g,c),c=Yx(o.stateNode,c,2),o=Ye(o,c,2),o!==null&&($i(o,2),Vl(o))}function Yi(o,c,g){if(o.tag===3)H8(o,o,g);else for(;c!==null;){if(c.tag===3){H8(c,o,g);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(sh===null||!sh.has(b))){o=Ca(g,o),g=j4(2),b=Ye(c,g,2),b!==null&&(W4(g,b,c,o),$i(b,2),Vl(b));break}}c=c.return}}function yb(o,c,g){var b=o.pingCache;if(b===null){b=o.pingCache=new RI;var D=new Set;b.set(c,D)}else D=b.get(c),D===void 0&&(D=new Set,b.set(c,D));D.has(g)||(fb=!0,D.add(g),o=UI.bind(null,o,c,g),c.then(o,o))}function UI(o,c,g){var b=o.pingCache;b!==null&&b.delete(c),o.pingedLanes|=o.suspendedLanes&g,o.warmLanes&=~g,or===o&&(bi&g)===g&&(Or===4||Or===3&&(bi&62914560)===bi&&300>Re()-X1?(Oi&2)===0&&JA(o,0):Ab|=g,KA===bi&&(KA=0)),Vl(o)}function j8(o,c){c===0&&(c=rr()),o=ju(o,c),o!==null&&($i(o,c),Vl(o))}function BI(o){var c=o.memoizedState,g=0;c!==null&&(g=c.retryLane),j8(o,g)}function OI(o,c){var g=0;switch(o.tag){case 31:case 13:var b=o.stateNode,D=o.memoizedState;D!==null&&(g=D.retryLane);break;case 19:b=o.stateNode;break;case 22:b=o.stateNode._retryCache;break;default:throw Error(n(314))}b!==null&&b.delete(c),j8(o,g)}function II(o,c){return xt(o,c)}var t2=null,td=null,xb=!1,n2=!1,bb=!1,lh=0;function Vl(o){o!==td&&o.next===null&&(td===null?t2=td=o:td=td.next=o),n2=!0,xb||(xb=!0,kI())}function Ip(o,c){if(!bb&&n2){bb=!0;do for(var g=!1,b=t2;b!==null;){if(o!==0){var D=b.pendingLanes;if(D===0)var P=0;else{var $=b.suspendedLanes,se=b.pingedLanes;P=(1<<31-Vt(42|o)+1)-1,P&=D&~($&~se),P=P&201326741?P&201326741|1:P?P|2:0}P!==0&&(g=!0,Y8(b,P))}else P=bi,P=Ht(b,b===or?P:0,b.cancelPendingCommit!==null||b.timeoutHandle!==-1),(P&3)===0||xn(b,P)||(g=!0,Y8(b,P));b=b.next}while(g);bb=!1}}function FI(){W8()}function W8(){n2=xb=!1;var o=0;lh!==0&&YI()&&(o=lh);for(var c=Re(),g=null,b=t2;b!==null;){var D=b.next,P=$8(b,c);P===0?(b.next=null,g===null?t2=D:g.next=D,D===null&&(td=g)):(g=b,(o!==0||(P&3)!==0)&&(n2=!0)),b=D}ds!==0&&ds!==5||Ip(o),lh!==0&&(lh=0)}function $8(o,c){for(var g=o.suspendedLanes,b=o.pingedLanes,D=o.expirationTimes,P=o.pendingLanes&-62914561;0<P;){var $=31-Vt(P),se=1<<$,De=D[$];De===-1?((se&g)===0||(se&b)!==0)&&(D[$]=qi(se,c)):De<=c&&(o.expiredLanes|=se),P&=~se}if(c=or,g=bi,g=Ht(o,o===c?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),b=o.callbackNode,g===0||o===c&&(Xi===2||Xi===9)||o.cancelPendingCommit!==null)return b!==null&&b!==null&&fe(b),o.callbackNode=null,o.callbackPriority=0;if((g&3)===0||xn(o,g)){if(c=g&-g,c===o.callbackPriority)return c;switch(b!==null&&fe(b),d(g)){case 2:case 8:g=nt;break;case 32:g=lt;break;case 268435456:g=jt;break;default:g=lt}return b=X8.bind(null,o),g=xt(g,b),o.callbackPriority=c,o.callbackNode=g,c}return b!==null&&b!==null&&fe(b),o.callbackPriority=2,o.callbackNode=null,2}function X8(o,c){if(ds!==0&&ds!==5)return o.callbackNode=null,o.callbackPriority=0,null;var g=o.callbackNode;if(e2()&&o.callbackNode!==g)return null;var b=bi;return b=Ht(o,o===or?b:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),b===0?null:(R8(o,b,c),$8(o,Re()),o.callbackNode!=null&&o.callbackNode===g?X8.bind(null,o):null)}function Y8(o,c){if(e2())return null;R8(o,c,!0)}function kI(){KI(function(){(Oi&6)!==0?xt(Me,FI):W8()})}function Sb(){if(lh===0){var o=eh;o===0&&(o=bt,bt<<=1,(bt&261888)===0&&(bt=256)),lh=o}return lh}function Q8(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Wc(""+o)}function K8(o,c){var g=c.ownerDocument.createElement("input");return g.name=c.name,g.value=c.value,o.id&&g.setAttribute("form",o.id),c.parentNode.insertBefore(g,c),o=new FormData(o),g.parentNode.removeChild(g),o}function zI(o,c,g,b,D){if(c==="submit"&&g&&g.stateNode===D){var P=Q8((D[un]||null).action),$=b.submitter;$&&(c=(c=$[un]||null)?Q8(c.formAction):$.getAttribute("formAction"),c!==null&&(P=c,$=null));var se=new MA("action","action",null,b,D);o.push({event:se,listeners:[{instance:null,listener:function(){if(b.defaultPrevented){if(lh!==0){var De=$?K8(D,$):new FormData(D);Vx(g,{pending:!0,data:De,method:D.method,action:P},null,De)}}else typeof P=="function"&&(se.preventDefault(),De=$?K8(D,$):new FormData(D),Vx(g,{pending:!0,data:De,method:D.method,action:P},P,De))},currentTarget:D}]})}}for(var Tb=0;Tb<pp.length;Tb++){var wb=pp[Tb],GI=wb.toLowerCase(),qI=wb[0].toUpperCase()+wb.slice(1);oo(GI,"on"+qI)}oo(Xs,"onAnimationEnd"),oo(T1,"onAnimationIteration"),oo(Zc,"onAnimationStart"),oo("dblclick","onDoubleClick"),oo("focusin","onFocus"),oo("focusout","onBlur"),oo(Mx,"onTransitionRun"),oo(Ex,"onTransitionStart"),oo(Cx,"onTransitionCancel"),oo(dp,"onTransitionEnd"),Z("onMouseEnter",["mouseout","mouseover"]),Z("onMouseLeave",["mouseout","mouseover"]),Z("onPointerEnter",["pointerout","pointerover"]),Z("onPointerLeave",["pointerout","pointerover"]),mt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),mt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),mt("onBeforeInput",["compositionend","keypress","textInput","paste"]),mt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),mt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),mt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fp="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(" "),VI=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fp));function Z8(o,c){c=(c&4)!==0;for(var g=0;g<o.length;g++){var b=o[g],D=b.event;b=b.listeners;e:{var P=void 0;if(c)for(var $=b.length-1;0<=$;$--){var se=b[$],De=se.instance,Je=se.currentTarget;if(se=se.listener,De!==P&&D.isPropagationStopped())break e;P=se,D.currentTarget=Je;try{P(D)}catch(ft){Hu(ft)}D.currentTarget=null,P=De}else for($=0;$<b.length;$++){if(se=b[$],De=se.instance,Je=se.currentTarget,se=se.listener,De!==P&&D.isPropagationStopped())break e;P=se,D.currentTarget=Je;try{P(D)}catch(ft){Hu(ft)}D.currentTarget=null,P=De}}}}function vi(o,c){var g=c[Hs];g===void 0&&(g=c[Hs]=new Set);var b=o+"__bubble";g.has(b)||(J8(c,o,2,!1),g.add(b))}function Mb(o,c,g){var b=0;c&&(b|=4),J8(g,o,b,c)}var i2="_reactListening"+Math.random().toString(36).slice(2);function Eb(o){if(!o[i2]){o[i2]=!0,It.forEach(function(g){g!=="selectionchange"&&(VI.has(g)||Mb(g,!1,o),Mb(g,!0,o))});var c=o.nodeType===9?o:o.ownerDocument;c===null||c[i2]||(c[i2]=!0,Mb("selectionchange",!1,c))}}function J8(o,c,g,b){switch(CC(c)){case 2:var D=gF;break;case 8:D=vF;break;default:D=qb}g=D.bind(null,c,g,o),D=void 0,!TA||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(D=!0),b?D!==void 0?o.addEventListener(c,g,{capture:!0,passive:D}):o.addEventListener(c,g,!0):D!==void 0?o.addEventListener(c,g,{passive:D}):o.addEventListener(c,g,!1)}function Cb(o,c,g,b,D){var P=b;if((c&1)===0&&(c&2)===0&&b!==null)e:for(;;){if(b===null)return;var $=b.tag;if($===3||$===4){var se=b.stateNode.containerInfo;if(se===D)break;if($===4)for($=b.return;$!==null;){var De=$.tag;if((De===3||De===4)&&$.stateNode.containerInfo===D)return;$=$.return}for(;se!==null;){if($=oe(se),$===null)return;if(De=$.tag,De===5||De===6||De===26||De===27){b=P=$;continue e}se=se.parentNode}}b=b.return}s1(function(){var Je=P,ft=tp(g),Et=[];e:{var et=w1.get(o);if(et!==void 0){var it=MA,ln=o;switch(o){case"keypress":if(rf(g)===0)break e;case"keydown":case"keyup":it=Ax;break;case"focusin":ln="focus",it=Yc;break;case"focusout":ln="blur",it=Yc;break;case"beforeblur":case"afterblur":it=Yc;break;case"click":if(g.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":it=o1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":it=hx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":it=mx;break;case Xs:case T1:case Zc:it=u1;break;case dp:it=gx;break;case"scroll":case"scrollend":it=Du;break;case"wheel":it=CA;break;case"copy":case"cut":case"paste":it=EA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":it=d1;break;case"toggle":case"beforetoggle":it=yx}var Pn=(c&4)!==0,er=!Pn&&(o==="scroll"||o==="scrollend"),Ve=Pn?et!==null?et+"Capture":null:et;Pn=[];for(var Oe=Je,Ke;Oe!==null;){var Tt=Oe;if(Ke=Tt.stateNode,Tt=Tt.tag,Tt!==5&&Tt!==26&&Tt!==27||Ke===null||Ve===null||(Tt=ef(Oe,Ve),Tt!=null&&Pn.push(kp(Oe,Tt,Ke))),er)break;Oe=Oe.return}0<Pn.length&&(et=new it(et,ln,null,g,ft),Et.push({event:et,listeners:Pn}))}}if((c&7)===0){e:{if(et=o==="mouseover"||o==="pointerover",it=o==="mouseout"||o==="pointerout",et&&g!==ep&&(ln=g.relatedTarget||g.fromElement)&&(oe(ln)||ln[qn]))break e;if((it||et)&&(et=ft.window===ft?ft:(et=ft.ownerDocument)?et.defaultView||et.parentWindow:window,it?(ln=g.relatedTarget||g.toElement,it=Je,ln=ln?oe(ln):null,ln!==null&&(er=s(ln),Pn=ln.tag,ln!==er||Pn!==5&&Pn!==27&&Pn!==6)&&(ln=null)):(it=null,ln=Je),it!==ln)){if(Pn=o1,Tt="onMouseLeave",Ve="onMouseEnter",Oe="mouse",(o==="pointerout"||o==="pointerover")&&(Pn=d1,Tt="onPointerLeave",Ve="onPointerEnter",Oe="pointer"),er=it==null?et:Qe(it),Ke=ln==null?et:Qe(ln),et=new Pn(Tt,Oe+"leave",it,g,ft),et.target=er,et.relatedTarget=Ke,Tt=null,oe(ft)===Je&&(Pn=new Pn(Ve,Oe+"enter",ln,g,ft),Pn.target=Ke,Pn.relatedTarget=er,Tt=Pn),er=Tt,it&&ln)t:{for(Pn=HI,Ve=it,Oe=ln,Ke=0,Tt=Ve;Tt;Tt=Pn(Tt))Ke++;Tt=0;for(var Sn=Oe;Sn;Sn=Pn(Sn))Tt++;for(;0<Ke-Tt;)Ve=Pn(Ve),Ke--;for(;0<Tt-Ke;)Oe=Pn(Oe),Tt--;for(;Ke--;){if(Ve===Oe||Oe!==null&&Ve===Oe.alternate){Pn=Ve;break t}Ve=Pn(Ve),Oe=Pn(Oe)}Pn=null}else Pn=null;it!==null&&eC(Et,et,it,Pn,!1),ln!==null&&er!==null&&eC(Et,er,ln,Pn,!0)}}e:{if(et=Je?Qe(Je):window,it=et.nodeName&&et.nodeName.toLowerCase(),it==="select"||it==="input"&&et.type==="file")var Di=_1;else if(NA(et))if(lp)Di=Tx;else{Di=cp;var hn=$s}else it=et.nodeName,!it||it.toLowerCase()!=="input"||et.type!=="checkbox"&&et.type!=="radio"?Je&&Bl(Je.elementType)&&(Di=_1):Di=ku;if(Di&&(Di=Di(o,Je))){v1(Et,Di,g,ft);break e}hn&&hn(o,et,Je),o==="focusout"&&Je&&et.type==="number"&&Je.memoizedProps.value!=null&&cn(et,"number",et.value)}switch(hn=Je?Qe(Je):window,o){case"focusin":(NA(hn)||hn.contentEditable==="true")&&(Gu=hn,fp=Je,qu=null);break;case"focusout":qu=fp=Gu=null;break;case"mousedown":Ap=!0;break;case"contextmenu":case"mouseup":case"dragend":Ap=!1,S1(Et,g,ft);break;case"selectionchange":if(wx)break;case"keydown":case"keyup":S1(Et,g,ft)}var oi;if(Bu)e:{switch(o){case"compositionstart":var Si="onCompositionStart";break e;case"compositionend":Si="onCompositionEnd";break e;case"compositionupdate":Si="onCompositionUpdate";break e}Si=void 0}else Qc?RA(o,g)&&(Si="onCompositionEnd"):o==="keydown"&&g.keyCode===229&&(Si="onCompositionStart");Si&&(ap&&g.locale!=="ko"&&(Qc||Si!=="onCompositionStart"?Si==="onCompositionEnd"&&Qc&&(oi=np()):(Lo=ft,nf="value"in Lo?Lo.value:Lo.textContent,Qc=!0)),hn=r2(Je,Si),0<hn.length&&(Si=new rl(Si,o,null,g,ft),Et.push({event:Si,listeners:hn}),oi?Si.data=oi:(oi=op(g),oi!==null&&(Si.data=oi)))),(oi=sp?g1(o,g):bx(o,g))&&(Si=r2(Je,"onBeforeInput"),0<Si.length&&(hn=new rl("onBeforeInput","beforeinput",null,g,ft),Et.push({event:hn,listeners:Si}),hn.data=oi)),zI(Et,o,Je,g,ft)}Z8(Et,c)})}function kp(o,c,g){return{instance:o,listener:c,currentTarget:g}}function r2(o,c){for(var g=c+"Capture",b=[];o!==null;){var D=o,P=D.stateNode;if(D=D.tag,D!==5&&D!==26&&D!==27||P===null||(D=ef(o,g),D!=null&&b.unshift(kp(o,D,P)),D=ef(o,c),D!=null&&b.push(kp(o,D,P))),o.tag===3)return b;o=o.return}return[]}function HI(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function eC(o,c,g,b,D){for(var P=c._reactName,$=[];g!==null&&g!==b;){var se=g,De=se.alternate,Je=se.stateNode;if(se=se.tag,De!==null&&De===b)break;se!==5&&se!==26&&se!==27||Je===null||(De=Je,D?(Je=ef(g,P),Je!=null&&$.unshift(kp(g,Je,De))):D||(Je=ef(g,P),Je!=null&&$.push(kp(g,Je,De)))),g=g.return}$.length!==0&&o.push({event:c,listeners:$})}var jI=/\r\n?/g,WI=/\u0000|\uFFFD/g;function tC(o){return(typeof o=="string"?o:""+o).replace(jI,`
`).replace(WI,"")}function nC(o,c){return c=tC(c),tC(o)===c}function Ji(o,c,g,b,D,P){switch(g){case"children":typeof b=="string"?c==="body"||c==="textarea"&&b===""||pi(o,b):(typeof b=="number"||typeof b=="bigint")&&c!=="body"&&pi(o,""+b);break;case"className":yi(o,"class",b);break;case"tabIndex":yi(o,"tabindex",b);break;case"dir":case"role":case"viewBox":case"width":case"height":yi(o,g,b);break;case"style":Zh(o,b,P);break;case"data":if(c!=="object"){yi(o,"data",b);break}case"src":case"href":if(b===""&&(c!=="a"||g!=="href")){o.removeAttribute(g);break}if(b==null||typeof b=="function"||typeof b=="symbol"||typeof b=="boolean"){o.removeAttribute(g);break}b=Wc(""+b),o.setAttribute(g,b);break;case"action":case"formAction":if(typeof b=="function"){o.setAttribute(g,"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 P=="function"&&(g==="formAction"?(c!=="input"&&Ji(o,c,"name",D.name,D,null),Ji(o,c,"formEncType",D.formEncType,D,null),Ji(o,c,"formMethod",D.formMethod,D,null),Ji(o,c,"formTarget",D.formTarget,D,null)):(Ji(o,c,"encType",D.encType,D,null),Ji(o,c,"method",D.method,D,null),Ji(o,c,"target",D.target,D,null)));if(b==null||typeof b=="symbol"||typeof b=="boolean"){o.removeAttribute(g);break}b=Wc(""+b),o.setAttribute(g,b);break;case"onClick":b!=null&&(o.onclick=Po);break;case"onScroll":b!=null&&vi("scroll",o);break;case"onScrollEnd":b!=null&&vi("scrollend",o);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(g=b.__html,g!=null){if(D.children!=null)throw Error(n(60));o.innerHTML=g}}break;case"multiple":o.multiple=b&&typeof b!="function"&&typeof b!="symbol";break;case"muted":o.muted=b&&typeof b!="function"&&typeof b!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(b==null||typeof b=="function"||typeof b=="boolean"||typeof b=="symbol"){o.removeAttribute("xlink:href");break}g=Wc(""+b),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",g);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":b!=null&&typeof b!="function"&&typeof b!="symbol"?o.setAttribute(g,""+b):o.removeAttribute(g);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":b&&typeof b!="function"&&typeof b!="symbol"?o.setAttribute(g,""):o.removeAttribute(g);break;case"capture":case"download":b===!0?o.setAttribute(g,""):b!==!1&&b!=null&&typeof b!="function"&&typeof b!="symbol"?o.setAttribute(g,b):o.removeAttribute(g);break;case"cols":case"rows":case"size":case"span":b!=null&&typeof b!="function"&&typeof b!="symbol"&&!isNaN(b)&&1<=b?o.setAttribute(g,b):o.removeAttribute(g);break;case"rowSpan":case"start":b==null||typeof b=="function"||typeof b=="symbol"||isNaN(b)?o.removeAttribute(g):o.setAttribute(g,b);break;case"popover":vi("beforetoggle",o),vi("toggle",o),ci(o,"popover",b);break;case"xlinkActuate":K(o,"http://www.w3.org/1999/xlink","xlink:actuate",b);break;case"xlinkArcrole":K(o,"http://www.w3.org/1999/xlink","xlink:arcrole",b);break;case"xlinkRole":K(o,"http://www.w3.org/1999/xlink","xlink:role",b);break;case"xlinkShow":K(o,"http://www.w3.org/1999/xlink","xlink:show",b);break;case"xlinkTitle":K(o,"http://www.w3.org/1999/xlink","xlink:title",b);break;case"xlinkType":K(o,"http://www.w3.org/1999/xlink","xlink:type",b);break;case"xmlBase":K(o,"http://www.w3.org/XML/1998/namespace","xml:base",b);break;case"xmlLang":K(o,"http://www.w3.org/XML/1998/namespace","xml:lang",b);break;case"xmlSpace":K(o,"http://www.w3.org/XML/1998/namespace","xml:space",b);break;case"is":ci(o,"is",b);break;case"innerText":case"textContent":break;default:(!(2<g.length)||g[0]!=="o"&&g[0]!=="O"||g[1]!=="n"&&g[1]!=="N")&&(g=nl.get(g)||g,ci(o,g,b))}}function Rb(o,c,g,b,D,P){switch(g){case"style":Zh(o,b,P);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(g=b.__html,g!=null){if(D.children!=null)throw Error(n(60));o.innerHTML=g}}break;case"children":typeof b=="string"?pi(o,b):(typeof b=="number"||typeof b=="bigint")&&pi(o,""+b);break;case"onScroll":b!=null&&vi("scroll",o);break;case"onScrollEnd":b!=null&&vi("scrollend",o);break;case"onClick":b!=null&&(o.onclick=Po);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xt.hasOwnProperty(g))e:{if(g[0]==="o"&&g[1]==="n"&&(D=g.endsWith("Capture"),c=g.slice(2,D?g.length-7:void 0),P=o[un]||null,P=P!=null?P[g]:null,typeof P=="function"&&o.removeEventListener(c,P,D),typeof b=="function")){typeof P!="function"&&P!==null&&(g in o?o[g]=null:o.hasAttribute(g)&&o.removeAttribute(g)),o.addEventListener(c,b,D);break e}g in o?o[g]=b:b===!0?o.setAttribute(g,""):ci(o,g,b)}}}function Us(o,c,g){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vi("error",o),vi("load",o);var b=!1,D=!1,P;for(P in g)if(g.hasOwnProperty(P)){var $=g[P];if($!=null)switch(P){case"src":b=!0;break;case"srcSet":D=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,c));default:Ji(o,c,P,$,g,null)}}D&&Ji(o,c,"srcSet",g.srcSet,g,null),b&&Ji(o,c,"src",g.src,g,null);return;case"input":vi("invalid",o);var se=P=$=D=null,De=null,Je=null;for(b in g)if(g.hasOwnProperty(b)){var ft=g[b];if(ft!=null)switch(b){case"name":D=ft;break;case"type":$=ft;break;case"checked":De=ft;break;case"defaultChecked":Je=ft;break;case"value":P=ft;break;case"defaultValue":se=ft;break;case"children":case"dangerouslySetInnerHTML":if(ft!=null)throw Error(n(137,c));break;default:Ji(o,c,b,ft,g,null)}}Jt(o,P,se,De,Je,$,D,!1);return;case"select":vi("invalid",o),b=$=P=null;for(D in g)if(g.hasOwnProperty(D)&&(se=g[D],se!=null))switch(D){case"value":P=se;break;case"defaultValue":$=se;break;case"multiple":b=se;default:Ji(o,c,D,se,g,null)}c=P,g=$,o.multiple=!!b,c!=null?Yn(o,!!b,c,!1):g!=null&&Yn(o,!!b,g,!0);return;case"textarea":vi("invalid",o),P=D=b=null;for($ in g)if(g.hasOwnProperty($)&&(se=g[$],se!=null))switch($){case"value":b=se;break;case"defaultValue":D=se;break;case"children":P=se;break;case"dangerouslySetInnerHTML":if(se!=null)throw Error(n(91));break;default:Ji(o,c,$,se,g,null)}js(o,b,D,P);return;case"option":for(De in g)if(g.hasOwnProperty(De)&&(b=g[De],b!=null))switch(De){case"selected":o.selected=b&&typeof b!="function"&&typeof b!="symbol";break;default:Ji(o,c,De,b,g,null)}return;case"dialog":vi("beforetoggle",o),vi("toggle",o),vi("cancel",o),vi("close",o);break;case"iframe":case"object":vi("load",o);break;case"video":case"audio":for(b=0;b<Fp.length;b++)vi(Fp[b],o);break;case"image":vi("error",o),vi("load",o);break;case"details":vi("toggle",o);break;case"embed":case"source":case"link":vi("error",o),vi("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(Je in g)if(g.hasOwnProperty(Je)&&(b=g[Je],b!=null))switch(Je){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,c));default:Ji(o,c,Je,b,g,null)}return;default:if(Bl(c)){for(ft in g)g.hasOwnProperty(ft)&&(b=g[ft],b!==void 0&&Rb(o,c,ft,b,g,void 0));return}}for(se in g)g.hasOwnProperty(se)&&(b=g[se],b!=null&&Ji(o,c,se,b,g,null))}function $I(o,c,g,b){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var D=null,P=null,$=null,se=null,De=null,Je=null,ft=null;for(it in g){var Et=g[it];if(g.hasOwnProperty(it)&&Et!=null)switch(it){case"checked":break;case"value":break;case"defaultValue":De=Et;default:b.hasOwnProperty(it)||Ji(o,c,it,null,b,Et)}}for(var et in b){var it=b[et];if(Et=g[et],b.hasOwnProperty(et)&&(it!=null||Et!=null))switch(et){case"type":P=it;break;case"name":D=it;break;case"checked":Je=it;break;case"defaultChecked":ft=it;break;case"value":$=it;break;case"defaultValue":se=it;break;case"children":case"dangerouslySetInnerHTML":if(it!=null)throw Error(n(137,c));break;default:it!==Et&&Ji(o,c,et,it,b,Et)}}Nt(o,$,se,De,Je,ft,P,D);return;case"select":it=$=se=et=null;for(P in g)if(De=g[P],g.hasOwnProperty(P)&&De!=null)switch(P){case"value":break;case"multiple":it=De;default:b.hasOwnProperty(P)||Ji(o,c,P,null,b,De)}for(D in b)if(P=b[D],De=g[D],b.hasOwnProperty(D)&&(P!=null||De!=null))switch(D){case"value":et=P;break;case"defaultValue":se=P;break;case"multiple":$=P;default:P!==De&&Ji(o,c,D,P,b,De)}c=se,g=$,b=it,et!=null?Yn(o,!!g,et,!1):!!b!=!!g&&(c!=null?Yn(o,!!g,c,!0):Yn(o,!!g,g?[]:"",!1));return;case"textarea":it=et=null;for(se in g)if(D=g[se],g.hasOwnProperty(se)&&D!=null&&!b.hasOwnProperty(se))switch(se){case"value":break;case"children":break;default:Ji(o,c,se,null,b,D)}for($ in b)if(D=b[$],P=g[$],b.hasOwnProperty($)&&(D!=null||P!=null))switch($){case"value":et=D;break;case"defaultValue":it=D;break;case"children":break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(n(91));break;default:D!==P&&Ji(o,c,$,D,b,P)}xi(o,et,it);return;case"option":for(var ln in g)if(et=g[ln],g.hasOwnProperty(ln)&&et!=null&&!b.hasOwnProperty(ln))switch(ln){case"selected":o.selected=!1;break;default:Ji(o,c,ln,null,b,et)}for(De in b)if(et=b[De],it=g[De],b.hasOwnProperty(De)&&et!==it&&(et!=null||it!=null))switch(De){case"selected":o.selected=et&&typeof et!="function"&&typeof et!="symbol";break;default:Ji(o,c,De,et,b,it)}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 Pn in g)et=g[Pn],g.hasOwnProperty(Pn)&&et!=null&&!b.hasOwnProperty(Pn)&&Ji(o,c,Pn,null,b,et);for(Je in b)if(et=b[Je],it=g[Je],b.hasOwnProperty(Je)&&et!==it&&(et!=null||it!=null))switch(Je){case"children":case"dangerouslySetInnerHTML":if(et!=null)throw Error(n(137,c));break;default:Ji(o,c,Je,et,b,it)}return;default:if(Bl(c)){for(var er in g)et=g[er],g.hasOwnProperty(er)&&et!==void 0&&!b.hasOwnProperty(er)&&Rb(o,c,er,void 0,b,et);for(ft in b)et=b[ft],it=g[ft],!b.hasOwnProperty(ft)||et===it||et===void 0&&it===void 0||Rb(o,c,ft,et,b,it);return}}for(var Ve in g)et=g[Ve],g.hasOwnProperty(Ve)&&et!=null&&!b.hasOwnProperty(Ve)&&Ji(o,c,Ve,null,b,et);for(Et in b)et=b[Et],it=g[Et],!b.hasOwnProperty(Et)||et===it||et==null&&it==null||Ji(o,c,Et,et,b,it)}function iC(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function XI(){if(typeof performance.getEntriesByType=="function"){for(var o=0,c=0,g=performance.getEntriesByType("resource"),b=0;b<g.length;b++){var D=g[b],P=D.transferSize,$=D.initiatorType,se=D.duration;if(P&&se&&iC($)){for($=0,se=D.responseEnd,b+=1;b<g.length;b++){var De=g[b],Je=De.startTime;if(Je>se)break;var ft=De.transferSize,Et=De.initiatorType;ft&&iC(Et)&&(De=De.responseEnd,$+=ft*(De<se?1:(se-Je)/(De-Je)))}if(--b,c+=8*(P+$)/(D.duration/1e3),o++,10<o)break}}if(0<o)return c/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var Nb=null,Db=null;function s2(o){return o.nodeType===9?o:o.ownerDocument}function rC(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 sC(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 Pb(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 Lb=null;function YI(){var o=window.event;return o&&o.type==="popstate"?o===Lb?!1:(Lb=o,!0):(Lb=null,!1)}var aC=typeof setTimeout=="function"?setTimeout:void 0,QI=typeof clearTimeout=="function"?clearTimeout:void 0,oC=typeof Promise=="function"?Promise:void 0,KI=typeof queueMicrotask=="function"?queueMicrotask:typeof oC<"u"?function(o){return oC.resolve(null).then(o).catch(ZI)}:aC;function ZI(o){setTimeout(function(){throw o})}function uh(o){return o==="head"}function lC(o,c){var g=c,b=0;do{var D=g.nextSibling;if(o.removeChild(g),D&&D.nodeType===8)if(g=D.data,g==="/$"||g==="/&"){if(b===0){o.removeChild(D),sd(c);return}b--}else if(g==="$"||g==="$?"||g==="$~"||g==="$!"||g==="&")b++;else if(g==="html")zp(o.ownerDocument.documentElement);else if(g==="head"){g=o.ownerDocument.head,zp(g);for(var P=g.firstChild;P;){var $=P.nextSibling,se=P.nodeName;P[Ma]||se==="SCRIPT"||se==="STYLE"||se==="LINK"&&P.rel.toLowerCase()==="stylesheet"||g.removeChild(P),P=$}}else g==="body"&&zp(o.ownerDocument.body);g=D}while(g);sd(c)}function uC(o,c){var g=o;o=0;do{var b=g.nextSibling;if(g.nodeType===1?c?(g._stashedDisplay=g.style.display,g.style.display="none"):(g.style.display=g._stashedDisplay||"",g.getAttribute("style")===""&&g.removeAttribute("style")):g.nodeType===3&&(c?(g._stashedText=g.nodeValue,g.nodeValue=""):g.nodeValue=g._stashedText||""),b&&b.nodeType===8)if(g=b.data,g==="/$"){if(o===0)break;o--}else g!=="$"&&g!=="$?"&&g!=="$~"&&g!=="$!"||o++;g=b}while(g)}function Ub(o){var c=o.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var g=c;switch(c=c.nextSibling,g.nodeName){case"HTML":case"HEAD":case"BODY":Ub(g),Ul(g);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(g.rel.toLowerCase()==="stylesheet")continue}o.removeChild(g)}}function JI(o,c,g,b){for(;o.nodeType===1;){var D=g;if(o.nodeName.toLowerCase()!==c.toLowerCase()){if(!b&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(b){if(!o[Ma])switch(c){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(P=o.getAttribute("rel"),P==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(P!==D.rel||o.getAttribute("href")!==(D.href==null||D.href===""?null:D.href)||o.getAttribute("crossorigin")!==(D.crossOrigin==null?null:D.crossOrigin)||o.getAttribute("title")!==(D.title==null?null:D.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(P=o.getAttribute("src"),(P!==(D.src==null?null:D.src)||o.getAttribute("type")!==(D.type==null?null:D.type)||o.getAttribute("crossorigin")!==(D.crossOrigin==null?null:D.crossOrigin))&&P&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(c==="input"&&o.type==="hidden"){var P=D.name==null?null:""+D.name;if(D.type==="hidden"&&o.getAttribute("name")===P)return o}else return o;if(o=zo(o.nextSibling),o===null)break}return null}function eF(o,c,g){if(c==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!g||(o=zo(o.nextSibling),o===null))return null;return o}function cC(o,c){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!c||(o=zo(o.nextSibling),o===null))return null;return o}function Bb(o){return o.data==="$?"||o.data==="$~"}function Ob(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function tF(o,c){var g=o.ownerDocument;if(o.data==="$~")o._reactRetry=c;else if(o.data!=="$?"||g.readyState!=="loading")c();else{var b=function(){c(),g.removeEventListener("DOMContentLoaded",b)};g.addEventListener("DOMContentLoaded",b),o._reactRetry=b}}function zo(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==="$~"||c==="&"||c==="F!"||c==="F")break;if(c==="/$"||c==="/&")return null}}return o}var Ib=null;function hC(o){o=o.nextSibling;for(var c=0;o;){if(o.nodeType===8){var g=o.data;if(g==="/$"||g==="/&"){if(c===0)return zo(o.nextSibling);c--}else g!=="$"&&g!=="$!"&&g!=="$?"&&g!=="$~"&&g!=="&"||c++}o=o.nextSibling}return null}function fC(o){o=o.previousSibling;for(var c=0;o;){if(o.nodeType===8){var g=o.data;if(g==="$"||g==="$!"||g==="$?"||g==="$~"||g==="&"){if(c===0)return o;c--}else g!=="/$"&&g!=="/&"||c++}o=o.previousSibling}return null}function AC(o,c,g){switch(c=s2(g),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 zp(o){for(var c=o.attributes;c.length;)o.removeAttributeNode(c[0]);Ul(o)}var Go=new Map,dC=new Set;function a2(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var hc=ae.d;ae.d={f:nF,r:iF,D:rF,C:sF,L:aF,m:oF,X:uF,S:lF,M:cF};function nF(){var o=hc.f(),c=K1();return o||c}function iF(o){var c=Fe(o);c!==null&&c.tag===5&&c.type==="form"?D4(c):hc.r(o)}var nd=typeof document>"u"?null:document;function pC(o,c,g){var b=nd;if(b&&typeof c=="string"&&c){var D=ot(c);D='link[rel="'+o+'"][href="'+D+'"]',typeof g=="string"&&(D+='[crossorigin="'+g+'"]'),dC.has(D)||(dC.add(D),o={rel:o,crossOrigin:g,href:c},b.querySelector(D)===null&&(c=b.createElement("link"),Us(c,"link",o),ke(c),b.head.appendChild(c)))}}function rF(o){hc.D(o),pC("dns-prefetch",o,null)}function sF(o,c){hc.C(o,c),pC("preconnect",o,c)}function aF(o,c,g){hc.L(o,c,g);var b=nd;if(b&&o&&c){var D='link[rel="preload"][as="'+ot(c)+'"]';c==="image"&&g&&g.imageSrcSet?(D+='[imagesrcset="'+ot(g.imageSrcSet)+'"]',typeof g.imageSizes=="string"&&(D+='[imagesizes="'+ot(g.imageSizes)+'"]')):D+='[href="'+ot(o)+'"]';var P=D;switch(c){case"style":P=id(o);break;case"script":P=rd(o)}Go.has(P)||(o=v({rel:"preload",href:c==="image"&&g&&g.imageSrcSet?void 0:o,as:c},g),Go.set(P,o),b.querySelector(D)!==null||c==="style"&&b.querySelector(Gp(P))||c==="script"&&b.querySelector(qp(P))||(c=b.createElement("link"),Us(c,"link",o),ke(c),b.head.appendChild(c)))}}function oF(o,c){hc.m(o,c);var g=nd;if(g&&o){var b=c&&typeof c.as=="string"?c.as:"script",D='link[rel="modulepreload"][as="'+ot(b)+'"][href="'+ot(o)+'"]',P=D;switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":P=rd(o)}if(!Go.has(P)&&(o=v({rel:"modulepreload",href:o},c),Go.set(P,o),g.querySelector(D)===null)){switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(g.querySelector(qp(P)))return}b=g.createElement("link"),Us(b,"link",o),ke(b),g.head.appendChild(b)}}}function lF(o,c,g){hc.S(o,c,g);var b=nd;if(b&&o){var D=Xe(b).hoistableStyles,P=id(o);c=c||"default";var $=D.get(P);if(!$){var se={loading:0,preload:null};if($=b.querySelector(Gp(P)))se.loading=5;else{o=v({rel:"stylesheet",href:o,"data-precedence":c},g),(g=Go.get(P))&&Fb(o,g);var De=$=b.createElement("link");ke(De),Us(De,"link",o),De._p=new Promise(function(Je,ft){De.onload=Je,De.onerror=ft}),De.addEventListener("load",function(){se.loading|=1}),De.addEventListener("error",function(){se.loading|=2}),se.loading|=4,o2($,c,b)}$={type:"stylesheet",instance:$,count:1,state:se},D.set(P,$)}}}function uF(o,c){hc.X(o,c);var g=nd;if(g&&o){var b=Xe(g).hoistableScripts,D=rd(o),P=b.get(D);P||(P=g.querySelector(qp(D)),P||(o=v({src:o,async:!0},c),(c=Go.get(D))&&kb(o,c),P=g.createElement("script"),ke(P),Us(P,"link",o),g.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},b.set(D,P))}}function cF(o,c){hc.M(o,c);var g=nd;if(g&&o){var b=Xe(g).hoistableScripts,D=rd(o),P=b.get(D);P||(P=g.querySelector(qp(D)),P||(o=v({src:o,async:!0,type:"module"},c),(c=Go.get(D))&&kb(o,c),P=g.createElement("script"),ke(P),Us(P,"link",o),g.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},b.set(D,P))}}function mC(o,c,g,b){var D=(D=Se.current)?a2(D):null;if(!D)throw Error(n(446));switch(o){case"meta":case"title":return null;case"style":return typeof g.precedence=="string"&&typeof g.href=="string"?(c=id(g.href),g=Xe(D).hoistableStyles,b=g.get(c),b||(b={type:"style",instance:null,count:0,state:null},g.set(c,b)),b):{type:"void",instance:null,count:0,state:null};case"link":if(g.rel==="stylesheet"&&typeof g.href=="string"&&typeof g.precedence=="string"){o=id(g.href);var P=Xe(D).hoistableStyles,$=P.get(o);if($||(D=D.ownerDocument||D,$={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},P.set(o,$),(P=D.querySelector(Gp(o)))&&!P._p&&($.instance=P,$.state.loading=5),Go.has(o)||(g={rel:"preload",as:"style",href:g.href,crossOrigin:g.crossOrigin,integrity:g.integrity,media:g.media,hrefLang:g.hrefLang,referrerPolicy:g.referrerPolicy},Go.set(o,g),P||hF(D,o,g,$.state))),c&&b===null)throw Error(n(528,""));return $}if(c&&b!==null)throw Error(n(529,""));return null;case"script":return c=g.async,g=g.src,typeof g=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=rd(g),g=Xe(D).hoistableScripts,b=g.get(c),b||(b={type:"script",instance:null,count:0,state:null},g.set(c,b)),b):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,o))}}function id(o){return'href="'+ot(o)+'"'}function Gp(o){return'link[rel="stylesheet"]['+o+"]"}function gC(o){return v({},o,{"data-precedence":o.precedence,precedence:null})}function hF(o,c,g,b){o.querySelector('link[rel="preload"][as="style"]['+c+"]")?b.loading=1:(c=o.createElement("link"),b.preload=c,c.addEventListener("load",function(){return b.loading|=1}),c.addEventListener("error",function(){return b.loading|=2}),Us(c,"link",g),ke(c),o.head.appendChild(c))}function rd(o){return'[src="'+ot(o)+'"]'}function qp(o){return"script[async]"+o}function vC(o,c,g){if(c.count++,c.instance===null)switch(c.type){case"style":var b=o.querySelector('style[data-href~="'+ot(g.href)+'"]');if(b)return c.instance=b,ke(b),b;var D=v({},g,{"data-href":g.href,"data-precedence":g.precedence,href:null,precedence:null});return b=(o.ownerDocument||o).createElement("style"),ke(b),Us(b,"style",D),o2(b,g.precedence,o),c.instance=b;case"stylesheet":D=id(g.href);var P=o.querySelector(Gp(D));if(P)return c.state.loading|=4,c.instance=P,ke(P),P;b=gC(g),(D=Go.get(D))&&Fb(b,D),P=(o.ownerDocument||o).createElement("link"),ke(P);var $=P;return $._p=new Promise(function(se,De){$.onload=se,$.onerror=De}),Us(P,"link",b),c.state.loading|=4,o2(P,g.precedence,o),c.instance=P;case"script":return P=rd(g.src),(D=o.querySelector(qp(P)))?(c.instance=D,ke(D),D):(b=g,(D=Go.get(P))&&(b=v({},g),kb(b,D)),o=o.ownerDocument||o,D=o.createElement("script"),ke(D),Us(D,"link",b),o.head.appendChild(D),c.instance=D);case"void":return null;default:throw Error(n(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(b=c.instance,c.state.loading|=4,o2(b,g.precedence,o));return c.instance}function o2(o,c,g){for(var b=g.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),D=b.length?b[b.length-1]:null,P=D,$=0;$<b.length;$++){var se=b[$];if(se.dataset.precedence===c)P=se;else if(P!==D)break}P?P.parentNode.insertBefore(o,P.nextSibling):(c=g.nodeType===9?g.head:g,c.insertBefore(o,c.firstChild))}function Fb(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.title==null&&(o.title=c.title)}function kb(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.integrity==null&&(o.integrity=c.integrity)}var l2=null;function _C(o,c,g){if(l2===null){var b=new Map,D=l2=new Map;D.set(g,b)}else D=l2,b=D.get(g),b||(b=new Map,D.set(g,b));if(b.has(o))return b;for(b.set(o,null),g=g.getElementsByTagName(o),D=0;D<g.length;D++){var P=g[D];if(!(P[Ma]||P[Xn]||o==="link"&&P.getAttribute("rel")==="stylesheet")&&P.namespaceURI!=="http://www.w3.org/2000/svg"){var $=P.getAttribute(c)||"";$=o+$;var se=b.get($);se?se.push(P):b.set($,[P])}}return b}function yC(o,c,g){o=o.ownerDocument||o,o.head.insertBefore(g,c==="title"?o.querySelector("head > title"):null)}function fF(o,c,g){if(g===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 xC(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function AF(o,c,g,b){if(g.type==="stylesheet"&&(typeof b.media!="string"||matchMedia(b.media).matches!==!1)&&(g.state.loading&4)===0){if(g.instance===null){var D=id(b.href),P=c.querySelector(Gp(D));if(P){c=P._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(o.count++,o=u2.bind(o),c.then(o,o)),g.state.loading|=4,g.instance=P,ke(P);return}P=c.ownerDocument||c,b=gC(b),(D=Go.get(D))&&Fb(b,D),P=P.createElement("link"),ke(P);var $=P;$._p=new Promise(function(se,De){$.onload=se,$.onerror=De}),Us(P,"link",b),g.instance=P}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(g,c),(c=g.state.preload)&&(g.state.loading&3)===0&&(o.count++,g=u2.bind(o),c.addEventListener("load",g),c.addEventListener("error",g))}}var zb=0;function dF(o,c){return o.stylesheets&&o.count===0&&h2(o,o.stylesheets),0<o.count||0<o.imgCount?function(g){var b=setTimeout(function(){if(o.stylesheets&&h2(o,o.stylesheets),o.unsuspend){var P=o.unsuspend;o.unsuspend=null,P()}},6e4+c);0<o.imgBytes&&zb===0&&(zb=62500*XI());var D=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&h2(o,o.stylesheets),o.unsuspend)){var P=o.unsuspend;o.unsuspend=null,P()}},(o.imgBytes>zb?50:800)+c);return o.unsuspend=g,function(){o.unsuspend=null,clearTimeout(b),clearTimeout(D)}}:null}function u2(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)h2(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var c2=null;function h2(o,c){o.stylesheets=null,o.unsuspend!==null&&(o.count++,c2=new Map,c.forEach(pF,o),c2=null,u2.call(o))}function pF(o,c){if(!(c.state.loading&4)){var g=c2.get(o);if(g)var b=g.get(null);else{g=new Map,c2.set(o,g);for(var D=o.querySelectorAll("link[data-precedence],style[data-precedence]"),P=0;P<D.length;P++){var $=D[P];($.nodeName==="LINK"||$.getAttribute("media")!=="not all")&&(g.set($.dataset.precedence,$),b=$)}b&&g.set(null,b)}D=c.instance,$=D.getAttribute("data-precedence"),P=g.get($)||b,P===b&&g.set(null,D),g.set($,D),this.count++,b=u2.bind(this),D.addEventListener("load",b),D.addEventListener("error",b),P?P.parentNode.insertBefore(D,P.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(D,o.firstChild)),c.state.loading|=4}}var Vp={$$typeof:L,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function mF(o,c,g,b,D,P,$,se,De){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=pn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pn(0),this.hiddenUpdates=pn(null),this.identifierPrefix=b,this.onUncaughtError=D,this.onCaughtError=P,this.onRecoverableError=$,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=De,this.incompleteTransitions=new Map}function bC(o,c,g,b,D,P,$,se,De,Je,ft,Et){return o=new mF(o,c,g,$,De,Je,ft,Et,se),c=1,P===!0&&(c|=24),P=Ys(3,null,null,c),o.current=P,P.stateNode=o,c=Ur(),c.refCount++,o.pooledCache=c,c.refCount++,P.memoizedState={element:b,isDehydrated:g,cache:c},ve(P),o}function SC(o){return o?(o=Wu,o):Wu}function TC(o,c,g,b,D,P){D=SC(D),b.context===null?b.context=D:b.pendingContext=D,b=Ie(c),b.payload={element:g},P=P===void 0?null:P,P!==null&&(b.callback=P),g=Ye(o,b,c),g!==null&&(Ia(g,o,c),qe(g,o,c))}function wC(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var g=o.retryLane;o.retryLane=g!==0&&g<c?g:c}}function Gb(o,c){wC(o,c),(o=o.alternate)&&wC(o,c)}function MC(o){if(o.tag===13||o.tag===31){var c=ju(o,67108864);c!==null&&Ia(c,o,67108864),Gb(o,67108864)}}function EC(o){if(o.tag===13||o.tag===31){var c=Ao();c=at(c);var g=ju(o,c);g!==null&&Ia(g,o,c),Gb(o,c)}}var f2=!0;function gF(o,c,g,b){var D=Q.T;Q.T=null;var P=ae.p;try{ae.p=2,qb(o,c,g,b)}finally{ae.p=P,Q.T=D}}function vF(o,c,g,b){var D=Q.T;Q.T=null;var P=ae.p;try{ae.p=8,qb(o,c,g,b)}finally{ae.p=P,Q.T=D}}function qb(o,c,g,b){if(f2){var D=Vb(b);if(D===null)Cb(o,c,b,A2,g),RC(o,b);else if(yF(D,o,c,g,b))b.stopPropagation();else if(RC(o,b),c&4&&-1<_F.indexOf(o)){for(;D!==null;){var P=Fe(D);if(P!==null)switch(P.tag){case 3:if(P=P.stateNode,P.current.memoizedState.isDehydrated){var $=qt(P.pendingLanes);if($!==0){var se=P;for(se.pendingLanes|=2,se.entangledLanes|=2;$;){var De=1<<31-Vt($);se.entanglements[1]|=De,$&=~De}Vl(P),(Oi&6)===0&&(Y1=Re()+500,Ip(0))}}break;case 31:case 13:se=ju(P,2),se!==null&&Ia(se,P,2),K1(),Gb(P,2)}if(P=Vb(b),P===null&&Cb(o,c,b,A2,g),P===D)break;D=P}D!==null&&b.stopPropagation()}else Cb(o,c,b,null,g)}}function Vb(o){return o=tp(o),Hb(o)}var A2=null;function Hb(o){if(A2=null,o=oe(o),o!==null){var c=s(o);if(c===null)o=null;else{var g=c.tag;if(g===13){if(o=a(c),o!==null)return o;o=null}else if(g===31){if(o=l(c),o!==null)return o;o=null}else if(g===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;o=null}else c!==o&&(o=null)}}return A2=o,null}function CC(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(pe()){case Me:return 2;case nt:return 8;case lt:case Ot:return 32;case jt:return 268435456;default:return 32}default:return 32}}var jb=!1,ch=null,hh=null,fh=null,Hp=new Map,jp=new Map,Ah=[],_F="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 RC(o,c){switch(o){case"focusin":case"focusout":ch=null;break;case"dragenter":case"dragleave":hh=null;break;case"mouseover":case"mouseout":fh=null;break;case"pointerover":case"pointerout":Hp.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":jp.delete(c.pointerId)}}function Wp(o,c,g,b,D,P){return o===null||o.nativeEvent!==P?(o={blockedOn:c,domEventName:g,eventSystemFlags:b,nativeEvent:P,targetContainers:[D]},c!==null&&(c=Fe(c),c!==null&&MC(c)),o):(o.eventSystemFlags|=b,c=o.targetContainers,D!==null&&c.indexOf(D)===-1&&c.push(D),o)}function yF(o,c,g,b,D){switch(c){case"focusin":return ch=Wp(ch,o,c,g,b,D),!0;case"dragenter":return hh=Wp(hh,o,c,g,b,D),!0;case"mouseover":return fh=Wp(fh,o,c,g,b,D),!0;case"pointerover":var P=D.pointerId;return Hp.set(P,Wp(Hp.get(P)||null,o,c,g,b,D)),!0;case"gotpointercapture":return P=D.pointerId,jp.set(P,Wp(jp.get(P)||null,o,c,g,b,D)),!0}return!1}function NC(o){var c=oe(o.target);if(c!==null){var g=s(c);if(g!==null){if(c=g.tag,c===13){if(c=a(g),c!==null){o.blockedOn=c,$n(o.priority,function(){EC(g)});return}}else if(c===31){if(c=l(g),c!==null){o.blockedOn=c,$n(o.priority,function(){EC(g)});return}}else if(c===3&&g.stateNode.current.memoizedState.isDehydrated){o.blockedOn=g.tag===3?g.stateNode.containerInfo:null;return}}}o.blockedOn=null}function d2(o){if(o.blockedOn!==null)return!1;for(var c=o.targetContainers;0<c.length;){var g=Vb(o.nativeEvent);if(g===null){g=o.nativeEvent;var b=new g.constructor(g.type,g);ep=b,g.target.dispatchEvent(b),ep=null}else return c=Fe(g),c!==null&&MC(c),o.blockedOn=g,!1;c.shift()}return!0}function DC(o,c,g){d2(o)&&g.delete(c)}function xF(){jb=!1,ch!==null&&d2(ch)&&(ch=null),hh!==null&&d2(hh)&&(hh=null),fh!==null&&d2(fh)&&(fh=null),Hp.forEach(DC),jp.forEach(DC)}function p2(o,c){o.blockedOn===c&&(o.blockedOn=null,jb||(jb=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,xF)))}var m2=null;function PC(o){m2!==o&&(m2=o,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){m2===o&&(m2=null);for(var c=0;c<o.length;c+=3){var g=o[c],b=o[c+1],D=o[c+2];if(typeof b!="function"){if(Hb(b||g)===null)continue;break}var P=Fe(g);P!==null&&(o.splice(c,3),c-=3,Vx(P,{pending:!0,data:D,method:g.method,action:b},b,D))}}))}function sd(o){function c(De){return p2(De,o)}ch!==null&&p2(ch,o),hh!==null&&p2(hh,o),fh!==null&&p2(fh,o),Hp.forEach(c),jp.forEach(c);for(var g=0;g<Ah.length;g++){var b=Ah[g];b.blockedOn===o&&(b.blockedOn=null)}for(;0<Ah.length&&(g=Ah[0],g.blockedOn===null);)NC(g),g.blockedOn===null&&Ah.shift();if(g=(o.ownerDocument||o).$$reactFormReplay,g!=null)for(b=0;b<g.length;b+=3){var D=g[b],P=g[b+1],$=D[un]||null;if(typeof P=="function")$||PC(g);else if($){var se=null;if(P&&P.hasAttribute("formAction")){if(D=P,$=P[un]||null)se=$.formAction;else if(Hb(D)!==null)continue}else se=$.action;typeof se=="function"?g[b+1]=se:(g.splice(b,3),b-=3),PC(g)}}}function LC(){function o(P){P.canIntercept&&P.info==="react-transition"&&P.intercept({handler:function(){return new Promise(function($){return D=$})},focusReset:"manual",scroll:"manual"})}function c(){D!==null&&(D(),D=null),b||setTimeout(g,20)}function g(){if(!b&&!navigation.transition){var P=navigation.currentEntry;P&&P.url!=null&&navigation.navigate(P.url,{state:P.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var b=!1,D=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",c),navigation.addEventListener("navigateerror",c),setTimeout(g,100),function(){b=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",c),navigation.removeEventListener("navigateerror",c),D!==null&&(D(),D=null)}}}function Wb(o){this._internalRoot=o}g2.prototype.render=Wb.prototype.render=function(o){var c=this._internalRoot;if(c===null)throw Error(n(409));var g=c.current,b=Ao();TC(g,b,o,c,null,null)},g2.prototype.unmount=Wb.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var c=o.containerInfo;TC(o.current,2,null,o,null,null),K1(),c[qn]=null}};function g2(o){this._internalRoot=o}g2.prototype.unstable_scheduleHydration=function(o){if(o){var c=J();o={blockedOn:null,target:o,priority:c};for(var g=0;g<Ah.length&&c!==0&&c<Ah[g].priority;g++);Ah.splice(g,0,o),g===0&&NC(o)}};var UC=e.version;if(UC!=="19.2.4")throw Error(n(527,UC,"19.2.4"));ae.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=h(c),o=o!==null?m(o):null,o=o===null?null:o.stateNode,o};var bF={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var v2=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!v2.isDisabled&&v2.supportsFiber)try{rn=v2.inject(bF),$t=v2}catch{}}return Xp.createRoot=function(o,c){if(!r(o))throw Error(n(299));var g=!1,b="",D=G4,P=q4,$=V4;return c!=null&&(c.unstable_strictMode===!0&&(g=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(D=c.onUncaughtError),c.onCaughtError!==void 0&&(P=c.onCaughtError),c.onRecoverableError!==void 0&&($=c.onRecoverableError)),c=bC(o,1,!1,null,null,g,b,null,D,P,$,LC),o[qn]=c.current,Eb(o),new Wb(c)},Xp.hydrateRoot=function(o,c,g){if(!r(o))throw Error(n(299));var b=!1,D="",P=G4,$=q4,se=V4,De=null;return g!=null&&(g.unstable_strictMode===!0&&(b=!0),g.identifierPrefix!==void 0&&(D=g.identifierPrefix),g.onUncaughtError!==void 0&&(P=g.onUncaughtError),g.onCaughtError!==void 0&&($=g.onCaughtError),g.onRecoverableError!==void 0&&(se=g.onRecoverableError),g.formState!==void 0&&(De=g.formState)),c=bC(o,1,!0,c,g??null,b,D,De,P,$,se,LC),c.context=SC(null),g=c.current,b=Ao(),b=at(b),D=Ie(b),D.callback=null,Ye(g,D,b),g=b,c.current.lanes=g,$i(c,g),Vl(c),o[qn]=c.current,Eb(o),new g2(c)},Xp.version="19.2.4",Xp}var HC;function PF(){if(HC)return Xb.exports;HC=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),Xb.exports=DF(),Xb.exports}var LF=PF(),xe=_w();const UF=S7(xe);/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const V0="172",Xo={ROTATE:0,DOLLY:1,PAN:2},Gd={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},T7=0,VS=1,w7=2,BF=0,yw=1,OF=2,xo=3,Nl=0,hr=1,as=2,Qa=0,Ka=1,a0=2,o0=3,l0=4,xw=5,Eo=100,bw=101,Sw=102,M7=103,E7=104,Tw=200,ww=201,Mw=202,Ew=203,qm=204,Vm=205,Cw=206,Rw=207,Nw=208,Dw=209,Pw=210,IF=211,FF=212,kF=213,zF=214,Hm=0,jm=1,Wm=2,kh=3,$m=4,Xm=5,Ym=6,Qm=7,Lg=0,C7=1,R7=2,Za=0,N7=1,D7=2,P7=3,L7=4,GF=5,U7=6,B7=7,Lw=300,Qo=301,Ko=302,zh=303,Gh=304,sA=306,aA=1e3,eu=1001,oA=1002,mr=1003,s_=1004,tu=1005,gs=1006,Jd=1007,Va=1008,qF=1008,aa=1009,Qf=1010,Kf=1011,wl=1012,Ns=1013,Rr=1014,$r=1015,Gs=1016,Ay=1017,dy=1018,Au=1020,py=35902,Uw=1021,Ug=1022,ks=1023,Bw=1024,Ow=1025,au=1026,du=1027,Bg=1028,H0=1029,lA=1030,j0=1031,VF=1032,W0=1033,Zf=33776,Bh=33777,Oh=33778,Ih=33779,Km=35840,Zm=35841,Jm=35842,eg=35843,tg=36196,u0=37492,c0=37496,h0=37808,f0=37809,A0=37810,d0=37811,p0=37812,m0=37813,g0=37814,v0=37815,_0=37816,y0=37817,x0=37818,b0=37819,S0=37820,T0=37821,Jf=36492,HS=36494,jS=36495,Iw=36283,ng=36284,ig=36285,rg=36286,HF=0,jF=1,jC=2,WF=3200,$F=3201,Dc=0,O7=1,Co="",_n="srgb",Ro="srgb-linear",a_="linear",Vi="srgb",XF=0,Uf=7680,YF=7681,QF=7682,KF=7683,ZF=34055,JF=34056,ek=5386,tk=512,nk=513,ik=514,rk=515,sk=516,ak=517,ok=518,WS=519,Fw=512,my=513,kw=514,gy=515,zw=516,Gw=517,qw=518,Vw=519,o_=35044,qd=35048,WC="300 es",Ha=2e3,pu=2001;class zc{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Js=["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 $C=1234567;const Em=Math.PI/180,w0=180/Math.PI;function ou(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Js[i&255]+Js[i>>8&255]+Js[i>>16&255]+Js[i>>24&255]+"-"+Js[e&255]+Js[e>>8&255]+"-"+Js[e>>16&15|64]+Js[e>>24&255]+"-"+Js[t&63|128]+Js[t>>8&255]+"-"+Js[t>>16&255]+Js[t>>24&255]+Js[n&255]+Js[n>>8&255]+Js[n>>16&255]+Js[n>>24&255]).toLowerCase()}function ni(i,e,t){return Math.max(e,Math.min(t,i))}function Hw(i,e){return(i%e+e)%e}function lk(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function uk(i,e,t){return i!==e?(t-i)/(e-i):0}function Cm(i,e,t){return(1-t)*i+t*e}function ck(i,e,t,n){return Cm(i,e,1-Math.exp(-t*n))}function hk(i,e=1){return e-Math.abs(Hw(i,e*2)-e)}function fk(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Ak(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function dk(i,e){return i+Math.floor(Math.random()*(e-i+1))}function pk(i,e){return i+Math.random()*(e-i)}function mk(i){return i*(.5-Math.random())}function gk(i){i!==void 0&&($C=i);let e=$C+=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 vk(i){return i*Em}function _k(i){return i*w0}function yk(i){return(i&i-1)===0&&i!==0}function xk(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function bk(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Sk(i,e,t,n,r){const s=Math.cos,a=Math.sin,l=s(t/2),u=a(t/2),h=s((e+n)/2),m=a((e+n)/2),v=s((e-n)/2),x=a((e-n)/2),S=s((n-e)/2),w=a((n-e)/2);switch(r){case"XYX":i.set(l*m,u*v,u*x,l*h);break;case"YZY":i.set(u*x,l*m,u*v,l*h);break;case"ZXZ":i.set(u*v,u*x,l*m,l*h);break;case"XZX":i.set(l*m,u*w,u*S,l*h);break;case"YXY":i.set(u*S,l*m,u*w,l*h);break;case"ZYZ":i.set(u*w,u*S,l*m,l*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ta(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function si(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const M0={DEG2RAD:Em,RAD2DEG:w0,generateUUID:ou,clamp:ni,euclideanModulo:Hw,mapLinear:lk,inverseLerp:uk,lerp:Cm,damp:ck,pingpong:hk,smoothstep:fk,smootherstep:Ak,randInt:dk,randFloat:pk,randFloatSpread:mk,seededRandom:gk,degToRad:vk,radToDeg:_k,isPowerOfTwo:yk,ceilPowerOfTwo:xk,floorPowerOfTwo:bk,setQuaternionFromProperEuler:Sk,normalize:si,denormalize:Ta};class gt{constructor(e=0,t=0){gt.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ni(this.x,e.x,t.x),this.y=ni(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ni(this.x,e,t),this.y=ni(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ni(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}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ni(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Vn{constructor(e,t,n,r,s,a,l,u,h){Vn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,l,u,h)}set(e,t,n,r,s,a,l,u,h){const m=this.elements;return m[0]=e,m[1]=r,m[2]=l,m[3]=t,m[4]=s,m[5]=u,m[6]=n,m[7]=a,m[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,r=t.elements,s=this.elements,a=n[0],l=n[3],u=n[6],h=n[1],m=n[4],v=n[7],x=n[2],S=n[5],w=n[8],R=r[0],C=r[3],E=r[6],B=r[1],L=r[4],O=r[7],G=r[2],q=r[5],z=r[8];return s[0]=a*R+l*B+u*G,s[3]=a*C+l*L+u*q,s[6]=a*E+l*O+u*z,s[1]=h*R+m*B+v*G,s[4]=h*C+m*L+v*q,s[7]=h*E+m*O+v*z,s[2]=x*R+S*B+w*G,s[5]=x*C+S*L+w*q,s[8]=x*E+S*O+w*z,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],m=e[8];return t*a*m-t*l*h-n*s*m+n*l*u+r*s*h-r*a*u}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],m=e[8],v=m*a-l*h,x=l*u-m*s,S=h*s-a*u,w=t*v+n*x+r*S;if(w===0)return this.set(0,0,0,0,0,0,0,0,0);const R=1/w;return e[0]=v*R,e[1]=(r*h-m*n)*R,e[2]=(l*n-r*a)*R,e[3]=x*R,e[4]=(m*t-r*u)*R,e[5]=(r*s-l*t)*R,e[6]=S*R,e[7]=(n*u-h*t)*R,e[8]=(a*t-n*s)*R,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,l){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*a+h*l)+a+e,-r*h,r*u,-r*(-h*a+u*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(Jb.makeScale(e,t)),this}rotate(e){return this.premultiply(Jb.makeRotation(-e)),this}translate(e,t){return this.premultiply(Jb.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Jb=new Vn;function I7(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function sg(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function F7(){const i=sg("canvas");return i.style.display="block",i}const XC={};function kf(i){i in XC||(XC[i]=!0,console.warn(i))}function Tk(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function wk(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Mk(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const YC=new Vn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),QC=new Vn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ek(){const i={enabled:!0,workingColorSpace:Ro,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Vi&&(r.r=Mc(r.r),r.g=Mc(r.g),r.b=Mc(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Vi&&(r.r=e0(r.r),r.g=e0(r.g),r.b=e0(r.b))),r},fromWorkingColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},toWorkingColorSpace:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Co?a_:this.spaces[r].transfer},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Ro]:{primaries:e,whitePoint:n,transfer:a_,toXYZ:YC,fromXYZ:QC,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:_n},outputColorSpaceConfig:{drawingBufferColorSpace:_n}},[_n]:{primaries:e,whitePoint:n,transfer:Vi,toXYZ:YC,fromXYZ:QC,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:_n}}}),i}const ai=Ek();function Mc(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function e0(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let ad;class Ck{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ad===void 0&&(ad=sg("canvas")),ad.width=e.width,ad.height=e.height;const n=ad.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ad}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=sg("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=Mc(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Mc(t[n]/255)*255):t[n]=Mc(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 Rk=0;class k7{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Rk++}),this.uuid=ou(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,l=r.length;a<l;a++)r[a].isDataTexture?s.push(e3(r[a].image)):s.push(e3(r[a]))}else s=e3(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function e3(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Ck.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Nk=0;class vs extends zc{constructor(e=vs.DEFAULT_IMAGE,t=vs.DEFAULT_MAPPING,n=eu,r=eu,s=gs,a=Va,l=ks,u=aa,h=vs.DEFAULT_ANISOTROPY,m=Co){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Nk++}),this.uuid=ou(),this.name="",this.source=new k7(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=h,this.format=l,this.internalFormat=null,this.type=u,this.offset=new gt(0,0),this.repeat=new gt(1,1),this.center=new gt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Vn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=m,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Lw)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case aA:e.x=e.x-Math.floor(e.x);break;case eu:e.x=e.x<0?0:1;break;case oA: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 aA:e.y=e.y-Math.floor(e.y);break;case eu:e.y=e.y<0?0:1;break;case oA: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++}}vs.DEFAULT_IMAGE=null;vs.DEFAULT_MAPPING=Lw;vs.DEFAULT_ANISOTROPY=1;class Ln{constructor(e=0,t=0,n=0,r=1){Ln.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}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,r,s;const u=e.elements,h=u[0],m=u[4],v=u[8],x=u[1],S=u[5],w=u[9],R=u[2],C=u[6],E=u[10];if(Math.abs(m-x)<.01&&Math.abs(v-R)<.01&&Math.abs(w-C)<.01){if(Math.abs(m+x)<.1&&Math.abs(v+R)<.1&&Math.abs(w+C)<.1&&Math.abs(h+S+E-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const L=(h+1)/2,O=(S+1)/2,G=(E+1)/2,q=(m+x)/4,z=(v+R)/4,j=(w+C)/4;return L>O&&L>G?L<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(L),r=q/n,s=z/n):O>G?O<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(O),n=q/r,s=j/r):G<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(G),n=z/s,r=j/s),this.set(n,r,s,t),this}let B=Math.sqrt((C-w)*(C-w)+(v-R)*(v-R)+(x-m)*(x-m));return Math.abs(B)<.001&&(B=1),this.x=(C-w)/B,this.y=(v-R)/B,this.z=(x-m)/B,this.w=Math.acos((h+S+E-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=ni(this.x,e.x,t.x),this.y=ni(this.y,e.y,t.y),this.z=ni(this.z,e.z,t.z),this.w=ni(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ni(this.x,e,t),this.y=ni(this.y,e,t),this.z=ni(this.z,e,t),this.w=ni(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ni(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 Wh extends zc{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ln(0,0,e,t),this.scissorTest=!1,this.viewport=new Ln(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:gs,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new vs(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let l=0;l<a;l++)this.textures[l]=s.clone(),this.textures[l].isRenderTargetTexture=!0,this.textures[l].renderTarget=this;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}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 r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const t=Object.assign({},e.texture.image);return this.texture.source=new k7(t),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 qh extends Wh{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class jw extends vs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=mr,this.minFilter=mr,this.wrapR=eu,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Dk extends vs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=mr,this.minFilter=mr,this.wrapR=eu,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class mu{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,l){let u=n[r+0],h=n[r+1],m=n[r+2],v=n[r+3];const x=s[a+0],S=s[a+1],w=s[a+2],R=s[a+3];if(l===0){e[t+0]=u,e[t+1]=h,e[t+2]=m,e[t+3]=v;return}if(l===1){e[t+0]=x,e[t+1]=S,e[t+2]=w,e[t+3]=R;return}if(v!==R||u!==x||h!==S||m!==w){let C=1-l;const E=u*x+h*S+m*w+v*R,B=E>=0?1:-1,L=1-E*E;if(L>Number.EPSILON){const G=Math.sqrt(L),q=Math.atan2(G,E*B);C=Math.sin(C*q)/G,l=Math.sin(l*q)/G}const O=l*B;if(u=u*C+x*O,h=h*C+S*O,m=m*C+w*O,v=v*C+R*O,C===1-l){const G=1/Math.sqrt(u*u+h*h+m*m+v*v);u*=G,h*=G,m*=G,v*=G}}e[t]=u,e[t+1]=h,e[t+2]=m,e[t+3]=v}static multiplyQuaternionsFlat(e,t,n,r,s,a){const l=n[r],u=n[r+1],h=n[r+2],m=n[r+3],v=s[a],x=s[a+1],S=s[a+2],w=s[a+3];return e[t]=l*w+m*v+u*S-h*x,e[t+1]=u*w+m*x+h*v-l*S,e[t+2]=h*w+m*S+l*x-u*v,e[t+3]=m*w-l*v-u*x-h*S,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,l=Math.cos,u=Math.sin,h=l(n/2),m=l(r/2),v=l(s/2),x=u(n/2),S=u(r/2),w=u(s/2);switch(a){case"XYZ":this._x=x*m*v+h*S*w,this._y=h*S*v-x*m*w,this._z=h*m*w+x*S*v,this._w=h*m*v-x*S*w;break;case"YXZ":this._x=x*m*v+h*S*w,this._y=h*S*v-x*m*w,this._z=h*m*w-x*S*v,this._w=h*m*v+x*S*w;break;case"ZXY":this._x=x*m*v-h*S*w,this._y=h*S*v+x*m*w,this._z=h*m*w+x*S*v,this._w=h*m*v-x*S*w;break;case"ZYX":this._x=x*m*v-h*S*w,this._y=h*S*v+x*m*w,this._z=h*m*w-x*S*v,this._w=h*m*v+x*S*w;break;case"YZX":this._x=x*m*v+h*S*w,this._y=h*S*v+x*m*w,this._z=h*m*w-x*S*v,this._w=h*m*v-x*S*w;break;case"XZY":this._x=x*m*v-h*S*w,this._y=h*S*v-x*m*w,this._z=h*m*w+x*S*v,this._w=h*m*v+x*S*w;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],l=t[5],u=t[9],h=t[2],m=t[6],v=t[10],x=n+l+v;if(x>0){const S=.5/Math.sqrt(x+1);this._w=.25/S,this._x=(m-u)*S,this._y=(s-h)*S,this._z=(a-r)*S}else if(n>l&&n>v){const S=2*Math.sqrt(1+n-l-v);this._w=(m-u)/S,this._x=.25*S,this._y=(r+a)/S,this._z=(s+h)/S}else if(l>v){const S=2*Math.sqrt(1+l-n-v);this._w=(s-h)/S,this._x=(r+a)/S,this._y=.25*S,this._z=(u+m)/S}else{const S=2*Math.sqrt(1+v-n-l);this._w=(a-r)/S,this._x=(s+h)/S,this._y=(u+m)/S,this._z=.25*S}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ni(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,l=t._x,u=t._y,h=t._z,m=t._w;return this._x=n*m+a*l+r*h-s*u,this._y=r*m+a*u+s*l-n*h,this._z=s*m+a*h+n*u-r*l,this._w=a*m-n*l-r*u-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let l=a*e._w+n*e._x+r*e._y+s*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=r,this._z=s,this;const u=1-l*l;if(u<=Number.EPSILON){const S=1-t;return this._w=S*a+t*this._w,this._x=S*n+t*this._x,this._y=S*r+t*this._y,this._z=S*s+t*this._z,this.normalize(),this}const h=Math.sqrt(u),m=Math.atan2(h,l),v=Math.sin((1-t)*m)/h,x=Math.sin(t*m)/h;return this._w=a*v+this._w*x,this._x=n*v+this._x*x,this._y=r*v+this._y*x,this._z=s*v+this._z*x,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class he{constructor(e=0,t=0,n=0){he.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(KC.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(KC.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,l=e.z,u=e.w,h=2*(a*r-l*n),m=2*(l*t-s*r),v=2*(s*n-a*t);return this.x=t+u*h+a*v-l*m,this.y=n+u*m+l*h-s*v,this.z=r+u*v+s*m-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,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ni(this.x,e.x,t.x),this.y=ni(this.y,e.y,t.y),this.z=ni(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ni(this.x,e,t),this.y=ni(this.y,e,t),this.z=ni(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ni(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,r=e.y,s=e.z,a=t.x,l=t.y,u=t.z;return this.x=r*u-s*l,this.y=s*a-n*u,this.z=n*l-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return t3.copy(this).projectOnVector(e),this.sub(t3)}reflect(e){return this.sub(t3.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(ni(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const t3=new he,KC=new mu;class Gc{constructor(e=new he(1/0,1/0,1/0),t=new he(-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(ml.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(ml.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=ml.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,l=s.count;a<l;a++)e.isMesh===!0?e.getVertexPosition(a,ml):ml.fromBufferAttribute(s,a),ml.applyMatrix4(e.matrixWorld),this.expandByPoint(ml);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),_2.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),_2.copy(n.boundingBox)),_2.applyMatrix4(e.matrixWorld),this.union(_2)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,ml),ml.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(Yp),y2.subVectors(this.max,Yp),od.subVectors(e.a,Yp),ld.subVectors(e.b,Yp),ud.subVectors(e.c,Yp),ph.subVectors(ld,od),mh.subVectors(ud,ld),yf.subVectors(od,ud);let t=[0,-ph.z,ph.y,0,-mh.z,mh.y,0,-yf.z,yf.y,ph.z,0,-ph.x,mh.z,0,-mh.x,yf.z,0,-yf.x,-ph.y,ph.x,0,-mh.y,mh.x,0,-yf.y,yf.x,0];return!n3(t,od,ld,ud,y2)||(t=[1,0,0,0,1,0,0,0,1],!n3(t,od,ld,ud,y2))?!1:(x2.crossVectors(ph,mh),t=[x2.x,x2.y,x2.z],n3(t,od,ld,ud,y2))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ml).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ml).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:(fc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fc),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 fc=[new he,new he,new he,new he,new he,new he,new he,new he],ml=new he,_2=new Gc,od=new he,ld=new he,ud=new he,ph=new he,mh=new he,yf=new he,Yp=new he,y2=new he,x2=new he,xf=new he;function n3(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){xf.fromArray(i,s);const l=r.x*Math.abs(xf.x)+r.y*Math.abs(xf.y)+r.z*Math.abs(xf.z),u=e.dot(xf),h=t.dot(xf),m=n.dot(xf);if(Math.max(-Math.max(u,h,m),Math.min(u,h,m))>l)return!1}return!0}const Pk=new Gc,Qp=new he,i3=new he;class dA{constructor(e=new he,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):Pk.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Qp.subVectors(e,this.center);const t=Qp.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Qp,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(i3.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Qp.copy(e.center).add(i3)),this.expandByPoint(Qp.copy(e.center).sub(i3))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ac=new he,r3=new he,b2=new he,gh=new he,s3=new he,S2=new he,a3=new he;class Og{constructor(e=new he,t=new he(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,Ac)),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=Ac.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ac.copy(this.origin).addScaledVector(this.direction,t),Ac.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){r3.copy(e).add(t).multiplyScalar(.5),b2.copy(t).sub(e).normalize(),gh.copy(this.origin).sub(r3);const s=e.distanceTo(t)*.5,a=-this.direction.dot(b2),l=gh.dot(this.direction),u=-gh.dot(b2),h=gh.lengthSq(),m=Math.abs(1-a*a);let v,x,S,w;if(m>0)if(v=a*u-l,x=a*l-u,w=s*m,v>=0)if(x>=-w)if(x<=w){const R=1/m;v*=R,x*=R,S=v*(v+a*x+2*l)+x*(a*v+x+2*u)+h}else x=s,v=Math.max(0,-(a*x+l)),S=-v*v+x*(x+2*u)+h;else x=-s,v=Math.max(0,-(a*x+l)),S=-v*v+x*(x+2*u)+h;else x<=-w?(v=Math.max(0,-(-a*s+l)),x=v>0?-s:Math.min(Math.max(-s,-u),s),S=-v*v+x*(x+2*u)+h):x<=w?(v=0,x=Math.min(Math.max(-s,-u),s),S=x*(x+2*u)+h):(v=Math.max(0,-(a*s+l)),x=v>0?s:Math.min(Math.max(-s,-u),s),S=-v*v+x*(x+2*u)+h);else x=a>0?-s:s,v=Math.max(0,-(a*x+l)),S=-v*v+x*(x+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,v),r&&r.copy(r3).addScaledVector(b2,x),S}intersectSphere(e,t){Ac.subVectors(e.center,this.origin);const n=Ac.dot(this.direction),r=Ac.dot(Ac)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),l=n-a,u=n+a;return u<0?null:l<0?this.at(u,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,l,u;const h=1/this.direction.x,m=1/this.direction.y,v=1/this.direction.z,x=this.origin;return h>=0?(n=(e.min.x-x.x)*h,r=(e.max.x-x.x)*h):(n=(e.max.x-x.x)*h,r=(e.min.x-x.x)*h),m>=0?(s=(e.min.y-x.y)*m,a=(e.max.y-x.y)*m):(s=(e.max.y-x.y)*m,a=(e.min.y-x.y)*m),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),v>=0?(l=(e.min.z-x.z)*v,u=(e.max.z-x.z)*v):(l=(e.max.z-x.z)*v,u=(e.min.z-x.z)*v),n>u||l>r)||((l>n||n!==n)&&(n=l),(u<r||r!==r)&&(r=u),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Ac)!==null}intersectTriangle(e,t,n,r,s){s3.subVectors(t,e),S2.subVectors(n,e),a3.crossVectors(s3,S2);let a=this.direction.dot(a3),l;if(a>0){if(r)return null;l=1}else if(a<0)l=-1,a=-a;else return null;gh.subVectors(this.origin,e);const u=l*this.direction.dot(S2.crossVectors(gh,S2));if(u<0)return null;const h=l*this.direction.dot(s3.cross(gh));if(h<0||u+h>a)return null;const m=-l*gh.dot(a3);return m<0?null:this.at(m/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class kn{constructor(e,t,n,r,s,a,l,u,h,m,v,x,S,w,R,C){kn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,l,u,h,m,v,x,S,w,R,C)}set(e,t,n,r,s,a,l,u,h,m,v,x,S,w,R,C){const E=this.elements;return E[0]=e,E[4]=t,E[8]=n,E[12]=r,E[1]=s,E[5]=a,E[9]=l,E[13]=u,E[2]=h,E[6]=m,E[10]=v,E[14]=x,E[3]=S,E[7]=w,E[11]=R,E[15]=C,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 kn().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/cd.setFromMatrixColumn(e,0).length(),s=1/cd.setFromMatrixColumn(e,1).length(),a=1/cd.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),l=Math.sin(n),u=Math.cos(r),h=Math.sin(r),m=Math.cos(s),v=Math.sin(s);if(e.order==="XYZ"){const x=a*m,S=a*v,w=l*m,R=l*v;t[0]=u*m,t[4]=-u*v,t[8]=h,t[1]=S+w*h,t[5]=x-R*h,t[9]=-l*u,t[2]=R-x*h,t[6]=w+S*h,t[10]=a*u}else if(e.order==="YXZ"){const x=u*m,S=u*v,w=h*m,R=h*v;t[0]=x+R*l,t[4]=w*l-S,t[8]=a*h,t[1]=a*v,t[5]=a*m,t[9]=-l,t[2]=S*l-w,t[6]=R+x*l,t[10]=a*u}else if(e.order==="ZXY"){const x=u*m,S=u*v,w=h*m,R=h*v;t[0]=x-R*l,t[4]=-a*v,t[8]=w+S*l,t[1]=S+w*l,t[5]=a*m,t[9]=R-x*l,t[2]=-a*h,t[6]=l,t[10]=a*u}else if(e.order==="ZYX"){const x=a*m,S=a*v,w=l*m,R=l*v;t[0]=u*m,t[4]=w*h-S,t[8]=x*h+R,t[1]=u*v,t[5]=R*h+x,t[9]=S*h-w,t[2]=-h,t[6]=l*u,t[10]=a*u}else if(e.order==="YZX"){const x=a*u,S=a*h,w=l*u,R=l*h;t[0]=u*m,t[4]=R-x*v,t[8]=w*v+S,t[1]=v,t[5]=a*m,t[9]=-l*m,t[2]=-h*m,t[6]=S*v+w,t[10]=x-R*v}else if(e.order==="XZY"){const x=a*u,S=a*h,w=l*u,R=l*h;t[0]=u*m,t[4]=-v,t[8]=h*m,t[1]=x*v+R,t[5]=a*m,t[9]=S*v-w,t[2]=w*v-S,t[6]=l*m,t[10]=R*v+x}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(Lk,e,Uk)}lookAt(e,t,n){const r=this.elements;return po.subVectors(e,t),po.lengthSq()===0&&(po.z=1),po.normalize(),vh.crossVectors(n,po),vh.lengthSq()===0&&(Math.abs(n.z)===1?po.x+=1e-4:po.z+=1e-4,po.normalize(),vh.crossVectors(n,po)),vh.normalize(),T2.crossVectors(po,vh),r[0]=vh.x,r[4]=T2.x,r[8]=po.x,r[1]=vh.y,r[5]=T2.y,r[9]=po.y,r[2]=vh.z,r[6]=T2.z,r[10]=po.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],l=n[4],u=n[8],h=n[12],m=n[1],v=n[5],x=n[9],S=n[13],w=n[2],R=n[6],C=n[10],E=n[14],B=n[3],L=n[7],O=n[11],G=n[15],q=r[0],z=r[4],j=r[8],F=r[12],V=r[1],Y=r[5],ee=r[9],te=r[13],re=r[2],ne=r[6],Q=r[10],ae=r[14],de=r[3],Te=r[7],be=r[11],ue=r[15];return s[0]=a*q+l*V+u*re+h*de,s[4]=a*z+l*Y+u*ne+h*Te,s[8]=a*j+l*ee+u*Q+h*be,s[12]=a*F+l*te+u*ae+h*ue,s[1]=m*q+v*V+x*re+S*de,s[5]=m*z+v*Y+x*ne+S*Te,s[9]=m*j+v*ee+x*Q+S*be,s[13]=m*F+v*te+x*ae+S*ue,s[2]=w*q+R*V+C*re+E*de,s[6]=w*z+R*Y+C*ne+E*Te,s[10]=w*j+R*ee+C*Q+E*be,s[14]=w*F+R*te+C*ae+E*ue,s[3]=B*q+L*V+O*re+G*de,s[7]=B*z+L*Y+O*ne+G*Te,s[11]=B*j+L*ee+O*Q+G*be,s[15]=B*F+L*te+O*ae+G*ue,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],l=e[5],u=e[9],h=e[13],m=e[2],v=e[6],x=e[10],S=e[14],w=e[3],R=e[7],C=e[11],E=e[15];return w*(+s*u*v-r*h*v-s*l*x+n*h*x+r*l*S-n*u*S)+R*(+t*u*S-t*h*x+s*a*x-r*a*S+r*h*m-s*u*m)+C*(+t*h*v-t*l*S-s*a*v+n*a*S+s*l*m-n*h*m)+E*(-r*l*m-t*u*v+t*l*x+r*a*v-n*a*x+n*u*m)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],m=e[8],v=e[9],x=e[10],S=e[11],w=e[12],R=e[13],C=e[14],E=e[15],B=v*C*h-R*x*h+R*u*S-l*C*S-v*u*E+l*x*E,L=w*x*h-m*C*h-w*u*S+a*C*S+m*u*E-a*x*E,O=m*R*h-w*v*h+w*l*S-a*R*S-m*l*E+a*v*E,G=w*v*u-m*R*u-w*l*x+a*R*x+m*l*C-a*v*C,q=t*B+n*L+r*O+s*G;if(q===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/q;return e[0]=B*z,e[1]=(R*x*s-v*C*s-R*r*S+n*C*S+v*r*E-n*x*E)*z,e[2]=(l*C*s-R*u*s+R*r*h-n*C*h-l*r*E+n*u*E)*z,e[3]=(v*u*s-l*x*s-v*r*h+n*x*h+l*r*S-n*u*S)*z,e[4]=L*z,e[5]=(m*C*s-w*x*s+w*r*S-t*C*S-m*r*E+t*x*E)*z,e[6]=(w*u*s-a*C*s-w*r*h+t*C*h+a*r*E-t*u*E)*z,e[7]=(a*x*s-m*u*s+m*r*h-t*x*h-a*r*S+t*u*S)*z,e[8]=O*z,e[9]=(w*v*s-m*R*s-w*n*S+t*R*S+m*n*E-t*v*E)*z,e[10]=(a*R*s-w*l*s+w*n*h-t*R*h-a*n*E+t*l*E)*z,e[11]=(m*l*s-a*v*s-m*n*h+t*v*h+a*n*S-t*l*S)*z,e[12]=G*z,e[13]=(m*R*r-w*v*r+w*n*x-t*R*x-m*n*C+t*v*C)*z,e[14]=(w*l*r-a*R*r-w*n*u+t*R*u+a*n*C-t*l*C)*z,e[15]=(a*v*r-m*l*r+m*n*u-t*v*u-a*n*x+t*l*x)*z,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,l=e.y,u=e.z,h=s*a,m=s*l;return this.set(h*a+n,h*l-r*u,h*u+r*l,0,h*l+r*u,m*l+n,m*u-r*a,0,h*u-r*l,m*u+r*a,s*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,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,l=t._z,u=t._w,h=s+s,m=a+a,v=l+l,x=s*h,S=s*m,w=s*v,R=a*m,C=a*v,E=l*v,B=u*h,L=u*m,O=u*v,G=n.x,q=n.y,z=n.z;return r[0]=(1-(R+E))*G,r[1]=(S+O)*G,r[2]=(w-L)*G,r[3]=0,r[4]=(S-O)*q,r[5]=(1-(x+E))*q,r[6]=(C+B)*q,r[7]=0,r[8]=(w+L)*z,r[9]=(C-B)*z,r[10]=(1-(x+R))*z,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=cd.set(r[0],r[1],r[2]).length();const a=cd.set(r[4],r[5],r[6]).length(),l=cd.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],gl.copy(this);const h=1/s,m=1/a,v=1/l;return gl.elements[0]*=h,gl.elements[1]*=h,gl.elements[2]*=h,gl.elements[4]*=m,gl.elements[5]*=m,gl.elements[6]*=m,gl.elements[8]*=v,gl.elements[9]*=v,gl.elements[10]*=v,t.setFromRotationMatrix(gl),n.x=s,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,a,l=Ha){const u=this.elements,h=2*s/(t-e),m=2*s/(n-r),v=(t+e)/(t-e),x=(n+r)/(n-r);let S,w;if(l===Ha)S=-(a+s)/(a-s),w=-2*a*s/(a-s);else if(l===pu)S=-a/(a-s),w=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return u[0]=h,u[4]=0,u[8]=v,u[12]=0,u[1]=0,u[5]=m,u[9]=x,u[13]=0,u[2]=0,u[6]=0,u[10]=S,u[14]=w,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,r,s,a,l=Ha){const u=this.elements,h=1/(t-e),m=1/(n-r),v=1/(a-s),x=(t+e)*h,S=(n+r)*m;let w,R;if(l===Ha)w=(a+s)*v,R=-2*v;else if(l===pu)w=s*v,R=-1*v;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return u[0]=2*h,u[4]=0,u[8]=0,u[12]=-x,u[1]=0,u[5]=2*m,u[9]=0,u[13]=-S,u[2]=0,u[6]=0,u[10]=R,u[14]=-w,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const cd=new he,gl=new kn,Lk=new he(0,0,0),Uk=new he(1,1,1),vh=new he,T2=new he,po=new he,ZC=new kn,JC=new mu;class la{constructor(e=0,t=0,n=0,r=la.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],l=r[8],u=r[1],h=r[5],m=r[9],v=r[2],x=r[6],S=r[10];switch(t){case"XYZ":this._y=Math.asin(ni(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-m,S),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(x,h),this._z=0);break;case"YXZ":this._x=Math.asin(-ni(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(l,S),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-v,s),this._z=0);break;case"ZXY":this._x=Math.asin(ni(x,-1,1)),Math.abs(x)<.9999999?(this._y=Math.atan2(-v,S),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-ni(v,-1,1)),Math.abs(v)<.9999999?(this._x=Math.atan2(x,S),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(ni(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-m,h),this._y=Math.atan2(-v,s)):(this._x=0,this._y=Math.atan2(l,S));break;case"XZY":this._z=Math.asin(-ni(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(x,h),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-m,S),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 ZC.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ZC,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return JC.setFromEuler(this),this.setFromQuaternion(JC,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}}la.DEFAULT_ORDER="XYZ";class Ww{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 Bk=0;const e5=new he,hd=new mu,dc=new kn,w2=new he,Kp=new he,Ok=new he,Ik=new mu,t5=new he(1,0,0),n5=new he(0,1,0),i5=new he(0,0,1),r5={type:"added"},Fk={type:"removed"},fd={type:"childadded",child:null},o3={type:"childremoved",child:null};class vr extends zc{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Bk++}),this.uuid=ou(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=vr.DEFAULT_UP.clone();const e=new he,t=new la,n=new mu,r=new he(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new kn},normalMatrix:{value:new Vn}}),this.matrix=new kn,this.matrixWorld=new kn,this.matrixAutoUpdate=vr.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=vr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ww,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return hd.setFromAxisAngle(e,t),this.quaternion.multiply(hd),this}rotateOnWorldAxis(e,t){return hd.setFromAxisAngle(e,t),this.quaternion.premultiply(hd),this}rotateX(e){return this.rotateOnAxis(t5,e)}rotateY(e){return this.rotateOnAxis(n5,e)}rotateZ(e){return this.rotateOnAxis(i5,e)}translateOnAxis(e,t){return e5.copy(e).applyQuaternion(this.quaternion),this.position.add(e5.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(t5,e)}translateY(e){return this.translateOnAxis(n5,e)}translateZ(e){return this.translateOnAxis(i5,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(dc.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?w2.copy(e):w2.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Kp.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?dc.lookAt(Kp,w2,this.up):dc.lookAt(w2,Kp,this.up),this.quaternion.setFromRotationMatrix(dc),r&&(dc.extractRotation(r.matrixWorld),hd.setFromRotationMatrix(dc),this.quaternion.premultiply(hd.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(r5),fd.child=e,this.dispatchEvent(fd),fd.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(Fk),o3.child=e,this.dispatchEvent(o3),o3.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),dc.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),dc.multiply(e.parent.matrixWorld)),e.applyMatrix4(dc),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(r5),fd.child=e,this.dispatchEvent(fd),fd.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kp,e,Ok),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kp,Ik,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)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 r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(l,u){return l[u.uuid]===void 0&&(l[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const u=l.shapes;if(Array.isArray(u))for(let h=0,m=u.length;h<m;h++){const v=u[h];s(e.shapes,v)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let u=0,h=this.material.length;u<h;u++)l.push(s(e.materials,this.material[u]));r.material=l}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let l=0;l<this.children.length;l++)r.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let l=0;l<this.animations.length;l++){const u=this.animations[l];r.animations.push(s(e.animations,u))}}if(t){const l=a(e.geometries),u=a(e.materials),h=a(e.textures),m=a(e.images),v=a(e.shapes),x=a(e.skeletons),S=a(e.animations),w=a(e.nodes);l.length>0&&(n.geometries=l),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),m.length>0&&(n.images=m),v.length>0&&(n.shapes=v),x.length>0&&(n.skeletons=x),S.length>0&&(n.animations=S),w.length>0&&(n.nodes=w)}return n.object=r,n;function a(l){const u=[];for(const h in l){const m=l[h];delete m.metadata,u.push(m)}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 r=e.children[n];this.add(r.clone())}return this}}vr.DEFAULT_UP=new he(0,1,0);vr.DEFAULT_MATRIX_AUTO_UPDATE=!0;vr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const vl=new he,pc=new he,l3=new he,mc=new he,Ad=new he,dd=new he,s5=new he,u3=new he,c3=new he,h3=new he,f3=new Ln,A3=new Ln,d3=new Ln;class Sl{constructor(e=new he,t=new he,n=new he){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),vl.subVectors(e,t),r.cross(vl);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){vl.subVectors(r,t),pc.subVectors(n,t),l3.subVectors(e,t);const a=vl.dot(vl),l=vl.dot(pc),u=vl.dot(l3),h=pc.dot(pc),m=pc.dot(l3),v=a*h-l*l;if(v===0)return s.set(0,0,0),null;const x=1/v,S=(h*u-l*m)*x,w=(a*m-l*u)*x;return s.set(1-S-w,w,S)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,mc)===null?!1:mc.x>=0&&mc.y>=0&&mc.x+mc.y<=1}static getInterpolation(e,t,n,r,s,a,l,u){return this.getBarycoord(e,t,n,r,mc)===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(s,mc.x),u.addScaledVector(a,mc.y),u.addScaledVector(l,mc.z),u)}static getInterpolatedAttribute(e,t,n,r,s,a){return f3.setScalar(0),A3.setScalar(0),d3.setScalar(0),f3.fromBufferAttribute(e,t),A3.fromBufferAttribute(e,n),d3.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(f3,s.x),a.addScaledVector(A3,s.y),a.addScaledVector(d3,s.z),a}static isFrontFacing(e,t,n,r){return vl.subVectors(n,t),pc.subVectors(e,t),vl.cross(pc).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return vl.subVectors(this.c,this.b),pc.subVectors(this.a,this.b),vl.cross(pc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Sl.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Sl.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Sl.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Sl.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Sl.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,l;Ad.subVectors(r,n),dd.subVectors(s,n),u3.subVectors(e,n);const u=Ad.dot(u3),h=dd.dot(u3);if(u<=0&&h<=0)return t.copy(n);c3.subVectors(e,r);const m=Ad.dot(c3),v=dd.dot(c3);if(m>=0&&v<=m)return t.copy(r);const x=u*v-m*h;if(x<=0&&u>=0&&m<=0)return a=u/(u-m),t.copy(n).addScaledVector(Ad,a);h3.subVectors(e,s);const S=Ad.dot(h3),w=dd.dot(h3);if(w>=0&&S<=w)return t.copy(s);const R=S*h-u*w;if(R<=0&&h>=0&&w<=0)return l=h/(h-w),t.copy(n).addScaledVector(dd,l);const C=m*w-S*v;if(C<=0&&v-m>=0&&S-w>=0)return s5.subVectors(s,r),l=(v-m)/(v-m+(S-w)),t.copy(r).addScaledVector(s5,l);const E=1/(C+R+x);return a=R*E,l=x*E,t.copy(n).addScaledVector(Ad,a).addScaledVector(dd,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const z7={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},_h={h:0,s:0,l:0},M2={h:0,s:0,l:0};function p3(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let an=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=_n){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ai.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=ai.workingColorSpace){return this.r=e,this.g=t,this.b=n,ai.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=ai.workingColorSpace){if(e=Hw(e,1),t=ni(t,0,1),n=ni(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=p3(a,s,e+1/3),this.g=p3(a,s,e),this.b=p3(a,s,e-1/3)}return ai.toWorkingColorSpace(this,r),this}setStyle(e,t=_n){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],l=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=_n){const n=z7[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=Mc(e.r),this.g=Mc(e.g),this.b=Mc(e.b),this}copyLinearToSRGB(e){return this.r=e0(e.r),this.g=e0(e.g),this.b=e0(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_n){return ai.fromWorkingColorSpace(ea.copy(this),e),Math.round(ni(ea.r*255,0,255))*65536+Math.round(ni(ea.g*255,0,255))*256+Math.round(ni(ea.b*255,0,255))}getHexString(e=_n){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ai.workingColorSpace){ai.fromWorkingColorSpace(ea.copy(this),t);const n=ea.r,r=ea.g,s=ea.b,a=Math.max(n,r,s),l=Math.min(n,r,s);let u,h;const m=(l+a)/2;if(l===a)u=0,h=0;else{const v=a-l;switch(h=m<=.5?v/(a+l):v/(2-a-l),a){case n:u=(r-s)/v+(r<s?6:0);break;case r:u=(s-n)/v+2;break;case s:u=(n-r)/v+4;break}u/=6}return e.h=u,e.s=h,e.l=m,e}getRGB(e,t=ai.workingColorSpace){return ai.fromWorkingColorSpace(ea.copy(this),t),e.r=ea.r,e.g=ea.g,e.b=ea.b,e}getStyle(e=_n){ai.fromWorkingColorSpace(ea.copy(this),e);const t=ea.r,n=ea.g,r=ea.b;return e!==_n?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(_h),this.setHSL(_h.h+e,_h.s+t,_h.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(_h),e.getHSL(M2);const n=Cm(_h.h,M2.h,t),r=Cm(_h.s,M2.s,t),s=Cm(_h.l,M2.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const ea=new an;an.NAMES=z7;let kk=0;class ua extends zc{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:kk++}),this.uuid=ou(),this.name="",this.type="Material",this.blending=Ka,this.side=Nl,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=qm,this.blendDst=Vm,this.blendEquation=Eo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new an(0,0,0),this.blendAlpha=0,this.depthFunc=kh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=WS,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Uf,this.stencilZFail=Uf,this.stencilZPass=Uf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.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!==Ka&&(n.blending=this.blending),this.side!==Nl&&(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!==qm&&(n.blendSrc=this.blendSrc),this.blendDst!==Vm&&(n.blendDst=this.blendDst),this.blendEquation!==Eo&&(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!==kh&&(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!==WS&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Uf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Uf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Uf&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const l in s){const u=s[l];delete u.metadata,a.push(u)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class pA extends ua{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new an(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 la,this.combine=Lg,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 bc=zk();function zk(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,r[u]=24,r[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,r[u]=-h-1,r[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,r[u]=13,r[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,r[u]=24,r[u|256]=24):(n[u]=31744,n[u|256]=64512,r[u]=13,r[u|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),l=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,m=0;for(;(h&8388608)===0;)h<<=1,m-=8388608;h&=-8388609,m+=947912704,s[u]=h|m}for(let u=1024;u<2048;++u)s[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:r,mantissaTable:s,exponentTable:a,offsetTable:l}}function mo(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=ni(i,-65504,65504),bc.floatView[0]=i;const e=bc.uint32View[0],t=e>>23&511;return bc.baseTable[t]+((e&8388607)>>bc.shiftTable[t])}function E2(i){const e=i>>10;return bc.uint32View[0]=bc.mantissaTable[bc.offsetTable[e]+(i&1023)]+bc.exponentTable[e],bc.floatView[0]}const is=new he,C2=new gt;class wr{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=o_,this.updateRanges=[],this.gpuType=$r,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 r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)C2.fromBufferAttribute(this,t),C2.applyMatrix3(e),this.setXY(t,C2.x,C2.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)is.fromBufferAttribute(this,t),is.applyMatrix3(e),this.setXYZ(t,is.x,is.y,is.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)is.fromBufferAttribute(this,t),is.applyMatrix4(e),this.setXYZ(t,is.x,is.y,is.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)is.fromBufferAttribute(this,t),is.applyNormalMatrix(e),this.setXYZ(t,is.x,is.y,is.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)is.fromBufferAttribute(this,t),is.transformDirection(e),this.setXYZ(t,is.x,is.y,is.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=Ta(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=si(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ta(t,this.array)),t}setX(e,t){return this.normalized&&(t=si(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ta(t,this.array)),t}setY(e,t){return this.normalized&&(t=si(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=Ta(t,this.array)),t}setZ(e,t){return this.normalized&&(t=si(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=Ta(t,this.array)),t}setW(e,t){return this.normalized&&(t=si(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=si(t,this.array),n=si(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=si(t,this.array),n=si(n,this.array),r=si(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=si(t,this.array),n=si(n,this.array),r=si(r,this.array),s=si(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==o_&&(e.usage=this.usage),e}}class $w extends wr{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Xw extends wr{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class G7 extends wr{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=E2(this.array[e*this.itemSize]);return this.normalized&&(t=Ta(t,this.array)),t}setX(e,t){return this.normalized&&(t=si(t,this.array)),this.array[e*this.itemSize]=mo(t),this}getY(e){let t=E2(this.array[e*this.itemSize+1]);return this.normalized&&(t=Ta(t,this.array)),t}setY(e,t){return this.normalized&&(t=si(t,this.array)),this.array[e*this.itemSize+1]=mo(t),this}getZ(e){let t=E2(this.array[e*this.itemSize+2]);return this.normalized&&(t=Ta(t,this.array)),t}setZ(e,t){return this.normalized&&(t=si(t,this.array)),this.array[e*this.itemSize+2]=mo(t),this}getW(e){let t=E2(this.array[e*this.itemSize+3]);return this.normalized&&(t=Ta(t,this.array)),t}setW(e,t){return this.normalized&&(t=si(t,this.array)),this.array[e*this.itemSize+3]=mo(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=si(t,this.array),n=si(n,this.array)),this.array[e+0]=mo(t),this.array[e+1]=mo(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=si(t,this.array),n=si(n,this.array),r=si(r,this.array)),this.array[e+0]=mo(t),this.array[e+1]=mo(n),this.array[e+2]=mo(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=si(t,this.array),n=si(n,this.array),r=si(r,this.array),s=si(s,this.array)),this.array[e+0]=mo(t),this.array[e+1]=mo(n),this.array[e+2]=mo(r),this.array[e+3]=mo(s),this}}class Mi extends wr{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Gk=0;const qo=new kn,m3=new vr,pd=new he,go=new Gc,Zp=new Gc,Es=new he;class Ki extends zc{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Gk++}),this.uuid=ou(),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(I7(e)?Xw:$w)(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 s=new Vn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return qo.makeRotationFromQuaternion(e),this.applyMatrix4(qo),this}rotateX(e){return qo.makeRotationX(e),this.applyMatrix4(qo),this}rotateY(e){return qo.makeRotationY(e),this.applyMatrix4(qo),this}rotateZ(e){return qo.makeRotationZ(e),this.applyMatrix4(qo),this}translate(e,t,n){return qo.makeTranslation(e,t,n),this.applyMatrix4(qo),this}scale(e,t,n){return qo.makeScale(e,t,n),this.applyMatrix4(qo),this}lookAt(e){return m3.lookAt(e),m3.updateMatrix(),this.applyMatrix4(m3.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(pd).negate(),this.translate(pd.x,pd.y,pd.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Mi(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.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 Gc);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 he(-1/0,-1/0,-1/0),new he(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];go.setFromBufferAttribute(s),this.morphTargetsRelative?(Es.addVectors(this.boundingBox.min,go.min),this.boundingBox.expandByPoint(Es),Es.addVectors(this.boundingBox.max,go.max),this.boundingBox.expandByPoint(Es)):(this.boundingBox.expandByPoint(go.min),this.boundingBox.expandByPoint(go.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 dA);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 he,1/0);return}if(e){const n=this.boundingSphere.center;if(go.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const l=t[s];Zp.setFromBufferAttribute(l),this.morphTargetsRelative?(Es.addVectors(go.min,Zp.min),go.expandByPoint(Es),Es.addVectors(go.max,Zp.max),go.expandByPoint(Es)):(go.expandByPoint(Zp.min),go.expandByPoint(Zp.max))}go.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)Es.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Es));if(t)for(let s=0,a=t.length;s<a;s++){const l=t[s],u=this.morphTargetsRelative;for(let h=0,m=l.count;h<m;h++)Es.fromBufferAttribute(l,h),u&&(pd.fromBufferAttribute(e,h),Es.add(pd)),r=Math.max(r,n.distanceToSquared(Es))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new wr(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),l=[],u=[];for(let j=0;j<n.count;j++)l[j]=new he,u[j]=new he;const h=new he,m=new he,v=new he,x=new gt,S=new gt,w=new gt,R=new he,C=new he;function E(j,F,V){h.fromBufferAttribute(n,j),m.fromBufferAttribute(n,F),v.fromBufferAttribute(n,V),x.fromBufferAttribute(s,j),S.fromBufferAttribute(s,F),w.fromBufferAttribute(s,V),m.sub(h),v.sub(h),S.sub(x),w.sub(x);const Y=1/(S.x*w.y-w.x*S.y);isFinite(Y)&&(R.copy(m).multiplyScalar(w.y).addScaledVector(v,-S.y).multiplyScalar(Y),C.copy(v).multiplyScalar(S.x).addScaledVector(m,-w.x).multiplyScalar(Y),l[j].add(R),l[F].add(R),l[V].add(R),u[j].add(C),u[F].add(C),u[V].add(C))}let B=this.groups;B.length===0&&(B=[{start:0,count:e.count}]);for(let j=0,F=B.length;j<F;++j){const V=B[j],Y=V.start,ee=V.count;for(let te=Y,re=Y+ee;te<re;te+=3)E(e.getX(te+0),e.getX(te+1),e.getX(te+2))}const L=new he,O=new he,G=new he,q=new he;function z(j){G.fromBufferAttribute(r,j),q.copy(G);const F=l[j];L.copy(F),L.sub(G.multiplyScalar(G.dot(F))).normalize(),O.crossVectors(q,F);const Y=O.dot(u[j])<0?-1:1;a.setXYZW(j,L.x,L.y,L.z,Y)}for(let j=0,F=B.length;j<F;++j){const V=B[j],Y=V.start,ee=V.count;for(let te=Y,re=Y+ee;te<re;te+=3)z(e.getX(te+0)),z(e.getX(te+1)),z(e.getX(te+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 wr(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let x=0,S=n.count;x<S;x++)n.setXYZ(x,0,0,0);const r=new he,s=new he,a=new he,l=new he,u=new he,h=new he,m=new he,v=new he;if(e)for(let x=0,S=e.count;x<S;x+=3){const w=e.getX(x+0),R=e.getX(x+1),C=e.getX(x+2);r.fromBufferAttribute(t,w),s.fromBufferAttribute(t,R),a.fromBufferAttribute(t,C),m.subVectors(a,s),v.subVectors(r,s),m.cross(v),l.fromBufferAttribute(n,w),u.fromBufferAttribute(n,R),h.fromBufferAttribute(n,C),l.add(m),u.add(m),h.add(m),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(R,u.x,u.y,u.z),n.setXYZ(C,h.x,h.y,h.z)}else for(let x=0,S=t.count;x<S;x+=3)r.fromBufferAttribute(t,x+0),s.fromBufferAttribute(t,x+1),a.fromBufferAttribute(t,x+2),m.subVectors(a,s),v.subVectors(r,s),m.cross(v),n.setXYZ(x+0,m.x,m.y,m.z),n.setXYZ(x+1,m.x,m.y,m.z),n.setXYZ(x+2,m.x,m.y,m.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Es.fromBufferAttribute(e,t),Es.normalize(),e.setXYZ(t,Es.x,Es.y,Es.z)}toNonIndexed(){function e(l,u){const h=l.array,m=l.itemSize,v=l.normalized,x=new h.constructor(u.length*m);let S=0,w=0;for(let R=0,C=u.length;R<C;R++){l.isInterleavedBufferAttribute?S=u[R]*l.data.stride+l.offset:S=u[R]*m;for(let E=0;E<m;E++)x[w++]=h[S++]}return new wr(x,m,v)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ki,n=this.index.array,r=this.attributes;for(const l in r){const u=r[l],h=e(u,n);t.setAttribute(l,h)}const s=this.morphAttributes;for(const l in s){const u=[],h=s[l];for(let m=0,v=h.length;m<v;m++){const x=h[m],S=e(x,n);u.push(S)}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.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const 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 r={};let s=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],m=[];for(let v=0,x=h.length;v<x;v++){const S=h[v];m.push(S.toJSON(e.data))}m.length>0&&(r[u]=m,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const h in r){const m=r[h];this.setAttribute(h,m.clone(t))}const s=e.morphAttributes;for(const h in s){const m=[],v=s[h];for(let x=0,S=v.length;x<S;x++)m.push(v[x].clone(t));this.morphAttributes[h]=m}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let h=0,m=a.length;h<m;h++){const v=a[h];this.addGroup(v.start,v.count,v.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"})}}const a5=new kn,bf=new Og,R2=new dA,o5=new he,N2=new he,D2=new he,P2=new he,g3=new he,L2=new he,l5=new he,U2=new he;class zi extends vr{constructor(e=new Ki,t=new pA){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const l=this.morphTargetInfluences;if(s&&l){L2.set(0,0,0);for(let u=0,h=s.length;u<h;u++){const m=l[u],v=s[u];m!==0&&(g3.fromBufferAttribute(v,e),a?L2.addScaledVector(g3,m):L2.addScaledVector(g3.sub(t),m))}t.add(L2)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),R2.copy(n.boundingSphere),R2.applyMatrix4(s),bf.copy(e.ray).recast(e.near),!(R2.containsPoint(bf.origin)===!1&&(bf.intersectSphere(R2,o5)===null||bf.origin.distanceToSquared(o5)>(e.far-e.near)**2))&&(a5.copy(s).invert(),bf.copy(e.ray).applyMatrix4(a5),!(n.boundingBox!==null&&bf.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,bf)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,l=s.index,u=s.attributes.position,h=s.attributes.uv,m=s.attributes.uv1,v=s.attributes.normal,x=s.groups,S=s.drawRange;if(l!==null)if(Array.isArray(a))for(let w=0,R=x.length;w<R;w++){const C=x[w],E=a[C.materialIndex],B=Math.max(C.start,S.start),L=Math.min(l.count,Math.min(C.start+C.count,S.start+S.count));for(let O=B,G=L;O<G;O+=3){const q=l.getX(O),z=l.getX(O+1),j=l.getX(O+2);r=B2(this,E,e,n,h,m,v,q,z,j),r&&(r.faceIndex=Math.floor(O/3),r.face.materialIndex=C.materialIndex,t.push(r))}}else{const w=Math.max(0,S.start),R=Math.min(l.count,S.start+S.count);for(let C=w,E=R;C<E;C+=3){const B=l.getX(C),L=l.getX(C+1),O=l.getX(C+2);r=B2(this,a,e,n,h,m,v,B,L,O),r&&(r.faceIndex=Math.floor(C/3),t.push(r))}}else if(u!==void 0)if(Array.isArray(a))for(let w=0,R=x.length;w<R;w++){const C=x[w],E=a[C.materialIndex],B=Math.max(C.start,S.start),L=Math.min(u.count,Math.min(C.start+C.count,S.start+S.count));for(let O=B,G=L;O<G;O+=3){const q=O,z=O+1,j=O+2;r=B2(this,E,e,n,h,m,v,q,z,j),r&&(r.faceIndex=Math.floor(O/3),r.face.materialIndex=C.materialIndex,t.push(r))}}else{const w=Math.max(0,S.start),R=Math.min(u.count,S.start+S.count);for(let C=w,E=R;C<E;C+=3){const B=C,L=C+1,O=C+2;r=B2(this,a,e,n,h,m,v,B,L,O),r&&(r.faceIndex=Math.floor(C/3),t.push(r))}}}}function qk(i,e,t,n,r,s,a,l){let u;if(e.side===hr?u=n.intersectTriangle(a,s,r,!0,l):u=n.intersectTriangle(r,s,a,e.side===Nl,l),u===null)return null;U2.copy(l),U2.applyMatrix4(i.matrixWorld);const h=t.ray.origin.distanceTo(U2);return h<t.near||h>t.far?null:{distance:h,point:U2.clone(),object:i}}function B2(i,e,t,n,r,s,a,l,u,h){i.getVertexPosition(l,N2),i.getVertexPosition(u,D2),i.getVertexPosition(h,P2);const m=qk(i,e,t,n,N2,D2,P2,l5);if(m){const v=new he;Sl.getBarycoord(l5,N2,D2,P2,v),r&&(m.uv=Sl.getInterpolatedAttribute(r,l,u,h,v,new gt)),s&&(m.uv1=Sl.getInterpolatedAttribute(s,l,u,h,v,new gt)),a&&(m.normal=Sl.getInterpolatedAttribute(a,l,u,h,v,new he),m.normal.dot(n.direction)>0&&m.normal.multiplyScalar(-1));const x={a:l,b:u,c:h,normal:new he,materialIndex:0};Sl.getNormal(N2,D2,P2,x.normal),m.face=x,m.barycoord=v}return m}class $h extends Ki{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const l=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const u=[],h=[],m=[],v=[];let x=0,S=0;w("z","y","x",-1,-1,n,t,e,a,s,0),w("z","y","x",1,-1,n,t,-e,a,s,1),w("x","z","y",1,1,e,n,t,r,a,2),w("x","z","y",1,-1,e,n,-t,r,a,3),w("x","y","z",1,-1,e,t,n,r,s,4),w("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(u),this.setAttribute("position",new Mi(h,3)),this.setAttribute("normal",new Mi(m,3)),this.setAttribute("uv",new Mi(v,2));function w(R,C,E,B,L,O,G,q,z,j,F){const V=O/z,Y=G/j,ee=O/2,te=G/2,re=q/2,ne=z+1,Q=j+1;let ae=0,de=0;const Te=new he;for(let be=0;be<Q;be++){const ue=be*Y-te;for(let we=0;we<ne;we++){const We=we*V-ee;Te[R]=We*B,Te[C]=ue*L,Te[E]=re,h.push(Te.x,Te.y,Te.z),Te[R]=0,Te[C]=0,Te[E]=q>0?1:-1,m.push(Te.x,Te.y,Te.z),v.push(we/z),v.push(1-be/j),ae+=1}}for(let be=0;be<j;be++)for(let ue=0;ue<z;ue++){const we=x+ue+ne*be,We=x+ue+ne*(be+1),Ne=x+(ue+1)+ne*(be+1),ze=x+(ue+1)+ne*be;u.push(we,We,ze),u.push(We,Ne,ze),de+=6}l.addGroup(S,de,F),S+=de,x+=ae}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $h(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function E0(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function _a(i){const e={};for(let t=0;t<i.length;t++){const n=E0(i[t]);for(const r in n)e[r]=n[r]}return e}function Vk(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function q7(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ai.workingColorSpace}const vy={clone:E0,merge:_a};var Hk=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,jk=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class Ja extends ua{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Hk,this.fragmentShader=jk,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=E0(e.uniforms),this.uniformsGroups=Vk(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class _y extends vr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new kn,this.projectionMatrix=new kn,this.projectionMatrixInverse=new kn,this.coordinateSystem=Ha}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 yh=new he,u5=new gt,c5=new gt;class ya extends _y{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=w0*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Em*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return w0*2*Math.atan(Math.tan(Em*.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){yh.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(yh.x,yh.y).multiplyScalar(-e/yh.z),yh.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(yh.x,yh.y).multiplyScalar(-e/yh.z)}getViewSize(e,t){return this.getViewBounds(e,u5,c5),t.subVectors(c5,u5)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Em*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const u=a.fullWidth,h=a.fullHeight;s+=a.offsetX*r/u,t-=a.offsetY*n/h,r*=a.width/u,n*=a.height/h}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const md=-90,gd=1;class V7 extends vr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new ya(md,gd,e,t);r.layers=this.layers,this.add(r);const s=new ya(md,gd,e,t);s.layers=this.layers,this.add(s);const a=new ya(md,gd,e,t);a.layers=this.layers,this.add(a);const l=new ya(md,gd,e,t);l.layers=this.layers,this.add(l);const u=new ya(md,gd,e,t);u.layers=this.layers,this.add(u);const h=new ya(md,gd,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,l,u]=t;for(const h of t)this.remove(h);if(e===Ha)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),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===pu)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),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:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,l,u,h,m]=this.children,v=e.getRenderTarget(),x=e.getActiveCubeFace(),S=e.getActiveMipmapLevel(),w=e.xr.enabled;e.xr.enabled=!1;const R=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,l),e.setRenderTarget(n,3,r),e.render(t,u),e.setRenderTarget(n,4,r),e.render(t,h),n.texture.generateMipmaps=R,e.setRenderTarget(n,5,r),e.render(t,m),e.setRenderTarget(v,x,S),e.xr.enabled=w,n.texture.needsPMREMUpdate=!0}}class yy extends vs{constructor(e,t,n,r,s,a,l,u,h,m){e=e!==void 0?e:[],t=t!==void 0?t:Qo,super(e,t,n,r,s,a,l,u,h,m),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class H7 extends qh{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new yy(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:gs}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},r=new $h(5,5,5),s=new Ja({name:"CubemapFromEquirect",uniforms:E0(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:hr,blending:Qa});s.uniforms.tEquirect.value=t;const a=new zi(r,s),l=t.minFilter;return t.minFilter===Va&&(t.minFilter=gs),new V7(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}class Yw extends vr{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 la,this.environmentIntensity=1,this.environmentRotation=new la,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 Qw{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=o_,this.updateRanges=[],this.version=0,this.uuid=ou()}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 r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];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=ou()),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=ou()),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 ga=new he;class nu{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}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++)ga.fromBufferAttribute(this,t),ga.applyMatrix4(e),this.setXYZ(t,ga.x,ga.y,ga.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ga.fromBufferAttribute(this,t),ga.applyNormalMatrix(e),this.setXYZ(t,ga.x,ga.y,ga.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ga.fromBufferAttribute(this,t),ga.transformDirection(e),this.setXYZ(t,ga.x,ga.y,ga.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Ta(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=si(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=si(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=si(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=si(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=si(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=Ta(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Ta(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Ta(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Ta(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=si(t,this.array),n=si(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=si(t,this.array),n=si(n,this.array),r=si(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=si(t,this.array),n=si(n,this.array),r=si(r,this.array),s=si(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,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 r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new wr(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 nu(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 r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}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 Wk extends ua{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new an(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}}class $k extends vs{constructor(e=null,t=1,n=1,r,s,a,l,u,h=mr,m=mr,v,x){super(null,a,l,u,h,m,r,s,v,x),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ig extends wr{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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 v3=new he,Xk=new he,Yk=new Vn;class Yl{constructor(e=new he(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=v3.subVectors(n,t).cross(Xk.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(v3),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Yk.getNormalMatrix(e),r=this.coplanarPoint(v3).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Sf=new dA,O2=new he;class Fg{constructor(e=new Yl,t=new Yl,n=new Yl,r=new Yl,s=new Yl,a=new Yl){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(n),l[3].copy(r),l[4].copy(s),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=Ha){const n=this.planes,r=e.elements,s=r[0],a=r[1],l=r[2],u=r[3],h=r[4],m=r[5],v=r[6],x=r[7],S=r[8],w=r[9],R=r[10],C=r[11],E=r[12],B=r[13],L=r[14],O=r[15];if(n[0].setComponents(u-s,x-h,C-S,O-E).normalize(),n[1].setComponents(u+s,x+h,C+S,O+E).normalize(),n[2].setComponents(u+a,x+m,C+w,O+B).normalize(),n[3].setComponents(u-a,x-m,C-w,O-B).normalize(),n[4].setComponents(u-l,x-v,C-R,O-L).normalize(),t===Ha)n[5].setComponents(u+l,x+v,C+R,O+L).normalize();else if(t===pu)n[5].setComponents(l,v,R,L).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(),Sf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Sf.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Sf)}intersectsSprite(e){return Sf.center.set(0,0,0),Sf.radius=.7071067811865476,Sf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Sf)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(O2.x=r.normal.x>0?e.max.x:e.min.x,O2.y=r.normal.y>0?e.max.y:e.min.y,O2.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(O2)<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)}}class $0 extends ua{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new an(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 l_=new he,u_=new he,h5=new kn,Jp=new Og,I2=new dA,_3=new he,f5=new he;class xy extends vr{constructor(e=new Ki,t=new $0){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)l_.fromBufferAttribute(t,r-1),u_.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=l_.distanceTo(u_);e.setAttribute("lineDistance",new Mi(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),I2.copy(n.boundingSphere),I2.applyMatrix4(r),I2.radius+=s,e.ray.intersectsSphere(I2)===!1)return;h5.copy(r).invert(),Jp.copy(e.ray).applyMatrix4(h5);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,h=this.isLineSegments?2:1,m=n.index,x=n.attributes.position;if(m!==null){const S=Math.max(0,a.start),w=Math.min(m.count,a.start+a.count);for(let R=S,C=w-1;R<C;R+=h){const E=m.getX(R),B=m.getX(R+1),L=F2(this,e,Jp,u,E,B);L&&t.push(L)}if(this.isLineLoop){const R=m.getX(w-1),C=m.getX(S),E=F2(this,e,Jp,u,R,C);E&&t.push(E)}}else{const S=Math.max(0,a.start),w=Math.min(x.count,a.start+a.count);for(let R=S,C=w-1;R<C;R+=h){const E=F2(this,e,Jp,u,R,R+1);E&&t.push(E)}if(this.isLineLoop){const R=F2(this,e,Jp,u,w-1,S);R&&t.push(R)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}}function F2(i,e,t,n,r,s){const a=i.geometry.attributes.position;if(l_.fromBufferAttribute(a,r),u_.fromBufferAttribute(a,s),t.distanceSqToSegment(l_,u_,_3,f5)>n)return;_3.applyMatrix4(i.matrixWorld);const u=e.ray.origin.distanceTo(_3);if(!(u<e.near||u>e.far))return{distance:u,point:f5.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:i}}const A5=new he,d5=new he;class j7 extends xy{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)A5.fromBufferAttribute(t,r),d5.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+A5.distanceTo(d5);e.setAttribute("lineDistance",new Mi(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Kw extends ua{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new an(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 p5=new kn,$S=new Og,k2=new dA,z2=new he;class Qk extends vr{constructor(e=new Ki,t=new Kw){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),k2.copy(n.boundingSphere),k2.applyMatrix4(r),k2.radius+=s,e.ray.intersectsSphere(k2)===!1)return;p5.copy(r).invert(),$S.copy(e.ray).applyMatrix4(p5);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,h=n.index,v=n.attributes.position;if(h!==null){const x=Math.max(0,a.start),S=Math.min(h.count,a.start+a.count);for(let w=x,R=S;w<R;w++){const C=h.getX(w);z2.fromBufferAttribute(v,C),m5(z2,C,u,r,e,t,this)}}else{const x=Math.max(0,a.start),S=Math.min(v.count,a.start+a.count);for(let w=x,R=S;w<R;w++)z2.fromBufferAttribute(v,w),m5(z2,w,u,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}}function m5(i,e,t,n,r,s,a){const l=$S.distanceSqToPoint(i);if(l<t){const u=new he;$S.closestPointToPoint(i,u),u.applyMatrix4(n);const h=r.ray.origin.distanceTo(u);if(h<r.near||h>r.far)return;s.push({distance:h,distanceToRay:Math.sqrt(l),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}let ja=class extends vr{constructor(){super(),this.isGroup=!0,this.type="Group"}};class W7 extends vs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=mr,this.minFilter=mr,this.generateMipmaps=!1,this.needsUpdate=!0}}class qc extends vs{constructor(e,t,n,r,s,a,l,u,h,m=au){if(m!==au&&m!==du)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&m===au&&(n=Rr),n===void 0&&m===du&&(n=Au),super(null,r,s,a,l,u,m,n,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=l!==void 0?l:mr,this.minFilter=u!==void 0?u:mr,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Pl{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let l=0,u=s-1,h;for(;l<=u;)if(r=Math.floor(l+(u-l)/2),h=n[r]-a,h<0)l=r+1;else if(h>0)u=r-1;else{u=r;break}if(r=u,n[r]===a)return r/(s-1);const m=n[r],x=n[r+1]-m,S=(a-m)/x;return(r+S)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),l=this.getPoint(s),u=t||(a.isVector2?new gt:new he);return u.copy(l).sub(a).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new he,r=[],s=[],a=[],l=new he,u=new kn;for(let S=0;S<=e;S++){const w=S/e;r[S]=this.getTangentAt(w,new he)}s[0]=new he,a[0]=new he;let h=Number.MAX_VALUE;const m=Math.abs(r[0].x),v=Math.abs(r[0].y),x=Math.abs(r[0].z);m<=h&&(h=m,n.set(1,0,0)),v<=h&&(h=v,n.set(0,1,0)),x<=h&&n.set(0,0,1),l.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],l),a[0].crossVectors(r[0],s[0]);for(let S=1;S<=e;S++){if(s[S]=s[S-1].clone(),a[S]=a[S-1].clone(),l.crossVectors(r[S-1],r[S]),l.length()>Number.EPSILON){l.normalize();const w=Math.acos(ni(r[S-1].dot(r[S]),-1,1));s[S].applyMatrix4(u.makeRotationAxis(l,w))}a[S].crossVectors(r[S],s[S])}if(t===!0){let S=Math.acos(ni(s[0].dot(s[e]),-1,1));S/=e,r[0].dot(l.crossVectors(s[0],s[e]))>0&&(S=-S);for(let w=1;w<=e;w++)s[w].applyMatrix4(u.makeRotationAxis(r[w],S*w)),a[w].crossVectors(r[w],s[w])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Zw extends Pl{constructor(e=0,t=0,n=1,r=1,s=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=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=l,this.aRotation=u}getPoint(e,t=new gt){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const l=this.aStartAngle+e*s;let u=this.aX+this.xRadius*Math.cos(l),h=this.aY+this.yRadius*Math.sin(l);if(this.aRotation!==0){const m=Math.cos(this.aRotation),v=Math.sin(this.aRotation),x=u-this.aX,S=h-this.aY;u=x*m-S*v+this.aX,h=x*v+S*m+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 Kk extends Zw{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function Jw(){let i=0,e=0,t=0,n=0;function r(s,a,l,u){i=s,e=l,t=-3*s+3*a-2*l-u,n=2*s-2*a+l+u}return{initCatmullRom:function(s,a,l,u,h){r(a,l,h*(l-s),h*(u-a))},initNonuniformCatmullRom:function(s,a,l,u,h,m,v){let x=(a-s)/h-(l-s)/(h+m)+(l-a)/m,S=(l-a)/m-(u-a)/(m+v)+(u-l)/v;x*=m,S*=m,r(a,l,x,S)},calc:function(s){const a=s*s,l=a*s;return i+e*s+t*a+n*l}}}const G2=new he,y3=new Jw,x3=new Jw,b3=new Jw;class Zk extends Pl{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new he){const n=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let l=Math.floor(a),u=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/s)+1)*s:u===0&&l===s-1&&(l=s-2,u=1);let h,m;this.closed||l>0?h=r[(l-1)%s]:(G2.subVectors(r[0],r[1]).add(r[0]),h=G2);const v=r[l%s],x=r[(l+1)%s];if(this.closed||l+2<s?m=r[(l+2)%s]:(G2.subVectors(r[s-1],r[s-2]).add(r[s-1]),m=G2),this.curveType==="centripetal"||this.curveType==="chordal"){const S=this.curveType==="chordal"?.5:.25;let w=Math.pow(h.distanceToSquared(v),S),R=Math.pow(v.distanceToSquared(x),S),C=Math.pow(x.distanceToSquared(m),S);R<1e-4&&(R=1),w<1e-4&&(w=R),C<1e-4&&(C=R),y3.initNonuniformCatmullRom(h.x,v.x,x.x,m.x,w,R,C),x3.initNonuniformCatmullRom(h.y,v.y,x.y,m.y,w,R,C),b3.initNonuniformCatmullRom(h.z,v.z,x.z,m.z,w,R,C)}else this.curveType==="catmullrom"&&(y3.initCatmullRom(h.x,v.x,x.x,m.x,this.tension),x3.initCatmullRom(h.y,v.y,x.y,m.y,this.tension),b3.initCatmullRom(h.z,v.z,x.z,m.z,this.tension));return n.set(y3.calc(u),x3.calc(u),b3.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new he().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function g5(i,e,t,n,r){const s=(n-e)*.5,a=(r-t)*.5,l=i*i,u=i*l;return(2*t-2*n+s+a)*u+(-3*t+3*n-2*s-a)*l+s*i+t}function Jk(i,e){const t=1-i;return t*t*e}function ez(i,e){return 2*(1-i)*i*e}function tz(i,e){return i*i*e}function Rm(i,e,t,n){return Jk(i,e)+ez(i,t)+tz(i,n)}function nz(i,e){const t=1-i;return t*t*t*e}function iz(i,e){const t=1-i;return 3*t*t*i*e}function rz(i,e){return 3*(1-i)*i*i*e}function sz(i,e){return i*i*i*e}function Nm(i,e,t,n,r){return nz(i,e)+iz(i,t)+rz(i,n)+sz(i,r)}class $7 extends Pl{constructor(e=new gt,t=new gt,n=new gt,r=new gt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new gt){const n=t,r=this.v0,s=this.v1,a=this.v2,l=this.v3;return n.set(Nm(e,r.x,s.x,a.x,l.x),Nm(e,r.y,s.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 X7 extends Pl{constructor(e=new he,t=new he,n=new he,r=new he){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new he){const n=t,r=this.v0,s=this.v1,a=this.v2,l=this.v3;return n.set(Nm(e,r.x,s.x,a.x,l.x),Nm(e,r.y,s.y,a.y,l.y),Nm(e,r.z,s.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 Y7 extends Pl{constructor(e=new gt,t=new gt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new gt){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 gt){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 az extends Pl{constructor(e=new he,t=new he){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new he){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new he){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Q7 extends Pl{constructor(e=new gt,t=new gt,n=new gt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new gt){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Rm(e,r.x,s.x,a.x),Rm(e,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class K7 extends Pl{constructor(e=new he,t=new he,n=new he){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new he){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Rm(e,r.x,s.x,a.x),Rm(e,r.y,s.y,a.y),Rm(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Z7 extends Pl{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new gt){const n=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),l=s-a,u=r[a===0?a:a-1],h=r[a],m=r[a>r.length-2?r.length-1:a+1],v=r[a>r.length-3?r.length-1:a+2];return n.set(g5(l,u.x,h.x,m.x,v.x),g5(l,u.y,h.y,m.y,v.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new gt().fromArray(r))}return this}}var c_=Object.freeze({__proto__:null,ArcCurve:Kk,CatmullRomCurve3:Zk,CubicBezierCurve:$7,CubicBezierCurve3:X7,EllipseCurve:Zw,LineCurve:Y7,LineCurve3:az,QuadraticBezierCurve:Q7,QuadraticBezierCurve3:K7,SplineCurve:Z7});class oz extends Pl{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 c_[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const a=r[s]-n,l=this.curves[s],u=l.getLength(),h=u===0?0:1-a/u;return l.getPointAt(h,t)}s++}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,r=this.curves.length;n<r;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 r=0,s=this.curves;r<s.length;r++){const a=s[r],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 m=u[h];n&&n.equals(m)||(t.push(m),n=m)}}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 r=e.curves[t];this.curves.push(r.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 r=this.curves[t];e.curves.push(r.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 r=e.curves[t];this.curves.push(new c_[r.type]().fromJSON(r))}return this}}let XS=class extends oz{constructor(e){super(),this.type="Path",this.currentPoint=new gt,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 Y7(this.currentPoint.clone(),new gt(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){const s=new Q7(this.currentPoint.clone(),new gt(e,t),new gt(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,a){const l=new $7(this.currentPoint.clone(),new gt(e,t),new gt(n,r),new gt(s,a));return this.curves.push(l),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Z7(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,a){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+l,t+u,n,r,s,a),this}absarc(e,t,n,r,s,a){return this.absellipse(e,t,n,n,r,s,a),this}ellipse(e,t,n,r,s,a,l,u){const h=this.currentPoint.x,m=this.currentPoint.y;return this.absellipse(e+h,t+m,n,r,s,a,l,u),this}absellipse(e,t,n,r,s,a,l,u){const h=new Zw(e,t,n,r,s,a,l,u);if(this.curves.length>0){const v=h.getPoint(0);v.equals(this.currentPoint)||this.lineTo(v.x,v.y)}this.curves.push(h);const m=h.getPoint(1);return this.currentPoint.copy(m),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 by extends Ki{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],a=[],l=[],u=[],h=new he,m=new gt;a.push(0,0,0),l.push(0,0,1),u.push(.5,.5);for(let v=0,x=3;v<=t;v++,x+=3){const S=n+v/t*r;h.x=e*Math.cos(S),h.y=e*Math.sin(S),a.push(h.x,h.y,h.z),l.push(0,0,1),m.x=(a[x]/e+1)/2,m.y=(a[x+1]/e+1)/2,u.push(m.x,m.y)}for(let v=1;v<=t;v++)s.push(v,v+1,0);this.setIndex(s),this.setAttribute("position",new Mi(a,3)),this.setAttribute("normal",new Mi(l,3)),this.setAttribute("uv",new Mi(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new by(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class eM extends Ki{constructor(e=1,t=1,n=1,r=32,s=1,a=!1,l=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:l,thetaLength:u};const h=this;r=Math.floor(r),s=Math.floor(s);const m=[],v=[],x=[],S=[];let w=0;const R=[],C=n/2;let E=0;B(),a===!1&&(e>0&&L(!0),t>0&&L(!1)),this.setIndex(m),this.setAttribute("position",new Mi(v,3)),this.setAttribute("normal",new Mi(x,3)),this.setAttribute("uv",new Mi(S,2));function B(){const O=new he,G=new he;let q=0;const z=(t-e)/n;for(let j=0;j<=s;j++){const F=[],V=j/s,Y=V*(t-e)+e;for(let ee=0;ee<=r;ee++){const te=ee/r,re=te*u+l,ne=Math.sin(re),Q=Math.cos(re);G.x=Y*ne,G.y=-V*n+C,G.z=Y*Q,v.push(G.x,G.y,G.z),O.set(ne,z,Q).normalize(),x.push(O.x,O.y,O.z),S.push(te,1-V),F.push(w++)}R.push(F)}for(let j=0;j<r;j++)for(let F=0;F<s;F++){const V=R[F][j],Y=R[F+1][j],ee=R[F+1][j+1],te=R[F][j+1];(e>0||F!==0)&&(m.push(V,Y,te),q+=3),(t>0||F!==s-1)&&(m.push(Y,ee,te),q+=3)}h.addGroup(E,q,0),E+=q}function L(O){const G=w,q=new gt,z=new he;let j=0;const F=O===!0?e:t,V=O===!0?1:-1;for(let ee=1;ee<=r;ee++)v.push(0,C*V,0),x.push(0,V,0),S.push(.5,.5),w++;const Y=w;for(let ee=0;ee<=r;ee++){const re=ee/r*u+l,ne=Math.cos(re),Q=Math.sin(re);z.x=F*Q,z.y=C*V,z.z=F*ne,v.push(z.x,z.y,z.z),x.push(0,V,0),q.x=ne*.5+.5,q.y=Q*.5*V+.5,S.push(q.x,q.y),w++}for(let ee=0;ee<r;ee++){const te=G+ee,re=Y+ee;O===!0?m.push(re,re+1,te):m.push(re+1,re,te),j+=3}h.addGroup(E,j,O===!0?1:2),E+=j}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new eM(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Gv extends XS{constructor(e){super(e),this.uuid=ou(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n<r;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 r=e.holes[t];this.holes.push(r.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 r=this.holes[t];e.holes.push(r.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 r=e.holes[t];this.holes.push(new XS().fromJSON(r))}return this}}const lz={triangulate:function(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let s=J7(i,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let l,u,h,m,v,x,S;if(n&&(s=Az(i,e,s,t)),i.length>80*t){l=h=i[0],u=m=i[1];for(let w=t;w<r;w+=t)v=i[w],x=i[w+1],v<l&&(l=v),x<u&&(u=x),v>h&&(h=v),x>m&&(m=x);S=Math.max(h-l,m-u),S=S!==0?32767/S:0}return ag(s,a,t,l,u,S,0),a}};function J7(i,e,t,n,r){let s,a;if(r===Tz(i,e,t,n)>0)for(s=e;s<t;s+=n)a=v5(s,i[s],i[s+1],a);else for(s=t-n;s>=e;s-=n)a=v5(s,i[s],i[s+1],a);return a&&Sy(a,a.next)&&(lg(a),a=a.next),a}function uA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(Sy(t,t.next)||Nr(t.prev,t,t.next)===0)){if(lg(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ag(i,e,t,n,r,s,a){if(!i)return;!a&&s&&vz(i,n,r,s);let l=i,u,h;for(;i.prev!==i.next;){if(u=i.prev,h=i.next,s?cz(i,n,r,s):uz(i)){e.push(u.i/t|0),e.push(i.i/t|0),e.push(h.i/t|0),lg(i),i=h.next,l=h.next;continue}if(i=h,i===l){a?a===1?(i=hz(uA(i),e,t),ag(i,e,t,n,r,s,2)):a===2&&fz(i,e,t,n,r,s):ag(uA(i),e,t,n,r,s,1);break}}}function uz(i){const e=i.prev,t=i,n=i.next;if(Nr(e,t,n)>=0)return!1;const r=e.x,s=t.x,a=n.x,l=e.y,u=t.y,h=n.y,m=r<s?r<a?r:a:s<a?s:a,v=l<u?l<h?l:h:u<h?u:h,x=r>s?r>a?r:a:s>a?s:a,S=l>u?l>h?l:h:u>h?u:h;let w=n.next;for(;w!==e;){if(w.x>=m&&w.x<=x&&w.y>=v&&w.y<=S&&Vd(r,l,s,u,a,h,w.x,w.y)&&Nr(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function cz(i,e,t,n){const r=i.prev,s=i,a=i.next;if(Nr(r,s,a)>=0)return!1;const l=r.x,u=s.x,h=a.x,m=r.y,v=s.y,x=a.y,S=l<u?l<h?l:h:u<h?u:h,w=m<v?m<x?m:x:v<x?v:x,R=l>u?l>h?l:h:u>h?u:h,C=m>v?m>x?m:x:v>x?v:x,E=YS(S,w,e,t,n),B=YS(R,C,e,t,n);let L=i.prevZ,O=i.nextZ;for(;L&&L.z>=E&&O&&O.z<=B;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Vd(l,m,u,v,h,x,L.x,L.y)&&Nr(L.prev,L,L.next)>=0||(L=L.prevZ,O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Vd(l,m,u,v,h,x,O.x,O.y)&&Nr(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;L&&L.z>=E;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Vd(l,m,u,v,h,x,L.x,L.y)&&Nr(L.prev,L,L.next)>=0)return!1;L=L.prevZ}for(;O&&O.z<=B;){if(O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Vd(l,m,u,v,h,x,O.x,O.y)&&Nr(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function hz(i,e,t){let n=i;do{const r=n.prev,s=n.next.next;!Sy(r,s)&&eD(r,n,n.next,s)&&og(r,s)&&og(s,r)&&(e.push(r.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),lg(n),lg(n.next),n=i=s),n=n.next}while(n!==i);return uA(n)}function fz(i,e,t,n,r,s){let a=i;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&xz(a,l)){let u=tD(a,l);a=uA(a,a.next),u=uA(u,u.next),ag(a,e,t,n,r,s,0),ag(u,e,t,n,r,s,0);return}l=l.next}a=a.next}while(a!==i)}function Az(i,e,t,n){const r=[];let s,a,l,u,h;for(s=0,a=e.length;s<a;s++)l=e[s]*n,u=s<a-1?e[s+1]*n:i.length,h=J7(i,l,u,n,!1),h===h.next&&(h.steiner=!0),r.push(yz(h));for(r.sort(dz),s=0;s<r.length;s++)t=pz(r[s],t);return t}function dz(i,e){return i.x-e.x}function pz(i,e){const t=mz(i,e);if(!t)return e;const n=tD(t,i);return uA(n,n.next),uA(t,t.next)}function mz(i,e){let t=e,n=-1/0,r;const s=i.x,a=i.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){const x=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(x<=s&&x>n&&(n=x,r=t.x<t.next.x?t:t.next,x===s))return r}t=t.next}while(t!==e);if(!r)return null;const l=r,u=r.x,h=r.y;let m=1/0,v;t=r;do s>=t.x&&t.x>=u&&s!==t.x&&Vd(a<h?s:n,a,u,h,a<h?n:s,a,t.x,t.y)&&(v=Math.abs(a-t.y)/(s-t.x),og(t,i)&&(v<m||v===m&&(t.x>r.x||t.x===r.x&&gz(r,t)))&&(r=t,m=v)),t=t.next;while(t!==l);return r}function gz(i,e){return Nr(i.prev,i,e.prev)<0&&Nr(e.next,i,i.next)<0}function vz(i,e,t,n){let r=i;do r.z===0&&(r.z=YS(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,_z(r)}function _z(i){let e,t,n,r,s,a,l,u,h=1;do{for(t=i,i=null,s=null,a=0;t;){for(a++,n=t,l=0,e=0;e<h&&(l++,n=n.nextZ,!!n);e++);for(u=h;l>0||u>0&&n;)l!==0&&(u===0||!n||t.z<=n.z)?(r=t,t=t.nextZ,l--):(r=n,n=n.nextZ,u--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;t=n}s.nextZ=null,h*=2}while(a>1);return i}function YS(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function yz(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Vd(i,e,t,n,r,s,a,l){return(r-a)*(e-l)>=(i-a)*(s-l)&&(i-a)*(n-l)>=(t-a)*(e-l)&&(t-a)*(s-l)>=(r-a)*(n-l)}function xz(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!bz(i,e)&&(og(i,e)&&og(e,i)&&Sz(i,e)&&(Nr(i.prev,i,e.prev)||Nr(i,e.prev,e))||Sy(i,e)&&Nr(i.prev,i,i.next)>0&&Nr(e.prev,e,e.next)>0)}function Nr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Sy(i,e){return i.x===e.x&&i.y===e.y}function eD(i,e,t,n){const r=V2(Nr(i,e,t)),s=V2(Nr(i,e,n)),a=V2(Nr(t,n,i)),l=V2(Nr(t,n,e));return!!(r!==s&&a!==l||r===0&&q2(i,t,e)||s===0&&q2(i,n,e)||a===0&&q2(t,i,n)||l===0&&q2(t,e,n))}function q2(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function V2(i){return i>0?1:i<0?-1:0}function bz(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&eD(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function og(i,e){return Nr(i.prev,i,i.next)<0?Nr(i,e,i.next)>=0&&Nr(i,i.prev,e)>=0:Nr(i,e,i.prev)<0||Nr(i,i.next,e)<0}function Sz(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function tD(i,e){const t=new QS(i.i,i.x,i.y),n=new QS(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function v5(i,e,t,n){const r=new QS(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function lg(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function QS(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Tz(i,e,t,n){let r=0;for(let s=e,a=t-n;s<t;s+=n)r+=(i[a]-i[s])*(i[s+1]+i[a+1]),a=s;return r}class t0{static area(e){const t=e.length;let n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return t0.area(e)<0}static triangulateShape(e,t){const n=[],r=[],s=[];_5(e),y5(n,e);let a=e.length;t.forEach(_5);for(let u=0;u<t.length;u++)r.push(a),a+=t[u].length,y5(n,t[u]);const l=lz.triangulate(n,r);for(let u=0;u<l.length;u+=3)s.push(l.slice(u,u+3));return s}}function _5(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function y5(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class tM extends Ki{constructor(e=new Gv([new gt(.5,.5),new gt(-.5,.5),new gt(-.5,-.5),new gt(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],s=[];for(let l=0,u=e.length;l<u;l++){const h=e[l];a(h)}this.setAttribute("position",new Mi(r,3)),this.setAttribute("uv",new Mi(s,2)),this.computeVertexNormals();function a(l){const u=[],h=t.curveSegments!==void 0?t.curveSegments:12,m=t.steps!==void 0?t.steps:1,v=t.depth!==void 0?t.depth:1;let x=t.bevelEnabled!==void 0?t.bevelEnabled:!0,S=t.bevelThickness!==void 0?t.bevelThickness:.2,w=t.bevelSize!==void 0?t.bevelSize:S-.1,R=t.bevelOffset!==void 0?t.bevelOffset:0,C=t.bevelSegments!==void 0?t.bevelSegments:3;const E=t.extrudePath,B=t.UVGenerator!==void 0?t.UVGenerator:wz;let L,O=!1,G,q,z,j;E&&(L=E.getSpacedPoints(m),O=!0,x=!1,G=E.computeFrenetFrames(m,!1),q=new he,z=new he,j=new he),x||(C=0,S=0,w=0,R=0);const F=l.extractPoints(h);let V=F.shape;const Y=F.holes;if(!t0.isClockWise(V)){V=V.reverse();for(let $e=0,rt=Y.length;$e<rt;$e++){const ce=Y[$e];t0.isClockWise(ce)&&(Y[$e]=ce.reverse())}}const te=t0.triangulateShape(V,Y),re=V;for(let $e=0,rt=Y.length;$e<rt;$e++){const ce=Y[$e];V=V.concat(ce)}function ne($e,rt,ce){return rt||console.error("THREE.ExtrudeGeometry: vec does not exist"),$e.clone().addScaledVector(rt,ce)}const Q=V.length,ae=te.length;function de($e,rt,ce){let Gt,ht,Pt;const yt=$e.x-rt.x,en=$e.y-rt.y,xt=ce.x-$e.x,fe=ce.y-$e.y,X=yt*yt+en*en,le=yt*fe-en*xt;if(Math.abs(le)>Number.EPSILON){const Re=Math.sqrt(X),pe=Math.sqrt(xt*xt+fe*fe),Me=rt.x-en/Re,nt=rt.y+yt/Re,lt=ce.x-fe/pe,Ot=ce.y+xt/pe,jt=((lt-Me)*fe-(Ot-nt)*xt)/(yt*fe-en*xt);Gt=Me+yt*jt-$e.x,ht=nt+en*jt-$e.y;const pt=Gt*Gt+ht*ht;if(pt<=2)return new gt(Gt,ht);Pt=Math.sqrt(pt/2)}else{let Re=!1;yt>Number.EPSILON?xt>Number.EPSILON&&(Re=!0):yt<-Number.EPSILON?xt<-Number.EPSILON&&(Re=!0):Math.sign(en)===Math.sign(fe)&&(Re=!0),Re?(Gt=-en,ht=yt,Pt=Math.sqrt(X)):(Gt=yt,ht=en,Pt=Math.sqrt(X/2))}return new gt(Gt/Pt,ht/Pt)}const Te=[];for(let $e=0,rt=re.length,ce=rt-1,Gt=$e+1;$e<rt;$e++,ce++,Gt++)ce===rt&&(ce=0),Gt===rt&&(Gt=0),Te[$e]=de(re[$e],re[ce],re[Gt]);const be=[];let ue,we=Te.concat();for(let $e=0,rt=Y.length;$e<rt;$e++){const ce=Y[$e];ue=[];for(let Gt=0,ht=ce.length,Pt=ht-1,yt=Gt+1;Gt<ht;Gt++,Pt++,yt++)Pt===ht&&(Pt=0),yt===ht&&(yt=0),ue[Gt]=de(ce[Gt],ce[Pt],ce[yt]);be.push(ue),we=we.concat(ue)}for(let $e=0;$e<C;$e++){const rt=$e/C,ce=S*Math.cos(rt*Math.PI/2),Gt=w*Math.sin(rt*Math.PI/2)+R;for(let ht=0,Pt=re.length;ht<Pt;ht++){const yt=ne(re[ht],Te[ht],Gt);Ce(yt.x,yt.y,-ce)}for(let ht=0,Pt=Y.length;ht<Pt;ht++){const yt=Y[ht];ue=be[ht];for(let en=0,xt=yt.length;en<xt;en++){const fe=ne(yt[en],ue[en],Gt);Ce(fe.x,fe.y,-ce)}}}const We=w+R;for(let $e=0;$e<Q;$e++){const rt=x?ne(V[$e],we[$e],We):V[$e];O?(z.copy(G.normals[0]).multiplyScalar(rt.x),q.copy(G.binormals[0]).multiplyScalar(rt.y),j.copy(L[0]).add(z).add(q),Ce(j.x,j.y,j.z)):Ce(rt.x,rt.y,0)}for(let $e=1;$e<=m;$e++)for(let rt=0;rt<Q;rt++){const ce=x?ne(V[rt],we[rt],We):V[rt];O?(z.copy(G.normals[$e]).multiplyScalar(ce.x),q.copy(G.binormals[$e]).multiplyScalar(ce.y),j.copy(L[$e]).add(z).add(q),Ce(j.x,j.y,j.z)):Ce(ce.x,ce.y,v/m*$e)}for(let $e=C-1;$e>=0;$e--){const rt=$e/C,ce=S*Math.cos(rt*Math.PI/2),Gt=w*Math.sin(rt*Math.PI/2)+R;for(let ht=0,Pt=re.length;ht<Pt;ht++){const yt=ne(re[ht],Te[ht],Gt);Ce(yt.x,yt.y,v+ce)}for(let ht=0,Pt=Y.length;ht<Pt;ht++){const yt=Y[ht];ue=be[ht];for(let en=0,xt=yt.length;en<xt;en++){const fe=ne(yt[en],ue[en],Gt);O?Ce(fe.x,fe.y+L[m-1].y,L[m-1].x+ce):Ce(fe.x,fe.y,v+ce)}}}Ne(),ze();function Ne(){const $e=r.length/3;if(x){let rt=0,ce=Q*rt;for(let Gt=0;Gt<ae;Gt++){const ht=te[Gt];dt(ht[2]+ce,ht[1]+ce,ht[0]+ce)}rt=m+C*2,ce=Q*rt;for(let Gt=0;Gt<ae;Gt++){const ht=te[Gt];dt(ht[0]+ce,ht[1]+ce,ht[2]+ce)}}else{for(let rt=0;rt<ae;rt++){const ce=te[rt];dt(ce[2],ce[1],ce[0])}for(let rt=0;rt<ae;rt++){const ce=te[rt];dt(ce[0]+Q*m,ce[1]+Q*m,ce[2]+Q*m)}}n.addGroup($e,r.length/3-$e,0)}function ze(){const $e=r.length/3;let rt=0;Se(re,rt),rt+=re.length;for(let ce=0,Gt=Y.length;ce<Gt;ce++){const ht=Y[ce];Se(ht,rt),rt+=ht.length}n.addGroup($e,r.length/3-$e,1)}function Se($e,rt){let ce=$e.length;for(;--ce>=0;){const Gt=ce;let ht=ce-1;ht<0&&(ht=$e.length-1);for(let Pt=0,yt=m+C*2;Pt<yt;Pt++){const en=Q*Pt,xt=Q*(Pt+1),fe=rt+Gt+en,X=rt+ht+en,le=rt+ht+xt,Re=rt+Gt+xt;At(fe,X,le,Re)}}}function Ce($e,rt,ce){u.push($e),u.push(rt),u.push(ce)}function dt($e,rt,ce){wt($e),wt(rt),wt(ce);const Gt=r.length/3,ht=B.generateTopUV(n,r,Gt-3,Gt-2,Gt-1);Ft(ht[0]),Ft(ht[1]),Ft(ht[2])}function At($e,rt,ce,Gt){wt($e),wt(rt),wt(Gt),wt(rt),wt(ce),wt(Gt);const ht=r.length/3,Pt=B.generateSideWallUV(n,r,ht-6,ht-3,ht-2,ht-1);Ft(Pt[0]),Ft(Pt[1]),Ft(Pt[3]),Ft(Pt[1]),Ft(Pt[2]),Ft(Pt[3])}function wt($e){r.push(u[$e*3+0]),r.push(u[$e*3+1]),r.push(u[$e*3+2])}function Ft($e){s.push($e.x),s.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 Mz(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const l=t[e.shapes[s]];n.push(l)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new c_[r.type]().fromJSON(r)),new tM(n,e.options)}}const wz={generateTopUV:function(i,e,t,n,r){const s=e[t*3],a=e[t*3+1],l=e[n*3],u=e[n*3+1],h=e[r*3],m=e[r*3+1];return[new gt(s,a),new gt(l,u),new gt(h,m)]},generateSideWallUV:function(i,e,t,n,r,s){const a=e[t*3],l=e[t*3+1],u=e[t*3+2],h=e[n*3],m=e[n*3+1],v=e[n*3+2],x=e[r*3],S=e[r*3+1],w=e[r*3+2],R=e[s*3],C=e[s*3+1],E=e[s*3+2];return Math.abs(l-m)<Math.abs(a-h)?[new gt(a,1-u),new gt(h,1-v),new gt(x,1-w),new gt(R,1-E)]:[new gt(l,1-u),new gt(m,1-v),new gt(S,1-w),new gt(C,1-E)]}};function Mz(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){const s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Ty extends Ki{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,l=Math.floor(n),u=Math.floor(r),h=l+1,m=u+1,v=e/l,x=t/u,S=[],w=[],R=[],C=[];for(let E=0;E<m;E++){const B=E*x-a;for(let L=0;L<h;L++){const O=L*v-s;w.push(O,-B,0),R.push(0,0,1),C.push(L/l),C.push(1-E/u)}}for(let E=0;E<u;E++)for(let B=0;B<l;B++){const L=B+h*E,O=B+h*(E+1),G=B+1+h*(E+1),q=B+1+h*E;S.push(L,O,q),S.push(O,G,q)}this.setIndex(S),this.setAttribute("position",new Mi(w,3)),this.setAttribute("normal",new Mi(R,3)),this.setAttribute("uv",new Mi(C,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ty(e.width,e.height,e.widthSegments,e.heightSegments)}}class Eu extends Ki{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,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 m=[],v=new he,x=new he,S=[],w=[],R=[],C=[];for(let E=0;E<=n;E++){const B=[],L=E/n;let O=0;E===0&&a===0?O=.5/t:E===n&&u===Math.PI&&(O=-.5/t);for(let G=0;G<=t;G++){const q=G/t;v.x=-e*Math.cos(r+q*s)*Math.sin(a+L*l),v.y=e*Math.cos(a+L*l),v.z=e*Math.sin(r+q*s)*Math.sin(a+L*l),w.push(v.x,v.y,v.z),x.copy(v).normalize(),R.push(x.x,x.y,x.z),C.push(q+O,1-L),B.push(h++)}m.push(B)}for(let E=0;E<n;E++)for(let B=0;B<t;B++){const L=m[E][B+1],O=m[E][B],G=m[E+1][B],q=m[E+1][B+1];(E!==0||a>0)&&S.push(L,O,q),(E!==n-1||u<Math.PI)&&S.push(O,G,q)}this.setIndex(S),this.setAttribute("position",new Mi(w,3)),this.setAttribute("normal",new Mi(R,3)),this.setAttribute("uv",new Mi(C,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Eu(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class nM extends Ki{constructor(e=new K7(new he(-1,-1,0),new he(-1,1,0),new he(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const l=new he,u=new he,h=new gt;let m=new he;const v=[],x=[],S=[],w=[];R(),this.setIndex(w),this.setAttribute("position",new Mi(v,3)),this.setAttribute("normal",new Mi(x,3)),this.setAttribute("uv",new Mi(S,2));function R(){for(let L=0;L<t;L++)C(L);C(s===!1?t:0),B(),E()}function C(L){m=e.getPointAt(L/t,m);const O=a.normals[L],G=a.binormals[L];for(let q=0;q<=r;q++){const z=q/r*Math.PI*2,j=Math.sin(z),F=-Math.cos(z);u.x=F*O.x+j*G.x,u.y=F*O.y+j*G.y,u.z=F*O.z+j*G.z,u.normalize(),x.push(u.x,u.y,u.z),l.x=m.x+n*u.x,l.y=m.y+n*u.y,l.z=m.z+n*u.z,v.push(l.x,l.y,l.z)}}function E(){for(let L=1;L<=t;L++)for(let O=1;O<=r;O++){const G=(r+1)*(L-1)+(O-1),q=(r+1)*L+(O-1),z=(r+1)*L+O,j=(r+1)*(L-1)+O;w.push(G,q,j),w.push(q,z,j)}}function B(){for(let L=0;L<=t;L++)for(let O=0;O<=r;O++)h.x=L/t,h.y=O/r,S.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 nM(new c_[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Ez extends Ki{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,r=new he,s=new he;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,m=u.length;h<m;++h){const v=u[h],x=v.start,S=v.count;for(let w=x,R=x+S;w<R;w+=3)for(let C=0;C<3;C++){const E=l.getX(w+C),B=l.getX(w+(C+1)%3);r.fromBufferAttribute(a,E),s.fromBufferAttribute(a,B),x5(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.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 m=3*l+h,v=3*l+(h+1)%3;r.fromBufferAttribute(a,m),s.fromBufferAttribute(a,v),x5(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Mi(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function x5(i,e,t){const n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}class Cz extends ua{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new an(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 nD extends ua{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new an(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 an(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new gt(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 la,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 Rz extends nD{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 gt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ni(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 an(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 an(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new an(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 iD extends ua{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new an(16777215),this.specular=new an(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new an(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new gt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new la,this.combine=Lg,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 Nz extends ua{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new an(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new an(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new gt(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 Dz extends ua{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new gt(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 Vc extends ua{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new an(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new an(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new gt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new la,this.combine=Lg,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 Pz extends ua{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=WF,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 Lz extends ua{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 Uz extends ua{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new an(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dc,this.normalScale=new gt(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 Bz extends $0{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}}const b5={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class Oz{constructor(e,t,n){const r=this;let s=!1,a=0,l=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(m){l++,s===!1&&r.onStart!==void 0&&r.onStart(m,a,l),s=!0},this.itemEnd=function(m){a++,r.onProgress!==void 0&&r.onProgress(m,a,l),a===l&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(m){r.onError!==void 0&&r.onError(m)},this.resolveURL=function(m){return u?u(m):m},this.setURLModifier=function(m){return u=m,this},this.addHandler=function(m,v){return h.push(m,v),this},this.removeHandler=function(m){const v=h.indexOf(m);return v!==-1&&h.splice(v,2),this},this.getHandler=function(m){for(let v=0,x=h.length;v<x;v+=2){const S=h[v],w=h[v+1];if(S.global&&(S.lastIndex=0),S.test(m))return w}return null}}}const Iz=new Oz;class iM{constructor(e){this.manager=e!==void 0?e:Iz,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}iM.DEFAULT_MATERIAL_NAME="__DEFAULT";class Fz extends iM{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=b5.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const l=sg("img");function u(){m(),b5.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(v){m(),r&&r(v),s.manager.itemError(e),s.manager.itemEnd(e)}function m(){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),s.manager.itemStart(e),l.src=e,l}}class rM extends iM{constructor(e){super(e)}load(e,t,n,r){const s=new vs,a=new Fz(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(l){s.image=l,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class mA extends vr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new an(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 kz extends mA{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(vr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new an(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const S3=new kn,S5=new he,T5=new he;class sM{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new gt(512,512),this.map=null,this.mapPass=null,this.matrix=new kn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Fg,this._frameExtents=new gt(1,1),this._viewportCount=1,this._viewports=[new Ln(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;S5.setFromMatrixPosition(e.matrixWorld),t.position.copy(S5),T5.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(T5),t.updateMatrixWorld(),S3.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(S3),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(S3)}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.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 zz extends sM{constructor(){super(new ya(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=w0*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class rD extends mA{constructor(e,t,n=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(vr.DEFAULT_UP),this.updateMatrix(),this.target=new vr,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new zz}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 w5=new kn,em=new he,T3=new he;class Gz extends sM{constructor(){super(new ya(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new gt(4,2),this._viewportCount=6,this._viewports=[new Ln(2,1,1,1),new Ln(0,1,1,1),new Ln(3,1,1,1),new Ln(1,1,1,1),new Ln(3,0,1,1),new Ln(1,0,1,1)],this._cubeDirections=[new he(1,0,0),new he(-1,0,0),new he(0,0,1),new he(0,0,-1),new he(0,1,0),new he(0,-1,0)],this._cubeUps=[new he(0,1,0),new he(0,1,0),new he(0,1,0),new he(0,1,0),new he(0,0,1),new he(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),em.setFromMatrixPosition(e.matrixWorld),n.position.copy(em),T3.copy(n.position),T3.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(T3),n.updateMatrixWorld(),r.makeTranslation(-em.x,-em.y,-em.z),w5.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(w5)}}class qz extends mA{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Gz}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}}class kg extends _y{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,l=r+t,u=r-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,a=s+h*this.view.width,l-=m*this.view.offsetY,u=l-m*this.view.height}this.projectionMatrix.makeOrthographic(s,a,l,u,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Vz extends sM{constructor(){super(new kg(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class sD extends mA{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(vr.DEFAULT_UP),this.updateMatrix(),this.target=new vr,this.shadow=new Vz}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class aD extends mA{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Hz extends mA{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}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 jz{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new he)}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,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*r)),t.addScaledVector(a[5],1.092548*(r*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*r),t.addScaledVector(a[5],2*.429043*r*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-r*r)),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 r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}}class Wz extends mA{constructor(e=new jz,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 $z extends Ki{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 Xz extends ya{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class oD{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=M5(),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=M5();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function M5(){return performance.now()}class h_ extends Qw{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}}const E5=new kn;class Yz{constructor(e,t,n=0,r=1/0){this.ray=new Og(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Ww,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: Unsupported camera type: "+t.type)}setFromXRController(e){return E5.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(E5),this}intersectObject(e,t=!0,n=[]){return KS(e,this,n,t),n.sort(C5),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)KS(e[r],this,n,t);return n.sort(C5),n}}function C5(i,e){return i.distance-e.distance}function KS(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const s=i.children;for(let a=0,l=s.length;a<l;a++)KS(s[a],e,t,!0)}}class R5{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=ni(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(ni(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const N5=new he,H2=new he;class Qz{constructor(e=new he,t=new he){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){N5.subVectors(e,this.start),H2.subVectors(this.end,this.start);const n=H2.dot(H2);let s=H2.dot(N5)/n;return t&&(s=ni(s,0,1)),s}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class Kz{constructor(){this.type="ShapePath",this.color=new an,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new XS,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,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,a){return this.currentPath.bezierCurveTo(e,t,n,r,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(E){const B=[];for(let L=0,O=E.length;L<O;L++){const G=E[L],q=new Gv;q.curves=G.curves,B.push(q)}return B}function n(E,B){const L=B.length;let O=!1;for(let G=L-1,q=0;q<L;G=q++){let z=B[G],j=B[q],F=j.x-z.x,V=j.y-z.y;if(Math.abs(V)>Number.EPSILON){if(V<0&&(z=B[q],F=-F,j=B[G],V=-V),E.y<z.y||E.y>j.y)continue;if(E.y===z.y){if(E.x===z.x)return!0}else{const Y=V*(E.x-z.x)-F*(E.y-z.y);if(Y===0)return!0;if(Y<0)continue;O=!O}}else{if(E.y!==z.y)continue;if(j.x<=E.x&&E.x<=z.x||z.x<=E.x&&E.x<=j.x)return!0}}return O}const r=t0.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,l,u;const h=[];if(s.length===1)return l=s[0],u=new Gv,u.curves=l.curves,h.push(u),h;let m=!r(s[0].getPoints());m=e?!m:m;const v=[],x=[];let S=[],w=0,R;x[w]=void 0,S[w]=[];for(let E=0,B=s.length;E<B;E++)l=s[E],R=l.getPoints(),a=r(R),a=e?!a:a,a?(!m&&x[w]&&w++,x[w]={s:new Gv,p:R},x[w].s.curves=l.curves,m&&w++,S[w]=[]):S[w].push({h:l,p:R[0]});if(!x[0])return t(s);if(x.length>1){let E=!1,B=0;for(let L=0,O=x.length;L<O;L++)v[L]=[];for(let L=0,O=x.length;L<O;L++){const G=S[L];for(let q=0;q<G.length;q++){const z=G[q];let j=!0;for(let F=0;F<x.length;F++)n(z.p,x[F].p)&&(L!==F&&B++,j?(j=!1,v[F].push(z)):E=!0);j&&v[L].push(z)}}B>0&&E===!1&&(S=v)}let C;for(let E=0,B=x.length;E<B;E++){u=x[E].s,h.push(u),C=S[E];for(let L=0,O=C.length;L<O;L++)u.holes.push(C[L].h)}return h}}class aM extends zc{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(){}disconnect(){}dispose(){}update(){}}function D5(i,e,t,n){const r=Zz(n);switch(t){case Uw:return i*e;case Bw:return i*e;case Ow:return i*e*2;case Bg:return i*e/r.components*r.byteLength;case H0:return i*e/r.components*r.byteLength;case lA:return i*e*2/r.components*r.byteLength;case j0:return i*e*2/r.components*r.byteLength;case Ug:return i*e*3/r.components*r.byteLength;case ks:return i*e*4/r.components*r.byteLength;case W0:return i*e*4/r.components*r.byteLength;case Zf:case Bh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Oh:case Ih:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Zm:case eg:return Math.max(i,16)*Math.max(e,8)/4;case Km:case Jm:return Math.max(i,8)*Math.max(e,8)/2;case tg:case u0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case c0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case h0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case f0:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case A0:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case d0:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case p0:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case m0:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case g0:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case v0:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case _0:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case y0:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case x0:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case b0:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case S0:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case T0:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Jf:case HS:case jS:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Iw:case ng:return Math.ceil(i/4)*Math.ceil(e/4)*8;case ig:case rg:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Zz(i){switch(i){case aa:case Qf:return{byteLength:1,components:1};case wl:case Kf:case Gs:return{byteLength:2,components:1};case Ay:case dy:return{byteLength:2,components:4};case Rr:case Ns:case $r:return{byteLength:4,components:1};case py:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:V0}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=V0);/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function lD(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function Jz(i){const e=new WeakMap;function t(l,u){const h=l.array,m=l.usage,v=h.byteLength,x=i.createBuffer();i.bindBuffer(u,x),i.bufferData(u,h,m),l.onUploadCallback();let S;if(h instanceof Float32Array)S=i.FLOAT;else if(h instanceof Uint16Array)l.isFloat16BufferAttribute?S=i.HALF_FLOAT:S=i.UNSIGNED_SHORT;else if(h instanceof Int16Array)S=i.SHORT;else if(h instanceof Uint32Array)S=i.UNSIGNED_INT;else if(h instanceof Int32Array)S=i.INT;else if(h instanceof Int8Array)S=i.BYTE;else if(h instanceof Uint8Array)S=i.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)S=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:x,type:S,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version,size:v}}function n(l,u,h){const m=u.array,v=u.updateRanges;if(i.bindBuffer(h,l),v.length===0)i.bufferSubData(h,0,m);else{v.sort((S,w)=>S.start-w.start);let x=0;for(let S=1;S<v.length;S++){const w=v[x],R=v[S];R.start<=w.start+w.count+1?w.count=Math.max(w.count,R.start+R.count-w.start):(++x,v[x]=R)}v.length=x+1;for(let S=0,w=v.length;S<w;S++){const R=v[S];i.bufferSubData(h,R.start*m.BYTES_PER_ELEMENT,m,R.start,R.count)}u.clearUpdateRanges()}u.onUploadCallback()}function r(l){return l.isInterleavedBufferAttribute&&(l=l.data),e.get(l)}function s(l){l.isInterleavedBufferAttribute&&(l=l.data);const u=e.get(l);u&&(i.deleteBuffer(u.buffer),e.delete(l))}function a(l,u){if(l.isInterleavedBufferAttribute&&(l=l.data),l.isGLBufferAttribute){const m=e.get(l);(!m||m.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:r,remove:s,update:a}}var eG=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,tG=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,nG=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,iG=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,rG=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,sG=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,aG=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,oG=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,lG=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec3 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
	}
#endif`,uG=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,cG=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,hG=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,fG=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,AG=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		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 ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,dG=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,pG=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,mG=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,gG=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,vG=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,_G=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,yG=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,xG=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec3 vColor;
#endif`,bG=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
	vColor.xyz *= batchingColor.xyz;
#endif`,SG=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,TG=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,wG=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,MG=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,EG=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,CG=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,RG=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,NG="gl_FragColor = linearToOutputTexel( gl_FragColor );",DG=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,PG=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,LG=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,UG=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,BG=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,OG=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,IG=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,FG=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,kG=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,zG=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,GG=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,qG=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,VG=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,HG=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void 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 ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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 ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,jG=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,WG=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,$G=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,XG=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void 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 ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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 ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,YG=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,QG=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void 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 ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void 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 ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,KG=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,ZG=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	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 ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void 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 ) {
#else
void 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 ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	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 ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void 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 ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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 ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,JG=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,eq=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,tq=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,nq=`#if defined( USE_LOGDEPTHBUF )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,iq=`#if defined( USE_LOGDEPTHBUF )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,rq=`#ifdef USE_LOGDEPTHBUF
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,sq=`#ifdef USE_LOGDEPTHBUF
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,aq=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,oq=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,lq=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,uq=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,cq=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,hq=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,fq=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,Aq=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,dq=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,pq=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,mq=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,gq=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,vq=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,_q=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,yq=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,xq=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,bq=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,Sq=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,Tq=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,wq=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,Mq=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,Eq=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Cq=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * depth - far );
}`,Rq=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,Nq=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,Dq=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,Pq=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,Lq=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,Uq=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,Bq=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			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 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
				) * ( 1.0 / 9.0 );
			#else
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
#endif`,Oq=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,Iq=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,Fq=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,kq=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,zq=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,Gq=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,qq=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,Vq=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,Hq=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,jq=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,Wq=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,$q=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,Xq=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		#else
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,Yq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Qq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,Kq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,Zq=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const Jq=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,eV=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		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 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,tV=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,nV=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,iV=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,rV=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,sV=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,aV=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,oV=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,lV=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,uV=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,cV=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,hV=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,fV=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,AV=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,dV=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,pV=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,mV=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,gV=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,vV=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,_V=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,yV=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,xV=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,bV=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,SV=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,TV=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,wV=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,MV=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,EV=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,CV=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,RV=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,NV=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,DV=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,PV=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,Zn={alphahash_fragment:eG,alphahash_pars_fragment:tG,alphamap_fragment:nG,alphamap_pars_fragment:iG,alphatest_fragment:rG,alphatest_pars_fragment:sG,aomap_fragment:aG,aomap_pars_fragment:oG,batching_pars_vertex:lG,batching_vertex:uG,begin_vertex:cG,beginnormal_vertex:hG,bsdfs:fG,iridescence_fragment:AG,bumpmap_pars_fragment:dG,clipping_planes_fragment:pG,clipping_planes_pars_fragment:mG,clipping_planes_pars_vertex:gG,clipping_planes_vertex:vG,color_fragment:_G,color_pars_fragment:yG,color_pars_vertex:xG,color_vertex:bG,common:SG,cube_uv_reflection_fragment:TG,defaultnormal_vertex:wG,displacementmap_pars_vertex:MG,displacementmap_vertex:EG,emissivemap_fragment:CG,emissivemap_pars_fragment:RG,colorspace_fragment:NG,colorspace_pars_fragment:DG,envmap_fragment:PG,envmap_common_pars_fragment:LG,envmap_pars_fragment:UG,envmap_pars_vertex:BG,envmap_physical_pars_fragment:WG,envmap_vertex:OG,fog_vertex:IG,fog_pars_vertex:FG,fog_fragment:kG,fog_pars_fragment:zG,gradientmap_pars_fragment:GG,lightmap_pars_fragment:qG,lights_lambert_fragment:VG,lights_lambert_pars_fragment:HG,lights_pars_begin:jG,lights_toon_fragment:$G,lights_toon_pars_fragment:XG,lights_phong_fragment:YG,lights_phong_pars_fragment:QG,lights_physical_fragment:KG,lights_physical_pars_fragment:ZG,lights_fragment_begin:JG,lights_fragment_maps:eq,lights_fragment_end:tq,logdepthbuf_fragment:nq,logdepthbuf_pars_fragment:iq,logdepthbuf_pars_vertex:rq,logdepthbuf_vertex:sq,map_fragment:aq,map_pars_fragment:oq,map_particle_fragment:lq,map_particle_pars_fragment:uq,metalnessmap_fragment:cq,metalnessmap_pars_fragment:hq,morphinstance_vertex:fq,morphcolor_vertex:Aq,morphnormal_vertex:dq,morphtarget_pars_vertex:pq,morphtarget_vertex:mq,normal_fragment_begin:gq,normal_fragment_maps:vq,normal_pars_fragment:_q,normal_pars_vertex:yq,normal_vertex:xq,normalmap_pars_fragment:bq,clearcoat_normal_fragment_begin:Sq,clearcoat_normal_fragment_maps:Tq,clearcoat_pars_fragment:wq,iridescence_pars_fragment:Mq,opaque_fragment:Eq,packing:Cq,premultiplied_alpha_fragment:Rq,project_vertex:Nq,dithering_fragment:Dq,dithering_pars_fragment:Pq,roughnessmap_fragment:Lq,roughnessmap_pars_fragment:Uq,shadowmap_pars_fragment:Bq,shadowmap_pars_vertex:Oq,shadowmap_vertex:Iq,shadowmask_pars_fragment:Fq,skinbase_vertex:kq,skinning_pars_vertex:zq,skinning_vertex:Gq,skinnormal_vertex:qq,specularmap_fragment:Vq,specularmap_pars_fragment:Hq,tonemapping_fragment:jq,tonemapping_pars_fragment:Wq,transmission_fragment:$q,transmission_pars_fragment:Xq,uv_pars_fragment:Yq,uv_pars_vertex:Qq,uv_vertex:Kq,worldpos_vertex:Zq,background_vert:Jq,background_frag:eV,backgroundCube_vert:tV,backgroundCube_frag:nV,cube_vert:iV,cube_frag:rV,depth_vert:sV,depth_frag:aV,distanceRGBA_vert:oV,distanceRGBA_frag:lV,equirect_vert:uV,equirect_frag:cV,linedashed_vert:hV,linedashed_frag:fV,meshbasic_vert:AV,meshbasic_frag:dV,meshlambert_vert:pV,meshlambert_frag:mV,meshmatcap_vert:gV,meshmatcap_frag:vV,meshnormal_vert:_V,meshnormal_frag:yV,meshphong_vert:xV,meshphong_frag:bV,meshphysical_vert:SV,meshphysical_frag:TV,meshtoon_vert:wV,meshtoon_frag:MV,points_vert:EV,points_frag:CV,shadow_vert:RV,shadow_frag:NV,sprite_vert:DV,sprite_frag:PV},Kt={common:{diffuse:{value:new an(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Vn},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Vn}},envmap:{envMap:{value:null},envMapRotation:{value:new Vn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Vn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Vn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Vn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Vn},normalScale:{value:new gt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Vn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Vn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Vn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Vn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new an(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 an(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0},uvTransform:{value:new Vn}},sprite:{diffuse:{value:new an(16777215)},opacity:{value:1},center:{value:new gt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Vn},alphaMap:{value:null},alphaMapTransform:{value:new Vn},alphaTest:{value:0}}},Ga={basic:{uniforms:_a([Kt.common,Kt.specularmap,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.fog]),vertexShader:Zn.meshbasic_vert,fragmentShader:Zn.meshbasic_frag},lambert:{uniforms:_a([Kt.common,Kt.specularmap,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.fog,Kt.lights,{emissive:{value:new an(0)}}]),vertexShader:Zn.meshlambert_vert,fragmentShader:Zn.meshlambert_frag},phong:{uniforms:_a([Kt.common,Kt.specularmap,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.fog,Kt.lights,{emissive:{value:new an(0)},specular:{value:new an(1118481)},shininess:{value:30}}]),vertexShader:Zn.meshphong_vert,fragmentShader:Zn.meshphong_frag},standard:{uniforms:_a([Kt.common,Kt.envmap,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.roughnessmap,Kt.metalnessmap,Kt.fog,Kt.lights,{emissive:{value:new an(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Zn.meshphysical_vert,fragmentShader:Zn.meshphysical_frag},toon:{uniforms:_a([Kt.common,Kt.aomap,Kt.lightmap,Kt.emissivemap,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.gradientmap,Kt.fog,Kt.lights,{emissive:{value:new an(0)}}]),vertexShader:Zn.meshtoon_vert,fragmentShader:Zn.meshtoon_frag},matcap:{uniforms:_a([Kt.common,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,Kt.fog,{matcap:{value:null}}]),vertexShader:Zn.meshmatcap_vert,fragmentShader:Zn.meshmatcap_frag},points:{uniforms:_a([Kt.points,Kt.fog]),vertexShader:Zn.points_vert,fragmentShader:Zn.points_frag},dashed:{uniforms:_a([Kt.common,Kt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Zn.linedashed_vert,fragmentShader:Zn.linedashed_frag},depth:{uniforms:_a([Kt.common,Kt.displacementmap]),vertexShader:Zn.depth_vert,fragmentShader:Zn.depth_frag},normal:{uniforms:_a([Kt.common,Kt.bumpmap,Kt.normalmap,Kt.displacementmap,{opacity:{value:1}}]),vertexShader:Zn.meshnormal_vert,fragmentShader:Zn.meshnormal_frag},sprite:{uniforms:_a([Kt.sprite,Kt.fog]),vertexShader:Zn.sprite_vert,fragmentShader:Zn.sprite_frag},background:{uniforms:{uvTransform:{value:new Vn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Zn.background_vert,fragmentShader:Zn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Vn}},vertexShader:Zn.backgroundCube_vert,fragmentShader:Zn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Zn.cube_vert,fragmentShader:Zn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Zn.equirect_vert,fragmentShader:Zn.equirect_frag},distanceRGBA:{uniforms:_a([Kt.common,Kt.displacementmap,{referencePosition:{value:new he},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Zn.distanceRGBA_vert,fragmentShader:Zn.distanceRGBA_frag},shadow:{uniforms:_a([Kt.lights,Kt.fog,{color:{value:new an(0)},opacity:{value:1}}]),vertexShader:Zn.shadow_vert,fragmentShader:Zn.shadow_frag}};Ga.physical={uniforms:_a([Ga.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Vn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Vn},clearcoatNormalScale:{value:new gt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Vn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Vn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Vn},sheen:{value:0},sheenColor:{value:new an(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Vn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Vn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Vn},transmissionSamplerSize:{value:new gt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Vn},attenuationDistance:{value:0},attenuationColor:{value:new an(0)},specularColor:{value:new an(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Vn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Vn},anisotropyVector:{value:new gt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Vn}}]),vertexShader:Zn.meshphysical_vert,fragmentShader:Zn.meshphysical_frag};const j2={r:0,b:0,g:0},Tf=new la,LV=new kn;function UV(i,e,t,n,r,s,a){const l=new an(0);let u=s===!0?0:1,h,m,v=null,x=0,S=null;function w(L){let O=L.isScene===!0?L.background:null;return O&&O.isTexture&&(O=(L.backgroundBlurriness>0?t:e).get(O)),O}function R(L){let O=!1;const G=w(L);G===null?E(l,u):G&&G.isColor&&(E(G,1),O=!0);const q=i.xr.getEnvironmentBlendMode();q==="additive"?n.buffers.color.setClear(0,0,0,1,a):q==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||O)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function C(L,O){const G=w(O);G&&(G.isCubeTexture||G.mapping===sA)?(m===void 0&&(m=new zi(new $h(1,1,1),new Ja({name:"BackgroundCubeMaterial",uniforms:E0(Ga.backgroundCube.uniforms),vertexShader:Ga.backgroundCube.vertexShader,fragmentShader:Ga.backgroundCube.fragmentShader,side:hr,depthTest:!1,depthWrite:!1,fog:!1})),m.geometry.deleteAttribute("normal"),m.geometry.deleteAttribute("uv"),m.onBeforeRender=function(q,z,j){this.matrixWorld.copyPosition(j.matrixWorld)},Object.defineProperty(m.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(m)),Tf.copy(O.backgroundRotation),Tf.x*=-1,Tf.y*=-1,Tf.z*=-1,G.isCubeTexture&&G.isRenderTargetTexture===!1&&(Tf.y*=-1,Tf.z*=-1),m.material.uniforms.envMap.value=G,m.material.uniforms.flipEnvMap.value=G.isCubeTexture&&G.isRenderTargetTexture===!1?-1:1,m.material.uniforms.backgroundBlurriness.value=O.backgroundBlurriness,m.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,m.material.uniforms.backgroundRotation.value.setFromMatrix4(LV.makeRotationFromEuler(Tf)),m.material.toneMapped=ai.getTransfer(G.colorSpace)!==Vi,(v!==G||x!==G.version||S!==i.toneMapping)&&(m.material.needsUpdate=!0,v=G,x=G.version,S=i.toneMapping),m.layers.enableAll(),L.unshift(m,m.geometry,m.material,0,0,null)):G&&G.isTexture&&(h===void 0&&(h=new zi(new Ty(2,2),new Ja({name:"BackgroundMaterial",uniforms:E0(Ga.background.uniforms),vertexShader:Ga.background.vertexShader,fragmentShader:Ga.background.fragmentShader,side:Nl,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(h)),h.material.uniforms.t2D.value=G,h.material.uniforms.backgroundIntensity.value=O.backgroundIntensity,h.material.toneMapped=ai.getTransfer(G.colorSpace)!==Vi,G.matrixAutoUpdate===!0&&G.updateMatrix(),h.material.uniforms.uvTransform.value.copy(G.matrix),(v!==G||x!==G.version||S!==i.toneMapping)&&(h.material.needsUpdate=!0,v=G,x=G.version,S=i.toneMapping),h.layers.enableAll(),L.unshift(h,h.geometry,h.material,0,0,null))}function E(L,O){L.getRGB(j2,q7(i)),n.buffers.color.setClear(j2.r,j2.g,j2.b,O,a)}function B(){m!==void 0&&(m.geometry.dispose(),m.material.dispose()),h!==void 0&&(h.geometry.dispose(),h.material.dispose())}return{getClearColor:function(){return l},setClearColor:function(L,O=1){l.set(L),u=O,E(l,u)},getClearAlpha:function(){return u},setClearAlpha:function(L){u=L,E(l,u)},render:R,addToRenderList:C,dispose:B}}function BV(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=x(null);let s=r,a=!1;function l(V,Y,ee,te,re){let ne=!1;const Q=v(te,ee,Y);s!==Q&&(s=Q,h(s.object)),ne=S(V,te,ee,re),ne&&w(V,te,ee,re),re!==null&&e.update(re,i.ELEMENT_ARRAY_BUFFER),(ne||a)&&(a=!1,O(V,Y,ee,te),re!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(re).buffer))}function u(){return i.createVertexArray()}function h(V){return i.bindVertexArray(V)}function m(V){return i.deleteVertexArray(V)}function v(V,Y,ee){const te=ee.wireframe===!0;let re=n[V.id];re===void 0&&(re={},n[V.id]=re);let ne=re[Y.id];ne===void 0&&(ne={},re[Y.id]=ne);let Q=ne[te];return Q===void 0&&(Q=x(u()),ne[te]=Q),Q}function x(V){const Y=[],ee=[],te=[];for(let re=0;re<t;re++)Y[re]=0,ee[re]=0,te[re]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:Y,enabledAttributes:ee,attributeDivisors:te,object:V,attributes:{},index:null}}function S(V,Y,ee,te){const re=s.attributes,ne=Y.attributes;let Q=0;const ae=ee.getAttributes();for(const de in ae)if(ae[de].location>=0){const be=re[de];let ue=ne[de];if(ue===void 0&&(de==="instanceMatrix"&&V.instanceMatrix&&(ue=V.instanceMatrix),de==="instanceColor"&&V.instanceColor&&(ue=V.instanceColor)),be===void 0||be.attribute!==ue||ue&&be.data!==ue.data)return!0;Q++}return s.attributesNum!==Q||s.index!==te}function w(V,Y,ee,te){const re={},ne=Y.attributes;let Q=0;const ae=ee.getAttributes();for(const de in ae)if(ae[de].location>=0){let be=ne[de];be===void 0&&(de==="instanceMatrix"&&V.instanceMatrix&&(be=V.instanceMatrix),de==="instanceColor"&&V.instanceColor&&(be=V.instanceColor));const ue={};ue.attribute=be,be&&be.data&&(ue.data=be.data),re[de]=ue,Q++}s.attributes=re,s.attributesNum=Q,s.index=te}function R(){const V=s.newAttributes;for(let Y=0,ee=V.length;Y<ee;Y++)V[Y]=0}function C(V){E(V,0)}function E(V,Y){const ee=s.newAttributes,te=s.enabledAttributes,re=s.attributeDivisors;ee[V]=1,te[V]===0&&(i.enableVertexAttribArray(V),te[V]=1),re[V]!==Y&&(i.vertexAttribDivisor(V,Y),re[V]=Y)}function B(){const V=s.newAttributes,Y=s.enabledAttributes;for(let ee=0,te=Y.length;ee<te;ee++)Y[ee]!==V[ee]&&(i.disableVertexAttribArray(ee),Y[ee]=0)}function L(V,Y,ee,te,re,ne,Q){Q===!0?i.vertexAttribIPointer(V,Y,ee,re,ne):i.vertexAttribPointer(V,Y,ee,te,re,ne)}function O(V,Y,ee,te){R();const re=te.attributes,ne=ee.getAttributes(),Q=Y.defaultAttributeValues;for(const ae in ne){const de=ne[ae];if(de.location>=0){let Te=re[ae];if(Te===void 0&&(ae==="instanceMatrix"&&V.instanceMatrix&&(Te=V.instanceMatrix),ae==="instanceColor"&&V.instanceColor&&(Te=V.instanceColor)),Te!==void 0){const be=Te.normalized,ue=Te.itemSize,we=e.get(Te);if(we===void 0)continue;const We=we.buffer,Ne=we.type,ze=we.bytesPerElement,Se=Ne===i.INT||Ne===i.UNSIGNED_INT||Te.gpuType===Ns;if(Te.isInterleavedBufferAttribute){const Ce=Te.data,dt=Ce.stride,At=Te.offset;if(Ce.isInstancedInterleavedBuffer){for(let wt=0;wt<de.locationSize;wt++)E(de.location+wt,Ce.meshPerAttribute);V.isInstancedMesh!==!0&&te._maxInstanceCount===void 0&&(te._maxInstanceCount=Ce.meshPerAttribute*Ce.count)}else for(let wt=0;wt<de.locationSize;wt++)C(de.location+wt);i.bindBuffer(i.ARRAY_BUFFER,We);for(let wt=0;wt<de.locationSize;wt++)L(de.location+wt,ue/de.locationSize,Ne,be,dt*ze,(At+ue/de.locationSize*wt)*ze,Se)}else{if(Te.isInstancedBufferAttribute){for(let Ce=0;Ce<de.locationSize;Ce++)E(de.location+Ce,Te.meshPerAttribute);V.isInstancedMesh!==!0&&te._maxInstanceCount===void 0&&(te._maxInstanceCount=Te.meshPerAttribute*Te.count)}else for(let Ce=0;Ce<de.locationSize;Ce++)C(de.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,We);for(let Ce=0;Ce<de.locationSize;Ce++)L(de.location+Ce,ue/de.locationSize,Ne,be,ue*ze,ue/de.locationSize*Ce*ze,Se)}}else if(Q!==void 0){const be=Q[ae];if(be!==void 0)switch(be.length){case 2:i.vertexAttrib2fv(de.location,be);break;case 3:i.vertexAttrib3fv(de.location,be);break;case 4:i.vertexAttrib4fv(de.location,be);break;default:i.vertexAttrib1fv(de.location,be)}}}}B()}function G(){j();for(const V in n){const Y=n[V];for(const ee in Y){const te=Y[ee];for(const re in te)m(te[re].object),delete te[re];delete Y[ee]}delete n[V]}}function q(V){if(n[V.id]===void 0)return;const Y=n[V.id];for(const ee in Y){const te=Y[ee];for(const re in te)m(te[re].object),delete te[re];delete Y[ee]}delete n[V.id]}function z(V){for(const Y in n){const ee=n[Y];if(ee[V.id]===void 0)continue;const te=ee[V.id];for(const re in te)m(te[re].object),delete te[re];delete ee[V.id]}}function j(){F(),a=!0,s!==r&&(s=r,h(s.object))}function F(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:l,reset:j,resetDefaultState:F,dispose:G,releaseStatesOfGeometry:q,releaseStatesOfProgram:z,initAttributes:R,enableAttribute:C,disableUnusedAttributes:B}}function OV(i,e,t){let n;function r(h){n=h}function s(h,m){i.drawArrays(n,h,m),t.update(m,n,1)}function a(h,m,v){v!==0&&(i.drawArraysInstanced(n,h,m,v),t.update(m,n,v))}function l(h,m,v){if(v===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,h,0,m,0,v);let S=0;for(let w=0;w<v;w++)S+=m[w];t.update(S,n,1)}function u(h,m,v,x){if(v===0)return;const S=e.get("WEBGL_multi_draw");if(S===null)for(let w=0;w<h.length;w++)a(h[w],m[w],x[w]);else{S.multiDrawArraysInstancedWEBGL(n,h,0,m,0,x,0,v);let w=0;for(let R=0;R<v;R++)w+=m[R]*x[R];t.update(w,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=l,this.renderMultiDrawInstances=u}function IV(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const z=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(z.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(z){return!(z!==ks&&n.convert(z)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(z){const j=z===Gs&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(z!==aa&&n.convert(z)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&z!==$r&&!j)}function u(z){if(z==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";z="mediump"}return z==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const m=u(h);m!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",m,"instead."),h=m);const v=t.logarithmicDepthBuffer===!0,x=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),S=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),R=i.getParameter(i.MAX_TEXTURE_SIZE),C=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),E=i.getParameter(i.MAX_VERTEX_ATTRIBS),B=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),L=i.getParameter(i.MAX_VARYING_VECTORS),O=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),G=w>0,q=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:a,textureTypeReadable:l,precision:h,logarithmicDepthBuffer:v,reverseDepthBuffer:x,maxTextures:S,maxVertexTextures:w,maxTextureSize:R,maxCubemapSize:C,maxAttributes:E,maxVertexUniforms:B,maxVaryings:L,maxFragmentUniforms:O,vertexTextures:G,maxSamples:q}}function FV(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new Yl,l=new Vn,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(v,x){const S=v.length!==0||x||n!==0||r;return r=x,n=v.length,S},this.beginShadows=function(){s=!0,m(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(v,x){t=m(v,x,0)},this.setState=function(v,x,S){const w=v.clippingPlanes,R=v.clipIntersection,C=v.clipShadows,E=i.get(v);if(!r||w===null||w.length===0||s&&!C)s?m(null):h();else{const B=s?0:n,L=B*4;let O=E.clippingState||null;u.value=O,O=m(w,x,L,S);for(let G=0;G!==L;++G)O[G]=t[G];E.clippingState=O,this.numIntersection=R?this.numPlanes:0,this.numPlanes+=B}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function m(v,x,S,w){const R=v!==null?v.length:0;let C=null;if(R!==0){if(C=u.value,w!==!0||C===null){const E=S+R*4,B=x.matrixWorldInverse;l.getNormalMatrix(B),(C===null||C.length<E)&&(C=new Float32Array(E));for(let L=0,O=S;L!==R;++L,O+=4)a.copy(v[L]).applyMatrix4(B,l),a.normal.toArray(C,O),C[O+3]=a.constant}u.value=C,u.needsUpdate=!0}return e.numPlanes=R,e.numIntersection=0,C}}function kV(i){let e=new WeakMap;function t(a,l){return l===zh?a.mapping=Qo:l===Gh&&(a.mapping=Ko),a}function n(a){if(a&&a.isTexture){const l=a.mapping;if(l===zh||l===Gh)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 H7(u.height);return h.fromEquirectangularTexture(i,a),e.set(a,h),a.addEventListener("dispose",r),t(h.texture,a.mapping)}else return null}}return a}function r(a){const l=a.target;l.removeEventListener("dispose",r);const u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Hd=4,P5=[.125,.215,.35,.446,.526,.582],zf=20,w3=new kg,L5=new an;let M3=null,E3=0,C3=0,R3=!1;const Bf=(1+Math.sqrt(5))/2,vd=1/Bf,U5=[new he(-Bf,vd,0),new he(Bf,vd,0),new he(-vd,0,Bf),new he(vd,0,Bf),new he(0,Bf,-vd),new he(0,Bf,vd),new he(-1,1,-1),new he(1,1,-1),new he(-1,1,1),new he(1,1,1)];let B5=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,r=100){M3=this._renderer.getRenderTarget(),E3=this._renderer.getActiveCubeFace(),C3=this._renderer.getActiveMipmapLevel(),R3=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=F5(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=I5(),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(M3,E3,C3),this._renderer.xr.enabled=R3,e.scissorTest=!1,W2(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Qo||e.mapping===Ko?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),M3=this._renderer.getRenderTarget(),E3=this._renderer.getActiveCubeFace(),C3=this._renderer.getActiveMipmapLevel(),R3=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:gs,minFilter:gs,generateMipmaps:!1,type:Gs,format:ks,colorSpace:Ro,depthBuffer:!1},r=O5(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=O5(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=zV(s)),this._blurMaterial=GV(s,e,t)}return r}_compileMaterial(e){const t=new zi(this._lodPlanes[0],e);this._renderer.compile(t,w3)}_sceneToCubeUV(e,t,n,r){const l=new ya(90,1,t,n),u=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],m=this._renderer,v=m.autoClear,x=m.toneMapping;m.getClearColor(L5),m.toneMapping=Za,m.autoClear=!1;const S=new pA({name:"PMREM.Background",side:hr,depthWrite:!1,depthTest:!1}),w=new zi(new $h,S);let R=!1;const C=e.background;C?C.isColor&&(S.color.copy(C),e.background=null,R=!0):(S.color.copy(L5),R=!0);for(let E=0;E<6;E++){const B=E%3;B===0?(l.up.set(0,u[E],0),l.lookAt(h[E],0,0)):B===1?(l.up.set(0,0,u[E]),l.lookAt(0,h[E],0)):(l.up.set(0,u[E],0),l.lookAt(0,0,h[E]));const L=this._cubeSize;W2(r,B*L,E>2?L:0,L,L),m.setRenderTarget(r),R&&m.render(w,l),m.render(e,l)}w.geometry.dispose(),w.material.dispose(),m.toneMapping=x,m.autoClear=v,e.background=C}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Qo||e.mapping===Ko;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=F5()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=I5());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new zi(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const u=this._cubeSize;W2(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(a,w3)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),l=U5[(r-s-1)%U5.length];this._blur(e,s-1,s,a,l)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,l){const u=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const m=3,v=new zi(this._lodPlanes[r],h),x=h.uniforms,S=this._sizeLods[n]-1,w=isFinite(s)?Math.PI/(2*S):2*Math.PI/(2*zf-1),R=s/w,C=isFinite(s)?1+Math.floor(m*R):zf;C>zf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${zf}`);const E=[];let B=0;for(let z=0;z<zf;++z){const j=z/R,F=Math.exp(-j*j/2);E.push(F),z===0?B+=F:z<C&&(B+=2*F)}for(let z=0;z<E.length;z++)E[z]=E[z]/B;x.envMap.value=e.texture,x.samples.value=C,x.weights.value=E,x.latitudinal.value=a==="latitudinal",l&&(x.poleAxis.value=l);const{_lodMax:L}=this;x.dTheta.value=w,x.mipInt.value=L-n;const O=this._sizeLods[r],G=3*O*(r>L-Hd?r-L+Hd:0),q=4*(this._cubeSize-O);W2(t,G,q,3*O,2*O),u.setRenderTarget(t),u.render(v,w3)}};function zV(i){const e=[],t=[],n=[];let r=i;const s=i-Hd+1+P5.length;for(let a=0;a<s;a++){const l=Math.pow(2,r);t.push(l);let u=1/l;a>i-Hd?u=P5[a-i+Hd-1]:a===0&&(u=0),n.push(u);const h=1/(l-2),m=-h,v=1+h,x=[m,m,v,m,v,v,m,m,v,v,m,v],S=6,w=6,R=3,C=2,E=1,B=new Float32Array(R*w*S),L=new Float32Array(C*w*S),O=new Float32Array(E*w*S);for(let q=0;q<S;q++){const z=q%3*2/3-1,j=q>2?0:-1,F=[z,j,0,z+2/3,j,0,z+2/3,j+1,0,z,j,0,z+2/3,j+1,0,z,j+1,0];B.set(F,R*w*q),L.set(x,C*w*q);const V=[q,q,q,q,q,q];O.set(V,E*w*q)}const G=new Ki;G.setAttribute("position",new wr(B,R)),G.setAttribute("uv",new wr(L,C)),G.setAttribute("faceIndex",new wr(O,E)),e.push(G),r>Hd&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function O5(i,e,t){const n=new qh(i,e,t);return n.texture.mapping=sA,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function W2(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function GV(i,e,t){const n=new Float32Array(zf),r=new he(0,1,0);return new Ja({name:"SphericalGaussianBlur",defines:{n:zf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:oM(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:Qa,depthTest:!1,depthWrite:!1})}function I5(){return new Ja({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:oM(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:Qa,depthTest:!1,depthWrite:!1})}function F5(){return new Ja({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:oM(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:Qa,depthTest:!1,depthWrite:!1})}function oM(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`}function qV(i){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const u=l.mapping,h=u===zh||u===Gh,m=u===Qo||u===Ko;if(h||m){let v=e.get(l);const x=v!==void 0?v.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==x)return t===null&&(t=new B5(i)),v=h?t.fromEquirectangular(l,v):t.fromCubemap(l,v),v.texture.pmremVersion=l.pmremVersion,e.set(l,v),v.texture;if(v!==void 0)return v.texture;{const S=l.image;return h&&S&&S.height>0||m&&S&&r(S)?(t===null&&(t=new B5(i)),v=h?t.fromEquirectangular(l):t.fromCubemap(l),v.texture.pmremVersion=l.pmremVersion,e.set(l,v),l.addEventListener("dispose",s),v.texture):null}}}return l}function r(l){let u=0;const h=6;for(let m=0;m<h;m++)l[m]!==void 0&&u++;return u===h}function s(l){const u=l.target;u.removeEventListener("dispose",s);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 VV(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&kf("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function HV(i,e,t,n){const r={},s=new WeakMap;function a(v){const x=v.target;x.index!==null&&e.remove(x.index);for(const w in x.attributes)e.remove(x.attributes[w]);x.removeEventListener("dispose",a),delete r[x.id];const S=s.get(x);S&&(e.remove(S),s.delete(x)),n.releaseStatesOfGeometry(x),x.isInstancedBufferGeometry===!0&&delete x._maxInstanceCount,t.memory.geometries--}function l(v,x){return r[x.id]===!0||(x.addEventListener("dispose",a),r[x.id]=!0,t.memory.geometries++),x}function u(v){const x=v.attributes;for(const S in x)e.update(x[S],i.ARRAY_BUFFER)}function h(v){const x=[],S=v.index,w=v.attributes.position;let R=0;if(S!==null){const B=S.array;R=S.version;for(let L=0,O=B.length;L<O;L+=3){const G=B[L+0],q=B[L+1],z=B[L+2];x.push(G,q,q,z,z,G)}}else if(w!==void 0){const B=w.array;R=w.version;for(let L=0,O=B.length/3-1;L<O;L+=3){const G=L+0,q=L+1,z=L+2;x.push(G,q,q,z,z,G)}}else return;const C=new(I7(x)?Xw:$w)(x,1);C.version=R;const E=s.get(v);E&&e.remove(E),s.set(v,C)}function m(v){const x=s.get(v);if(x){const S=v.index;S!==null&&x.version<S.version&&h(v)}else h(v);return s.get(v)}return{get:l,update:u,getWireframeAttribute:m}}function jV(i,e,t){let n;function r(x){n=x}let s,a;function l(x){s=x.type,a=x.bytesPerElement}function u(x,S){i.drawElements(n,S,s,x*a),t.update(S,n,1)}function h(x,S,w){w!==0&&(i.drawElementsInstanced(n,S,s,x*a,w),t.update(S,n,w))}function m(x,S,w){if(w===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,S,0,s,x,0,w);let C=0;for(let E=0;E<w;E++)C+=S[E];t.update(C,n,1)}function v(x,S,w,R){if(w===0)return;const C=e.get("WEBGL_multi_draw");if(C===null)for(let E=0;E<x.length;E++)h(x[E]/a,S[E],R[E]);else{C.multiDrawElementsInstancedWEBGL(n,S,0,s,x,0,R,0,w);let E=0;for(let B=0;B<w;B++)E+=S[B]*R[B];t.update(E,n,1)}}this.setMode=r,this.setIndex=l,this.render=u,this.renderInstances=h,this.renderMultiDraw=m,this.renderMultiDrawInstances=v}function WV(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,l){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=l*(s/3);break;case i.LINES:t.lines+=l*(s/2);break;case i.LINE_STRIP:t.lines+=l*(s-1);break;case i.LINE_LOOP:t.lines+=l*s;break;case i.POINTS:t.points+=l*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function $V(i,e,t){const n=new WeakMap,r=new Ln;function s(a,l,u){const h=a.morphTargetInfluences,m=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,v=m!==void 0?m.length:0;let x=n.get(l);if(x===void 0||x.count!==v){let V=function(){j.dispose(),n.delete(l),l.removeEventListener("dispose",V)};var S=V;x!==void 0&&x.texture.dispose();const w=l.morphAttributes.position!==void 0,R=l.morphAttributes.normal!==void 0,C=l.morphAttributes.color!==void 0,E=l.morphAttributes.position||[],B=l.morphAttributes.normal||[],L=l.morphAttributes.color||[];let O=0;w===!0&&(O=1),R===!0&&(O=2),C===!0&&(O=3);let G=l.attributes.position.count*O,q=1;G>e.maxTextureSize&&(q=Math.ceil(G/e.maxTextureSize),G=e.maxTextureSize);const z=new Float32Array(G*q*4*v),j=new jw(z,G,q,v);j.type=$r,j.needsUpdate=!0;const F=O*4;for(let Y=0;Y<v;Y++){const ee=E[Y],te=B[Y],re=L[Y],ne=G*q*4*Y;for(let Q=0;Q<ee.count;Q++){const ae=Q*F;w===!0&&(r.fromBufferAttribute(ee,Q),z[ne+ae+0]=r.x,z[ne+ae+1]=r.y,z[ne+ae+2]=r.z,z[ne+ae+3]=0),R===!0&&(r.fromBufferAttribute(te,Q),z[ne+ae+4]=r.x,z[ne+ae+5]=r.y,z[ne+ae+6]=r.z,z[ne+ae+7]=0),C===!0&&(r.fromBufferAttribute(re,Q),z[ne+ae+8]=r.x,z[ne+ae+9]=r.y,z[ne+ae+10]=r.z,z[ne+ae+11]=re.itemSize===4?r.w:1)}}x={count:v,texture:j,size:new gt(G,q)},n.set(l,x),l.addEventListener("dispose",V)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)u.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let w=0;for(let C=0;C<h.length;C++)w+=h[C];const R=l.morphTargetsRelative?1:1-w;u.getUniforms().setValue(i,"morphTargetBaseInfluence",R),u.getUniforms().setValue(i,"morphTargetInfluences",h)}u.getUniforms().setValue(i,"morphTargetsTexture",x.texture,t),u.getUniforms().setValue(i,"morphTargetsTextureSize",x.size)}return{update:s}}function XV(i,e,t,n){let r=new WeakMap;function s(u){const h=n.render.frame,m=u.geometry,v=e.get(u,m);if(r.get(v)!==h&&(e.update(v),r.set(v,h)),u.isInstancedMesh&&(u.hasEventListener("dispose",l)===!1&&u.addEventListener("dispose",l),r.get(u)!==h&&(t.update(u.instanceMatrix,i.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,i.ARRAY_BUFFER),r.set(u,h))),u.isSkinnedMesh){const x=u.skeleton;r.get(x)!==h&&(x.update(),r.set(x,h))}return v}function a(){r=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:s,dispose:a}}const uD=new vs,k5=new qc(1,1),cD=new jw,hD=new Dk,fD=new yy,z5=[],G5=[],q5=new Float32Array(16),V5=new Float32Array(9),H5=new Float32Array(4);function X0(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=z5[r];if(s===void 0&&(s=new Float32Array(r),z5[r]=s),e!==0){n.toArray(s,0);for(let a=1,l=0;a!==e;++a)l+=t,i[a].toArray(s,l)}return s}function _s(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function ys(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function wy(i,e){let t=G5[e];t===void 0&&(t=new Int32Array(e),G5[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function YV(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function QV(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(_s(t,e))return;i.uniform2fv(this.addr,e),ys(t,e)}}function KV(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(_s(t,e))return;i.uniform3fv(this.addr,e),ys(t,e)}}function ZV(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(_s(t,e))return;i.uniform4fv(this.addr,e),ys(t,e)}}function JV(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(_s(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),ys(t,e)}else{if(_s(t,n))return;H5.set(n),i.uniformMatrix2fv(this.addr,!1,H5),ys(t,n)}}function eH(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(_s(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),ys(t,e)}else{if(_s(t,n))return;V5.set(n),i.uniformMatrix3fv(this.addr,!1,V5),ys(t,n)}}function tH(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(_s(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),ys(t,e)}else{if(_s(t,n))return;q5.set(n),i.uniformMatrix4fv(this.addr,!1,q5),ys(t,n)}}function nH(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function iH(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(_s(t,e))return;i.uniform2iv(this.addr,e),ys(t,e)}}function rH(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(_s(t,e))return;i.uniform3iv(this.addr,e),ys(t,e)}}function sH(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(_s(t,e))return;i.uniform4iv(this.addr,e),ys(t,e)}}function aH(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function oH(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(_s(t,e))return;i.uniform2uiv(this.addr,e),ys(t,e)}}function lH(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(_s(t,e))return;i.uniform3uiv(this.addr,e),ys(t,e)}}function uH(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(_s(t,e))return;i.uniform4uiv(this.addr,e),ys(t,e)}}function cH(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(k5.compareFunction=gy,s=k5):s=uD,t.setTexture2D(e||s,r)}function hH(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||hD,r)}function fH(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||fD,r)}function AH(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||cD,r)}function dH(i){switch(i){case 5126:return YV;case 35664:return QV;case 35665:return KV;case 35666:return ZV;case 35674:return JV;case 35675:return eH;case 35676:return tH;case 5124:case 35670:return nH;case 35667:case 35671:return iH;case 35668:case 35672:return rH;case 35669:case 35673:return sH;case 5125:return aH;case 36294:return oH;case 36295:return lH;case 36296:return uH;case 35678:case 36198:case 36298:case 36306:case 35682:return cH;case 35679:case 36299:case 36307:return hH;case 35680:case 36300:case 36308:case 36293:return fH;case 36289:case 36303:case 36311:case 36292:return AH}}function pH(i,e){i.uniform1fv(this.addr,e)}function mH(i,e){const t=X0(e,this.size,2);i.uniform2fv(this.addr,t)}function gH(i,e){const t=X0(e,this.size,3);i.uniform3fv(this.addr,t)}function vH(i,e){const t=X0(e,this.size,4);i.uniform4fv(this.addr,t)}function _H(i,e){const t=X0(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function yH(i,e){const t=X0(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function xH(i,e){const t=X0(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function bH(i,e){i.uniform1iv(this.addr,e)}function SH(i,e){i.uniform2iv(this.addr,e)}function TH(i,e){i.uniform3iv(this.addr,e)}function wH(i,e){i.uniform4iv(this.addr,e)}function MH(i,e){i.uniform1uiv(this.addr,e)}function EH(i,e){i.uniform2uiv(this.addr,e)}function CH(i,e){i.uniform3uiv(this.addr,e)}function RH(i,e){i.uniform4uiv(this.addr,e)}function NH(i,e,t){const n=this.cache,r=e.length,s=wy(t,r);_s(n,s)||(i.uniform1iv(this.addr,s),ys(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||uD,s[a])}function DH(i,e,t){const n=this.cache,r=e.length,s=wy(t,r);_s(n,s)||(i.uniform1iv(this.addr,s),ys(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||hD,s[a])}function PH(i,e,t){const n=this.cache,r=e.length,s=wy(t,r);_s(n,s)||(i.uniform1iv(this.addr,s),ys(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||fD,s[a])}function LH(i,e,t){const n=this.cache,r=e.length,s=wy(t,r);_s(n,s)||(i.uniform1iv(this.addr,s),ys(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||cD,s[a])}function UH(i){switch(i){case 5126:return pH;case 35664:return mH;case 35665:return gH;case 35666:return vH;case 35674:return _H;case 35675:return yH;case 35676:return xH;case 5124:case 35670:return bH;case 35667:case 35671:return SH;case 35668:case 35672:return TH;case 35669:case 35673:return wH;case 5125:return MH;case 36294:return EH;case 36295:return CH;case 36296:return RH;case 35678:case 36198:case 36298:case 36306:case 35682:return NH;case 35679:case 36299:case 36307:return DH;case 35680:case 36300:case 36308:case 36293:return PH;case 36289:case 36303:case 36311:case 36292:return LH}}class BH{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=dH(t.type)}}class OH{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=UH(t.type)}}class IH{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const l=r[s];l.setValue(e,t[l.id],n)}}}const N3=/(\w+)(\])?(\[|\.)?/g;function j5(i,e){i.seq.push(e),i.map[e.id]=e}function FH(i,e,t){const n=i.name,r=n.length;for(N3.lastIndex=0;;){const s=N3.exec(n),a=N3.lastIndex;let l=s[1];const u=s[2]==="]",h=s[3];if(u&&(l=l|0),h===void 0||h==="["&&a+2===r){j5(t,h===void 0?new BH(l,i,e):new OH(l,i,e));break}else{let v=t.map[l];v===void 0&&(v=new IH(l),j5(t,v)),t=v}}}class qv{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);FH(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const l=t[s],u=n[l.id];u.needsUpdate!==!1&&l.setValue(e,u.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function W5(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const kH=37297;let zH=0;function GH(i,e){const t=i.split(`
`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const l=a+1;n.push(`${l===e?">":" "} ${l}: ${t[a]}`)}return n.join(`
`)}const $5=new Vn;function qH(i){ai._getMatrix($5,ai.workingColorSpace,i);const e=`mat3( ${$5.elements.map(t=>t.toFixed(4))} )`;switch(ai.getTransfer(i)){case a_:return[e,"LinearTransferOETF"];case Vi:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function X5(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`

`+r+`

`+GH(i.getShaderSource(e),a)}else return r}function VH(i,e){const t=qH(e);return[`vec4 ${i}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
`)}function HH(i,e){let t;switch(e){case N7:t="Linear";break;case D7:t="Reinhard";break;case P7:t="Cineon";break;case L7:t="ACESFilmic";break;case U7:t="AgX";break;case B7:t="Neutral";break;case GF:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const $2=new he;function jH(){ai.getLuminanceCoefficients($2);const i=$2.x.toFixed(4),e=$2.y.toFixed(4),t=$2.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${i}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
`)}function WH(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(_m).join(`
`)}function $H(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
`)}function XH(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let l=1;s.type===i.FLOAT_MAT2&&(l=2),s.type===i.FLOAT_MAT3&&(l=3),s.type===i.FLOAT_MAT4&&(l=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:l}}return t}function _m(i){return i!==""}function Y5(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Q5(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const YH=/^[ \t]*#include +<([\w\d./]+)>/gm;function ZS(i){return i.replace(YH,KH)}const QH=new Map;function KH(i,e){let t=Zn[e];if(t===void 0){const n=QH.get(e);if(n!==void 0)t=Zn[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 ZS(t)}const ZH=/#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 K5(i){return i.replace(ZH,JH)}function JH(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Z5(i){let e=`precision ${i.precision} float;
	precision ${i.precision} int;
	precision ${i.precision} sampler2D;
	precision ${i.precision} samplerCube;
	precision ${i.precision} sampler3D;
	precision ${i.precision} sampler2DArray;
	precision ${i.precision} sampler2DShadow;
	precision ${i.precision} samplerCubeShadow;
	precision ${i.precision} sampler2DArrayShadow;
	precision ${i.precision} isampler2D;
	precision ${i.precision} isampler3D;
	precision ${i.precision} isamplerCube;
	precision ${i.precision} isampler2DArray;
	precision ${i.precision} usampler2D;
	precision ${i.precision} usampler3D;
	precision ${i.precision} usamplerCube;
	precision ${i.precision} usampler2DArray;
	`;return i.precision==="highp"?e+=`
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function ej(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===yw?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===OF?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===xo&&(e="SHADOWMAP_TYPE_VSM"),e}function tj(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Qo:case Ko:e="ENVMAP_TYPE_CUBE";break;case sA:e="ENVMAP_TYPE_CUBE_UV";break}return e}function nj(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Ko:e="ENVMAP_MODE_REFRACTION";break}return e}function ij(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Lg:e="ENVMAP_BLENDING_MULTIPLY";break;case C7:e="ENVMAP_BLENDING_MIX";break;case R7:e="ENVMAP_BLENDING_ADD";break}return e}function rj(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function sj(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,l=t.fragmentShader;const u=ej(t),h=tj(t),m=nj(t),v=ij(t),x=rj(t),S=WH(t),w=$H(s),R=r.createProgram();let C,E,B=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(C=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w].filter(_m).join(`
`),C.length>0&&(C+=`
`),E=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w].filter(_m).join(`
`),E.length>0&&(E+=`
`)):(C=[Z5(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w,t.extensionClipCullDistance?"#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 "+m:"",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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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",`
`].filter(_m).join(`
`),E=[Z5(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,w,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 "+m:"",t.envMap?"#define "+v:"",x?"#define CUBEUV_TEXEL_WIDTH "+x.texelWidth:"",x?"#define CUBEUV_TEXEL_HEIGHT "+x.texelHeight:"",x?"#define CUBEUV_MAX_MIP "+x.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_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Za?"#define TONE_MAPPING":"",t.toneMapping!==Za?Zn.tonemapping_pars_fragment:"",t.toneMapping!==Za?HH("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Zn.colorspace_pars_fragment,VH("linearToOutputTexel",t.outputColorSpace),jH(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(_m).join(`
`)),a=ZS(a),a=Y5(a,t),a=Q5(a,t),l=ZS(l),l=Y5(l,t),l=Q5(l,t),a=K5(a),l=K5(l),t.isRawShaderMaterial!==!0&&(B=`#version 300 es
`,C=[S,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+C,E=["#define varying in",t.glslVersion===WC?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===WC?"":"#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(`
`)+`
`+E);const L=B+C+a,O=B+E+l,G=W5(r,r.VERTEX_SHADER,L),q=W5(r,r.FRAGMENT_SHADER,O);r.attachShader(R,G),r.attachShader(R,q),t.index0AttributeName!==void 0?r.bindAttribLocation(R,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(R,0,"position"),r.linkProgram(R);function z(Y){if(i.debug.checkShaderErrors){const ee=r.getProgramInfoLog(R).trim(),te=r.getShaderInfoLog(G).trim(),re=r.getShaderInfoLog(q).trim();let ne=!0,Q=!0;if(r.getProgramParameter(R,r.LINK_STATUS)===!1)if(ne=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,R,G,q);else{const ae=X5(r,G,"vertex"),de=X5(r,q,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(R,r.VALIDATE_STATUS)+`

Material Name: `+Y.name+`
Material Type: `+Y.type+`

Program Info Log: `+ee+`
`+ae+`
`+de)}else ee!==""?console.warn("THREE.WebGLProgram: Program Info Log:",ee):(te===""||re==="")&&(Q=!1);Q&&(Y.diagnostics={runnable:ne,programLog:ee,vertexShader:{log:te,prefix:C},fragmentShader:{log:re,prefix:E}})}r.deleteShader(G),r.deleteShader(q),j=new qv(r,R),F=XH(r,R)}let j;this.getUniforms=function(){return j===void 0&&z(this),j};let F;this.getAttributes=function(){return F===void 0&&z(this),F};let V=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return V===!1&&(V=r.getProgramParameter(R,kH)),V},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(R),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=zH++,this.cacheKey=e,this.usedTimes=1,this.program=R,this.vertexShader=G,this.fragmentShader=q,this}let aj=0;class oj{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new lj(e),t.set(e,n)),n}}class lj{constructor(e){this.id=aj++,this.code=e,this.usedTimes=0}}function uj(i,e,t,n,r,s,a){const l=new Ww,u=new oj,h=new Set,m=[],v=r.logarithmicDepthBuffer,x=r.vertexTextures;let S=r.precision;const w={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 R(F){return h.add(F),F===0?"uv":`uv${F}`}function C(F,V,Y,ee,te){const re=ee.fog,ne=te.geometry,Q=F.isMeshStandardMaterial?ee.environment:null,ae=(F.isMeshStandardMaterial?t:e).get(F.envMap||Q),de=ae&&ae.mapping===sA?ae.image.height:null,Te=w[F.type];F.precision!==null&&(S=r.getMaxPrecision(F.precision),S!==F.precision&&console.warn("THREE.WebGLProgram.getParameters:",F.precision,"not supported, using",S,"instead."));const be=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,ue=be!==void 0?be.length:0;let we=0;ne.morphAttributes.position!==void 0&&(we=1),ne.morphAttributes.normal!==void 0&&(we=2),ne.morphAttributes.color!==void 0&&(we=3);let We,Ne,ze,Se;if(Te){const pn=Ga[Te];We=pn.vertexShader,Ne=pn.fragmentShader}else We=F.vertexShader,Ne=F.fragmentShader,u.update(F),ze=u.getVertexShaderID(F),Se=u.getFragmentShaderID(F);const Ce=i.getRenderTarget(),dt=i.state.buffers.depth.getReversed(),At=te.isInstancedMesh===!0,wt=te.isBatchedMesh===!0,Ft=!!F.map,$e=!!F.matcap,rt=!!ae,ce=!!F.aoMap,Gt=!!F.lightMap,ht=!!F.bumpMap,Pt=!!F.normalMap,yt=!!F.displacementMap,en=!!F.emissiveMap,xt=!!F.metalnessMap,fe=!!F.roughnessMap,X=F.anisotropy>0,le=F.clearcoat>0,Re=F.dispersion>0,pe=F.iridescence>0,Me=F.sheen>0,nt=F.transmission>0,lt=X&&!!F.anisotropyMap,Ot=le&&!!F.clearcoatMap,jt=le&&!!F.clearcoatNormalMap,pt=le&&!!F.clearcoatRoughnessMap,Yt=pe&&!!F.iridescenceMap,rn=pe&&!!F.iridescenceThicknessMap,$t=Me&&!!F.sheenColorMap,kt=Me&&!!F.sheenRoughnessMap,Vt=!!F.specularMap,Nn=!!F.specularColorMap,_i=!!F.specularIntensityMap,me=nt&&!!F.transmissionMap,bt=nt&&!!F.thicknessMap,tt=!!F.gradientMap,St=!!F.alphaMap,qt=F.alphaTest>0,Ht=!!F.alphaHash,xn=!!F.extensions;let qi=Za;F.toneMapped&&(Ce===null||Ce.isXRRenderTarget===!0)&&(qi=i.toneMapping);const rr={shaderID:Te,shaderType:F.type,shaderName:F.name,vertexShader:We,fragmentShader:Ne,defines:F.defines,customVertexShaderID:ze,customFragmentShaderID:Se,isRawShaderMaterial:F.isRawShaderMaterial===!0,glslVersion:F.glslVersion,precision:S,batching:wt,batchingColor:wt&&te._colorsTexture!==null,instancing:At,instancingColor:At&&te.instanceColor!==null,instancingMorph:At&&te.morphTexture!==null,supportsVertexTextures:x,outputColorSpace:Ce===null?i.outputColorSpace:Ce.isXRRenderTarget===!0?Ce.texture.colorSpace:Ro,alphaToCoverage:!!F.alphaToCoverage,map:Ft,matcap:$e,envMap:rt,envMapMode:rt&&ae.mapping,envMapCubeUVHeight:de,aoMap:ce,lightMap:Gt,bumpMap:ht,normalMap:Pt,displacementMap:x&&yt,emissiveMap:en,normalMapObjectSpace:Pt&&F.normalMapType===O7,normalMapTangentSpace:Pt&&F.normalMapType===Dc,metalnessMap:xt,roughnessMap:fe,anisotropy:X,anisotropyMap:lt,clearcoat:le,clearcoatMap:Ot,clearcoatNormalMap:jt,clearcoatRoughnessMap:pt,dispersion:Re,iridescence:pe,iridescenceMap:Yt,iridescenceThicknessMap:rn,sheen:Me,sheenColorMap:$t,sheenRoughnessMap:kt,specularMap:Vt,specularColorMap:Nn,specularIntensityMap:_i,transmission:nt,transmissionMap:me,thicknessMap:bt,gradientMap:tt,opaque:F.transparent===!1&&F.blending===Ka&&F.alphaToCoverage===!1,alphaMap:St,alphaTest:qt,alphaHash:Ht,combine:F.combine,mapUv:Ft&&R(F.map.channel),aoMapUv:ce&&R(F.aoMap.channel),lightMapUv:Gt&&R(F.lightMap.channel),bumpMapUv:ht&&R(F.bumpMap.channel),normalMapUv:Pt&&R(F.normalMap.channel),displacementMapUv:yt&&R(F.displacementMap.channel),emissiveMapUv:en&&R(F.emissiveMap.channel),metalnessMapUv:xt&&R(F.metalnessMap.channel),roughnessMapUv:fe&&R(F.roughnessMap.channel),anisotropyMapUv:lt&&R(F.anisotropyMap.channel),clearcoatMapUv:Ot&&R(F.clearcoatMap.channel),clearcoatNormalMapUv:jt&&R(F.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:pt&&R(F.clearcoatRoughnessMap.channel),iridescenceMapUv:Yt&&R(F.iridescenceMap.channel),iridescenceThicknessMapUv:rn&&R(F.iridescenceThicknessMap.channel),sheenColorMapUv:$t&&R(F.sheenColorMap.channel),sheenRoughnessMapUv:kt&&R(F.sheenRoughnessMap.channel),specularMapUv:Vt&&R(F.specularMap.channel),specularColorMapUv:Nn&&R(F.specularColorMap.channel),specularIntensityMapUv:_i&&R(F.specularIntensityMap.channel),transmissionMapUv:me&&R(F.transmissionMap.channel),thicknessMapUv:bt&&R(F.thicknessMap.channel),alphaMapUv:St&&R(F.alphaMap.channel),vertexTangents:!!ne.attributes.tangent&&(Pt||X),vertexColors:F.vertexColors,vertexAlphas:F.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,pointsUvs:te.isPoints===!0&&!!ne.attributes.uv&&(Ft||St),fog:!!re,useFog:F.fog===!0,fogExp2:!!re&&re.isFogExp2,flatShading:F.flatShading===!0,sizeAttenuation:F.sizeAttenuation===!0,logarithmicDepthBuffer:v,reverseDepthBuffer:dt,skinning:te.isSkinnedMesh===!0,morphTargets:ne.morphAttributes.position!==void 0,morphNormals:ne.morphAttributes.normal!==void 0,morphColors:ne.morphAttributes.color!==void 0,morphTargetsCount:ue,morphTextureStride:we,numDirLights:V.directional.length,numPointLights:V.point.length,numSpotLights:V.spot.length,numSpotLightMaps:V.spotLightMap.length,numRectAreaLights:V.rectArea.length,numHemiLights:V.hemi.length,numDirLightShadows:V.directionalShadowMap.length,numPointLightShadows:V.pointShadowMap.length,numSpotLightShadows:V.spotShadowMap.length,numSpotLightShadowsWithMaps:V.numSpotLightShadowsWithMaps,numLightProbes:V.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:F.dithering,shadowMapEnabled:i.shadowMap.enabled&&Y.length>0,shadowMapType:i.shadowMap.type,toneMapping:qi,decodeVideoTexture:Ft&&F.map.isVideoTexture===!0&&ai.getTransfer(F.map.colorSpace)===Vi,decodeVideoTextureEmissive:en&&F.emissiveMap.isVideoTexture===!0&&ai.getTransfer(F.emissiveMap.colorSpace)===Vi,premultipliedAlpha:F.premultipliedAlpha,doubleSided:F.side===as,flipSided:F.side===hr,useDepthPacking:F.depthPacking>=0,depthPacking:F.depthPacking||0,index0AttributeName:F.index0AttributeName,extensionClipCullDistance:xn&&F.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(xn&&F.extensions.multiDraw===!0||wt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:F.customProgramCacheKey()};return rr.vertexUv1s=h.has(1),rr.vertexUv2s=h.has(2),rr.vertexUv3s=h.has(3),h.clear(),rr}function E(F){const V=[];if(F.shaderID?V.push(F.shaderID):(V.push(F.customVertexShaderID),V.push(F.customFragmentShaderID)),F.defines!==void 0)for(const Y in F.defines)V.push(Y),V.push(F.defines[Y]);return F.isRawShaderMaterial===!1&&(B(V,F),L(V,F),V.push(i.outputColorSpace)),V.push(F.customProgramCacheKey),V.join()}function B(F,V){F.push(V.precision),F.push(V.outputColorSpace),F.push(V.envMapMode),F.push(V.envMapCubeUVHeight),F.push(V.mapUv),F.push(V.alphaMapUv),F.push(V.lightMapUv),F.push(V.aoMapUv),F.push(V.bumpMapUv),F.push(V.normalMapUv),F.push(V.displacementMapUv),F.push(V.emissiveMapUv),F.push(V.metalnessMapUv),F.push(V.roughnessMapUv),F.push(V.anisotropyMapUv),F.push(V.clearcoatMapUv),F.push(V.clearcoatNormalMapUv),F.push(V.clearcoatRoughnessMapUv),F.push(V.iridescenceMapUv),F.push(V.iridescenceThicknessMapUv),F.push(V.sheenColorMapUv),F.push(V.sheenRoughnessMapUv),F.push(V.specularMapUv),F.push(V.specularColorMapUv),F.push(V.specularIntensityMapUv),F.push(V.transmissionMapUv),F.push(V.thicknessMapUv),F.push(V.combine),F.push(V.fogExp2),F.push(V.sizeAttenuation),F.push(V.morphTargetsCount),F.push(V.morphAttributeCount),F.push(V.numDirLights),F.push(V.numPointLights),F.push(V.numSpotLights),F.push(V.numSpotLightMaps),F.push(V.numHemiLights),F.push(V.numRectAreaLights),F.push(V.numDirLightShadows),F.push(V.numPointLightShadows),F.push(V.numSpotLightShadows),F.push(V.numSpotLightShadowsWithMaps),F.push(V.numLightProbes),F.push(V.shadowMapType),F.push(V.toneMapping),F.push(V.numClippingPlanes),F.push(V.numClipIntersection),F.push(V.depthPacking)}function L(F,V){l.disableAll(),V.supportsVertexTextures&&l.enable(0),V.instancing&&l.enable(1),V.instancingColor&&l.enable(2),V.instancingMorph&&l.enable(3),V.matcap&&l.enable(4),V.envMap&&l.enable(5),V.normalMapObjectSpace&&l.enable(6),V.normalMapTangentSpace&&l.enable(7),V.clearcoat&&l.enable(8),V.iridescence&&l.enable(9),V.alphaTest&&l.enable(10),V.vertexColors&&l.enable(11),V.vertexAlphas&&l.enable(12),V.vertexUv1s&&l.enable(13),V.vertexUv2s&&l.enable(14),V.vertexUv3s&&l.enable(15),V.vertexTangents&&l.enable(16),V.anisotropy&&l.enable(17),V.alphaHash&&l.enable(18),V.batching&&l.enable(19),V.dispersion&&l.enable(20),V.batchingColor&&l.enable(21),F.push(l.mask),l.disableAll(),V.fog&&l.enable(0),V.useFog&&l.enable(1),V.flatShading&&l.enable(2),V.logarithmicDepthBuffer&&l.enable(3),V.reverseDepthBuffer&&l.enable(4),V.skinning&&l.enable(5),V.morphTargets&&l.enable(6),V.morphNormals&&l.enable(7),V.morphColors&&l.enable(8),V.premultipliedAlpha&&l.enable(9),V.shadowMapEnabled&&l.enable(10),V.doubleSided&&l.enable(11),V.flipSided&&l.enable(12),V.useDepthPacking&&l.enable(13),V.dithering&&l.enable(14),V.transmission&&l.enable(15),V.sheen&&l.enable(16),V.opaque&&l.enable(17),V.pointsUvs&&l.enable(18),V.decodeVideoTexture&&l.enable(19),V.decodeVideoTextureEmissive&&l.enable(20),V.alphaToCoverage&&l.enable(21),F.push(l.mask)}function O(F){const V=w[F.type];let Y;if(V){const ee=Ga[V];Y=vy.clone(ee.uniforms)}else Y=F.uniforms;return Y}function G(F,V){let Y;for(let ee=0,te=m.length;ee<te;ee++){const re=m[ee];if(re.cacheKey===V){Y=re,++Y.usedTimes;break}}return Y===void 0&&(Y=new sj(i,V,F,s),m.push(Y)),Y}function q(F){if(--F.usedTimes===0){const V=m.indexOf(F);m[V]=m[m.length-1],m.pop(),F.destroy()}}function z(F){u.remove(F)}function j(){u.dispose()}return{getParameters:C,getProgramCacheKey:E,getUniforms:O,acquireProgram:G,releaseProgram:q,releaseShaderCache:z,programs:m,dispose:j}}function cj(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let l=i.get(a);return l===void 0&&(l={},i.set(a,l)),l}function n(a){i.delete(a)}function r(a,l,u){i.get(a)[l]=u}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function hj(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function J5(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function eR(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(v,x,S,w,R,C){let E=i[e];return E===void 0?(E={id:v.id,object:v,geometry:x,material:S,groupOrder:w,renderOrder:v.renderOrder,z:R,group:C},i[e]=E):(E.id=v.id,E.object=v,E.geometry=x,E.material=S,E.groupOrder=w,E.renderOrder=v.renderOrder,E.z=R,E.group=C),e++,E}function l(v,x,S,w,R,C){const E=a(v,x,S,w,R,C);S.transmission>0?n.push(E):S.transparent===!0?r.push(E):t.push(E)}function u(v,x,S,w,R,C){const E=a(v,x,S,w,R,C);S.transmission>0?n.unshift(E):S.transparent===!0?r.unshift(E):t.unshift(E)}function h(v,x){t.length>1&&t.sort(v||hj),n.length>1&&n.sort(x||J5),r.length>1&&r.sort(x||J5)}function m(){for(let v=e,x=i.length;v<x;v++){const S=i[v];if(S.id===null)break;S.id=null,S.object=null,S.geometry=null,S.material=null,S.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:u,finish:m,sort:h}}function fj(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new eR,i.set(n,[a])):r>=s.length?(a=new eR,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Aj(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new he,color:new an};break;case"SpotLight":t={position:new he,direction:new he,color:new an,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new he,color:new an,distance:0,decay:0};break;case"HemisphereLight":t={direction:new he,skyColor:new an,groundColor:new an};break;case"RectAreaLight":t={color:new an,position:new he,halfWidth:new he,halfHeight:new he};break}return i[e.id]=t,t}}}function dj(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new gt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new gt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new gt,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let pj=0;function mj(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function gj(i){const e=new Aj,t=dj(),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 he);const r=new he,s=new kn,a=new kn;function l(h){let m=0,v=0,x=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let S=0,w=0,R=0,C=0,E=0,B=0,L=0,O=0,G=0,q=0,z=0;h.sort(mj);for(let F=0,V=h.length;F<V;F++){const Y=h[F],ee=Y.color,te=Y.intensity,re=Y.distance,ne=Y.shadow&&Y.shadow.map?Y.shadow.map.texture:null;if(Y.isAmbientLight)m+=ee.r*te,v+=ee.g*te,x+=ee.b*te;else if(Y.isLightProbe){for(let Q=0;Q<9;Q++)n.probe[Q].addScaledVector(Y.sh.coefficients[Q],te);z++}else if(Y.isDirectionalLight){const Q=e.get(Y);if(Q.color.copy(Y.color).multiplyScalar(Y.intensity),Y.castShadow){const ae=Y.shadow,de=t.get(Y);de.shadowIntensity=ae.intensity,de.shadowBias=ae.bias,de.shadowNormalBias=ae.normalBias,de.shadowRadius=ae.radius,de.shadowMapSize=ae.mapSize,n.directionalShadow[S]=de,n.directionalShadowMap[S]=ne,n.directionalShadowMatrix[S]=Y.shadow.matrix,B++}n.directional[S]=Q,S++}else if(Y.isSpotLight){const Q=e.get(Y);Q.position.setFromMatrixPosition(Y.matrixWorld),Q.color.copy(ee).multiplyScalar(te),Q.distance=re,Q.coneCos=Math.cos(Y.angle),Q.penumbraCos=Math.cos(Y.angle*(1-Y.penumbra)),Q.decay=Y.decay,n.spot[R]=Q;const ae=Y.shadow;if(Y.map&&(n.spotLightMap[G]=Y.map,G++,ae.updateMatrices(Y),Y.castShadow&&q++),n.spotLightMatrix[R]=ae.matrix,Y.castShadow){const de=t.get(Y);de.shadowIntensity=ae.intensity,de.shadowBias=ae.bias,de.shadowNormalBias=ae.normalBias,de.shadowRadius=ae.radius,de.shadowMapSize=ae.mapSize,n.spotShadow[R]=de,n.spotShadowMap[R]=ne,O++}R++}else if(Y.isRectAreaLight){const Q=e.get(Y);Q.color.copy(ee).multiplyScalar(te),Q.halfWidth.set(Y.width*.5,0,0),Q.halfHeight.set(0,Y.height*.5,0),n.rectArea[C]=Q,C++}else if(Y.isPointLight){const Q=e.get(Y);if(Q.color.copy(Y.color).multiplyScalar(Y.intensity),Q.distance=Y.distance,Q.decay=Y.decay,Y.castShadow){const ae=Y.shadow,de=t.get(Y);de.shadowIntensity=ae.intensity,de.shadowBias=ae.bias,de.shadowNormalBias=ae.normalBias,de.shadowRadius=ae.radius,de.shadowMapSize=ae.mapSize,de.shadowCameraNear=ae.camera.near,de.shadowCameraFar=ae.camera.far,n.pointShadow[w]=de,n.pointShadowMap[w]=ne,n.pointShadowMatrix[w]=Y.shadow.matrix,L++}n.point[w]=Q,w++}else if(Y.isHemisphereLight){const Q=e.get(Y);Q.skyColor.copy(Y.color).multiplyScalar(te),Q.groundColor.copy(Y.groundColor).multiplyScalar(te),n.hemi[E]=Q,E++}}C>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Kt.LTC_FLOAT_1,n.rectAreaLTC2=Kt.LTC_FLOAT_2):(n.rectAreaLTC1=Kt.LTC_HALF_1,n.rectAreaLTC2=Kt.LTC_HALF_2)),n.ambient[0]=m,n.ambient[1]=v,n.ambient[2]=x;const j=n.hash;(j.directionalLength!==S||j.pointLength!==w||j.spotLength!==R||j.rectAreaLength!==C||j.hemiLength!==E||j.numDirectionalShadows!==B||j.numPointShadows!==L||j.numSpotShadows!==O||j.numSpotMaps!==G||j.numLightProbes!==z)&&(n.directional.length=S,n.spot.length=R,n.rectArea.length=C,n.point.length=w,n.hemi.length=E,n.directionalShadow.length=B,n.directionalShadowMap.length=B,n.pointShadow.length=L,n.pointShadowMap.length=L,n.spotShadow.length=O,n.spotShadowMap.length=O,n.directionalShadowMatrix.length=B,n.pointShadowMatrix.length=L,n.spotLightMatrix.length=O+G-q,n.spotLightMap.length=G,n.numSpotLightShadowsWithMaps=q,n.numLightProbes=z,j.directionalLength=S,j.pointLength=w,j.spotLength=R,j.rectAreaLength=C,j.hemiLength=E,j.numDirectionalShadows=B,j.numPointShadows=L,j.numSpotShadows=O,j.numSpotMaps=G,j.numLightProbes=z,n.version=pj++)}function u(h,m){let v=0,x=0,S=0,w=0,R=0;const C=m.matrixWorldInverse;for(let E=0,B=h.length;E<B;E++){const L=h[E];if(L.isDirectionalLight){const O=n.directional[v];O.direction.setFromMatrixPosition(L.matrixWorld),r.setFromMatrixPosition(L.target.matrixWorld),O.direction.sub(r),O.direction.transformDirection(C),v++}else if(L.isSpotLight){const O=n.spot[S];O.position.setFromMatrixPosition(L.matrixWorld),O.position.applyMatrix4(C),O.direction.setFromMatrixPosition(L.matrixWorld),r.setFromMatrixPosition(L.target.matrixWorld),O.direction.sub(r),O.direction.transformDirection(C),S++}else if(L.isRectAreaLight){const O=n.rectArea[w];O.position.setFromMatrixPosition(L.matrixWorld),O.position.applyMatrix4(C),a.identity(),s.copy(L.matrixWorld),s.premultiply(C),a.extractRotation(s),O.halfWidth.set(L.width*.5,0,0),O.halfHeight.set(0,L.height*.5,0),O.halfWidth.applyMatrix4(a),O.halfHeight.applyMatrix4(a),w++}else if(L.isPointLight){const O=n.point[x];O.position.setFromMatrixPosition(L.matrixWorld),O.position.applyMatrix4(C),x++}else if(L.isHemisphereLight){const O=n.hemi[R];O.direction.setFromMatrixPosition(L.matrixWorld),O.direction.transformDirection(C),R++}}}return{setup:l,setupView:u,state:n}}function tR(i){const e=new gj(i),t=[],n=[];function r(m){h.camera=m,t.length=0,n.length=0}function s(m){t.push(m)}function a(m){n.push(m)}function l(){e.setup(t)}function u(m){e.setupView(t,m)}const h={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:h,setupLights:l,setupLightsView:u,pushLight:s,pushShadow:a}}function vj(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let l;return a===void 0?(l=new tR(i),e.set(r,[l])):s>=a.length?(l=new tR(i),a.push(l)):l=a[s],l}function n(){e=new WeakMap}return{get:t,dispose:n}}const _j=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,yj=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i < samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( squared_mean - mean * mean );
	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function xj(i,e,t){let n=new Fg;const r=new gt,s=new gt,a=new Ln,l=new Pz({depthPacking:$F}),u=new Lz,h={},m=t.maxTextureSize,v={[Nl]:hr,[hr]:Nl,[as]:as},x=new Ja({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new gt},radius:{value:4}},vertexShader:_j,fragmentShader:yj}),S=x.clone();S.defines.HORIZONTAL_PASS=1;const w=new Ki;w.setAttribute("position",new wr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const R=new zi(w,x),C=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=yw;let E=this.type;this.render=function(q,z,j){if(C.enabled===!1||C.autoUpdate===!1&&C.needsUpdate===!1||q.length===0)return;const F=i.getRenderTarget(),V=i.getActiveCubeFace(),Y=i.getActiveMipmapLevel(),ee=i.state;ee.setBlending(Qa),ee.buffers.color.setClear(1,1,1,1),ee.buffers.depth.setTest(!0),ee.setScissorTest(!1);const te=E!==xo&&this.type===xo,re=E===xo&&this.type!==xo;for(let ne=0,Q=q.length;ne<Q;ne++){const ae=q[ne],de=ae.shadow;if(de===void 0){console.warn("THREE.WebGLShadowMap:",ae,"has no shadow.");continue}if(de.autoUpdate===!1&&de.needsUpdate===!1)continue;r.copy(de.mapSize);const Te=de.getFrameExtents();if(r.multiply(Te),s.copy(de.mapSize),(r.x>m||r.y>m)&&(r.x>m&&(s.x=Math.floor(m/Te.x),r.x=s.x*Te.x,de.mapSize.x=s.x),r.y>m&&(s.y=Math.floor(m/Te.y),r.y=s.y*Te.y,de.mapSize.y=s.y)),de.map===null||te===!0||re===!0){const ue=this.type!==xo?{minFilter:mr,magFilter:mr}:{};de.map!==null&&de.map.dispose(),de.map=new qh(r.x,r.y,ue),de.map.texture.name=ae.name+".shadowMap",de.camera.updateProjectionMatrix()}i.setRenderTarget(de.map),i.clear();const be=de.getViewportCount();for(let ue=0;ue<be;ue++){const we=de.getViewport(ue);a.set(s.x*we.x,s.y*we.y,s.x*we.z,s.y*we.w),ee.viewport(a),de.updateMatrices(ae,ue),n=de.getFrustum(),O(z,j,de.camera,ae,this.type)}de.isPointLightShadow!==!0&&this.type===xo&&B(de,j),de.needsUpdate=!1}E=this.type,C.needsUpdate=!1,i.setRenderTarget(F,V,Y)};function B(q,z){const j=e.update(R);x.defines.VSM_SAMPLES!==q.blurSamples&&(x.defines.VSM_SAMPLES=q.blurSamples,S.defines.VSM_SAMPLES=q.blurSamples,x.needsUpdate=!0,S.needsUpdate=!0),q.mapPass===null&&(q.mapPass=new qh(r.x,r.y)),x.uniforms.shadow_pass.value=q.map.texture,x.uniforms.resolution.value=q.mapSize,x.uniforms.radius.value=q.radius,i.setRenderTarget(q.mapPass),i.clear(),i.renderBufferDirect(z,null,j,x,R,null),S.uniforms.shadow_pass.value=q.mapPass.texture,S.uniforms.resolution.value=q.mapSize,S.uniforms.radius.value=q.radius,i.setRenderTarget(q.map),i.clear(),i.renderBufferDirect(z,null,j,S,R,null)}function L(q,z,j,F){let V=null;const Y=j.isPointLight===!0?q.customDistanceMaterial:q.customDepthMaterial;if(Y!==void 0)V=Y;else if(V=j.isPointLight===!0?u:l,i.localClippingEnabled&&z.clipShadows===!0&&Array.isArray(z.clippingPlanes)&&z.clippingPlanes.length!==0||z.displacementMap&&z.displacementScale!==0||z.alphaMap&&z.alphaTest>0||z.map&&z.alphaTest>0){const ee=V.uuid,te=z.uuid;let re=h[ee];re===void 0&&(re={},h[ee]=re);let ne=re[te];ne===void 0&&(ne=V.clone(),re[te]=ne,z.addEventListener("dispose",G)),V=ne}if(V.visible=z.visible,V.wireframe=z.wireframe,F===xo?V.side=z.shadowSide!==null?z.shadowSide:z.side:V.side=z.shadowSide!==null?z.shadowSide:v[z.side],V.alphaMap=z.alphaMap,V.alphaTest=z.alphaTest,V.map=z.map,V.clipShadows=z.clipShadows,V.clippingPlanes=z.clippingPlanes,V.clipIntersection=z.clipIntersection,V.displacementMap=z.displacementMap,V.displacementScale=z.displacementScale,V.displacementBias=z.displacementBias,V.wireframeLinewidth=z.wireframeLinewidth,V.linewidth=z.linewidth,j.isPointLight===!0&&V.isMeshDistanceMaterial===!0){const ee=i.properties.get(V);ee.light=j}return V}function O(q,z,j,F,V){if(q.visible===!1)return;if(q.layers.test(z.layers)&&(q.isMesh||q.isLine||q.isPoints)&&(q.castShadow||q.receiveShadow&&V===xo)&&(!q.frustumCulled||n.intersectsObject(q))){q.modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,q.matrixWorld);const te=e.update(q),re=q.material;if(Array.isArray(re)){const ne=te.groups;for(let Q=0,ae=ne.length;Q<ae;Q++){const de=ne[Q],Te=re[de.materialIndex];if(Te&&Te.visible){const be=L(q,Te,F,V);q.onBeforeShadow(i,q,z,j,te,be,de),i.renderBufferDirect(j,null,te,be,q,de),q.onAfterShadow(i,q,z,j,te,be,de)}}}else if(re.visible){const ne=L(q,re,F,V);q.onBeforeShadow(i,q,z,j,te,ne,null),i.renderBufferDirect(j,null,te,ne,q,null),q.onAfterShadow(i,q,z,j,te,ne,null)}}const ee=q.children;for(let te=0,re=ee.length;te<re;te++)O(ee[te],z,j,F,V)}function G(q){q.target.removeEventListener("dispose",G);for(const j in h){const F=h[j],V=q.target.uuid;V in F&&(F[V].dispose(),delete F[V])}}}const bj={[Hm]:jm,[Wm]:Ym,[$m]:Qm,[kh]:Xm,[jm]:Hm,[Ym]:Wm,[Qm]:$m,[Xm]:kh};function Sj(i,e){function t(){let me=!1;const bt=new Ln;let tt=null;const St=new Ln(0,0,0,0);return{setMask:function(qt){tt!==qt&&!me&&(i.colorMask(qt,qt,qt,qt),tt=qt)},setLocked:function(qt){me=qt},setClear:function(qt,Ht,xn,qi,rr){rr===!0&&(qt*=qi,Ht*=qi,xn*=qi),bt.set(qt,Ht,xn,qi),St.equals(bt)===!1&&(i.clearColor(qt,Ht,xn,qi),St.copy(bt))},reset:function(){me=!1,tt=null,St.set(-1,0,0,0)}}}function n(){let me=!1,bt=!1,tt=null,St=null,qt=null;return{setReversed:function(Ht){if(bt!==Ht){const xn=e.get("EXT_clip_control");bt?xn.clipControlEXT(xn.LOWER_LEFT_EXT,xn.ZERO_TO_ONE_EXT):xn.clipControlEXT(xn.LOWER_LEFT_EXT,xn.NEGATIVE_ONE_TO_ONE_EXT);const qi=qt;qt=null,this.setClear(qi)}bt=Ht},getReversed:function(){return bt},setTest:function(Ht){Ht?Ce(i.DEPTH_TEST):dt(i.DEPTH_TEST)},setMask:function(Ht){tt!==Ht&&!me&&(i.depthMask(Ht),tt=Ht)},setFunc:function(Ht){if(bt&&(Ht=bj[Ht]),St!==Ht){switch(Ht){case Hm:i.depthFunc(i.NEVER);break;case jm:i.depthFunc(i.ALWAYS);break;case Wm:i.depthFunc(i.LESS);break;case kh:i.depthFunc(i.LEQUAL);break;case $m:i.depthFunc(i.EQUAL);break;case Xm:i.depthFunc(i.GEQUAL);break;case Ym:i.depthFunc(i.GREATER);break;case Qm:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}St=Ht}},setLocked:function(Ht){me=Ht},setClear:function(Ht){qt!==Ht&&(bt&&(Ht=1-Ht),i.clearDepth(Ht),qt=Ht)},reset:function(){me=!1,tt=null,St=null,qt=null,bt=!1}}}function r(){let me=!1,bt=null,tt=null,St=null,qt=null,Ht=null,xn=null,qi=null,rr=null;return{setTest:function(pn){me||(pn?Ce(i.STENCIL_TEST):dt(i.STENCIL_TEST))},setMask:function(pn){bt!==pn&&!me&&(i.stencilMask(pn),bt=pn)},setFunc:function(pn,$i,Jr){(tt!==pn||St!==$i||qt!==Jr)&&(i.stencilFunc(pn,$i,Jr),tt=pn,St=$i,qt=Jr)},setOp:function(pn,$i,Jr){(Ht!==pn||xn!==$i||qi!==Jr)&&(i.stencilOp(pn,$i,Jr),Ht=pn,xn=$i,qi=Jr)},setLocked:function(pn){me=pn},setClear:function(pn){rr!==pn&&(i.clearStencil(pn),rr=pn)},reset:function(){me=!1,bt=null,tt=null,St=null,qt=null,Ht=null,xn=null,qi=null,rr=null}}}const s=new t,a=new n,l=new r,u=new WeakMap,h=new WeakMap;let m={},v={},x=new WeakMap,S=[],w=null,R=!1,C=null,E=null,B=null,L=null,O=null,G=null,q=null,z=new an(0,0,0),j=0,F=!1,V=null,Y=null,ee=null,te=null,re=null;const ne=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Q=!1,ae=0;const de=i.getParameter(i.VERSION);de.indexOf("WebGL")!==-1?(ae=parseFloat(/^WebGL (\d)/.exec(de)[1]),Q=ae>=1):de.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(de)[1]),Q=ae>=2);let Te=null,be={};const ue=i.getParameter(i.SCISSOR_BOX),we=i.getParameter(i.VIEWPORT),We=new Ln().fromArray(ue),Ne=new Ln().fromArray(we);function ze(me,bt,tt,St){const qt=new Uint8Array(4),Ht=i.createTexture();i.bindTexture(me,Ht),i.texParameteri(me,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(me,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let xn=0;xn<tt;xn++)me===i.TEXTURE_3D||me===i.TEXTURE_2D_ARRAY?i.texImage3D(bt,0,i.RGBA,1,1,St,0,i.RGBA,i.UNSIGNED_BYTE,qt):i.texImage2D(bt+xn,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,qt);return Ht}const Se={};Se[i.TEXTURE_2D]=ze(i.TEXTURE_2D,i.TEXTURE_2D,1),Se[i.TEXTURE_CUBE_MAP]=ze(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Se[i.TEXTURE_2D_ARRAY]=ze(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Se[i.TEXTURE_3D]=ze(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),l.setClear(0),Ce(i.DEPTH_TEST),a.setFunc(kh),ht(!1),Pt(VS),Ce(i.CULL_FACE),ce(Qa);function Ce(me){m[me]!==!0&&(i.enable(me),m[me]=!0)}function dt(me){m[me]!==!1&&(i.disable(me),m[me]=!1)}function At(me,bt){return v[me]!==bt?(i.bindFramebuffer(me,bt),v[me]=bt,me===i.DRAW_FRAMEBUFFER&&(v[i.FRAMEBUFFER]=bt),me===i.FRAMEBUFFER&&(v[i.DRAW_FRAMEBUFFER]=bt),!0):!1}function wt(me,bt){let tt=S,St=!1;if(me){tt=x.get(bt),tt===void 0&&(tt=[],x.set(bt,tt));const qt=me.textures;if(tt.length!==qt.length||tt[0]!==i.COLOR_ATTACHMENT0){for(let Ht=0,xn=qt.length;Ht<xn;Ht++)tt[Ht]=i.COLOR_ATTACHMENT0+Ht;tt.length=qt.length,St=!0}}else tt[0]!==i.BACK&&(tt[0]=i.BACK,St=!0);St&&i.drawBuffers(tt)}function Ft(me){return w!==me?(i.useProgram(me),w=me,!0):!1}const $e={[Eo]:i.FUNC_ADD,[bw]:i.FUNC_SUBTRACT,[Sw]:i.FUNC_REVERSE_SUBTRACT};$e[M7]=i.MIN,$e[E7]=i.MAX;const rt={[Tw]:i.ZERO,[ww]:i.ONE,[Mw]:i.SRC_COLOR,[qm]:i.SRC_ALPHA,[Pw]:i.SRC_ALPHA_SATURATE,[Nw]:i.DST_COLOR,[Cw]:i.DST_ALPHA,[Ew]:i.ONE_MINUS_SRC_COLOR,[Vm]:i.ONE_MINUS_SRC_ALPHA,[Dw]:i.ONE_MINUS_DST_COLOR,[Rw]:i.ONE_MINUS_DST_ALPHA,[IF]:i.CONSTANT_COLOR,[FF]:i.ONE_MINUS_CONSTANT_COLOR,[kF]:i.CONSTANT_ALPHA,[zF]:i.ONE_MINUS_CONSTANT_ALPHA};function ce(me,bt,tt,St,qt,Ht,xn,qi,rr,pn){if(me===Qa){R===!0&&(dt(i.BLEND),R=!1);return}if(R===!1&&(Ce(i.BLEND),R=!0),me!==xw){if(me!==C||pn!==F){if((E!==Eo||O!==Eo)&&(i.blendEquation(i.FUNC_ADD),E=Eo,O=Eo),pn)switch(me){case Ka:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case a0:i.blendFunc(i.ONE,i.ONE);break;case o0:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case l0:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",me);break}else switch(me){case Ka:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case a0:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case o0:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case l0:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",me);break}B=null,L=null,G=null,q=null,z.set(0,0,0),j=0,C=me,F=pn}return}qt=qt||bt,Ht=Ht||tt,xn=xn||St,(bt!==E||qt!==O)&&(i.blendEquationSeparate($e[bt],$e[qt]),E=bt,O=qt),(tt!==B||St!==L||Ht!==G||xn!==q)&&(i.blendFuncSeparate(rt[tt],rt[St],rt[Ht],rt[xn]),B=tt,L=St,G=Ht,q=xn),(qi.equals(z)===!1||rr!==j)&&(i.blendColor(qi.r,qi.g,qi.b,rr),z.copy(qi),j=rr),C=me,F=!1}function Gt(me,bt){me.side===as?dt(i.CULL_FACE):Ce(i.CULL_FACE);let tt=me.side===hr;bt&&(tt=!tt),ht(tt),me.blending===Ka&&me.transparent===!1?ce(Qa):ce(me.blending,me.blendEquation,me.blendSrc,me.blendDst,me.blendEquationAlpha,me.blendSrcAlpha,me.blendDstAlpha,me.blendColor,me.blendAlpha,me.premultipliedAlpha),a.setFunc(me.depthFunc),a.setTest(me.depthTest),a.setMask(me.depthWrite),s.setMask(me.colorWrite);const St=me.stencilWrite;l.setTest(St),St&&(l.setMask(me.stencilWriteMask),l.setFunc(me.stencilFunc,me.stencilRef,me.stencilFuncMask),l.setOp(me.stencilFail,me.stencilZFail,me.stencilZPass)),en(me.polygonOffset,me.polygonOffsetFactor,me.polygonOffsetUnits),me.alphaToCoverage===!0?Ce(i.SAMPLE_ALPHA_TO_COVERAGE):dt(i.SAMPLE_ALPHA_TO_COVERAGE)}function ht(me){V!==me&&(me?i.frontFace(i.CW):i.frontFace(i.CCW),V=me)}function Pt(me){me!==T7?(Ce(i.CULL_FACE),me!==Y&&(me===VS?i.cullFace(i.BACK):me===w7?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):dt(i.CULL_FACE),Y=me}function yt(me){me!==ee&&(Q&&i.lineWidth(me),ee=me)}function en(me,bt,tt){me?(Ce(i.POLYGON_OFFSET_FILL),(te!==bt||re!==tt)&&(i.polygonOffset(bt,tt),te=bt,re=tt)):dt(i.POLYGON_OFFSET_FILL)}function xt(me){me?Ce(i.SCISSOR_TEST):dt(i.SCISSOR_TEST)}function fe(me){me===void 0&&(me=i.TEXTURE0+ne-1),Te!==me&&(i.activeTexture(me),Te=me)}function X(me,bt,tt){tt===void 0&&(Te===null?tt=i.TEXTURE0+ne-1:tt=Te);let St=be[tt];St===void 0&&(St={type:void 0,texture:void 0},be[tt]=St),(St.type!==me||St.texture!==bt)&&(Te!==tt&&(i.activeTexture(tt),Te=tt),i.bindTexture(me,bt||Se[me]),St.type=me,St.texture=bt)}function le(){const me=be[Te];me!==void 0&&me.type!==void 0&&(i.bindTexture(me.type,null),me.type=void 0,me.texture=void 0)}function Re(){try{i.compressedTexImage2D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function pe(){try{i.compressedTexImage3D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function Me(){try{i.texSubImage2D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function nt(){try{i.texSubImage3D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function lt(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function Ot(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function jt(){try{i.texStorage2D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function pt(){try{i.texStorage3D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function Yt(){try{i.texImage2D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function rn(){try{i.texImage3D.apply(i,arguments)}catch(me){console.error("THREE.WebGLState:",me)}}function $t(me){We.equals(me)===!1&&(i.scissor(me.x,me.y,me.z,me.w),We.copy(me))}function kt(me){Ne.equals(me)===!1&&(i.viewport(me.x,me.y,me.z,me.w),Ne.copy(me))}function Vt(me,bt){let tt=h.get(bt);tt===void 0&&(tt=new WeakMap,h.set(bt,tt));let St=tt.get(me);St===void 0&&(St=i.getUniformBlockIndex(bt,me.name),tt.set(me,St))}function Nn(me,bt){const St=h.get(bt).get(me);u.get(bt)!==St&&(i.uniformBlockBinding(bt,St,me.__bindingPointIndex),u.set(bt,St))}function _i(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),m={},Te=null,be={},v={},x=new WeakMap,S=[],w=null,R=!1,C=null,E=null,B=null,L=null,O=null,G=null,q=null,z=new an(0,0,0),j=0,F=!1,V=null,Y=null,ee=null,te=null,re=null,We.set(0,0,i.canvas.width,i.canvas.height),Ne.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),l.reset()}return{buffers:{color:s,depth:a,stencil:l},enable:Ce,disable:dt,bindFramebuffer:At,drawBuffers:wt,useProgram:Ft,setBlending:ce,setMaterial:Gt,setFlipSided:ht,setCullFace:Pt,setLineWidth:yt,setPolygonOffset:en,setScissorTest:xt,activeTexture:fe,bindTexture:X,unbindTexture:le,compressedTexImage2D:Re,compressedTexImage3D:pe,texImage2D:Yt,texImage3D:rn,updateUBOMapping:Vt,uniformBlockBinding:Nn,texStorage2D:jt,texStorage3D:pt,texSubImage2D:Me,texSubImage3D:nt,compressedTexSubImage2D:lt,compressedTexSubImage3D:Ot,scissor:$t,viewport:kt,reset:_i}}function Tj(i,e,t,n,r,s,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 gt,m=new WeakMap;let v;const x=new WeakMap;let S=!1;try{S=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(fe,X){return S?new OffscreenCanvas(fe,X):sg("canvas")}function R(fe,X,le){let Re=1;const pe=xt(fe);if((pe.width>le||pe.height>le)&&(Re=le/Math.max(pe.width,pe.height)),Re<1)if(typeof HTMLImageElement<"u"&&fe instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&fe instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&fe instanceof ImageBitmap||typeof VideoFrame<"u"&&fe instanceof VideoFrame){const Me=Math.floor(Re*pe.width),nt=Math.floor(Re*pe.height);v===void 0&&(v=w(Me,nt));const lt=X?w(Me,nt):v;return lt.width=Me,lt.height=nt,lt.getContext("2d").drawImage(fe,0,0,Me,nt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+pe.width+"x"+pe.height+") to ("+Me+"x"+nt+")."),lt}else return"data"in fe&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+pe.width+"x"+pe.height+")."),fe;return fe}function C(fe){return fe.generateMipmaps}function E(fe){i.generateMipmap(fe)}function B(fe){return fe.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:fe.isWebGL3DRenderTarget?i.TEXTURE_3D:fe.isWebGLArrayRenderTarget||fe.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function L(fe,X,le,Re,pe=!1){if(fe!==null){if(i[fe]!==void 0)return i[fe];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+fe+"'")}let Me=X;if(X===i.RED&&(le===i.FLOAT&&(Me=i.R32F),le===i.HALF_FLOAT&&(Me=i.R16F),le===i.UNSIGNED_BYTE&&(Me=i.R8)),X===i.RED_INTEGER&&(le===i.UNSIGNED_BYTE&&(Me=i.R8UI),le===i.UNSIGNED_SHORT&&(Me=i.R16UI),le===i.UNSIGNED_INT&&(Me=i.R32UI),le===i.BYTE&&(Me=i.R8I),le===i.SHORT&&(Me=i.R16I),le===i.INT&&(Me=i.R32I)),X===i.RG&&(le===i.FLOAT&&(Me=i.RG32F),le===i.HALF_FLOAT&&(Me=i.RG16F),le===i.UNSIGNED_BYTE&&(Me=i.RG8)),X===i.RG_INTEGER&&(le===i.UNSIGNED_BYTE&&(Me=i.RG8UI),le===i.UNSIGNED_SHORT&&(Me=i.RG16UI),le===i.UNSIGNED_INT&&(Me=i.RG32UI),le===i.BYTE&&(Me=i.RG8I),le===i.SHORT&&(Me=i.RG16I),le===i.INT&&(Me=i.RG32I)),X===i.RGB_INTEGER&&(le===i.UNSIGNED_BYTE&&(Me=i.RGB8UI),le===i.UNSIGNED_SHORT&&(Me=i.RGB16UI),le===i.UNSIGNED_INT&&(Me=i.RGB32UI),le===i.BYTE&&(Me=i.RGB8I),le===i.SHORT&&(Me=i.RGB16I),le===i.INT&&(Me=i.RGB32I)),X===i.RGBA_INTEGER&&(le===i.UNSIGNED_BYTE&&(Me=i.RGBA8UI),le===i.UNSIGNED_SHORT&&(Me=i.RGBA16UI),le===i.UNSIGNED_INT&&(Me=i.RGBA32UI),le===i.BYTE&&(Me=i.RGBA8I),le===i.SHORT&&(Me=i.RGBA16I),le===i.INT&&(Me=i.RGBA32I)),X===i.RGB&&le===i.UNSIGNED_INT_5_9_9_9_REV&&(Me=i.RGB9_E5),X===i.RGBA){const nt=pe?a_:ai.getTransfer(Re);le===i.FLOAT&&(Me=i.RGBA32F),le===i.HALF_FLOAT&&(Me=i.RGBA16F),le===i.UNSIGNED_BYTE&&(Me=nt===Vi?i.SRGB8_ALPHA8:i.RGBA8),le===i.UNSIGNED_SHORT_4_4_4_4&&(Me=i.RGBA4),le===i.UNSIGNED_SHORT_5_5_5_1&&(Me=i.RGB5_A1)}return(Me===i.R16F||Me===i.R32F||Me===i.RG16F||Me===i.RG32F||Me===i.RGBA16F||Me===i.RGBA32F)&&e.get("EXT_color_buffer_float"),Me}function O(fe,X){let le;return fe?X===null||X===Rr||X===Au?le=i.DEPTH24_STENCIL8:X===$r?le=i.DEPTH32F_STENCIL8:X===wl&&(le=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):X===null||X===Rr||X===Au?le=i.DEPTH_COMPONENT24:X===$r?le=i.DEPTH_COMPONENT32F:X===wl&&(le=i.DEPTH_COMPONENT16),le}function G(fe,X){return C(fe)===!0||fe.isFramebufferTexture&&fe.minFilter!==mr&&fe.minFilter!==gs?Math.log2(Math.max(X.width,X.height))+1:fe.mipmaps!==void 0&&fe.mipmaps.length>0?fe.mipmaps.length:fe.isCompressedTexture&&Array.isArray(fe.image)?X.mipmaps.length:1}function q(fe){const X=fe.target;X.removeEventListener("dispose",q),j(X),X.isVideoTexture&&m.delete(X)}function z(fe){const X=fe.target;X.removeEventListener("dispose",z),V(X)}function j(fe){const X=n.get(fe);if(X.__webglInit===void 0)return;const le=fe.source,Re=x.get(le);if(Re){const pe=Re[X.__cacheKey];pe.usedTimes--,pe.usedTimes===0&&F(fe),Object.keys(Re).length===0&&x.delete(le)}n.remove(fe)}function F(fe){const X=n.get(fe);i.deleteTexture(X.__webglTexture);const le=fe.source,Re=x.get(le);delete Re[X.__cacheKey],a.memory.textures--}function V(fe){const X=n.get(fe);if(fe.depthTexture&&(fe.depthTexture.dispose(),n.remove(fe.depthTexture)),fe.isWebGLCubeRenderTarget)for(let Re=0;Re<6;Re++){if(Array.isArray(X.__webglFramebuffer[Re]))for(let pe=0;pe<X.__webglFramebuffer[Re].length;pe++)i.deleteFramebuffer(X.__webglFramebuffer[Re][pe]);else i.deleteFramebuffer(X.__webglFramebuffer[Re]);X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer[Re])}else{if(Array.isArray(X.__webglFramebuffer))for(let Re=0;Re<X.__webglFramebuffer.length;Re++)i.deleteFramebuffer(X.__webglFramebuffer[Re]);else i.deleteFramebuffer(X.__webglFramebuffer);if(X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer),X.__webglMultisampledFramebuffer&&i.deleteFramebuffer(X.__webglMultisampledFramebuffer),X.__webglColorRenderbuffer)for(let Re=0;Re<X.__webglColorRenderbuffer.length;Re++)X.__webglColorRenderbuffer[Re]&&i.deleteRenderbuffer(X.__webglColorRenderbuffer[Re]);X.__webglDepthRenderbuffer&&i.deleteRenderbuffer(X.__webglDepthRenderbuffer)}const le=fe.textures;for(let Re=0,pe=le.length;Re<pe;Re++){const Me=n.get(le[Re]);Me.__webglTexture&&(i.deleteTexture(Me.__webglTexture),a.memory.textures--),n.remove(le[Re])}n.remove(fe)}let Y=0;function ee(){Y=0}function te(){const fe=Y;return fe>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+fe+" texture units while this GPU supports only "+r.maxTextures),Y+=1,fe}function re(fe){const X=[];return X.push(fe.wrapS),X.push(fe.wrapT),X.push(fe.wrapR||0),X.push(fe.magFilter),X.push(fe.minFilter),X.push(fe.anisotropy),X.push(fe.internalFormat),X.push(fe.format),X.push(fe.type),X.push(fe.generateMipmaps),X.push(fe.premultiplyAlpha),X.push(fe.flipY),X.push(fe.unpackAlignment),X.push(fe.colorSpace),X.join()}function ne(fe,X){const le=n.get(fe);if(fe.isVideoTexture&&yt(fe),fe.isRenderTargetTexture===!1&&fe.version>0&&le.__version!==fe.version){const Re=fe.image;if(Re===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Re.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ne(le,fe,X);return}}t.bindTexture(i.TEXTURE_2D,le.__webglTexture,i.TEXTURE0+X)}function Q(fe,X){const le=n.get(fe);if(fe.version>0&&le.__version!==fe.version){Ne(le,fe,X);return}t.bindTexture(i.TEXTURE_2D_ARRAY,le.__webglTexture,i.TEXTURE0+X)}function ae(fe,X){const le=n.get(fe);if(fe.version>0&&le.__version!==fe.version){Ne(le,fe,X);return}t.bindTexture(i.TEXTURE_3D,le.__webglTexture,i.TEXTURE0+X)}function de(fe,X){const le=n.get(fe);if(fe.version>0&&le.__version!==fe.version){ze(le,fe,X);return}t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+X)}const Te={[aA]:i.REPEAT,[eu]:i.CLAMP_TO_EDGE,[oA]:i.MIRRORED_REPEAT},be={[mr]:i.NEAREST,[s_]:i.NEAREST_MIPMAP_NEAREST,[tu]:i.NEAREST_MIPMAP_LINEAR,[gs]:i.LINEAR,[Jd]:i.LINEAR_MIPMAP_NEAREST,[Va]:i.LINEAR_MIPMAP_LINEAR},ue={[Fw]:i.NEVER,[Vw]:i.ALWAYS,[my]:i.LESS,[gy]:i.LEQUAL,[kw]:i.EQUAL,[qw]:i.GEQUAL,[zw]:i.GREATER,[Gw]:i.NOTEQUAL};function we(fe,X){if(X.type===$r&&e.has("OES_texture_float_linear")===!1&&(X.magFilter===gs||X.magFilter===Jd||X.magFilter===tu||X.magFilter===Va||X.minFilter===gs||X.minFilter===Jd||X.minFilter===tu||X.minFilter===Va)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(fe,i.TEXTURE_WRAP_S,Te[X.wrapS]),i.texParameteri(fe,i.TEXTURE_WRAP_T,Te[X.wrapT]),(fe===i.TEXTURE_3D||fe===i.TEXTURE_2D_ARRAY)&&i.texParameteri(fe,i.TEXTURE_WRAP_R,Te[X.wrapR]),i.texParameteri(fe,i.TEXTURE_MAG_FILTER,be[X.magFilter]),i.texParameteri(fe,i.TEXTURE_MIN_FILTER,be[X.minFilter]),X.compareFunction&&(i.texParameteri(fe,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(fe,i.TEXTURE_COMPARE_FUNC,ue[X.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(X.magFilter===mr||X.minFilter!==tu&&X.minFilter!==Va||X.type===$r&&e.has("OES_texture_float_linear")===!1)return;if(X.anisotropy>1||n.get(X).__currentAnisotropy){const le=e.get("EXT_texture_filter_anisotropic");i.texParameterf(fe,le.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(X.anisotropy,r.getMaxAnisotropy())),n.get(X).__currentAnisotropy=X.anisotropy}}}function We(fe,X){let le=!1;fe.__webglInit===void 0&&(fe.__webglInit=!0,X.addEventListener("dispose",q));const Re=X.source;let pe=x.get(Re);pe===void 0&&(pe={},x.set(Re,pe));const Me=re(X);if(Me!==fe.__cacheKey){pe[Me]===void 0&&(pe[Me]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,le=!0),pe[Me].usedTimes++;const nt=pe[fe.__cacheKey];nt!==void 0&&(pe[fe.__cacheKey].usedTimes--,nt.usedTimes===0&&F(X)),fe.__cacheKey=Me,fe.__webglTexture=pe[Me].texture}return le}function Ne(fe,X,le){let Re=i.TEXTURE_2D;(X.isDataArrayTexture||X.isCompressedArrayTexture)&&(Re=i.TEXTURE_2D_ARRAY),X.isData3DTexture&&(Re=i.TEXTURE_3D);const pe=We(fe,X),Me=X.source;t.bindTexture(Re,fe.__webglTexture,i.TEXTURE0+le);const nt=n.get(Me);if(Me.version!==nt.__version||pe===!0){t.activeTexture(i.TEXTURE0+le);const lt=ai.getPrimaries(ai.workingColorSpace),Ot=X.colorSpace===Co?null:ai.getPrimaries(X.colorSpace),jt=X.colorSpace===Co||lt===Ot?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,jt);let pt=R(X.image,!1,r.maxTextureSize);pt=en(X,pt);const Yt=s.convert(X.format,X.colorSpace),rn=s.convert(X.type);let $t=L(X.internalFormat,Yt,rn,X.colorSpace,X.isVideoTexture);we(Re,X);let kt;const Vt=X.mipmaps,Nn=X.isVideoTexture!==!0,_i=nt.__version===void 0||pe===!0,me=Me.dataReady,bt=G(X,pt);if(X.isDepthTexture)$t=O(X.format===du,X.type),_i&&(Nn?t.texStorage2D(i.TEXTURE_2D,1,$t,pt.width,pt.height):t.texImage2D(i.TEXTURE_2D,0,$t,pt.width,pt.height,0,Yt,rn,null));else if(X.isDataTexture)if(Vt.length>0){Nn&&_i&&t.texStorage2D(i.TEXTURE_2D,bt,$t,Vt[0].width,Vt[0].height);for(let tt=0,St=Vt.length;tt<St;tt++)kt=Vt[tt],Nn?me&&t.texSubImage2D(i.TEXTURE_2D,tt,0,0,kt.width,kt.height,Yt,rn,kt.data):t.texImage2D(i.TEXTURE_2D,tt,$t,kt.width,kt.height,0,Yt,rn,kt.data);X.generateMipmaps=!1}else Nn?(_i&&t.texStorage2D(i.TEXTURE_2D,bt,$t,pt.width,pt.height),me&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,pt.width,pt.height,Yt,rn,pt.data)):t.texImage2D(i.TEXTURE_2D,0,$t,pt.width,pt.height,0,Yt,rn,pt.data);else if(X.isCompressedTexture)if(X.isCompressedArrayTexture){Nn&&_i&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,$t,Vt[0].width,Vt[0].height,pt.depth);for(let tt=0,St=Vt.length;tt<St;tt++)if(kt=Vt[tt],X.format!==ks)if(Yt!==null)if(Nn){if(me)if(X.layerUpdates.size>0){const qt=D5(kt.width,kt.height,X.format,X.type);for(const Ht of X.layerUpdates){const xn=kt.data.subarray(Ht*qt/kt.data.BYTES_PER_ELEMENT,(Ht+1)*qt/kt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,tt,0,0,Ht,kt.width,kt.height,1,Yt,xn)}X.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,tt,0,0,0,kt.width,kt.height,pt.depth,Yt,kt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,tt,$t,kt.width,kt.height,pt.depth,0,kt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Nn?me&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,tt,0,0,0,kt.width,kt.height,pt.depth,Yt,rn,kt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,tt,$t,kt.width,kt.height,pt.depth,0,Yt,rn,kt.data)}else{Nn&&_i&&t.texStorage2D(i.TEXTURE_2D,bt,$t,Vt[0].width,Vt[0].height);for(let tt=0,St=Vt.length;tt<St;tt++)kt=Vt[tt],X.format!==ks?Yt!==null?Nn?me&&t.compressedTexSubImage2D(i.TEXTURE_2D,tt,0,0,kt.width,kt.height,Yt,kt.data):t.compressedTexImage2D(i.TEXTURE_2D,tt,$t,kt.width,kt.height,0,kt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Nn?me&&t.texSubImage2D(i.TEXTURE_2D,tt,0,0,kt.width,kt.height,Yt,rn,kt.data):t.texImage2D(i.TEXTURE_2D,tt,$t,kt.width,kt.height,0,Yt,rn,kt.data)}else if(X.isDataArrayTexture)if(Nn){if(_i&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,$t,pt.width,pt.height,pt.depth),me)if(X.layerUpdates.size>0){const tt=D5(pt.width,pt.height,X.format,X.type);for(const St of X.layerUpdates){const qt=pt.data.subarray(St*tt/pt.data.BYTES_PER_ELEMENT,(St+1)*tt/pt.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,St,pt.width,pt.height,1,Yt,rn,qt)}X.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,pt.width,pt.height,pt.depth,Yt,rn,pt.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,$t,pt.width,pt.height,pt.depth,0,Yt,rn,pt.data);else if(X.isData3DTexture)Nn?(_i&&t.texStorage3D(i.TEXTURE_3D,bt,$t,pt.width,pt.height,pt.depth),me&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,pt.width,pt.height,pt.depth,Yt,rn,pt.data)):t.texImage3D(i.TEXTURE_3D,0,$t,pt.width,pt.height,pt.depth,0,Yt,rn,pt.data);else if(X.isFramebufferTexture){if(_i)if(Nn)t.texStorage2D(i.TEXTURE_2D,bt,$t,pt.width,pt.height);else{let tt=pt.width,St=pt.height;for(let qt=0;qt<bt;qt++)t.texImage2D(i.TEXTURE_2D,qt,$t,tt,St,0,Yt,rn,null),tt>>=1,St>>=1}}else if(Vt.length>0){if(Nn&&_i){const tt=xt(Vt[0]);t.texStorage2D(i.TEXTURE_2D,bt,$t,tt.width,tt.height)}for(let tt=0,St=Vt.length;tt<St;tt++)kt=Vt[tt],Nn?me&&t.texSubImage2D(i.TEXTURE_2D,tt,0,0,Yt,rn,kt):t.texImage2D(i.TEXTURE_2D,tt,$t,Yt,rn,kt);X.generateMipmaps=!1}else if(Nn){if(_i){const tt=xt(pt);t.texStorage2D(i.TEXTURE_2D,bt,$t,tt.width,tt.height)}me&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Yt,rn,pt)}else t.texImage2D(i.TEXTURE_2D,0,$t,Yt,rn,pt);C(X)&&E(Re),nt.__version=Me.version,X.onUpdate&&X.onUpdate(X)}fe.__version=X.version}function ze(fe,X,le){if(X.image.length!==6)return;const Re=We(fe,X),pe=X.source;t.bindTexture(i.TEXTURE_CUBE_MAP,fe.__webglTexture,i.TEXTURE0+le);const Me=n.get(pe);if(pe.version!==Me.__version||Re===!0){t.activeTexture(i.TEXTURE0+le);const nt=ai.getPrimaries(ai.workingColorSpace),lt=X.colorSpace===Co?null:ai.getPrimaries(X.colorSpace),Ot=X.colorSpace===Co||nt===lt?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ot);const jt=X.isCompressedTexture||X.image[0].isCompressedTexture,pt=X.image[0]&&X.image[0].isDataTexture,Yt=[];for(let St=0;St<6;St++)!jt&&!pt?Yt[St]=R(X.image[St],!0,r.maxCubemapSize):Yt[St]=pt?X.image[St].image:X.image[St],Yt[St]=en(X,Yt[St]);const rn=Yt[0],$t=s.convert(X.format,X.colorSpace),kt=s.convert(X.type),Vt=L(X.internalFormat,$t,kt,X.colorSpace),Nn=X.isVideoTexture!==!0,_i=Me.__version===void 0||Re===!0,me=pe.dataReady;let bt=G(X,rn);we(i.TEXTURE_CUBE_MAP,X);let tt;if(jt){Nn&&_i&&t.texStorage2D(i.TEXTURE_CUBE_MAP,bt,Vt,rn.width,rn.height);for(let St=0;St<6;St++){tt=Yt[St].mipmaps;for(let qt=0;qt<tt.length;qt++){const Ht=tt[qt];X.format!==ks?$t!==null?Nn?me&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,qt,0,0,Ht.width,Ht.height,$t,Ht.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,qt,Vt,Ht.width,Ht.height,0,Ht.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Nn?me&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,qt,0,0,Ht.width,Ht.height,$t,kt,Ht.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,qt,Vt,Ht.width,Ht.height,0,$t,kt,Ht.data)}}}else{if(tt=X.mipmaps,Nn&&_i){tt.length>0&&bt++;const St=xt(Yt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,bt,Vt,St.width,St.height)}for(let St=0;St<6;St++)if(pt){Nn?me&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,0,0,0,Yt[St].width,Yt[St].height,$t,kt,Yt[St].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,0,Vt,Yt[St].width,Yt[St].height,0,$t,kt,Yt[St].data);for(let qt=0;qt<tt.length;qt++){const xn=tt[qt].image[St].image;Nn?me&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,qt+1,0,0,xn.width,xn.height,$t,kt,xn.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,qt+1,Vt,xn.width,xn.height,0,$t,kt,xn.data)}}else{Nn?me&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,0,0,0,$t,kt,Yt[St]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,0,Vt,$t,kt,Yt[St]);for(let qt=0;qt<tt.length;qt++){const Ht=tt[qt];Nn?me&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,qt+1,0,0,$t,kt,Ht.image[St]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+St,qt+1,Vt,$t,kt,Ht.image[St])}}}C(X)&&E(i.TEXTURE_CUBE_MAP),Me.__version=pe.version,X.onUpdate&&X.onUpdate(X)}fe.__version=X.version}function Se(fe,X,le,Re,pe,Me){const nt=s.convert(le.format,le.colorSpace),lt=s.convert(le.type),Ot=L(le.internalFormat,nt,lt,le.colorSpace),jt=n.get(X),pt=n.get(le);if(pt.__renderTarget=X,!jt.__hasExternalTextures){const Yt=Math.max(1,X.width>>Me),rn=Math.max(1,X.height>>Me);pe===i.TEXTURE_3D||pe===i.TEXTURE_2D_ARRAY?t.texImage3D(pe,Me,Ot,Yt,rn,X.depth,0,nt,lt,null):t.texImage2D(pe,Me,Ot,Yt,rn,0,nt,lt,null)}t.bindFramebuffer(i.FRAMEBUFFER,fe),Pt(X)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Re,pe,pt.__webglTexture,0,ht(X)):(pe===i.TEXTURE_2D||pe>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&pe<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Re,pe,pt.__webglTexture,Me),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ce(fe,X,le){if(i.bindRenderbuffer(i.RENDERBUFFER,fe),X.depthBuffer){const Re=X.depthTexture,pe=Re&&Re.isDepthTexture?Re.type:null,Me=O(X.stencilBuffer,pe),nt=X.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,lt=ht(X);Pt(X)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,lt,Me,X.width,X.height):le?i.renderbufferStorageMultisample(i.RENDERBUFFER,lt,Me,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,Me,X.width,X.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,nt,i.RENDERBUFFER,fe)}else{const Re=X.textures;for(let pe=0;pe<Re.length;pe++){const Me=Re[pe],nt=s.convert(Me.format,Me.colorSpace),lt=s.convert(Me.type),Ot=L(Me.internalFormat,nt,lt,Me.colorSpace),jt=ht(X);le&&Pt(X)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,jt,Ot,X.width,X.height):Pt(X)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,jt,Ot,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,Ot,X.width,X.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function dt(fe,X){if(X&&X.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,fe),!(X.depthTexture&&X.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Re=n.get(X.depthTexture);Re.__renderTarget=X,(!Re.__webglTexture||X.depthTexture.image.width!==X.width||X.depthTexture.image.height!==X.height)&&(X.depthTexture.image.width=X.width,X.depthTexture.image.height=X.height,X.depthTexture.needsUpdate=!0),ne(X.depthTexture,0);const pe=Re.__webglTexture,Me=ht(X);if(X.depthTexture.format===au)Pt(X)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,pe,0,Me):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,pe,0);else if(X.depthTexture.format===du)Pt(X)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,pe,0,Me):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,pe,0);else throw new Error("Unknown depthTexture format")}function At(fe){const X=n.get(fe),le=fe.isWebGLCubeRenderTarget===!0;if(X.__boundDepthTexture!==fe.depthTexture){const Re=fe.depthTexture;if(X.__depthDisposeCallback&&X.__depthDisposeCallback(),Re){const pe=()=>{delete X.__boundDepthTexture,delete X.__depthDisposeCallback,Re.removeEventListener("dispose",pe)};Re.addEventListener("dispose",pe),X.__depthDisposeCallback=pe}X.__boundDepthTexture=Re}if(fe.depthTexture&&!X.__autoAllocateDepthBuffer){if(le)throw new Error("target.depthTexture not supported in Cube render targets");dt(X.__webglFramebuffer,fe)}else if(le){X.__webglDepthbuffer=[];for(let Re=0;Re<6;Re++)if(t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer[Re]),X.__webglDepthbuffer[Re]===void 0)X.__webglDepthbuffer[Re]=i.createRenderbuffer(),Ce(X.__webglDepthbuffer[Re],fe,!1);else{const pe=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Me=X.__webglDepthbuffer[Re];i.bindRenderbuffer(i.RENDERBUFFER,Me),i.framebufferRenderbuffer(i.FRAMEBUFFER,pe,i.RENDERBUFFER,Me)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer),X.__webglDepthbuffer===void 0)X.__webglDepthbuffer=i.createRenderbuffer(),Ce(X.__webglDepthbuffer,fe,!1);else{const Re=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,pe=X.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,pe),i.framebufferRenderbuffer(i.FRAMEBUFFER,Re,i.RENDERBUFFER,pe)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function wt(fe,X,le){const Re=n.get(fe);X!==void 0&&Se(Re.__webglFramebuffer,fe,fe.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),le!==void 0&&At(fe)}function Ft(fe){const X=fe.texture,le=n.get(fe),Re=n.get(X);fe.addEventListener("dispose",z);const pe=fe.textures,Me=fe.isWebGLCubeRenderTarget===!0,nt=pe.length>1;if(nt||(Re.__webglTexture===void 0&&(Re.__webglTexture=i.createTexture()),Re.__version=X.version,a.memory.textures++),Me){le.__webglFramebuffer=[];for(let lt=0;lt<6;lt++)if(X.mipmaps&&X.mipmaps.length>0){le.__webglFramebuffer[lt]=[];for(let Ot=0;Ot<X.mipmaps.length;Ot++)le.__webglFramebuffer[lt][Ot]=i.createFramebuffer()}else le.__webglFramebuffer[lt]=i.createFramebuffer()}else{if(X.mipmaps&&X.mipmaps.length>0){le.__webglFramebuffer=[];for(let lt=0;lt<X.mipmaps.length;lt++)le.__webglFramebuffer[lt]=i.createFramebuffer()}else le.__webglFramebuffer=i.createFramebuffer();if(nt)for(let lt=0,Ot=pe.length;lt<Ot;lt++){const jt=n.get(pe[lt]);jt.__webglTexture===void 0&&(jt.__webglTexture=i.createTexture(),a.memory.textures++)}if(fe.samples>0&&Pt(fe)===!1){le.__webglMultisampledFramebuffer=i.createFramebuffer(),le.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,le.__webglMultisampledFramebuffer);for(let lt=0;lt<pe.length;lt++){const Ot=pe[lt];le.__webglColorRenderbuffer[lt]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,le.__webglColorRenderbuffer[lt]);const jt=s.convert(Ot.format,Ot.colorSpace),pt=s.convert(Ot.type),Yt=L(Ot.internalFormat,jt,pt,Ot.colorSpace,fe.isXRRenderTarget===!0),rn=ht(fe);i.renderbufferStorageMultisample(i.RENDERBUFFER,rn,Yt,fe.width,fe.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+lt,i.RENDERBUFFER,le.__webglColorRenderbuffer[lt])}i.bindRenderbuffer(i.RENDERBUFFER,null),fe.depthBuffer&&(le.__webglDepthRenderbuffer=i.createRenderbuffer(),Ce(le.__webglDepthRenderbuffer,fe,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(Me){t.bindTexture(i.TEXTURE_CUBE_MAP,Re.__webglTexture),we(i.TEXTURE_CUBE_MAP,X);for(let lt=0;lt<6;lt++)if(X.mipmaps&&X.mipmaps.length>0)for(let Ot=0;Ot<X.mipmaps.length;Ot++)Se(le.__webglFramebuffer[lt][Ot],fe,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+lt,Ot);else Se(le.__webglFramebuffer[lt],fe,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+lt,0);C(X)&&E(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(nt){for(let lt=0,Ot=pe.length;lt<Ot;lt++){const jt=pe[lt],pt=n.get(jt);t.bindTexture(i.TEXTURE_2D,pt.__webglTexture),we(i.TEXTURE_2D,jt),Se(le.__webglFramebuffer,fe,jt,i.COLOR_ATTACHMENT0+lt,i.TEXTURE_2D,0),C(jt)&&E(i.TEXTURE_2D)}t.unbindTexture()}else{let lt=i.TEXTURE_2D;if((fe.isWebGL3DRenderTarget||fe.isWebGLArrayRenderTarget)&&(lt=fe.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(lt,Re.__webglTexture),we(lt,X),X.mipmaps&&X.mipmaps.length>0)for(let Ot=0;Ot<X.mipmaps.length;Ot++)Se(le.__webglFramebuffer[Ot],fe,X,i.COLOR_ATTACHMENT0,lt,Ot);else Se(le.__webglFramebuffer,fe,X,i.COLOR_ATTACHMENT0,lt,0);C(X)&&E(lt),t.unbindTexture()}fe.depthBuffer&&At(fe)}function $e(fe){const X=fe.textures;for(let le=0,Re=X.length;le<Re;le++){const pe=X[le];if(C(pe)){const Me=B(fe),nt=n.get(pe).__webglTexture;t.bindTexture(Me,nt),E(Me),t.unbindTexture()}}}const rt=[],ce=[];function Gt(fe){if(fe.samples>0){if(Pt(fe)===!1){const X=fe.textures,le=fe.width,Re=fe.height;let pe=i.COLOR_BUFFER_BIT;const Me=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,nt=n.get(fe),lt=X.length>1;if(lt)for(let Ot=0;Ot<X.length;Ot++)t.bindFramebuffer(i.FRAMEBUFFER,nt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ot,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,nt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ot,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,nt.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,nt.__webglFramebuffer);for(let Ot=0;Ot<X.length;Ot++){if(fe.resolveDepthBuffer&&(fe.depthBuffer&&(pe|=i.DEPTH_BUFFER_BIT),fe.stencilBuffer&&fe.resolveStencilBuffer&&(pe|=i.STENCIL_BUFFER_BIT)),lt){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,nt.__webglColorRenderbuffer[Ot]);const jt=n.get(X[Ot]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,jt,0)}i.blitFramebuffer(0,0,le,Re,0,0,le,Re,pe,i.NEAREST),u===!0&&(rt.length=0,ce.length=0,rt.push(i.COLOR_ATTACHMENT0+Ot),fe.depthBuffer&&fe.resolveDepthBuffer===!1&&(rt.push(Me),ce.push(Me),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,ce)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,rt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),lt)for(let Ot=0;Ot<X.length;Ot++){t.bindFramebuffer(i.FRAMEBUFFER,nt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ot,i.RENDERBUFFER,nt.__webglColorRenderbuffer[Ot]);const jt=n.get(X[Ot]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,nt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ot,i.TEXTURE_2D,jt,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,nt.__webglMultisampledFramebuffer)}else if(fe.depthBuffer&&fe.resolveDepthBuffer===!1&&u){const X=fe.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[X])}}}function ht(fe){return Math.min(r.maxSamples,fe.samples)}function Pt(fe){const X=n.get(fe);return fe.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&X.__useRenderToTexture!==!1}function yt(fe){const X=a.render.frame;m.get(fe)!==X&&(m.set(fe,X),fe.update())}function en(fe,X){const le=fe.colorSpace,Re=fe.format,pe=fe.type;return fe.isCompressedTexture===!0||fe.isVideoTexture===!0||le!==Ro&&le!==Co&&(ai.getTransfer(le)===Vi?(Re!==ks||pe!==aa)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",le)),X}function xt(fe){return typeof HTMLImageElement<"u"&&fe instanceof HTMLImageElement?(h.width=fe.naturalWidth||fe.width,h.height=fe.naturalHeight||fe.height):typeof VideoFrame<"u"&&fe instanceof VideoFrame?(h.width=fe.displayWidth,h.height=fe.displayHeight):(h.width=fe.width,h.height=fe.height),h}this.allocateTextureUnit=te,this.resetTextureUnits=ee,this.setTexture2D=ne,this.setTexture2DArray=Q,this.setTexture3D=ae,this.setTextureCube=de,this.rebindTextures=wt,this.setupRenderTarget=Ft,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=Gt,this.setupDepthRenderbuffer=At,this.setupFrameBufferTexture=Se,this.useMultisampledRTT=Pt}function wj(i,e){function t(n,r=Co){let s;const a=ai.getTransfer(r);if(n===aa)return i.UNSIGNED_BYTE;if(n===Ay)return i.UNSIGNED_SHORT_4_4_4_4;if(n===dy)return i.UNSIGNED_SHORT_5_5_5_1;if(n===py)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Qf)return i.BYTE;if(n===Kf)return i.SHORT;if(n===wl)return i.UNSIGNED_SHORT;if(n===Ns)return i.INT;if(n===Rr)return i.UNSIGNED_INT;if(n===$r)return i.FLOAT;if(n===Gs)return i.HALF_FLOAT;if(n===Uw)return i.ALPHA;if(n===Ug)return i.RGB;if(n===ks)return i.RGBA;if(n===Bw)return i.LUMINANCE;if(n===Ow)return i.LUMINANCE_ALPHA;if(n===au)return i.DEPTH_COMPONENT;if(n===du)return i.DEPTH_STENCIL;if(n===Bg)return i.RED;if(n===H0)return i.RED_INTEGER;if(n===lA)return i.RG;if(n===j0)return i.RG_INTEGER;if(n===W0)return i.RGBA_INTEGER;if(n===Zf||n===Bh||n===Oh||n===Ih)if(a===Vi)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Zf)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Bh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Oh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ih)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Zf)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Bh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Oh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ih)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Km||n===Zm||n===Jm||n===eg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Km)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Zm)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Jm)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===eg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===tg||n===u0||n===c0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===tg||n===u0)return a===Vi?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===c0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===h0||n===f0||n===A0||n===d0||n===p0||n===m0||n===g0||n===v0||n===_0||n===y0||n===x0||n===b0||n===S0||n===T0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===h0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===f0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===A0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===d0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===p0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===m0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===g0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===v0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===_0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===y0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===x0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===b0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===S0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===T0)return a===Vi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Jf||n===HS||n===jS)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Jf)return a===Vi?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===HS)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===jS)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Iw||n===ng||n===ig||n===rg)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Jf)return s.COMPRESSED_RED_RGTC1_EXT;if(n===ng)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ig)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===rg)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Au?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const Mj={type:"move"};class D3{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ja,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 ja,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new he,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new he),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ja,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new he,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new he),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const l=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const R of e.hand.values()){const C=t.getJointPose(R,n),E=this._getHandJoint(h,R);C!==null&&(E.matrix.fromArray(C.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,E.jointRadius=C.radius),E.visible=C!==null}const m=h.joints["index-finger-tip"],v=h.joints["thumb-tip"],x=m.position.distanceTo(v.position),S=.02,w=.005;h.inputState.pinching&&x>S+w?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&x<=S-w&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));l!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(Mj)))}return l!==null&&(l.visible=r!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ja;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Ej=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,Cj=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;

void main() {

	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );

	if ( coord.x >= 1.0 ) {

		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

	} else {

		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

	}

}`;class Rj{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new vs,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Ja({vertexShader:Ej,fragmentShader:Cj,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new zi(new Ty(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Nj extends zc{constructor(e,t){super();const n=this;let r=null,s=1,a=null,l="local-floor",u=1,h=null,m=null,v=null,x=null,S=null,w=null;const R=new Rj,C=t.getContextAttributes();let E=null,B=null;const L=[],O=[],G=new gt;let q=null;const z=new ya;z.viewport=new Ln;const j=new ya;j.viewport=new Ln;const F=[z,j],V=new Xz;let Y=null,ee=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ne){let ze=L[Ne];return ze===void 0&&(ze=new D3,L[Ne]=ze),ze.getTargetRaySpace()},this.getControllerGrip=function(Ne){let ze=L[Ne];return ze===void 0&&(ze=new D3,L[Ne]=ze),ze.getGripSpace()},this.getHand=function(Ne){let ze=L[Ne];return ze===void 0&&(ze=new D3,L[Ne]=ze),ze.getHandSpace()};function te(Ne){const ze=O.indexOf(Ne.inputSource);if(ze===-1)return;const Se=L[ze];Se!==void 0&&(Se.update(Ne.inputSource,Ne.frame,h||a),Se.dispatchEvent({type:Ne.type,data:Ne.inputSource}))}function re(){r.removeEventListener("select",te),r.removeEventListener("selectstart",te),r.removeEventListener("selectend",te),r.removeEventListener("squeeze",te),r.removeEventListener("squeezestart",te),r.removeEventListener("squeezeend",te),r.removeEventListener("end",re),r.removeEventListener("inputsourceschange",ne);for(let Ne=0;Ne<L.length;Ne++){const ze=O[Ne];ze!==null&&(O[Ne]=null,L[Ne].disconnect(ze))}Y=null,ee=null,R.reset(),e.setRenderTarget(E),S=null,x=null,v=null,r=null,B=null,We.stop(),n.isPresenting=!1,e.setPixelRatio(q),e.setSize(G.width,G.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Ne){s=Ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ne){l=Ne,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||a},this.setReferenceSpace=function(Ne){h=Ne},this.getBaseLayer=function(){return x!==null?x:S},this.getBinding=function(){return v},this.getFrame=function(){return w},this.getSession=function(){return r},this.setSession=async function(Ne){if(r=Ne,r!==null){if(E=e.getRenderTarget(),r.addEventListener("select",te),r.addEventListener("selectstart",te),r.addEventListener("selectend",te),r.addEventListener("squeeze",te),r.addEventListener("squeezestart",te),r.addEventListener("squeezeend",te),r.addEventListener("end",re),r.addEventListener("inputsourceschange",ne),C.xrCompatible!==!0&&await t.makeXRCompatible(),q=e.getPixelRatio(),e.getSize(G),r.enabledFeatures!==void 0&&r.enabledFeatures.includes("layers")){let Se=null,Ce=null,dt=null;C.depth&&(dt=C.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Se=C.stencil?du:au,Ce=C.stencil?Au:Rr);const At={colorFormat:t.RGBA8,depthFormat:dt,scaleFactor:s};v=new XRWebGLBinding(r,t),x=v.createProjectionLayer(At),r.updateRenderState({layers:[x]}),e.setPixelRatio(1),e.setSize(x.textureWidth,x.textureHeight,!1),B=new qh(x.textureWidth,x.textureHeight,{format:ks,type:aa,depthTexture:new qc(x.textureWidth,x.textureHeight,Ce,void 0,void 0,void 0,void 0,void 0,void 0,Se),stencilBuffer:C.stencil,colorSpace:e.outputColorSpace,samples:C.antialias?4:0,resolveDepthBuffer:x.ignoreDepthValues===!1})}else{const Se={antialias:C.antialias,alpha:!0,depth:C.depth,stencil:C.stencil,framebufferScaleFactor:s};S=new XRWebGLLayer(r,t,Se),r.updateRenderState({baseLayer:S}),e.setPixelRatio(1),e.setSize(S.framebufferWidth,S.framebufferHeight,!1),B=new qh(S.framebufferWidth,S.framebufferHeight,{format:ks,type:aa,colorSpace:e.outputColorSpace,stencilBuffer:C.stencil})}B.isXRRenderTarget=!0,this.setFoveation(u),h=null,a=await r.requestReferenceSpace(l),We.setContext(r),We.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return R.getDepthTexture()};function ne(Ne){for(let ze=0;ze<Ne.removed.length;ze++){const Se=Ne.removed[ze],Ce=O.indexOf(Se);Ce>=0&&(O[Ce]=null,L[Ce].disconnect(Se))}for(let ze=0;ze<Ne.added.length;ze++){const Se=Ne.added[ze];let Ce=O.indexOf(Se);if(Ce===-1){for(let At=0;At<L.length;At++)if(At>=O.length){O.push(Se),Ce=At;break}else if(O[At]===null){O[At]=Se,Ce=At;break}if(Ce===-1)break}const dt=L[Ce];dt&&dt.connect(Se)}}const Q=new he,ae=new he;function de(Ne,ze,Se){Q.setFromMatrixPosition(ze.matrixWorld),ae.setFromMatrixPosition(Se.matrixWorld);const Ce=Q.distanceTo(ae),dt=ze.projectionMatrix.elements,At=Se.projectionMatrix.elements,wt=dt[14]/(dt[10]-1),Ft=dt[14]/(dt[10]+1),$e=(dt[9]+1)/dt[5],rt=(dt[9]-1)/dt[5],ce=(dt[8]-1)/dt[0],Gt=(At[8]+1)/At[0],ht=wt*ce,Pt=wt*Gt,yt=Ce/(-ce+Gt),en=yt*-ce;if(ze.matrixWorld.decompose(Ne.position,Ne.quaternion,Ne.scale),Ne.translateX(en),Ne.translateZ(yt),Ne.matrixWorld.compose(Ne.position,Ne.quaternion,Ne.scale),Ne.matrixWorldInverse.copy(Ne.matrixWorld).invert(),dt[10]===-1)Ne.projectionMatrix.copy(ze.projectionMatrix),Ne.projectionMatrixInverse.copy(ze.projectionMatrixInverse);else{const xt=wt+yt,fe=Ft+yt,X=ht-en,le=Pt+(Ce-en),Re=$e*Ft/fe*xt,pe=rt*Ft/fe*xt;Ne.projectionMatrix.makePerspective(X,le,Re,pe,xt,fe),Ne.projectionMatrixInverse.copy(Ne.projectionMatrix).invert()}}function Te(Ne,ze){ze===null?Ne.matrixWorld.copy(Ne.matrix):Ne.matrixWorld.multiplyMatrices(ze.matrixWorld,Ne.matrix),Ne.matrixWorldInverse.copy(Ne.matrixWorld).invert()}this.updateCamera=function(Ne){if(r===null)return;let ze=Ne.near,Se=Ne.far;R.texture!==null&&(R.depthNear>0&&(ze=R.depthNear),R.depthFar>0&&(Se=R.depthFar)),V.near=j.near=z.near=ze,V.far=j.far=z.far=Se,(Y!==V.near||ee!==V.far)&&(r.updateRenderState({depthNear:V.near,depthFar:V.far}),Y=V.near,ee=V.far),z.layers.mask=Ne.layers.mask|2,j.layers.mask=Ne.layers.mask|4,V.layers.mask=z.layers.mask|j.layers.mask;const Ce=Ne.parent,dt=V.cameras;Te(V,Ce);for(let At=0;At<dt.length;At++)Te(dt[At],Ce);dt.length===2?de(V,z,j):V.projectionMatrix.copy(z.projectionMatrix),be(Ne,V,Ce)};function be(Ne,ze,Se){Se===null?Ne.matrix.copy(ze.matrixWorld):(Ne.matrix.copy(Se.matrixWorld),Ne.matrix.invert(),Ne.matrix.multiply(ze.matrixWorld)),Ne.matrix.decompose(Ne.position,Ne.quaternion,Ne.scale),Ne.updateMatrixWorld(!0),Ne.projectionMatrix.copy(ze.projectionMatrix),Ne.projectionMatrixInverse.copy(ze.projectionMatrixInverse),Ne.isPerspectiveCamera&&(Ne.fov=w0*2*Math.atan(1/Ne.projectionMatrix.elements[5]),Ne.zoom=1)}this.getCamera=function(){return V},this.getFoveation=function(){if(!(x===null&&S===null))return u},this.setFoveation=function(Ne){u=Ne,x!==null&&(x.fixedFoveation=Ne),S!==null&&S.fixedFoveation!==void 0&&(S.fixedFoveation=Ne)},this.hasDepthSensing=function(){return R.texture!==null},this.getDepthSensingMesh=function(){return R.getMesh(V)};let ue=null;function we(Ne,ze){if(m=ze.getViewerPose(h||a),w=ze,m!==null){const Se=m.views;S!==null&&(e.setRenderTargetFramebuffer(B,S.framebuffer),e.setRenderTarget(B));let Ce=!1;Se.length!==V.cameras.length&&(V.cameras.length=0,Ce=!0);for(let At=0;At<Se.length;At++){const wt=Se[At];let Ft=null;if(S!==null)Ft=S.getViewport(wt);else{const rt=v.getViewSubImage(x,wt);Ft=rt.viewport,At===0&&(e.setRenderTargetTextures(B,rt.colorTexture,x.ignoreDepthValues?void 0:rt.depthStencilTexture),e.setRenderTarget(B))}let $e=F[At];$e===void 0&&($e=new ya,$e.layers.enable(At),$e.viewport=new Ln,F[At]=$e),$e.matrix.fromArray(wt.transform.matrix),$e.matrix.decompose($e.position,$e.quaternion,$e.scale),$e.projectionMatrix.fromArray(wt.projectionMatrix),$e.projectionMatrixInverse.copy($e.projectionMatrix).invert(),$e.viewport.set(Ft.x,Ft.y,Ft.width,Ft.height),At===0&&(V.matrix.copy($e.matrix),V.matrix.decompose(V.position,V.quaternion,V.scale)),Ce===!0&&V.cameras.push($e)}const dt=r.enabledFeatures;if(dt&&dt.includes("depth-sensing")){const At=v.getDepthInformation(Se[0]);At&&At.isValid&&At.texture&&R.init(e,At,r.renderState)}}for(let Se=0;Se<L.length;Se++){const Ce=O[Se],dt=L[Se];Ce!==null&&dt!==void 0&&dt.update(Ce,ze,h||a)}ue&&ue(Ne,ze),ze.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ze}),w=null}const We=new lD;We.setAnimationLoop(we),this.setAnimationLoop=function(Ne){ue=Ne},this.dispose=function(){}}}const wf=new la,Dj=new kn;function Pj(i,e){function t(C,E){C.matrixAutoUpdate===!0&&C.updateMatrix(),E.value.copy(C.matrix)}function n(C,E){E.color.getRGB(C.fogColor.value,q7(i)),E.isFog?(C.fogNear.value=E.near,C.fogFar.value=E.far):E.isFogExp2&&(C.fogDensity.value=E.density)}function r(C,E,B,L,O){E.isMeshBasicMaterial||E.isMeshLambertMaterial?s(C,E):E.isMeshToonMaterial?(s(C,E),v(C,E)):E.isMeshPhongMaterial?(s(C,E),m(C,E)):E.isMeshStandardMaterial?(s(C,E),x(C,E),E.isMeshPhysicalMaterial&&S(C,E,O)):E.isMeshMatcapMaterial?(s(C,E),w(C,E)):E.isMeshDepthMaterial?s(C,E):E.isMeshDistanceMaterial?(s(C,E),R(C,E)):E.isMeshNormalMaterial?s(C,E):E.isLineBasicMaterial?(a(C,E),E.isLineDashedMaterial&&l(C,E)):E.isPointsMaterial?u(C,E,B,L):E.isSpriteMaterial?h(C,E):E.isShadowMaterial?(C.color.value.copy(E.color),C.opacity.value=E.opacity):E.isShaderMaterial&&(E.uniformsNeedUpdate=!1)}function s(C,E){C.opacity.value=E.opacity,E.color&&C.diffuse.value.copy(E.color),E.emissive&&C.emissive.value.copy(E.emissive).multiplyScalar(E.emissiveIntensity),E.map&&(C.map.value=E.map,t(E.map,C.mapTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.bumpMap&&(C.bumpMap.value=E.bumpMap,t(E.bumpMap,C.bumpMapTransform),C.bumpScale.value=E.bumpScale,E.side===hr&&(C.bumpScale.value*=-1)),E.normalMap&&(C.normalMap.value=E.normalMap,t(E.normalMap,C.normalMapTransform),C.normalScale.value.copy(E.normalScale),E.side===hr&&C.normalScale.value.negate()),E.displacementMap&&(C.displacementMap.value=E.displacementMap,t(E.displacementMap,C.displacementMapTransform),C.displacementScale.value=E.displacementScale,C.displacementBias.value=E.displacementBias),E.emissiveMap&&(C.emissiveMap.value=E.emissiveMap,t(E.emissiveMap,C.emissiveMapTransform)),E.specularMap&&(C.specularMap.value=E.specularMap,t(E.specularMap,C.specularMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest);const B=e.get(E),L=B.envMap,O=B.envMapRotation;L&&(C.envMap.value=L,wf.copy(O),wf.x*=-1,wf.y*=-1,wf.z*=-1,L.isCubeTexture&&L.isRenderTargetTexture===!1&&(wf.y*=-1,wf.z*=-1),C.envMapRotation.value.setFromMatrix4(Dj.makeRotationFromEuler(wf)),C.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,C.reflectivity.value=E.reflectivity,C.ior.value=E.ior,C.refractionRatio.value=E.refractionRatio),E.lightMap&&(C.lightMap.value=E.lightMap,C.lightMapIntensity.value=E.lightMapIntensity,t(E.lightMap,C.lightMapTransform)),E.aoMap&&(C.aoMap.value=E.aoMap,C.aoMapIntensity.value=E.aoMapIntensity,t(E.aoMap,C.aoMapTransform))}function a(C,E){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,E.map&&(C.map.value=E.map,t(E.map,C.mapTransform))}function l(C,E){C.dashSize.value=E.dashSize,C.totalSize.value=E.dashSize+E.gapSize,C.scale.value=E.scale}function u(C,E,B,L){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,C.size.value=E.size*B,C.scale.value=L*.5,E.map&&(C.map.value=E.map,t(E.map,C.uvTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest)}function h(C,E){C.diffuse.value.copy(E.color),C.opacity.value=E.opacity,C.rotation.value=E.rotation,E.map&&(C.map.value=E.map,t(E.map,C.mapTransform)),E.alphaMap&&(C.alphaMap.value=E.alphaMap,t(E.alphaMap,C.alphaMapTransform)),E.alphaTest>0&&(C.alphaTest.value=E.alphaTest)}function m(C,E){C.specular.value.copy(E.specular),C.shininess.value=Math.max(E.shininess,1e-4)}function v(C,E){E.gradientMap&&(C.gradientMap.value=E.gradientMap)}function x(C,E){C.metalness.value=E.metalness,E.metalnessMap&&(C.metalnessMap.value=E.metalnessMap,t(E.metalnessMap,C.metalnessMapTransform)),C.roughness.value=E.roughness,E.roughnessMap&&(C.roughnessMap.value=E.roughnessMap,t(E.roughnessMap,C.roughnessMapTransform)),E.envMap&&(C.envMapIntensity.value=E.envMapIntensity)}function S(C,E,B){C.ior.value=E.ior,E.sheen>0&&(C.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),C.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(C.sheenColorMap.value=E.sheenColorMap,t(E.sheenColorMap,C.sheenColorMapTransform)),E.sheenRoughnessMap&&(C.sheenRoughnessMap.value=E.sheenRoughnessMap,t(E.sheenRoughnessMap,C.sheenRoughnessMapTransform))),E.clearcoat>0&&(C.clearcoat.value=E.clearcoat,C.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(C.clearcoatMap.value=E.clearcoatMap,t(E.clearcoatMap,C.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(C.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,t(E.clearcoatRoughnessMap,C.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(C.clearcoatNormalMap.value=E.clearcoatNormalMap,t(E.clearcoatNormalMap,C.clearcoatNormalMapTransform),C.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===hr&&C.clearcoatNormalScale.value.negate())),E.dispersion>0&&(C.dispersion.value=E.dispersion),E.iridescence>0&&(C.iridescence.value=E.iridescence,C.iridescenceIOR.value=E.iridescenceIOR,C.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],C.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(C.iridescenceMap.value=E.iridescenceMap,t(E.iridescenceMap,C.iridescenceMapTransform)),E.iridescenceThicknessMap&&(C.iridescenceThicknessMap.value=E.iridescenceThicknessMap,t(E.iridescenceThicknessMap,C.iridescenceThicknessMapTransform))),E.transmission>0&&(C.transmission.value=E.transmission,C.transmissionSamplerMap.value=B.texture,C.transmissionSamplerSize.value.set(B.width,B.height),E.transmissionMap&&(C.transmissionMap.value=E.transmissionMap,t(E.transmissionMap,C.transmissionMapTransform)),C.thickness.value=E.thickness,E.thicknessMap&&(C.thicknessMap.value=E.thicknessMap,t(E.thicknessMap,C.thicknessMapTransform)),C.attenuationDistance.value=E.attenuationDistance,C.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(C.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(C.anisotropyMap.value=E.anisotropyMap,t(E.anisotropyMap,C.anisotropyMapTransform))),C.specularIntensity.value=E.specularIntensity,C.specularColor.value.copy(E.specularColor),E.specularColorMap&&(C.specularColorMap.value=E.specularColorMap,t(E.specularColorMap,C.specularColorMapTransform)),E.specularIntensityMap&&(C.specularIntensityMap.value=E.specularIntensityMap,t(E.specularIntensityMap,C.specularIntensityMapTransform))}function w(C,E){E.matcap&&(C.matcap.value=E.matcap)}function R(C,E){const B=e.get(E).light;C.referencePosition.value.setFromMatrixPosition(B.matrixWorld),C.nearDistance.value=B.shadow.camera.near,C.farDistance.value=B.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Lj(i,e,t,n){let r={},s={},a=[];const l=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function u(B,L){const O=L.program;n.uniformBlockBinding(B,O)}function h(B,L){let O=r[B.id];O===void 0&&(w(B),O=m(B),r[B.id]=O,B.addEventListener("dispose",C));const G=L.program;n.updateUBOMapping(B,G);const q=e.render.frame;s[B.id]!==q&&(x(B),s[B.id]=q)}function m(B){const L=v();B.__bindingPointIndex=L;const O=i.createBuffer(),G=B.__size,q=B.usage;return i.bindBuffer(i.UNIFORM_BUFFER,O),i.bufferData(i.UNIFORM_BUFFER,G,q),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,L,O),O}function v(){for(let B=0;B<l;B++)if(a.indexOf(B)===-1)return a.push(B),B;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function x(B){const L=r[B.id],O=B.uniforms,G=B.__cache;i.bindBuffer(i.UNIFORM_BUFFER,L);for(let q=0,z=O.length;q<z;q++){const j=Array.isArray(O[q])?O[q]:[O[q]];for(let F=0,V=j.length;F<V;F++){const Y=j[F];if(S(Y,q,F,G)===!0){const ee=Y.__offset,te=Array.isArray(Y.value)?Y.value:[Y.value];let re=0;for(let ne=0;ne<te.length;ne++){const Q=te[ne],ae=R(Q);typeof Q=="number"||typeof Q=="boolean"?(Y.__data[0]=Q,i.bufferSubData(i.UNIFORM_BUFFER,ee+re,Y.__data)):Q.isMatrix3?(Y.__data[0]=Q.elements[0],Y.__data[1]=Q.elements[1],Y.__data[2]=Q.elements[2],Y.__data[3]=0,Y.__data[4]=Q.elements[3],Y.__data[5]=Q.elements[4],Y.__data[6]=Q.elements[5],Y.__data[7]=0,Y.__data[8]=Q.elements[6],Y.__data[9]=Q.elements[7],Y.__data[10]=Q.elements[8],Y.__data[11]=0):(Q.toArray(Y.__data,re),re+=ae.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,ee,Y.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function S(B,L,O,G){const q=B.value,z=L+"_"+O;if(G[z]===void 0)return typeof q=="number"||typeof q=="boolean"?G[z]=q:G[z]=q.clone(),!0;{const j=G[z];if(typeof q=="number"||typeof q=="boolean"){if(j!==q)return G[z]=q,!0}else if(j.equals(q)===!1)return j.copy(q),!0}return!1}function w(B){const L=B.uniforms;let O=0;const G=16;for(let z=0,j=L.length;z<j;z++){const F=Array.isArray(L[z])?L[z]:[L[z]];for(let V=0,Y=F.length;V<Y;V++){const ee=F[V],te=Array.isArray(ee.value)?ee.value:[ee.value];for(let re=0,ne=te.length;re<ne;re++){const Q=te[re],ae=R(Q),de=O%G,Te=de%ae.boundary,be=de+Te;O+=Te,be!==0&&G-be<ae.storage&&(O+=G-be),ee.__data=new Float32Array(ae.storage/Float32Array.BYTES_PER_ELEMENT),ee.__offset=O,O+=ae.storage}}}const q=O%G;return q>0&&(O+=G-q),B.__size=O,B.__cache={},this}function R(B){const L={boundary:0,storage:0};return typeof B=="number"||typeof B=="boolean"?(L.boundary=4,L.storage=4):B.isVector2?(L.boundary=8,L.storage=8):B.isVector3||B.isColor?(L.boundary=16,L.storage=12):B.isVector4?(L.boundary=16,L.storage=16):B.isMatrix3?(L.boundary=48,L.storage=48):B.isMatrix4?(L.boundary=64,L.storage=64):B.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",B),L}function C(B){const L=B.target;L.removeEventListener("dispose",C);const O=a.indexOf(L.__bindingPointIndex);a.splice(O,1),i.deleteBuffer(r[L.id]),delete r[L.id],delete s[L.id]}function E(){for(const B in r)i.deleteBuffer(r[B]);a=[],r={},s={}}return{bind:u,update:h,dispose:E}}class Uj{constructor(e={}){const{canvas:t=F7(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:m="default",failIfMajorPerformanceCaveat:v=!1,reverseDepthBuffer:x=!1}=e;this.isWebGLRenderer=!0;let S;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");S=n.getContextAttributes().alpha}else S=a;const w=new Uint32Array(4),R=new Int32Array(4);let C=null,E=null;const B=[],L=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=_n,this.toneMapping=Za,this.toneMappingExposure=1;const O=this;let G=!1,q=0,z=0,j=null,F=-1,V=null;const Y=new Ln,ee=new Ln;let te=null;const re=new an(0);let ne=0,Q=t.width,ae=t.height,de=1,Te=null,be=null;const ue=new Ln(0,0,Q,ae),we=new Ln(0,0,Q,ae);let We=!1;const Ne=new Fg;let ze=!1,Se=!1;this.transmissionResolutionScale=1;const Ce=new kn,dt=new kn,At=new he,wt=new Ln,Ft={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $e=!1;function rt(){return j===null?de:1}let ce=n;function Gt(oe,Fe){return t.getContext(oe,Fe)}try{const oe={alpha:!0,depth:r,stencil:s,antialias:l,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:m,failIfMajorPerformanceCaveat:v};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${V0}`),t.addEventListener("webglcontextlost",St,!1),t.addEventListener("webglcontextrestored",qt,!1),t.addEventListener("webglcontextcreationerror",Ht,!1),ce===null){const Fe="webgl2";if(ce=Gt(Fe,oe),ce===null)throw Gt(Fe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(oe){throw console.error("THREE.WebGLRenderer: "+oe.message),oe}let ht,Pt,yt,en,xt,fe,X,le,Re,pe,Me,nt,lt,Ot,jt,pt,Yt,rn,$t,kt,Vt,Nn,_i,me;function bt(){ht=new VV(ce),ht.init(),Nn=new wj(ce,ht),Pt=new IV(ce,ht,e,Nn),yt=new Sj(ce,ht),Pt.reverseDepthBuffer&&x&&yt.buffers.depth.setReversed(!0),en=new WV(ce),xt=new cj,fe=new Tj(ce,ht,yt,xt,Pt,Nn,en),X=new kV(O),le=new qV(O),Re=new Jz(ce),_i=new BV(ce,Re),pe=new HV(ce,Re,en,_i),Me=new XV(ce,pe,Re,en),$t=new $V(ce,Pt,fe),pt=new FV(xt),nt=new uj(O,X,le,ht,Pt,_i,pt),lt=new Pj(O,xt),Ot=new fj,jt=new vj(ht),rn=new UV(O,X,le,yt,Me,S,u),Yt=new xj(O,Me,Pt),me=new Lj(ce,en,Pt,yt),kt=new OV(ce,ht,en),Vt=new jV(ce,ht,en),en.programs=nt.programs,O.capabilities=Pt,O.extensions=ht,O.properties=xt,O.renderLists=Ot,O.shadowMap=Yt,O.state=yt,O.info=en}bt();const tt=new Nj(O,ce);this.xr=tt,this.getContext=function(){return ce},this.getContextAttributes=function(){return ce.getContextAttributes()},this.forceContextLoss=function(){const oe=ht.get("WEBGL_lose_context");oe&&oe.loseContext()},this.forceContextRestore=function(){const oe=ht.get("WEBGL_lose_context");oe&&oe.restoreContext()},this.getPixelRatio=function(){return de},this.setPixelRatio=function(oe){oe!==void 0&&(de=oe,this.setSize(Q,ae,!1))},this.getSize=function(oe){return oe.set(Q,ae)},this.setSize=function(oe,Fe,Qe=!0){if(tt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}Q=oe,ae=Fe,t.width=Math.floor(oe*de),t.height=Math.floor(Fe*de),Qe===!0&&(t.style.width=oe+"px",t.style.height=Fe+"px"),this.setViewport(0,0,oe,Fe)},this.getDrawingBufferSize=function(oe){return oe.set(Q*de,ae*de).floor()},this.setDrawingBufferSize=function(oe,Fe,Qe){Q=oe,ae=Fe,de=Qe,t.width=Math.floor(oe*Qe),t.height=Math.floor(Fe*Qe),this.setViewport(0,0,oe,Fe)},this.getCurrentViewport=function(oe){return oe.copy(Y)},this.getViewport=function(oe){return oe.copy(ue)},this.setViewport=function(oe,Fe,Qe,Xe){oe.isVector4?ue.set(oe.x,oe.y,oe.z,oe.w):ue.set(oe,Fe,Qe,Xe),yt.viewport(Y.copy(ue).multiplyScalar(de).round())},this.getScissor=function(oe){return oe.copy(we)},this.setScissor=function(oe,Fe,Qe,Xe){oe.isVector4?we.set(oe.x,oe.y,oe.z,oe.w):we.set(oe,Fe,Qe,Xe),yt.scissor(ee.copy(we).multiplyScalar(de).round())},this.getScissorTest=function(){return We},this.setScissorTest=function(oe){yt.setScissorTest(We=oe)},this.setOpaqueSort=function(oe){Te=oe},this.setTransparentSort=function(oe){be=oe},this.getClearColor=function(oe){return oe.copy(rn.getClearColor())},this.setClearColor=function(){rn.setClearColor.apply(rn,arguments)},this.getClearAlpha=function(){return rn.getClearAlpha()},this.setClearAlpha=function(){rn.setClearAlpha.apply(rn,arguments)},this.clear=function(oe=!0,Fe=!0,Qe=!0){let Xe=0;if(oe){let ke=!1;if(j!==null){const It=j.texture.format;ke=It===W0||It===j0||It===H0}if(ke){const It=j.texture.type,Xt=It===aa||It===Rr||It===wl||It===Au||It===Ay||It===dy,mt=rn.getClearColor(),Z=rn.getClearAlpha(),Bt=mt.r,bn=mt.g,fn=mt.b;Xt?(w[0]=Bt,w[1]=bn,w[2]=fn,w[3]=Z,ce.clearBufferuiv(ce.COLOR,0,w)):(R[0]=Bt,R[1]=bn,R[2]=fn,R[3]=Z,ce.clearBufferiv(ce.COLOR,0,R))}else Xe|=ce.COLOR_BUFFER_BIT}Fe&&(Xe|=ce.DEPTH_BUFFER_BIT),Qe&&(Xe|=ce.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ce.clear(Xe)},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",St,!1),t.removeEventListener("webglcontextrestored",qt,!1),t.removeEventListener("webglcontextcreationerror",Ht,!1),rn.dispose(),Ot.dispose(),jt.dispose(),xt.dispose(),X.dispose(),le.dispose(),Me.dispose(),_i.dispose(),me.dispose(),nt.dispose(),tt.dispose(),tt.removeEventListener("sessionstart",Ze),tt.removeEventListener("sessionend",vt),zt.stop()};function St(oe){oe.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),G=!0}function qt(){console.log("THREE.WebGLRenderer: Context Restored."),G=!1;const oe=en.autoReset,Fe=Yt.enabled,Qe=Yt.autoUpdate,Xe=Yt.needsUpdate,ke=Yt.type;bt(),en.autoReset=oe,Yt.enabled=Fe,Yt.autoUpdate=Qe,Yt.needsUpdate=Xe,Yt.type=ke}function Ht(oe){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",oe.statusMessage)}function xn(oe){const Fe=oe.target;Fe.removeEventListener("dispose",xn),qi(Fe)}function qi(oe){rr(oe),xt.remove(oe)}function rr(oe){const Fe=xt.get(oe).programs;Fe!==void 0&&(Fe.forEach(function(Qe){nt.releaseProgram(Qe)}),oe.isShaderMaterial&&nt.releaseShaderCache(oe))}this.renderBufferDirect=function(oe,Fe,Qe,Xe,ke,It){Fe===null&&(Fe=Ft);const Xt=ke.isMesh&&ke.matrixWorld.determinant()<0,mt=Hs(oe,Fe,Qe,Xe,ke);yt.setMaterial(Xe,Xt);let Z=Qe.index,Bt=1;if(Xe.wireframe===!0){if(Z=pe.getWireframeAttribute(Qe),Z===void 0)return;Bt=2}const bn=Qe.drawRange,fn=Qe.attributes.position;let ui=bn.start*Bt,ci=(bn.start+bn.count)*Bt;It!==null&&(ui=Math.max(ui,It.start*Bt),ci=Math.min(ci,(It.start+It.count)*Bt)),Z!==null?(ui=Math.max(ui,0),ci=Math.min(ci,Z.count)):fn!=null&&(ui=Math.max(ui,0),ci=Math.min(ci,fn.count));const yi=ci-ui;if(yi<0||yi===1/0)return;_i.setup(ke,Xe,mt,Qe,Z);let K,Un=kt;if(Z!==null&&(K=Re.get(Z),Un=Vt,Un.setIndex(K)),ke.isMesh)Xe.wireframe===!0?(yt.setLineWidth(Xe.wireframeLinewidth*rt()),Un.setMode(ce.LINES)):Un.setMode(ce.TRIANGLES);else if(ke.isLine){let mn=Xe.linewidth;mn===void 0&&(mn=1),yt.setLineWidth(mn*rt()),ke.isLineSegments?Un.setMode(ce.LINES):ke.isLineLoop?Un.setMode(ce.LINE_LOOP):Un.setMode(ce.LINE_STRIP)}else ke.isPoints?Un.setMode(ce.POINTS):ke.isSprite&&Un.setMode(ce.TRIANGLES);if(ke.isBatchedMesh)if(ke._multiDrawInstances!==null)Un.renderMultiDrawInstances(ke._multiDrawStarts,ke._multiDrawCounts,ke._multiDrawCount,ke._multiDrawInstances);else if(ht.get("WEBGL_multi_draw"))Un.renderMultiDraw(ke._multiDrawStarts,ke._multiDrawCounts,ke._multiDrawCount);else{const mn=ke._multiDrawStarts,yr=ke._multiDrawCounts,hi=ke._multiDrawCount,bs=Z?Re.get(Z).bytesPerElement:1,fa=xt.get(Xe).currentProgram.getUniforms();for(let ye=0;ye<hi;ye++)fa.setValue(ce,"_gl_DrawID",ye),Un.render(mn[ye]/bs,yr[ye])}else if(ke.isInstancedMesh)Un.renderInstances(ui,yi,ke.count);else if(Qe.isInstancedBufferGeometry){const mn=Qe._maxInstanceCount!==void 0?Qe._maxInstanceCount:1/0,yr=Math.min(Qe.instanceCount,mn);Un.renderInstances(ui,yi,yr)}else Un.render(ui,yi)};function pn(oe,Fe,Qe){oe.transparent===!0&&oe.side===as&&oe.forceSinglePass===!1?(oe.side=hr,oe.needsUpdate=!0,Xn(oe,Fe,Qe),oe.side=Nl,oe.needsUpdate=!0,Xn(oe,Fe,Qe),oe.side=as):Xn(oe,Fe,Qe)}this.compile=function(oe,Fe,Qe=null){Qe===null&&(Qe=oe),E=jt.get(Qe),E.init(Fe),L.push(E),Qe.traverseVisible(function(ke){ke.isLight&&ke.layers.test(Fe.layers)&&(E.pushLight(ke),ke.castShadow&&E.pushShadow(ke))}),oe!==Qe&&oe.traverseVisible(function(ke){ke.isLight&&ke.layers.test(Fe.layers)&&(E.pushLight(ke),ke.castShadow&&E.pushShadow(ke))}),E.setupLights();const Xe=new Set;return oe.traverse(function(ke){if(!(ke.isMesh||ke.isPoints||ke.isLine||ke.isSprite))return;const It=ke.material;if(It)if(Array.isArray(It))for(let Xt=0;Xt<It.length;Xt++){const mt=It[Xt];pn(mt,Qe,ke),Xe.add(mt)}else pn(It,Qe,ke),Xe.add(It)}),L.pop(),E=null,Xe},this.compileAsync=function(oe,Fe,Qe=null){const Xe=this.compile(oe,Fe,Qe);return new Promise(ke=>{function It(){if(Xe.forEach(function(Xt){xt.get(Xt).currentProgram.isReady()&&Xe.delete(Xt)}),Xe.size===0){ke(oe);return}setTimeout(It,10)}ht.get("KHR_parallel_shader_compile")!==null?It():setTimeout(It,10)})};let $i=null;function Jr(oe){$i&&$i(oe)}function Ze(){zt.stop()}function vt(){zt.start()}const zt=new lD;zt.setAnimationLoop(Jr),typeof self<"u"&&zt.setContext(self),this.setAnimationLoop=function(oe){$i=oe,tt.setAnimationLoop(oe),oe===null?zt.stop():zt.start()},tt.addEventListener("sessionstart",Ze),tt.addEventListener("sessionend",vt),this.render=function(oe,Fe){if(Fe!==void 0&&Fe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(G===!0)return;if(oe.matrixWorldAutoUpdate===!0&&oe.updateMatrixWorld(),Fe.parent===null&&Fe.matrixWorldAutoUpdate===!0&&Fe.updateMatrixWorld(),tt.enabled===!0&&tt.isPresenting===!0&&(tt.cameraAutoUpdate===!0&&tt.updateCamera(Fe),Fe=tt.getCamera()),oe.isScene===!0&&oe.onBeforeRender(O,oe,Fe,j),E=jt.get(oe,L.length),E.init(Fe),L.push(E),dt.multiplyMatrices(Fe.projectionMatrix,Fe.matrixWorldInverse),Ne.setFromProjectionMatrix(dt),Se=this.localClippingEnabled,ze=pt.init(this.clippingPlanes,Se),C=Ot.get(oe,B.length),C.init(),B.push(C),tt.enabled===!0&&tt.isPresenting===!0){const It=O.xr.getDepthSensingMesh();It!==null&&at(It,Fe,-1/0,O.sortObjects)}at(oe,Fe,0,O.sortObjects),C.finish(),O.sortObjects===!0&&C.sort(Te,be),$e=tt.enabled===!1||tt.isPresenting===!1||tt.hasDepthSensing()===!1,$e&&rn.addToRenderList(C,oe),this.info.render.frame++,ze===!0&&pt.beginShadows();const Qe=E.state.shadowsArray;Yt.render(Qe,oe,Fe),ze===!0&&pt.endShadows(),this.info.autoReset===!0&&this.info.reset();const Xe=C.opaque,ke=C.transmissive;if(E.setupLights(),Fe.isArrayCamera){const It=Fe.cameras;if(ke.length>0)for(let Xt=0,mt=It.length;Xt<mt;Xt++){const Z=It[Xt];J(Xe,ke,oe,Z)}$e&&rn.render(oe);for(let Xt=0,mt=It.length;Xt<mt;Xt++){const Z=It[Xt];d(C,oe,Z,Z.viewport)}}else ke.length>0&&J(Xe,ke,oe,Fe),$e&&rn.render(oe),d(C,oe,Fe);j!==null&&z===0&&(fe.updateMultisampleRenderTarget(j),fe.updateRenderTargetMipmap(j)),oe.isScene===!0&&oe.onAfterRender(O,oe,Fe),_i.resetDefaultState(),F=-1,V=null,L.pop(),L.length>0?(E=L[L.length-1],ze===!0&&pt.setGlobalState(O.clippingPlanes,E.state.camera)):E=null,B.pop(),B.length>0?C=B[B.length-1]:C=null};function at(oe,Fe,Qe,Xe){if(oe.visible===!1)return;if(oe.layers.test(Fe.layers)){if(oe.isGroup)Qe=oe.renderOrder;else if(oe.isLOD)oe.autoUpdate===!0&&oe.update(Fe);else if(oe.isLight)E.pushLight(oe),oe.castShadow&&E.pushShadow(oe);else if(oe.isSprite){if(!oe.frustumCulled||Ne.intersectsSprite(oe)){Xe&&wt.setFromMatrixPosition(oe.matrixWorld).applyMatrix4(dt);const Xt=Me.update(oe),mt=oe.material;mt.visible&&C.push(oe,Xt,mt,Qe,wt.z,null)}}else if((oe.isMesh||oe.isLine||oe.isPoints)&&(!oe.frustumCulled||Ne.intersectsObject(oe))){const Xt=Me.update(oe),mt=oe.material;if(Xe&&(oe.boundingSphere!==void 0?(oe.boundingSphere===null&&oe.computeBoundingSphere(),wt.copy(oe.boundingSphere.center)):(Xt.boundingSphere===null&&Xt.computeBoundingSphere(),wt.copy(Xt.boundingSphere.center)),wt.applyMatrix4(oe.matrixWorld).applyMatrix4(dt)),Array.isArray(mt)){const Z=Xt.groups;for(let Bt=0,bn=Z.length;Bt<bn;Bt++){const fn=Z[Bt],ui=mt[fn.materialIndex];ui&&ui.visible&&C.push(oe,Xt,ui,Qe,wt.z,fn)}}else mt.visible&&C.push(oe,Xt,mt,Qe,wt.z,null)}}const It=oe.children;for(let Xt=0,mt=It.length;Xt<mt;Xt++)at(It[Xt],Fe,Qe,Xe)}function d(oe,Fe,Qe,Xe){const ke=oe.opaque,It=oe.transmissive,Xt=oe.transparent;E.setupLightsView(Qe),ze===!0&&pt.setGlobalState(O.clippingPlanes,Qe),Xe&&yt.viewport(Y.copy(Xe)),ke.length>0&&$n(ke,Fe,Qe),It.length>0&&$n(It,Fe,Qe),Xt.length>0&&$n(Xt,Fe,Qe),yt.buffers.depth.setTest(!0),yt.buffers.depth.setMask(!0),yt.buffers.color.setMask(!0),yt.setPolygonOffset(!1)}function J(oe,Fe,Qe,Xe){if((Qe.isScene===!0?Qe.overrideMaterial:null)!==null)return;E.state.transmissionRenderTarget[Xe.id]===void 0&&(E.state.transmissionRenderTarget[Xe.id]=new qh(1,1,{generateMipmaps:!0,type:ht.has("EXT_color_buffer_half_float")||ht.has("EXT_color_buffer_float")?Gs:aa,minFilter:Va,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ai.workingColorSpace}));const It=E.state.transmissionRenderTarget[Xe.id],Xt=Xe.viewport||Y;It.setSize(Xt.z*O.transmissionResolutionScale,Xt.w*O.transmissionResolutionScale);const mt=O.getRenderTarget();O.setRenderTarget(It),O.getClearColor(re),ne=O.getClearAlpha(),ne<1&&O.setClearColor(16777215,.5),O.clear(),$e&&rn.render(Qe);const Z=O.toneMapping;O.toneMapping=Za;const Bt=Xe.viewport;if(Xe.viewport!==void 0&&(Xe.viewport=void 0),E.setupLightsView(Xe),ze===!0&&pt.setGlobalState(O.clippingPlanes,Xe),$n(oe,Qe,Xe),fe.updateMultisampleRenderTarget(It),fe.updateRenderTargetMipmap(It),ht.has("WEBGL_multisampled_render_to_texture")===!1){let bn=!1;for(let fn=0,ui=Fe.length;fn<ui;fn++){const ci=Fe[fn],yi=ci.object,K=ci.geometry,Un=ci.material,mn=ci.group;if(Un.side===as&&yi.layers.test(Xe.layers)){const yr=Un.side;Un.side=hr,Un.needsUpdate=!0,Gn(yi,Qe,Xe,K,Un,mn),Un.side=yr,Un.needsUpdate=!0,bn=!0}}bn===!0&&(fe.updateMultisampleRenderTarget(It),fe.updateRenderTargetMipmap(It))}O.setRenderTarget(mt),O.setClearColor(re,ne),Bt!==void 0&&(Xe.viewport=Bt),O.toneMapping=Z}function $n(oe,Fe,Qe){const Xe=Fe.isScene===!0?Fe.overrideMaterial:null;for(let ke=0,It=oe.length;ke<It;ke++){const Xt=oe[ke],mt=Xt.object,Z=Xt.geometry,Bt=Xe===null?Xt.material:Xe,bn=Xt.group;mt.layers.test(Qe.layers)&&Gn(mt,Fe,Qe,Z,Bt,bn)}}function Gn(oe,Fe,Qe,Xe,ke,It){oe.onBeforeRender(O,Fe,Qe,Xe,ke,It),oe.modelViewMatrix.multiplyMatrices(Qe.matrixWorldInverse,oe.matrixWorld),oe.normalMatrix.getNormalMatrix(oe.modelViewMatrix),ke.onBeforeRender(O,Fe,Qe,Xe,oe,It),ke.transparent===!0&&ke.side===as&&ke.forceSinglePass===!1?(ke.side=hr,ke.needsUpdate=!0,O.renderBufferDirect(Qe,Fe,Xe,ke,oe,It),ke.side=Nl,ke.needsUpdate=!0,O.renderBufferDirect(Qe,Fe,Xe,ke,oe,It),ke.side=as):O.renderBufferDirect(Qe,Fe,Xe,ke,oe,It),oe.onAfterRender(O,Fe,Qe,Xe,ke,It)}function Xn(oe,Fe,Qe){Fe.isScene!==!0&&(Fe=Ft);const Xe=xt.get(oe),ke=E.state.lights,It=E.state.shadowsArray,Xt=ke.state.version,mt=nt.getParameters(oe,ke.state,It,Fe,Qe),Z=nt.getProgramCacheKey(mt);let Bt=Xe.programs;Xe.environment=oe.isMeshStandardMaterial?Fe.environment:null,Xe.fog=Fe.fog,Xe.envMap=(oe.isMeshStandardMaterial?le:X).get(oe.envMap||Xe.environment),Xe.envMapRotation=Xe.environment!==null&&oe.envMap===null?Fe.environmentRotation:oe.envMapRotation,Bt===void 0&&(oe.addEventListener("dispose",xn),Bt=new Map,Xe.programs=Bt);let bn=Bt.get(Z);if(bn!==void 0){if(Xe.currentProgram===bn&&Xe.lightsStateVersion===Xt)return qn(oe,mt),bn}else mt.uniforms=nt.getUniforms(oe),oe.onBeforeCompile(mt,O),bn=nt.acquireProgram(mt,Z),Bt.set(Z,bn),Xe.uniforms=mt.uniforms;const fn=Xe.uniforms;return(!oe.isShaderMaterial&&!oe.isRawShaderMaterial||oe.clipping===!0)&&(fn.clippingPlanes=pt.uniform),qn(oe,mt),Xe.needsLights=Fn(oe),Xe.lightsStateVersion=Xt,Xe.needsLights&&(fn.ambientLightColor.value=ke.state.ambient,fn.lightProbe.value=ke.state.probe,fn.directionalLights.value=ke.state.directional,fn.directionalLightShadows.value=ke.state.directionalShadow,fn.spotLights.value=ke.state.spot,fn.spotLightShadows.value=ke.state.spotShadow,fn.rectAreaLights.value=ke.state.rectArea,fn.ltc_1.value=ke.state.rectAreaLTC1,fn.ltc_2.value=ke.state.rectAreaLTC2,fn.pointLights.value=ke.state.point,fn.pointLightShadows.value=ke.state.pointShadow,fn.hemisphereLights.value=ke.state.hemi,fn.directionalShadowMap.value=ke.state.directionalShadowMap,fn.directionalShadowMatrix.value=ke.state.directionalShadowMatrix,fn.spotShadowMap.value=ke.state.spotShadowMap,fn.spotLightMatrix.value=ke.state.spotLightMatrix,fn.spotLightMap.value=ke.state.spotLightMap,fn.pointShadowMap.value=ke.state.pointShadowMap,fn.pointShadowMatrix.value=ke.state.pointShadowMatrix),Xe.currentProgram=bn,Xe.uniformsList=null,bn}function un(oe){if(oe.uniformsList===null){const Fe=oe.currentProgram.getUniforms();oe.uniformsList=qv.seqWithValue(Fe.seq,oe.uniforms)}return oe.uniformsList}function qn(oe,Fe){const Qe=xt.get(oe);Qe.outputColorSpace=Fe.outputColorSpace,Qe.batching=Fe.batching,Qe.batchingColor=Fe.batchingColor,Qe.instancing=Fe.instancing,Qe.instancingColor=Fe.instancingColor,Qe.instancingMorph=Fe.instancingMorph,Qe.skinning=Fe.skinning,Qe.morphTargets=Fe.morphTargets,Qe.morphNormals=Fe.morphNormals,Qe.morphColors=Fe.morphColors,Qe.morphTargetsCount=Fe.morphTargetsCount,Qe.numClippingPlanes=Fe.numClippingPlanes,Qe.numIntersection=Fe.numClipIntersection,Qe.vertexAlphas=Fe.vertexAlphas,Qe.vertexTangents=Fe.vertexTangents,Qe.toneMapping=Fe.toneMapping}function Hs(oe,Fe,Qe,Xe,ke){Fe.isScene!==!0&&(Fe=Ft),fe.resetTextureUnits();const It=Fe.fog,Xt=Xe.isMeshStandardMaterial?Fe.environment:null,mt=j===null?O.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:Ro,Z=(Xe.isMeshStandardMaterial?le:X).get(Xe.envMap||Xt),Bt=Xe.vertexColors===!0&&!!Qe.attributes.color&&Qe.attributes.color.itemSize===4,bn=!!Qe.attributes.tangent&&(!!Xe.normalMap||Xe.anisotropy>0),fn=!!Qe.morphAttributes.position,ui=!!Qe.morphAttributes.normal,ci=!!Qe.morphAttributes.color;let yi=Za;Xe.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(yi=O.toneMapping);const K=Qe.morphAttributes.position||Qe.morphAttributes.normal||Qe.morphAttributes.color,Un=K!==void 0?K.length:0,mn=xt.get(Xe),yr=E.state.lights;if(ze===!0&&(Se===!0||oe!==V)){const Yn=oe===V&&Xe.id===F;pt.setState(Xe,oe,Yn)}let hi=!1;Xe.version===mn.__version?(mn.needsLights&&mn.lightsStateVersion!==yr.state.version||mn.outputColorSpace!==mt||ke.isBatchedMesh&&mn.batching===!1||!ke.isBatchedMesh&&mn.batching===!0||ke.isBatchedMesh&&mn.batchingColor===!0&&ke.colorTexture===null||ke.isBatchedMesh&&mn.batchingColor===!1&&ke.colorTexture!==null||ke.isInstancedMesh&&mn.instancing===!1||!ke.isInstancedMesh&&mn.instancing===!0||ke.isSkinnedMesh&&mn.skinning===!1||!ke.isSkinnedMesh&&mn.skinning===!0||ke.isInstancedMesh&&mn.instancingColor===!0&&ke.instanceColor===null||ke.isInstancedMesh&&mn.instancingColor===!1&&ke.instanceColor!==null||ke.isInstancedMesh&&mn.instancingMorph===!0&&ke.morphTexture===null||ke.isInstancedMesh&&mn.instancingMorph===!1&&ke.morphTexture!==null||mn.envMap!==Z||Xe.fog===!0&&mn.fog!==It||mn.numClippingPlanes!==void 0&&(mn.numClippingPlanes!==pt.numPlanes||mn.numIntersection!==pt.numIntersection)||mn.vertexAlphas!==Bt||mn.vertexTangents!==bn||mn.morphTargets!==fn||mn.morphNormals!==ui||mn.morphColors!==ci||mn.toneMapping!==yi||mn.morphTargetsCount!==Un)&&(hi=!0):(hi=!0,mn.__version=Xe.version);let bs=mn.currentProgram;hi===!0&&(bs=Xn(Xe,Fe,ke));let fa=!1,ye=!1,ot=!1;const Nt=bs.getUniforms(),Jt=mn.uniforms;if(yt.useProgram(bs.program)&&(fa=!0,ye=!0,ot=!0),Xe.id!==F&&(F=Xe.id,ye=!0),fa||V!==oe){yt.buffers.depth.getReversed()?(Ce.copy(oe.projectionMatrix),wk(Ce),Mk(Ce),Nt.setValue(ce,"projectionMatrix",Ce)):Nt.setValue(ce,"projectionMatrix",oe.projectionMatrix),Nt.setValue(ce,"viewMatrix",oe.matrixWorldInverse);const xi=Nt.map.cameraPosition;xi!==void 0&&xi.setValue(ce,At.setFromMatrixPosition(oe.matrixWorld)),Pt.logarithmicDepthBuffer&&Nt.setValue(ce,"logDepthBufFC",2/(Math.log(oe.far+1)/Math.LN2)),(Xe.isMeshPhongMaterial||Xe.isMeshToonMaterial||Xe.isMeshLambertMaterial||Xe.isMeshBasicMaterial||Xe.isMeshStandardMaterial||Xe.isShaderMaterial)&&Nt.setValue(ce,"isOrthographic",oe.isOrthographicCamera===!0),V!==oe&&(V=oe,ye=!0,ot=!0)}if(ke.isSkinnedMesh){Nt.setOptional(ce,ke,"bindMatrix"),Nt.setOptional(ce,ke,"bindMatrixInverse");const Yn=ke.skeleton;Yn&&(Yn.boneTexture===null&&Yn.computeBoneTexture(),Nt.setValue(ce,"boneTexture",Yn.boneTexture,fe))}ke.isBatchedMesh&&(Nt.setOptional(ce,ke,"batchingTexture"),Nt.setValue(ce,"batchingTexture",ke._matricesTexture,fe),Nt.setOptional(ce,ke,"batchingIdTexture"),Nt.setValue(ce,"batchingIdTexture",ke._indirectTexture,fe),Nt.setOptional(ce,ke,"batchingColorTexture"),ke._colorsTexture!==null&&Nt.setValue(ce,"batchingColorTexture",ke._colorsTexture,fe));const cn=Qe.morphAttributes;if((cn.position!==void 0||cn.normal!==void 0||cn.color!==void 0)&&$t.update(ke,Qe,bs),(ye||mn.receiveShadow!==ke.receiveShadow)&&(mn.receiveShadow=ke.receiveShadow,Nt.setValue(ce,"receiveShadow",ke.receiveShadow)),Xe.isMeshGouraudMaterial&&Xe.envMap!==null&&(Jt.envMap.value=Z,Jt.flipEnvMap.value=Z.isCubeTexture&&Z.isRenderTargetTexture===!1?-1:1),Xe.isMeshStandardMaterial&&Xe.envMap===null&&Fe.environment!==null&&(Jt.envMapIntensity.value=Fe.environmentIntensity),ye&&(Nt.setValue(ce,"toneMappingExposure",O.toneMappingExposure),mn.needsLights&&li(Jt,ot),It&&Xe.fog===!0&&lt.refreshFogUniforms(Jt,It),lt.refreshMaterialUniforms(Jt,Xe,de,ae,E.state.transmissionRenderTarget[oe.id]),qv.upload(ce,un(mn),Jt,fe)),Xe.isShaderMaterial&&Xe.uniformsNeedUpdate===!0&&(qv.upload(ce,un(mn),Jt,fe),Xe.uniformsNeedUpdate=!1),Xe.isSpriteMaterial&&Nt.setValue(ce,"center",ke.center),Nt.setValue(ce,"modelViewMatrix",ke.modelViewMatrix),Nt.setValue(ce,"normalMatrix",ke.normalMatrix),Nt.setValue(ce,"modelMatrix",ke.matrixWorld),Xe.isShaderMaterial||Xe.isRawShaderMaterial){const Yn=Xe.uniformsGroups;for(let xi=0,js=Yn.length;xi<js;xi++){const pi=Yn[xi];me.update(pi,bs),me.bind(pi,bs)}}return bs}function li(oe,Fe){oe.ambientLightColor.needsUpdate=Fe,oe.lightProbe.needsUpdate=Fe,oe.directionalLights.needsUpdate=Fe,oe.directionalLightShadows.needsUpdate=Fe,oe.pointLights.needsUpdate=Fe,oe.pointLightShadows.needsUpdate=Fe,oe.spotLights.needsUpdate=Fe,oe.spotLightShadows.needsUpdate=Fe,oe.rectAreaLights.needsUpdate=Fe,oe.hemisphereLights.needsUpdate=Fe}function Fn(oe){return oe.isMeshLambertMaterial||oe.isMeshToonMaterial||oe.isMeshPhongMaterial||oe.isMeshStandardMaterial||oe.isShadowMaterial||oe.isShaderMaterial&&oe.lights===!0}this.getActiveCubeFace=function(){return q},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return j},this.setRenderTargetTextures=function(oe,Fe,Qe){xt.get(oe.texture).__webglTexture=Fe,xt.get(oe.depthTexture).__webglTexture=Qe;const Xe=xt.get(oe);Xe.__hasExternalTextures=!0,Xe.__autoAllocateDepthBuffer=Qe===void 0,Xe.__autoAllocateDepthBuffer||ht.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Xe.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(oe,Fe){const Qe=xt.get(oe);Qe.__webglFramebuffer=Fe,Qe.__useDefaultFramebuffer=Fe===void 0};const cs=ce.createFramebuffer();this.setRenderTarget=function(oe,Fe=0,Qe=0){j=oe,q=Fe,z=Qe;let Xe=!0,ke=null,It=!1,Xt=!1;if(oe){const Z=xt.get(oe);if(Z.__useDefaultFramebuffer!==void 0)yt.bindFramebuffer(ce.FRAMEBUFFER,null),Xe=!1;else if(Z.__webglFramebuffer===void 0)fe.setupRenderTarget(oe);else if(Z.__hasExternalTextures)fe.rebindTextures(oe,xt.get(oe.texture).__webglTexture,xt.get(oe.depthTexture).__webglTexture);else if(oe.depthBuffer){const fn=oe.depthTexture;if(Z.__boundDepthTexture!==fn){if(fn!==null&&xt.has(fn)&&(oe.width!==fn.image.width||oe.height!==fn.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");fe.setupDepthRenderbuffer(oe)}}const Bt=oe.texture;(Bt.isData3DTexture||Bt.isDataArrayTexture||Bt.isCompressedArrayTexture)&&(Xt=!0);const bn=xt.get(oe).__webglFramebuffer;oe.isWebGLCubeRenderTarget?(Array.isArray(bn[Fe])?ke=bn[Fe][Qe]:ke=bn[Fe],It=!0):oe.samples>0&&fe.useMultisampledRTT(oe)===!1?ke=xt.get(oe).__webglMultisampledFramebuffer:Array.isArray(bn)?ke=bn[Qe]:ke=bn,Y.copy(oe.viewport),ee.copy(oe.scissor),te=oe.scissorTest}else Y.copy(ue).multiplyScalar(de).floor(),ee.copy(we).multiplyScalar(de).floor(),te=We;if(Qe!==0&&(ke=cs),yt.bindFramebuffer(ce.FRAMEBUFFER,ke)&&Xe&&yt.drawBuffers(oe,ke),yt.viewport(Y),yt.scissor(ee),yt.setScissorTest(te),It){const Z=xt.get(oe.texture);ce.framebufferTexture2D(ce.FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.TEXTURE_CUBE_MAP_POSITIVE_X+Fe,Z.__webglTexture,Qe)}else if(Xt){const Z=xt.get(oe.texture),Bt=Fe;ce.framebufferTextureLayer(ce.FRAMEBUFFER,ce.COLOR_ATTACHMENT0,Z.__webglTexture,Qe,Bt)}else if(oe!==null&&Qe!==0){const Z=xt.get(oe.texture);ce.framebufferTexture2D(ce.FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.TEXTURE_2D,Z.__webglTexture,Qe)}F=-1},this.readRenderTargetPixels=function(oe,Fe,Qe,Xe,ke,It,Xt){if(!(oe&&oe.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let mt=xt.get(oe).__webglFramebuffer;if(oe.isWebGLCubeRenderTarget&&Xt!==void 0&&(mt=mt[Xt]),mt){yt.bindFramebuffer(ce.FRAMEBUFFER,mt);try{const Z=oe.texture,Bt=Z.format,bn=Z.type;if(!Pt.textureFormatReadable(Bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Pt.textureTypeReadable(bn)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Fe>=0&&Fe<=oe.width-Xe&&Qe>=0&&Qe<=oe.height-ke&&ce.readPixels(Fe,Qe,Xe,ke,Nn.convert(Bt),Nn.convert(bn),It)}finally{const Z=j!==null?xt.get(j).__webglFramebuffer:null;yt.bindFramebuffer(ce.FRAMEBUFFER,Z)}}},this.readRenderTargetPixelsAsync=async function(oe,Fe,Qe,Xe,ke,It,Xt){if(!(oe&&oe.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let mt=xt.get(oe).__webglFramebuffer;if(oe.isWebGLCubeRenderTarget&&Xt!==void 0&&(mt=mt[Xt]),mt){const Z=oe.texture,Bt=Z.format,bn=Z.type;if(!Pt.textureFormatReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Pt.textureTypeReadable(bn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(Fe>=0&&Fe<=oe.width-Xe&&Qe>=0&&Qe<=oe.height-ke){yt.bindFramebuffer(ce.FRAMEBUFFER,mt);const fn=ce.createBuffer();ce.bindBuffer(ce.PIXEL_PACK_BUFFER,fn),ce.bufferData(ce.PIXEL_PACK_BUFFER,It.byteLength,ce.STREAM_READ),ce.readPixels(Fe,Qe,Xe,ke,Nn.convert(Bt),Nn.convert(bn),0);const ui=j!==null?xt.get(j).__webglFramebuffer:null;yt.bindFramebuffer(ce.FRAMEBUFFER,ui);const ci=ce.fenceSync(ce.SYNC_GPU_COMMANDS_COMPLETE,0);return ce.flush(),await Tk(ce,ci,4),ce.bindBuffer(ce.PIXEL_PACK_BUFFER,fn),ce.getBufferSubData(ce.PIXEL_PACK_BUFFER,0,It),ce.deleteBuffer(fn),ce.deleteSync(ci),It}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(oe,Fe=null,Qe=0){oe.isTexture!==!0&&(kf("WebGLRenderer: copyFramebufferToTexture function signature has changed."),Fe=arguments[0]||null,oe=arguments[1]);const Xe=Math.pow(2,-Qe),ke=Math.floor(oe.image.width*Xe),It=Math.floor(oe.image.height*Xe),Xt=Fe!==null?Fe.x:0,mt=Fe!==null?Fe.y:0;fe.setTexture2D(oe,0),ce.copyTexSubImage2D(ce.TEXTURE_2D,Qe,0,0,Xt,mt,ke,It),yt.unbindTexture()};const Ma=ce.createFramebuffer(),Ul=ce.createFramebuffer();this.copyTextureToTexture=function(oe,Fe,Qe=null,Xe=null,ke=0,It=null){oe.isTexture!==!0&&(kf("WebGLRenderer: copyTextureToTexture function signature has changed."),Xe=arguments[0]||null,oe=arguments[1],Fe=arguments[2],It=arguments[3]||0,Qe=null),It===null&&(ke!==0?(kf("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),It=ke,ke=0):It=0);let Xt,mt,Z,Bt,bn,fn,ui,ci,yi;const K=oe.isCompressedTexture?oe.mipmaps[It]:oe.image;if(Qe!==null)Xt=Qe.max.x-Qe.min.x,mt=Qe.max.y-Qe.min.y,Z=Qe.isBox3?Qe.max.z-Qe.min.z:1,Bt=Qe.min.x,bn=Qe.min.y,fn=Qe.isBox3?Qe.min.z:0;else{const cn=Math.pow(2,-ke);Xt=Math.floor(K.width*cn),mt=Math.floor(K.height*cn),oe.isDataArrayTexture?Z=K.depth:oe.isData3DTexture?Z=Math.floor(K.depth*cn):Z=1,Bt=0,bn=0,fn=0}Xe!==null?(ui=Xe.x,ci=Xe.y,yi=Xe.z):(ui=0,ci=0,yi=0);const Un=Nn.convert(Fe.format),mn=Nn.convert(Fe.type);let yr;Fe.isData3DTexture?(fe.setTexture3D(Fe,0),yr=ce.TEXTURE_3D):Fe.isDataArrayTexture||Fe.isCompressedArrayTexture?(fe.setTexture2DArray(Fe,0),yr=ce.TEXTURE_2D_ARRAY):(fe.setTexture2D(Fe,0),yr=ce.TEXTURE_2D),ce.pixelStorei(ce.UNPACK_FLIP_Y_WEBGL,Fe.flipY),ce.pixelStorei(ce.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Fe.premultiplyAlpha),ce.pixelStorei(ce.UNPACK_ALIGNMENT,Fe.unpackAlignment);const hi=ce.getParameter(ce.UNPACK_ROW_LENGTH),bs=ce.getParameter(ce.UNPACK_IMAGE_HEIGHT),fa=ce.getParameter(ce.UNPACK_SKIP_PIXELS),ye=ce.getParameter(ce.UNPACK_SKIP_ROWS),ot=ce.getParameter(ce.UNPACK_SKIP_IMAGES);ce.pixelStorei(ce.UNPACK_ROW_LENGTH,K.width),ce.pixelStorei(ce.UNPACK_IMAGE_HEIGHT,K.height),ce.pixelStorei(ce.UNPACK_SKIP_PIXELS,Bt),ce.pixelStorei(ce.UNPACK_SKIP_ROWS,bn),ce.pixelStorei(ce.UNPACK_SKIP_IMAGES,fn);const Nt=oe.isDataArrayTexture||oe.isData3DTexture,Jt=Fe.isDataArrayTexture||Fe.isData3DTexture;if(oe.isDepthTexture){const cn=xt.get(oe),Yn=xt.get(Fe),xi=xt.get(cn.__renderTarget),js=xt.get(Yn.__renderTarget);yt.bindFramebuffer(ce.READ_FRAMEBUFFER,xi.__webglFramebuffer),yt.bindFramebuffer(ce.DRAW_FRAMEBUFFER,js.__webglFramebuffer);for(let pi=0;pi<Z;pi++)Nt&&(ce.framebufferTextureLayer(ce.READ_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,xt.get(oe).__webglTexture,ke,fn+pi),ce.framebufferTextureLayer(ce.DRAW_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,xt.get(Fe).__webglTexture,It,yi+pi)),ce.blitFramebuffer(Bt,bn,Xt,mt,ui,ci,Xt,mt,ce.DEPTH_BUFFER_BIT,ce.NEAREST);yt.bindFramebuffer(ce.READ_FRAMEBUFFER,null),yt.bindFramebuffer(ce.DRAW_FRAMEBUFFER,null)}else if(ke!==0||oe.isRenderTargetTexture||xt.has(oe)){const cn=xt.get(oe),Yn=xt.get(Fe);yt.bindFramebuffer(ce.READ_FRAMEBUFFER,Ma),yt.bindFramebuffer(ce.DRAW_FRAMEBUFFER,Ul);for(let xi=0;xi<Z;xi++)Nt?ce.framebufferTextureLayer(ce.READ_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,cn.__webglTexture,ke,fn+xi):ce.framebufferTexture2D(ce.READ_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.TEXTURE_2D,cn.__webglTexture,ke),Jt?ce.framebufferTextureLayer(ce.DRAW_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,Yn.__webglTexture,It,yi+xi):ce.framebufferTexture2D(ce.DRAW_FRAMEBUFFER,ce.COLOR_ATTACHMENT0,ce.TEXTURE_2D,Yn.__webglTexture,It),ke!==0?ce.blitFramebuffer(Bt,bn,Xt,mt,ui,ci,Xt,mt,ce.COLOR_BUFFER_BIT,ce.NEAREST):Jt?ce.copyTexSubImage3D(yr,It,ui,ci,yi+xi,Bt,bn,Xt,mt):ce.copyTexSubImage2D(yr,It,ui,ci,Bt,bn,Xt,mt);yt.bindFramebuffer(ce.READ_FRAMEBUFFER,null),yt.bindFramebuffer(ce.DRAW_FRAMEBUFFER,null)}else Jt?oe.isDataTexture||oe.isData3DTexture?ce.texSubImage3D(yr,It,ui,ci,yi,Xt,mt,Z,Un,mn,K.data):Fe.isCompressedArrayTexture?ce.compressedTexSubImage3D(yr,It,ui,ci,yi,Xt,mt,Z,Un,K.data):ce.texSubImage3D(yr,It,ui,ci,yi,Xt,mt,Z,Un,mn,K):oe.isDataTexture?ce.texSubImage2D(ce.TEXTURE_2D,It,ui,ci,Xt,mt,Un,mn,K.data):oe.isCompressedTexture?ce.compressedTexSubImage2D(ce.TEXTURE_2D,It,ui,ci,K.width,K.height,Un,K.data):ce.texSubImage2D(ce.TEXTURE_2D,It,ui,ci,Xt,mt,Un,mn,K);ce.pixelStorei(ce.UNPACK_ROW_LENGTH,hi),ce.pixelStorei(ce.UNPACK_IMAGE_HEIGHT,bs),ce.pixelStorei(ce.UNPACK_SKIP_PIXELS,fa),ce.pixelStorei(ce.UNPACK_SKIP_ROWS,ye),ce.pixelStorei(ce.UNPACK_SKIP_IMAGES,ot),It===0&&Fe.generateMipmaps&&ce.generateMipmap(yr),yt.unbindTexture()},this.copyTextureToTexture3D=function(oe,Fe,Qe=null,Xe=null,ke=0){return oe.isTexture!==!0&&(kf("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Qe=arguments[0]||null,Xe=arguments[1]||null,oe=arguments[2],Fe=arguments[3],ke=arguments[4]||0),kf('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(oe,Fe,Qe,Xe,ke)},this.initRenderTarget=function(oe){xt.get(oe).__webglFramebuffer===void 0&&fe.setupRenderTarget(oe)},this.initTexture=function(oe){oe.isCubeTexture?fe.setTextureCube(oe,0):oe.isData3DTexture?fe.setTexture3D(oe,0):oe.isDataArrayTexture||oe.isCompressedArrayTexture?fe.setTexture2DArray(oe,0):fe.setTexture2D(oe,0),yt.unbindTexture()},this.resetState=function(){q=0,z=0,j=null,yt.reset(),_i.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ha}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=ai._getDrawingBufferColorSpace(e),t.unpackColorSpace=ai._getUnpackColorSpace()}}class Bj extends vr{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new gt(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const _d=new he,nR=new kn,iR=new kn,rR=new he,sR=new he;class Oj{constructor(e={}){const t=this;let n,r,s,a;const l={objects:new WeakMap},u=e.element!==void 0?e.element:document.createElement("div");u.style.overflow="hidden",this.domElement=u,this.getSize=function(){return{width:n,height:r}},this.render=function(w,R){w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),R.parent===null&&R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),nR.copy(R.matrixWorldInverse),iR.multiplyMatrices(R.projectionMatrix,nR),m(w,w,R),S(w)},this.setSize=function(w,R){n=w,r=R,s=n/2,a=r/2,u.style.width=w+"px",u.style.height=R+"px"};function h(w){w.isCSS2DObject&&(w.element.style.display="none");for(let R=0,C=w.children.length;R<C;R++)h(w.children[R])}function m(w,R,C){if(w.visible===!1){h(w);return}if(w.isCSS2DObject){_d.setFromMatrixPosition(w.matrixWorld),_d.applyMatrix4(iR);const E=_d.z>=-1&&_d.z<=1&&w.layers.test(C.layers)===!0,B=w.element;B.style.display=E===!0?"":"none",E===!0&&(w.onBeforeRender(t,R,C),B.style.transform="translate("+-100*w.center.x+"%,"+-100*w.center.y+"%)translate("+(_d.x*s+s)+"px,"+(-_d.y*a+a)+"px)",B.parentNode!==u&&u.appendChild(B),w.onAfterRender(t,R,C));const L={distanceToCameraSquared:v(C,w)};l.objects.set(w,L)}for(let E=0,B=w.children.length;E<B;E++)m(w.children[E],R,C)}function v(w,R){return rR.setFromMatrixPosition(w.matrixWorld),sR.setFromMatrixPosition(R.matrixWorld),rR.distanceToSquared(sR)}function x(w){const R=[];return w.traverseVisible(function(C){C.isCSS2DObject&&R.push(C)}),R}function S(w){const R=x(w).sort(function(E,B){if(E.renderOrder!==B.renderOrder)return B.renderOrder-E.renderOrder;const L=l.objects.get(E).distanceToCameraSquared,O=l.objects.get(B).distanceToCameraSquared;return L-O}),C=R.length;for(let E=0,B=R.length;E<B;E++)R[E].element.style.zIndex=C-E}}}function JS(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Ij=typeof global=="object"&&global&&global.Object===Object&&global,Fj=typeof self=="object"&&self&&self.Object===Object&&self,AD=Ij||Fj||Function("return this")(),P3=function(){return AD.Date.now()},kj=/\s/;function zj(i){for(var e=i.length;e--&&kj.test(i.charAt(e)););return e}var Gj=/^\s+/;function qj(i){return i&&i.slice(0,zj(i)+1).replace(Gj,"")}var f_=AD.Symbol,dD=Object.prototype,Vj=dD.hasOwnProperty,Hj=dD.toString,tm=f_?f_.toStringTag:void 0;function jj(i){var e=Vj.call(i,tm),t=i[tm];try{i[tm]=void 0;var n=!0}catch{}var r=Hj.call(i);return n&&(e?i[tm]=t:delete i[tm]),r}var Wj=Object.prototype,$j=Wj.toString;function Xj(i){return $j.call(i)}var Yj="[object Null]",Qj="[object Undefined]",aR=f_?f_.toStringTag:void 0;function Kj(i){return i==null?i===void 0?Qj:Yj:aR&&aR in Object(i)?jj(i):Xj(i)}function Zj(i){return i!=null&&typeof i=="object"}var Jj="[object Symbol]";function eW(i){return typeof i=="symbol"||Zj(i)&&Kj(i)==Jj}var oR=NaN,tW=/^[-+]0x[0-9a-f]+$/i,nW=/^0b[01]+$/i,iW=/^0o[0-7]+$/i,rW=parseInt;function lR(i){if(typeof i=="number")return i;if(eW(i))return oR;if(JS(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=JS(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=qj(i);var t=nW.test(i);return t||iW.test(i)?rW(i.slice(2),t?2:8):tW.test(i)?oR:+i}var sW="Expected a function",aW=Math.max,oW=Math.min;function lW(i,e,t){var n,r,s,a,l,u,h=0,m=!1,v=!1,x=!0;if(typeof i!="function")throw new TypeError(sW);e=lR(e)||0,JS(t)&&(m=!!t.leading,v="maxWait"in t,s=v?aW(lR(t.maxWait)||0,e):s,x="trailing"in t?!!t.trailing:x);function S(q){var z=n,j=r;return n=r=void 0,h=q,a=i.apply(j,z),a}function w(q){return h=q,l=setTimeout(E,e),m?S(q):a}function R(q){var z=q-u,j=q-h,F=e-z;return v?oW(F,s-j):F}function C(q){var z=q-u,j=q-h;return u===void 0||z>=e||z<0||v&&j>=s}function E(){var q=P3();if(C(q))return B(q);l=setTimeout(E,R(q))}function B(q){return l=void 0,x&&n?S(q):(n=r=void 0,a)}function L(){l!==void 0&&clearTimeout(l),h=0,n=u=r=l=void 0}function O(){return l===void 0?a:B(P3())}function G(){var q=P3(),z=C(q);if(n=arguments,r=this,u=q,z){if(l===void 0)return w(u);if(v)return clearTimeout(l),l=setTimeout(E,e),S(u)}return l===void 0&&(l=setTimeout(E,e)),a}return G.cancel=L,G.flush=O,G}function uR(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function uW(i){if(Array.isArray(i))return i}function cW(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function hW(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function fW(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function AW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dW(i,e){return uW(i)||fW(i,e)||pW(i,e)||AW()}function pW(i,e){if(i){if(typeof i=="string")return uR(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?uR(i,e):void 0}}var mW=hW(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,a=s===void 0?!0:s,l=t.onChange,u=l===void 0?function(h,m){}:l;cW(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=a,this.onChange=u});function xs(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,a=s===void 0?{}:s,l=i.aliases,u=l===void 0?{}:l,h=i.init,m=h===void 0?function(){}:h,v=i.update,x=v===void 0?function(){}:v,S=Object.keys(r).map(function(w){return new mW(w,r[w])});return function w(){for(var R=arguments.length,C=new Array(R),E=0;E<R;E++)C[E]=arguments[E];var B=!!(this instanceof w&&this.constructor),L=B?C.shift():void 0,O=C[0],G=O===void 0?{}:O,q=Object.assign({},t instanceof Function?t(G):t,{initialised:!1}),z={};function j(Y){return F(Y,G),V(),j}var F=function(ee,te){m.call(j,ee,q,te),q.initialised=!0},V=lW(function(){q.initialised&&(x.call(j,q,z),z={})},1);return S.forEach(function(Y){j[Y.name]=ee(Y);function ee(te){var re=te.name,ne=te.triggerUpdate,Q=ne===void 0?!1:ne,ae=te.onChange,de=ae===void 0?function(ue,we){}:ae,Te=te.defaultVal,be=Te===void 0?null:Te;return function(ue){var we=q[re];if(!arguments.length)return we;var We=ue===void 0?be:ue;return q[re]=We,de.call(j,We,q,we),!z.hasOwnProperty(re)&&(z[re]=we),Q&&V(),j}}}),Object.keys(a).forEach(function(Y){j[Y]=function(){for(var ee,te=arguments.length,re=new Array(te),ne=0;ne<te;ne++)re[ne]=arguments[ne];return(ee=a[Y]).call.apply(ee,[j,q].concat(re))}}),Object.entries(u).forEach(function(Y){var ee=dW(Y,2),te=ee[0],re=ee[1];return j[te]=j[re]}),j.resetProps=function(){return S.forEach(function(Y){j[Y.name](Y.defaultVal)}),j},j.resetProps(),q._rerender=V,B&&L&&j(L),j}}var os=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-os.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?os.Bounce.In(i*2)*.5:os.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),ym=function(){return performance.now()},My=(function(){function i(){this._tweens={},this._tweensAddedDuringUpdate={}}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},i.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},i.prototype.update=function(e,t){e===void 0&&(e=ym()),t===void 0&&(t=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],a=!t;s&&s.update(e,a)===!1&&!t&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},i})(),eT={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=eT.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i}}},pD=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),tT=new My,ca=(function(){function i(e,t){t===void 0&&(t=tT),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=os.Linear.None,this._interpolationFunction=eT.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=pD.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=ym()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var a in n){var l=e[a],u=Array.isArray(l),h=u?"array":typeof l,m=!u&&Array.isArray(n[a]);if(!(h==="undefined"||h==="function")){if(m){var v=n[a];if(v.length===0)continue;for(var x=[l],S=0,w=v.length;S<w;S+=1){var R=this._handleRelativeValue(l,v[S]);if(isNaN(R)){m=!1,console.warn("Found invalid interpolation list. Skipping.");break}x.push(R)}m&&(n[a]=x)}if((h==="object"||u)&&l&&!m){t[a]=u?[]:{};var C=l;for(var E in C)t[a][E]=C[E];r[a]=u?[]:{};var v=n[a];if(!this._isDynamic){var B={};for(var E in v)B[E]=v[E];n[a]=v=B}this._setupProperties(C,t[a],v,r[a],s)}else(typeof t[a]>"u"||s)&&(t[a]=l),u||(t[a]*=1),m?r[a]=n[a].slice().reverse():r[a]=t[a]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},i.prototype.pause=function(e){return e===void 0&&(e=ym()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},i.prototype.resume=function(e){return e===void 0&&(e=ym()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e===void 0&&(e=tT),this._group=e,this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=os.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=eT.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=ym()),t===void 0&&(t=!0),this._isPaused)return!0;var s,a=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>a)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var l=e-this._startTime,u=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),h=this._duration+this._repeat*u,m=function(){if(n._duration===0||l>h)return 1;var C=Math.trunc(l/u),E=l-C*u,B=Math.min(E/n._duration,1);return B===0&&l===n._duration?1:B},v=m(),x=this._easingFunction(v);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,x),this._onUpdateCallback&&this._onUpdateCallback(this._object,v),this._duration===0||l>=this._duration)if(this._repeat>0){var S=Math.min(Math.trunc((l-this._duration)/u)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=S);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=u*S,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var w=0,R=this._chainedTweens.length;w<R;w++)this._chainedTweens[w].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var a=t[s]||0,l=n[s],u=Array.isArray(e[s]),h=Array.isArray(l),m=!u&&h;m?e[s]=this._interpolationFunction(l,r):typeof l=="object"&&l?this._updateProperties(e[s],a,l,r):(l=this._handleRelativeValue(a,l),typeof l=="number"&&(e[s]=a+(l-a)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i})();pD.nextId;var gu=tT;gu.getAll.bind(gu);gu.removeAll.bind(gu);gu.add.bind(gu);gu.remove.bind(gu);gu.update.bind(gu);function gW(i){const e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return mD(this.cover(e,t,n),e,t,n,i)}function mD(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,a=i._root,l={data:r},u=i._x0,h=i._y0,m=i._z0,v=i._x1,x=i._y1,S=i._z1,w,R,C,E,B,L,O,G,q,z,j;if(!a)return i._root=l,i;for(;a.length;)if((O=e>=(w=(u+v)/2))?u=w:v=w,(G=t>=(R=(h+x)/2))?h=R:x=R,(q=n>=(C=(m+S)/2))?m=C:S=C,s=a,!(a=a[z=q<<2|G<<1|O]))return s[z]=l,i;if(E=+i._x.call(null,a.data),B=+i._y.call(null,a.data),L=+i._z.call(null,a.data),e===E&&t===B&&n===L)return l.next=a,s?s[z]=l:i._root=l,i;do s=s?s[z]=new Array(8):i._root=new Array(8),(O=e>=(w=(u+v)/2))?u=w:v=w,(G=t>=(R=(h+x)/2))?h=R:x=R,(q=n>=(C=(m+S)/2))?m=C:S=C;while((z=q<<2|G<<1|O)===(j=(L>=C)<<2|(B>=R)<<1|E>=w));return s[j]=a,s[z]=l,i}function vW(i){Array.isArray(i)||(i=Array.from(i));const e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e);let s=1/0,a=1/0,l=1/0,u=-1/0,h=-1/0,m=-1/0;for(let v=0,x,S,w,R;v<e;++v)isNaN(S=+this._x.call(null,x=i[v]))||isNaN(w=+this._y.call(null,x))||isNaN(R=+this._z.call(null,x))||(t[v]=S,n[v]=w,r[v]=R,S<s&&(s=S),S>u&&(u=S),w<a&&(a=w),w>h&&(h=w),R<l&&(l=R),R>m&&(m=R));if(s>u||a>h||l>m)return this;this.cover(s,a,l).cover(u,h,m);for(let v=0;v<e;++v)mD(this,t[v],n[v],r[v],i[v]);return this}function _W(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,a=this._x1,l=this._y1,u=this._z1;if(isNaN(n))a=(n=Math.floor(i))+1,l=(r=Math.floor(e))+1,u=(s=Math.floor(t))+1;else{for(var h=a-n||1,m=this._root,v,x;n>i||i>=a||r>e||e>=l||s>t||t>=u;)switch(x=(t<s)<<2|(e<r)<<1|i<n,v=new Array(8),v[x]=m,m=v,h*=2,x){case 0:a=n+h,l=r+h,u=s+h;break;case 1:n=a-h,l=r+h,u=s+h;break;case 2:a=n+h,r=l-h,u=s+h;break;case 3:n=a-h,r=l-h,u=s+h;break;case 4:a=n+h,l=r+h,s=u-h;break;case 5:n=a-h,l=r+h,s=u-h;break;case 6:a=n+h,r=l-h,s=u-h;break;case 7:n=a-h,r=l-h,s=u-h;break}this._root&&this._root.length&&(this._root=m)}return this._x0=n,this._y0=r,this._z0=s,this._x1=a,this._y1=l,this._z1=u,this}function yW(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function xW(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function lr(i,e,t,n,r,s,a){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=a}function bW(i,e,t,n){var r,s=this._x0,a=this._y0,l=this._z0,u,h,m,v,x,S,w=this._x1,R=this._y1,C=this._z1,E=[],B=this._root,L,O;for(B&&E.push(new lr(B,s,a,l,w,R,C)),n==null?n=1/0:(s=i-n,a=e-n,l=t-n,w=i+n,R=e+n,C=t+n,n*=n);L=E.pop();)if(!(!(B=L.node)||(u=L.x0)>w||(h=L.y0)>R||(m=L.z0)>C||(v=L.x1)<s||(x=L.y1)<a||(S=L.z1)<l))if(B.length){var G=(u+v)/2,q=(h+x)/2,z=(m+S)/2;E.push(new lr(B[7],G,q,z,v,x,S),new lr(B[6],u,q,z,G,x,S),new lr(B[5],G,h,z,v,q,S),new lr(B[4],u,h,z,G,q,S),new lr(B[3],G,q,m,v,x,z),new lr(B[2],u,q,m,G,x,z),new lr(B[1],G,h,m,v,q,z),new lr(B[0],u,h,m,G,q,z)),(O=(t>=z)<<2|(e>=q)<<1|i>=G)&&(L=E[E.length-1],E[E.length-1]=E[E.length-1-O],E[E.length-1-O]=L)}else{var j=i-+this._x.call(null,B.data),F=e-+this._y.call(null,B.data),V=t-+this._z.call(null,B.data),Y=j*j+F*F+V*V;if(Y<n){var ee=Math.sqrt(n=Y);s=i-ee,a=e-ee,l=t-ee,w=i+ee,R=e+ee,C=t+ee,r=B.data}}return r}const SW=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function TW(i,e,t,n){const r=[],s=i-n,a=e-n,l=t-n,u=i+n,h=e+n,m=t+n;return this.visit((v,x,S,w,R,C,E)=>{if(!v.length)do{const B=v.data;SW(i,e,t,this._x(B),this._y(B),this._z(B))<=n&&r.push(B)}while(v=v.next);return x>u||S>h||w>m||R<s||C<a||E<l}),r}function wW(i){if(isNaN(x=+this._x.call(null,i))||isNaN(S=+this._y.call(null,i))||isNaN(w=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,a=this._x0,l=this._y0,u=this._z0,h=this._x1,m=this._y1,v=this._z1,x,S,w,R,C,E,B,L,O,G,q;if(!t)return this;if(t.length)for(;;){if((B=x>=(R=(a+h)/2))?a=R:h=R,(L=S>=(C=(l+m)/2))?l=C:m=C,(O=w>=(E=(u+v)/2))?u=E:v=E,e=t,!(t=t[G=O<<2|L<<1|B]))return this;if(!t.length)break;(e[G+1&7]||e[G+2&7]||e[G+3&7]||e[G+4&7]||e[G+5&7]||e[G+6&7]||e[G+7&7])&&(n=e,q=G)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[G]=s:delete e[G],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[q]=t:this._root=t),this):(this._root=s,this)}function MW(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function EW(){return this._root}function CW(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function RW(i){var e=[],t,n=this._root,r,s,a,l,u,h,m;for(n&&e.push(new lr(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,a=t.y0,l=t.z0,u=t.x1,h=t.y1,m=t.z1)&&n.length){var v=(s+u)/2,x=(a+h)/2,S=(l+m)/2;(r=n[7])&&e.push(new lr(r,v,x,S,u,h,m)),(r=n[6])&&e.push(new lr(r,s,x,S,v,h,m)),(r=n[5])&&e.push(new lr(r,v,a,S,u,x,m)),(r=n[4])&&e.push(new lr(r,s,a,S,v,x,m)),(r=n[3])&&e.push(new lr(r,v,x,l,u,h,S)),(r=n[2])&&e.push(new lr(r,s,x,l,v,h,S)),(r=n[1])&&e.push(new lr(r,v,a,l,u,x,S)),(r=n[0])&&e.push(new lr(r,s,a,l,v,x,S))}return this}function NW(i){var e=[],t=[],n;for(this._root&&e.push(new lr(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,a=n.x0,l=n.y0,u=n.z0,h=n.x1,m=n.y1,v=n.z1,x=(a+h)/2,S=(l+m)/2,w=(u+v)/2;(s=r[0])&&e.push(new lr(s,a,l,u,x,S,w)),(s=r[1])&&e.push(new lr(s,x,l,u,h,S,w)),(s=r[2])&&e.push(new lr(s,a,S,u,x,m,w)),(s=r[3])&&e.push(new lr(s,x,S,u,h,m,w)),(s=r[4])&&e.push(new lr(s,a,l,w,x,S,v)),(s=r[5])&&e.push(new lr(s,x,l,w,h,S,v)),(s=r[6])&&e.push(new lr(s,a,S,w,x,m,v)),(s=r[7])&&e.push(new lr(s,x,S,w,h,m,v))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function DW(i){return i[0]}function PW(i){return arguments.length?(this._x=i,this):this._x}function LW(i){return i[1]}function UW(i){return arguments.length?(this._y=i,this):this._y}function BW(i){return i[2]}function OW(i){return arguments.length?(this._z=i,this):this._z}function gD(i,e,t,n){var r=new lM(e??DW,t??LW,n??BW,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function lM(i,e,t,n,r,s,a,l,u){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=a,this._y1=l,this._z1=u,this._root=void 0}function cR(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var qs=gD.prototype=lM.prototype;qs.copy=function(){var i=new lM(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=cR(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=cR(n));return i};qs.add=gW;qs.addAll=vW;qs.cover=_W;qs.data=yW;qs.extent=xW;qs.find=bW;qs.findAllWithinRadius=TW;qs.remove=wW;qs.removeAll=MW;qs.root=EW;qs.size=CW;qs.visit=RW;qs.visitAfter=NW;qs.x=PW;qs.y=UW;qs.z=OW;function Vv(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function IW(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function vD(i){let e,t,n;i.length!==2?(e=Vv,t=(l,u)=>Vv(i(l),u),n=(l,u)=>i(l)-u):(e=i===Vv||i===IW?i:FW,t=i,n=i);function r(l,u,h=0,m=l.length){if(h<m){if(e(u,u)!==0)return m;do{const v=h+m>>>1;t(l[v],u)<0?h=v+1:m=v}while(h<m)}return h}function s(l,u,h=0,m=l.length){if(h<m){if(e(u,u)!==0)return m;do{const v=h+m>>>1;t(l[v],u)<=0?h=v+1:m=v}while(h<m)}return h}function a(l,u,h=0,m=l.length){const v=r(l,u,h,m-1);return v>h&&n(l[v-1],u)>-n(l[v],u)?v-1:v}return{left:r,center:a,right:s}}function FW(){return 0}function kW(i){return i===null?NaN:+i}const zW=vD(Vv),_D=zW.right;vD(kW).center;function A_(i,e){let t,n;if(e===void 0)for(const r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}class Ec{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const s=t[r],a=e+s,l=Math.abs(e)<Math.abs(s)?e-(a-s):s-(a-e);l&&(t[n++]=l),e=a}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t=this._n,n,r,s,a=0;if(t>0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,s=r-(a-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=a+r,r==n-a&&(a=n))}return a}}const GW=Math.sqrt(50),qW=Math.sqrt(10),VW=Math.sqrt(2);function d_(i,e,t){const n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),a=s>=GW?10:s>=qW?5:s>=VW?2:1;let l,u,h;return r<0?(h=Math.pow(10,-r)/a,l=Math.round(i*h),u=Math.round(e*h),l/h<i&&++l,u/h>e&&--u,h=-h):(h=Math.pow(10,r)*a,l=Math.round(i/h),u=Math.round(e/h),l*h<i&&++l,u*h>e&&--u),u<l&&.5<=t&&t<2?d_(i,e,t*2):[l,u,h]}function HW(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];const n=e<i,[r,s,a]=n?d_(e,i,t):d_(i,e,t);if(!(s>=r))return[];const l=s-r+1,u=new Array(l);if(n)if(a<0)for(let h=0;h<l;++h)u[h]=(s-h)/-a;else for(let h=0;h<l;++h)u[h]=(s-h)*a;else if(a<0)for(let h=0;h<l;++h)u[h]=(r+h)/-a;else for(let h=0;h<l;++h)u[h]=(r+h)*a;return u}function nT(i,e,t){return e=+e,i=+i,t=+t,d_(i,e,t)[2]}function jW(i,e,t){e=+e,i=+i,t=+t;const n=e<i,r=n?nT(e,i,t):nT(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function WW(i,e){let t;for(const n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);return t}function $W(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*XW(i){for(const e of i)yield*e}function ug(i){return Array.from(XW(i))}function jd(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function YW(i,e){let t=0;for(let n of i)(n=+n)&&(t+=n);return t}function yD(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function uM(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function xD(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function zg(){}var cg=.7,p_=1/cg,n0="\\s*([+-]?\\d+)\\s*",hg="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",lu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",QW=/^#([0-9a-f]{3,8})$/,KW=new RegExp(`^rgb\\(${n0},${n0},${n0}\\)$`),ZW=new RegExp(`^rgb\\(${lu},${lu},${lu}\\)$`),JW=new RegExp(`^rgba\\(${n0},${n0},${n0},${hg}\\)$`),e$=new RegExp(`^rgba\\(${lu},${lu},${lu},${hg}\\)$`),t$=new RegExp(`^hsl\\(${hg},${lu},${lu}\\)$`),n$=new RegExp(`^hsla\\(${hg},${lu},${lu},${hg}\\)$`),hR={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};uM(zg,cA,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:fR,formatHex:fR,formatHex8:i$,formatHsl:r$,formatRgb:AR,toString:AR});function fR(){return this.rgb().formatHex()}function i$(){return this.rgb().formatHex8()}function r$(){return bD(this).formatHsl()}function AR(){return this.rgb().formatRgb()}function cA(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=QW.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?dR(e):t===3?new Wa(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?X2(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?X2(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=KW.exec(i))?new Wa(e[1],e[2],e[3],1):(e=ZW.exec(i))?new Wa(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=JW.exec(i))?X2(e[1],e[2],e[3],e[4]):(e=e$.exec(i))?X2(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=t$.exec(i))?gR(e[1],e[2]/100,e[3]/100,1):(e=n$.exec(i))?gR(e[1],e[2]/100,e[3]/100,e[4]):hR.hasOwnProperty(i)?dR(hR[i]):i==="transparent"?new Wa(NaN,NaN,NaN,0):null}function dR(i){return new Wa(i>>16&255,i>>8&255,i&255,1)}function X2(i,e,t,n){return n<=0&&(i=e=t=NaN),new Wa(i,e,t,n)}function s$(i){return i instanceof zg||(i=cA(i)),i?(i=i.rgb(),new Wa(i.r,i.g,i.b,i.opacity)):new Wa}function iT(i,e,t,n){return arguments.length===1?s$(i):new Wa(i,e,t,n??1)}function Wa(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}uM(Wa,iT,xD(zg,{brighter(i){return i=i==null?p_:Math.pow(p_,i),new Wa(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?cg:Math.pow(cg,i),new Wa(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Wa(eA(this.r),eA(this.g),eA(this.b),m_(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:pR,formatHex:pR,formatHex8:a$,formatRgb:mR,toString:mR}));function pR(){return`#${Wf(this.r)}${Wf(this.g)}${Wf(this.b)}`}function a$(){return`#${Wf(this.r)}${Wf(this.g)}${Wf(this.b)}${Wf((isNaN(this.opacity)?1:this.opacity)*255)}`}function mR(){const i=m_(this.opacity);return`${i===1?"rgb(":"rgba("}${eA(this.r)}, ${eA(this.g)}, ${eA(this.b)}${i===1?")":`, ${i})`}`}function m_(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function eA(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function Wf(i){return i=eA(i),(i<16?"0":"")+i.toString(16)}function gR(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Tl(i,e,t,n)}function bD(i){if(i instanceof Tl)return new Tl(i.h,i.s,i.l,i.opacity);if(i instanceof zg||(i=cA(i)),!i)return new Tl;if(i instanceof Tl)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),a=NaN,l=s-r,u=(s+r)/2;return l?(e===s?a=(t-n)/l+(t<n)*6:t===s?a=(n-e)/l+2:a=(e-t)/l+4,l/=u<.5?s+r:2-s-r,a*=60):l=u>0&&u<1?0:a,new Tl(a,l,u,i.opacity)}function o$(i,e,t,n){return arguments.length===1?bD(i):new Tl(i,e,t,n??1)}function Tl(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}uM(Tl,o$,xD(zg,{brighter(i){return i=i==null?p_:Math.pow(p_,i),new Tl(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?cg:Math.pow(cg,i),new Tl(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new Wa(L3(i>=240?i-240:i+120,r,n),L3(i,r,n),L3(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Tl(vR(this.h),Y2(this.s),Y2(this.l),m_(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const i=m_(this.opacity);return`${i===1?"hsl(":"hsla("}${vR(this.h)}, ${Y2(this.s)*100}%, ${Y2(this.l)*100}%${i===1?")":`, ${i})`}`}}));function vR(i){return i=(i||0)%360,i<0?i+360:i}function Y2(i){return Math.max(0,Math.min(1,i||0))}function L3(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}const cM=i=>()=>i;function l$(i,e){return function(t){return i+t*e}}function u$(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function c$(i){return(i=+i)==1?SD:function(e,t){return t-e?u$(e,t,i):cM(isNaN(e)?t:e)}}function SD(i,e){var t=e-i;return t?l$(i,t):cM(isNaN(i)?e:i)}const _R=(function i(e){var t=c$(e);function n(r,s){var a=t((r=iT(r)).r,(s=iT(s)).r),l=t(r.g,s.g),u=t(r.b,s.b),h=SD(r.opacity,s.opacity);return function(m){return r.r=a(m),r.g=l(m),r.b=u(m),r.opacity=h(m),r+""}}return n.gamma=i,n})(1);function TD(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function wD(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function h$(i,e){return(wD(e)?TD:MD)(i,e)}function MD(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),a;for(a=0;a<n;++a)r[a]=hM(i[a],e[a]);for(;a<t;++a)s[a]=e[a];return function(l){for(a=0;a<n;++a)s[a]=r[a](l);return s}}function f$(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function fg(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function A$(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=hM(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var rT=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,U3=new RegExp(rT.source,"g");function d$(i){return function(){return i}}function p$(i){return function(e){return i(e)+""}}function m$(i,e){var t=rT.lastIndex=U3.lastIndex=0,n,r,s,a=-1,l=[],u=[];for(i=i+"",e=e+"";(n=rT.exec(i))&&(r=U3.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),l[a]?l[a]+=s:l[++a]=s),(n=n[0])===(r=r[0])?l[a]?l[a]+=r:l[++a]=r:(l[++a]=null,u.push({i:a,x:fg(n,r)})),t=U3.lastIndex;return t<e.length&&(s=e.slice(t),l[a]?l[a]+=s:l[++a]=s),l.length<2?u[0]?p$(u[0].x):d$(e):(e=u.length,function(h){for(var m=0,v;m<e;++m)l[(v=u[m]).i]=v.x(h);return l.join("")})}function hM(i,e){var t=typeof e,n;return e==null||t==="boolean"?cM(e):(t==="number"?fg:t==="string"?(n=cA(e))?(e=n,_R):m$:e instanceof cA?_R:e instanceof Date?f$:wD(e)?TD:Array.isArray(e)?MD:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?A$:fg)(i,e)}function g$(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function v$(i){return function(){return i}}function _$(i){return+i}var yR=[0,1];function Wd(i){return i}function sT(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:v$(isNaN(e)?NaN:.5)}function y$(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function x$(i,e,t){var n=i[0],r=i[1],s=e[0],a=e[1];return r<n?(n=sT(r,n),s=t(a,s)):(n=sT(n,r),s=t(s,a)),function(l){return s(n(l))}}function b$(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),a=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++a<n;)r[a]=sT(i[a],i[a+1]),s[a]=t(e[a],e[a+1]);return function(l){var u=_D(i,l,1,n)-1;return s[u](r[u](l))}}function S$(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function T$(){var i=yR,e=yR,t=hM,n,r,s,a=Wd,l,u,h;function m(){var x=Math.min(i.length,e.length);return a!==Wd&&(a=y$(i[0],i[x-1])),l=x>2?b$:x$,u=h=null,v}function v(x){return x==null||isNaN(x=+x)?s:(u||(u=l(i.map(n),e,t)))(n(a(x)))}return v.invert=function(x){return a(r((h||(h=l(e,i.map(n),fg)))(x)))},v.domain=function(x){return arguments.length?(i=Array.from(x,_$),m()):i.slice()},v.range=function(x){return arguments.length?(e=Array.from(x),m()):e.slice()},v.rangeRound=function(x){return e=Array.from(x),t=g$,m()},v.clamp=function(x){return arguments.length?(a=x?!0:Wd,m()):a!==Wd},v.interpolate=function(x){return arguments.length?(t=x,m()):t},v.unknown=function(x){return arguments.length?(s=x,v):s},function(x,S){return n=x,r=S,m()}}function w$(){return T$()(Wd,Wd)}function M$(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function g_(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function C0(i){return i=g_(Math.abs(i)),i?i[1]:NaN}function E$(i,e){return function(t,n){for(var r=t.length,s=[],a=0,l=i[0],u=0;r>0&&l>0&&(u+l+1>n&&(l=Math.max(1,n-u)),s.push(t.substring(r-=l,r+l)),!((u+=l+1)>n));)l=i[a=(a+1)%i.length];return s.reverse().join(e)}}function C$(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var R$=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function v_(i){if(!(e=R$.exec(i)))throw new Error("invalid format: "+i);var e;return new fM({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}v_.prototype=fM.prototype;function fM(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}fM.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function N$(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var __;function D$(i,e){var t=g_(i,e);if(!t)return __=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(__=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+g_(i,Math.max(0,e+s-1))[0]}function xR(i,e){var t=g_(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}const bR={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:M$,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>xR(i*100,e),r:xR,s:D$,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function SR(i){return i}var TR=Array.prototype.map,wR=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function P$(i){var e=i.grouping===void 0||i.thousands===void 0?SR:E$(TR.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?SR:C$(TR.call(i.numerals,String)),a=i.percent===void 0?"%":i.percent+"",l=i.minus===void 0?"−":i.minus+"",u=i.nan===void 0?"NaN":i.nan+"";function h(v,x){v=v_(v);var S=v.fill,w=v.align,R=v.sign,C=v.symbol,E=v.zero,B=v.width,L=v.comma,O=v.precision,G=v.trim,q=v.type;q==="n"?(L=!0,q="g"):bR[q]||(O===void 0&&(O=12),G=!0,q="g"),(E||S==="0"&&w==="=")&&(E=!0,S="0",w="=");var z=(x&&x.prefix!==void 0?x.prefix:"")+(C==="$"?t:C==="#"&&/[boxX]/.test(q)?"0"+q.toLowerCase():""),j=(C==="$"?n:/[%p]/.test(q)?a:"")+(x&&x.suffix!==void 0?x.suffix:""),F=bR[q],V=/[defgprs%]/.test(q);O=O===void 0?6:/[gprs]/.test(q)?Math.max(1,Math.min(21,O)):Math.max(0,Math.min(20,O));function Y(ee){var te=z,re=j,ne,Q,ae;if(q==="c")re=F(ee)+re,ee="";else{ee=+ee;var de=ee<0||1/ee<0;if(ee=isNaN(ee)?u:F(Math.abs(ee),O),G&&(ee=N$(ee)),de&&+ee==0&&R!=="+"&&(de=!1),te=(de?R==="("?R:l:R==="-"||R==="("?"":R)+te,re=(q==="s"&&!isNaN(ee)&&__!==void 0?wR[8+__/3]:"")+re+(de&&R==="("?")":""),V){for(ne=-1,Q=ee.length;++ne<Q;)if(ae=ee.charCodeAt(ne),48>ae||ae>57){re=(ae===46?r+ee.slice(ne+1):ee.slice(ne))+re,ee=ee.slice(0,ne);break}}}L&&!E&&(ee=e(ee,1/0));var Te=te.length+ee.length+re.length,be=Te<B?new Array(B-Te+1).join(S):"";switch(L&&E&&(ee=e(be+ee,be.length?B-re.length:1/0),be=""),w){case"<":ee=te+ee+re+be;break;case"=":ee=te+be+ee+re;break;case"^":ee=be.slice(0,Te=be.length>>1)+te+ee+re+be.slice(Te);break;default:ee=be+te+ee+re;break}return s(ee)}return Y.toString=function(){return v+""},Y}function m(v,x){var S=Math.max(-8,Math.min(8,Math.floor(C0(x)/3)))*3,w=Math.pow(10,-S),R=h((v=v_(v),v.type="f",v),{suffix:wR[8+S/3]});return function(C){return R(w*C)}}return{format:h,formatPrefix:m}}var Q2,ED,CD;L$({thousands:",",grouping:[3],currency:["$",""]});function L$(i){return Q2=P$(i),ED=Q2.format,CD=Q2.formatPrefix,Q2}function U$(i){return Math.max(0,-C0(Math.abs(i)))}function B$(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(C0(e)/3)))*3-C0(Math.abs(i)))}function O$(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,C0(e)-C0(i))+1}function I$(i,e,t,n){var r=jW(i,e,t),s;switch(n=v_(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=B$(r,a))&&(n.precision=s),CD(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=O$(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=U$(r))&&(n.precision=s-(n.type==="%")*2);break}}return ED(n)}function RD(i){var e=i.domain;return i.ticks=function(t){var n=e();return HW(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return I$(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,a=n[r],l=n[s],u,h,m=10;for(l<a&&(h=a,a=l,l=h,h=r,r=s,s=h);m-- >0;){if(h=nT(a,l,t),h===u)return n[r]=a,n[s]=l,e(n);if(h>0)a=Math.floor(a/h)*h,l=Math.ceil(l/h)*h;else if(h<0)a=Math.ceil(a*h)/h,l=Math.floor(l*h)/h;else break;u=h}return i},i}function Pc(){var i=w$();return i.copy=function(){return S$(i,Pc())},yD.apply(i,arguments),RD(i)}function ND(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function a(u){return u!=null&&u<=u?r[_D(n,u,0,t)]:s}function l(){var u=-1;for(n=new Array(t);++u<t;)n[u]=((u+1)*e-(u-t)*i)/(t+1);return a}return a.domain=function(u){return arguments.length?([i,e]=u,i=+i,e=+e,l()):[i,e]},a.range=function(u){return arguments.length?(t=(r=Array.from(u)).length-1,l()):r.slice()},a.invertExtent=function(u){var h=r.indexOf(u);return h<0?[NaN,NaN]:h<1?[i,n[0]]:h>=t?[n[t-1],e]:[n[h-1],n[h]]},a.unknown=function(u){return arguments.length&&(s=u),a},a.thresholds=function(){return n.slice()},a.copy=function(){return ND().domain([i,e]).range(r).unknown(s)},yD.apply(RD(a),arguments)}var di=1e-6,y_=1e-12,Ni=Math.PI,$a=Ni/2,x_=Ni/4,No=Ni*2,kr=180/Ni,Hn=Ni/180,ir=Math.abs,AM=Math.atan,Zo=Math.atan2,ei=Math.cos,K2=Math.ceil,F$=Math.exp,aT=Math.hypot,k$=Math.log,zn=Math.sin,z$=Math.sign||function(i){return i>0?1:i<0?-1:0},Lc=Math.sqrt,G$=Math.tan;function q$(i){return i>1?0:i<-1?Ni:Math.acos(i)}function Uc(i){return i>1?$a:i<-1?-$a:Math.asin(i)}function MR(i){return(i=zn(i/2))*i}function ra(){}function b_(i,e){i&&CR.hasOwnProperty(i.type)&&CR[i.type](i,e)}var ER={Feature:function(i,e){b_(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)b_(t[n].geometry,e)}},CR={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){oT(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)oT(t[n],e,0)},Polygon:function(i,e){RR(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)RR(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)b_(t[n],e)}};function oT(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function RR(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)oT(i[t],e,1);e.polygonEnd()}function Ey(i,e){i&&ER.hasOwnProperty(i.type)?ER[i.type](i,e):b_(i,e)}var S_=new Ec,NR=new Ec,DD,PD,lT,uT,cT,Bc={point:ra,lineStart:ra,lineEnd:ra,polygonStart:function(){S_=new Ec,Bc.lineStart=V$,Bc.lineEnd=H$},polygonEnd:function(){var i=+S_;NR.add(i<0?No+i:i),this.lineStart=this.lineEnd=this.point=ra},sphere:function(){NR.add(No)}};function V$(){Bc.point=j$}function H$(){LD(DD,PD)}function j$(i,e){Bc.point=LD,DD=i,PD=e,i*=Hn,e*=Hn,lT=i,uT=ei(e=e/2+x_),cT=zn(e)}function LD(i,e){i*=Hn,e*=Hn,e=e/2+x_;var t=i-lT,n=t>=0?1:-1,r=n*t,s=ei(e),a=zn(e),l=cT*a,u=uT*s+l*ei(r),h=l*n*zn(r);S_.add(Zo(h,u)),lT=i,uT=s,cT=a}function T_(i){return[Zo(i[1],i[0]),Uc(i[2])]}function hA(i){var e=i[0],t=i[1],n=ei(t);return[n*ei(e),n*zn(e),zn(t)]}function Z2(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function R0(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function B3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function J2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function w_(i){var e=Lc(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Cr,qa,Ir,wo,Of,UD,BD,i0,Dm,Ch,Oc,_c={point:hT,lineStart:DR,lineEnd:PR,polygonStart:function(){_c.point=ID,_c.lineStart=W$,_c.lineEnd=$$,Dm=new Ec,Bc.polygonStart()},polygonEnd:function(){Bc.polygonEnd(),_c.point=hT,_c.lineStart=DR,_c.lineEnd=PR,S_<0?(Cr=-(Ir=180),qa=-(wo=90)):Dm>di?wo=90:Dm<-di&&(qa=-90),Oc[0]=Cr,Oc[1]=Ir},sphere:function(){Cr=-(Ir=180),qa=-(wo=90)}};function hT(i,e){Ch.push(Oc=[Cr=i,Ir=i]),e<qa&&(qa=e),e>wo&&(wo=e)}function OD(i,e){var t=hA([i*Hn,e*Hn]);if(i0){var n=R0(i0,t),r=[n[1],-n[0],0],s=R0(r,n);w_(s),s=T_(s);var a=i-Of,l=a>0?1:-1,u=s[0]*kr*l,h,m=ir(a)>180;m^(l*Of<u&&u<l*i)?(h=s[1]*kr,h>wo&&(wo=h)):(u=(u+360)%360-180,m^(l*Of<u&&u<l*i)?(h=-s[1]*kr,h<qa&&(qa=h)):(e<qa&&(qa=e),e>wo&&(wo=e))),m?i<Of?bo(Cr,i)>bo(Cr,Ir)&&(Ir=i):bo(i,Ir)>bo(Cr,Ir)&&(Cr=i):Ir>=Cr?(i<Cr&&(Cr=i),i>Ir&&(Ir=i)):i>Of?bo(Cr,i)>bo(Cr,Ir)&&(Ir=i):bo(i,Ir)>bo(Cr,Ir)&&(Cr=i)}else Ch.push(Oc=[Cr=i,Ir=i]);e<qa&&(qa=e),e>wo&&(wo=e),i0=t,Of=i}function DR(){_c.point=OD}function PR(){Oc[0]=Cr,Oc[1]=Ir,_c.point=hT,i0=null}function ID(i,e){if(i0){var t=i-Of;Dm.add(ir(t)>180?t+(t>0?360:-360):t)}else UD=i,BD=e;Bc.point(i,e),OD(i,e)}function W$(){Bc.lineStart()}function $$(){ID(UD,BD),Bc.lineEnd(),ir(Dm)>di&&(Cr=-(Ir=180)),Oc[0]=Cr,Oc[1]=Ir,i0=null}function bo(i,e){return(e-=i)<0?e+360:e}function X$(i,e){return i[0]-e[0]}function LR(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function FD(i){var e,t,n,r,s,a,l;if(wo=Ir=-(Cr=qa=1/0),Ch=[],Ey(i,_c),t=Ch.length){for(Ch.sort(X$),e=1,n=Ch[0],s=[n];e<t;++e)r=Ch[e],LR(n,r[0])||LR(n,r[1])?(bo(n[0],r[1])>bo(n[0],n[1])&&(n[1]=r[1]),bo(r[0],n[1])>bo(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(a=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(l=bo(n[1],r[0]))>a&&(a=l,Cr=r[0],Ir=n[1])}return Ch=Oc=null,Cr===1/0||qa===1/0?[[NaN,NaN],[NaN,NaN]]:[[Cr,qa],[Ir,wo]]}var xm,M_,E_,C_,R_,N_,D_,P_,fT,AT,dT,kD,zD,xa,ba,Sa,Ml={sphere:ra,point:dM,lineStart:UR,lineEnd:BR,polygonStart:function(){Ml.lineStart=K$,Ml.lineEnd=Z$},polygonEnd:function(){Ml.lineStart=UR,Ml.lineEnd=BR}};function dM(i,e){i*=Hn,e*=Hn;var t=ei(e);Gg(t*ei(i),t*zn(i),zn(e))}function Gg(i,e,t){++xm,E_+=(i-E_)/xm,C_+=(e-C_)/xm,R_+=(t-R_)/xm}function UR(){Ml.point=Y$}function Y$(i,e){i*=Hn,e*=Hn;var t=ei(e);xa=t*ei(i),ba=t*zn(i),Sa=zn(e),Ml.point=Q$,Gg(xa,ba,Sa)}function Q$(i,e){i*=Hn,e*=Hn;var t=ei(e),n=t*ei(i),r=t*zn(i),s=zn(e),a=Zo(Lc((a=ba*s-Sa*r)*a+(a=Sa*n-xa*s)*a+(a=xa*r-ba*n)*a),xa*n+ba*r+Sa*s);M_+=a,N_+=a*(xa+(xa=n)),D_+=a*(ba+(ba=r)),P_+=a*(Sa+(Sa=s)),Gg(xa,ba,Sa)}function BR(){Ml.point=dM}function K$(){Ml.point=J$}function Z$(){GD(kD,zD),Ml.point=dM}function J$(i,e){kD=i,zD=e,i*=Hn,e*=Hn,Ml.point=GD;var t=ei(e);xa=t*ei(i),ba=t*zn(i),Sa=zn(e),Gg(xa,ba,Sa)}function GD(i,e){i*=Hn,e*=Hn;var t=ei(e),n=t*ei(i),r=t*zn(i),s=zn(e),a=ba*s-Sa*r,l=Sa*n-xa*s,u=xa*r-ba*n,h=aT(a,l,u),m=Uc(h),v=h&&-m/h;fT.add(v*a),AT.add(v*l),dT.add(v*u),M_+=m,N_+=m*(xa+(xa=n)),D_+=m*(ba+(ba=r)),P_+=m*(Sa+(Sa=s)),Gg(xa,ba,Sa)}function OR(i){xm=M_=E_=C_=R_=N_=D_=P_=0,fT=new Ec,AT=new Ec,dT=new Ec,Ey(i,Ml);var e=+fT,t=+AT,n=+dT,r=aT(e,t,n);return r<y_&&(e=N_,t=D_,n=P_,M_<di&&(e=E_,t=C_,n=R_),r=aT(e,t,n),r<y_)?[NaN,NaN]:[Zo(t,e)*kr,Uc(n/r)*kr]}function pT(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function mT(i,e){return ir(i)>Ni&&(i-=Math.round(i/No)*No),[i,e]}mT.invert=mT;function qD(i,e,t){return(i%=No)?e||t?pT(FR(i),kR(e,t)):FR(i):e||t?kR(e,t):mT}function IR(i){return function(e,t){return e+=i,ir(e)>Ni&&(e-=Math.round(e/No)*No),[e,t]}}function FR(i){var e=IR(i);return e.invert=IR(-i),e}function kR(i,e){var t=ei(i),n=zn(i),r=ei(e),s=zn(e);function a(l,u){var h=ei(u),m=ei(l)*h,v=zn(l)*h,x=zn(u),S=x*t+m*n;return[Zo(v*r-S*s,m*t-x*n),Uc(S*r+v*s)]}return a.invert=function(l,u){var h=ei(u),m=ei(l)*h,v=zn(l)*h,x=zn(u),S=x*r-v*s;return[Zo(v*r+x*s,m*t+S*n),Uc(S*t-m*n)]},a}function eX(i){i=qD(i[0]*Hn,i[1]*Hn,i.length>2?i[2]*Hn:0);function e(t){return t=i(t[0]*Hn,t[1]*Hn),t[0]*=kr,t[1]*=kr,t}return e.invert=function(t){return t=i.invert(t[0]*Hn,t[1]*Hn),t[0]*=kr,t[1]*=kr,t},e}function tX(i,e,t,n,r,s){if(t){var a=ei(e),l=zn(e),u=n*t;r==null?(r=e+n*No,s=e-u/2):(r=zR(a,r),s=zR(a,s),(n>0?r<s:r>s)&&(r+=n*No));for(var h,m=r;n>0?m>s:m<s;m-=u)h=T_([a,-l*ei(m),-l*zn(m)]),i.point(h[0],h[1])}}function zR(i,e){e=hA(e),e[0]-=i,w_(e);var t=q$(-e[1]);return((-e[2]<0?-t:t)+No-di)%No}function VD(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:ra,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function Hv(i,e){return ir(i[0]-e[0])<di&&ir(i[1]-e[1])<di}function ev(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function HD(i,e,t,n,r){var s=[],a=[],l,u;if(i.forEach(function(w){if(!((R=w.length-1)<=0)){var R,C=w[0],E=w[R],B;if(Hv(C,E)){if(!C[2]&&!E[2]){for(r.lineStart(),l=0;l<R;++l)r.point((C=w[l])[0],C[1]);r.lineEnd();return}E[0]+=2*di}s.push(B=new ev(C,w,null,!0)),a.push(B.o=new ev(C,null,B,!1)),s.push(B=new ev(E,w,null,!1)),a.push(B.o=new ev(E,null,B,!0))}}),!!s.length){for(a.sort(e),GR(s),GR(a),l=0,u=a.length;l<u;++l)a[l].e=t=!t;for(var h=s[0],m,v;;){for(var x=h,S=!0;x.v;)if((x=x.n)===h)return;m=x.z,r.lineStart();do{if(x.v=x.o.v=!0,x.e){if(S)for(l=0,u=m.length;l<u;++l)r.point((v=m[l])[0],v[1]);else n(x.x,x.n.x,1,r);x=x.n}else{if(S)for(m=x.p.z,l=m.length-1;l>=0;--l)r.point((v=m[l])[0],v[1]);else n(x.x,x.p.x,-1,r);x=x.p}x=x.o,m=x.z,S=!S}while(!x.v);r.lineEnd()}}}function GR(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function O3(i){return ir(i[0])<=Ni?i[0]:z$(i[0])*((ir(i[0])+Ni)%No-Ni)}function jD(i,e){var t=O3(e),n=e[1],r=zn(n),s=[zn(t),-ei(t),0],a=0,l=0,u=new Ec;r===1?n=$a+di:r===-1&&(n=-$a-di);for(var h=0,m=i.length;h<m;++h)if(x=(v=i[h]).length)for(var v,x,S=v[x-1],w=O3(S),R=S[1]/2+x_,C=zn(R),E=ei(R),B=0;B<x;++B,w=O,C=q,E=z,S=L){var L=v[B],O=O3(L),G=L[1]/2+x_,q=zn(G),z=ei(G),j=O-w,F=j>=0?1:-1,V=F*j,Y=V>Ni,ee=C*q;if(u.add(Zo(ee*F*zn(V),E*z+ee*ei(V))),a+=Y?j+F*No:j,Y^w>=t^O>=t){var te=R0(hA(S),hA(L));w_(te);var re=R0(s,te);w_(re);var ne=(Y^j>=0?-1:1)*Uc(re[2]);(n>ne||n===ne&&(te[0]||te[1]))&&(l+=Y^j>=0?1:-1)}}return(a<-di||a<di&&u<-y_)^l&1}function WD(i,e,t,n){return function(r){var s=e(r),a=VD(),l=e(a),u=!1,h,m,v,x={point:S,lineStart:R,lineEnd:C,polygonStart:function(){x.point=E,x.lineStart=B,x.lineEnd=L,m=[],h=[]},polygonEnd:function(){x.point=S,x.lineStart=R,x.lineEnd=C,m=ug(m);var O=jD(h,n);m.length?(u||(r.polygonStart(),u=!0),HD(m,iX,O,t,r)):O&&(u||(r.polygonStart(),u=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),u&&(r.polygonEnd(),u=!1),m=h=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function S(O,G){i(O,G)&&r.point(O,G)}function w(O,G){s.point(O,G)}function R(){x.point=w,s.lineStart()}function C(){x.point=S,s.lineEnd()}function E(O,G){v.push([O,G]),l.point(O,G)}function B(){l.lineStart(),v=[]}function L(){E(v[0][0],v[0][1]),l.lineEnd();var O=l.clean(),G=a.result(),q,z=G.length,j,F,V;if(v.pop(),h.push(v),v=null,!!z){if(O&1){if(F=G[0],(j=F.length-1)>0){for(u||(r.polygonStart(),u=!0),r.lineStart(),q=0;q<j;++q)r.point((V=F[q])[0],V[1]);r.lineEnd()}return}z>1&&O&2&&G.push(G.pop().concat(G.shift())),m.push(G.filter(nX))}}return x}}function nX(i){return i.length>1}function iX(i,e){return((i=i.x)[0]<0?i[1]-$a-di:$a-i[1])-((e=e.x)[0]<0?e[1]-$a-di:$a-e[1])}const qR=WD(function(){return!0},rX,aX,[-Ni,-$a]);function rX(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,a){var l=s>0?Ni:-Ni,u=ir(s-e);ir(u-Ni)<di?(i.point(e,t=(t+a)/2>0?$a:-$a),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(l,t),i.point(s,t),r=0):n!==l&&u>=Ni&&(ir(e-n)<di&&(e-=n*di),ir(s-l)<di&&(s-=l*di),t=sX(e,t,s,a),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(l,t),r=0),i.point(e=s,t=a),n=l},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function sX(i,e,t,n){var r,s,a=zn(i-t);return ir(a)>di?AM((zn(e)*(s=ei(n))*zn(t)-zn(n)*(r=ei(e))*zn(i))/(r*s*a)):(e+n)/2}function aX(i,e,t,n){var r;if(i==null)r=t*$a,n.point(-Ni,r),n.point(0,r),n.point(Ni,r),n.point(Ni,0),n.point(Ni,-r),n.point(0,-r),n.point(-Ni,-r),n.point(-Ni,0),n.point(-Ni,r);else if(ir(i[0]-e[0])>di){var s=i[0]<e[0]?Ni:-Ni;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function oX(i){var e=ei(i),t=2*Hn,n=e>0,r=ir(e)>di;function s(m,v,x,S){tX(S,i,t,x,m,v)}function a(m,v){return ei(m)*ei(v)>e}function l(m){var v,x,S,w,R;return{lineStart:function(){w=S=!1,R=1},point:function(C,E){var B=[C,E],L,O=a(C,E),G=n?O?0:h(C,E):O?h(C+(C<0?Ni:-Ni),E):0;if(!v&&(w=S=O)&&m.lineStart(),O!==S&&(L=u(v,B),(!L||Hv(v,L)||Hv(B,L))&&(B[2]=1)),O!==S)R=0,O?(m.lineStart(),L=u(B,v),m.point(L[0],L[1])):(L=u(v,B),m.point(L[0],L[1],2),m.lineEnd()),v=L;else if(r&&v&&n^O){var q;!(G&x)&&(q=u(B,v,!0))&&(R=0,n?(m.lineStart(),m.point(q[0][0],q[0][1]),m.point(q[1][0],q[1][1]),m.lineEnd()):(m.point(q[1][0],q[1][1]),m.lineEnd(),m.lineStart(),m.point(q[0][0],q[0][1],3)))}O&&(!v||!Hv(v,B))&&m.point(B[0],B[1]),v=B,S=O,x=G},lineEnd:function(){S&&m.lineEnd(),v=null},clean:function(){return R|(w&&S)<<1}}}function u(m,v,x){var S=hA(m),w=hA(v),R=[1,0,0],C=R0(S,w),E=Z2(C,C),B=C[0],L=E-B*B;if(!L)return!x&&m;var O=e*E/L,G=-e*B/L,q=R0(R,C),z=J2(R,O),j=J2(C,G);B3(z,j);var F=q,V=Z2(z,F),Y=Z2(F,F),ee=V*V-Y*(Z2(z,z)-1);if(!(ee<0)){var te=Lc(ee),re=J2(F,(-V-te)/Y);if(B3(re,z),re=T_(re),!x)return re;var ne=m[0],Q=v[0],ae=m[1],de=v[1],Te;Q<ne&&(Te=ne,ne=Q,Q=Te);var be=Q-ne,ue=ir(be-Ni)<di,we=ue||be<di;if(!ue&&de<ae&&(Te=ae,ae=de,de=Te),we?ue?ae+de>0^re[1]<(ir(re[0]-ne)<di?ae:de):ae<=re[1]&&re[1]<=de:be>Ni^(ne<=re[0]&&re[0]<=Q)){var We=J2(F,(-V+te)/Y);return B3(We,z),[re,T_(We)]}}}function h(m,v){var x=n?i:Ni-i,S=0;return m<-x?S|=1:m>x&&(S|=2),v<-x?S|=4:v>x&&(S|=8),S}return WD(a,l,s,n?[0,-i]:[-Ni,i-Ni])}function lX(i,e,t,n,r,s){var a=i[0],l=i[1],u=e[0],h=e[1],m=0,v=1,x=u-a,S=h-l,w;if(w=t-a,!(!x&&w>0)){if(w/=x,x<0){if(w<m)return;w<v&&(v=w)}else if(x>0){if(w>v)return;w>m&&(m=w)}if(w=r-a,!(!x&&w<0)){if(w/=x,x<0){if(w>v)return;w>m&&(m=w)}else if(x>0){if(w<m)return;w<v&&(v=w)}if(w=n-l,!(!S&&w>0)){if(w/=S,S<0){if(w<m)return;w<v&&(v=w)}else if(S>0){if(w>v)return;w>m&&(m=w)}if(w=s-l,!(!S&&w<0)){if(w/=S,S<0){if(w>v)return;w>m&&(m=w)}else if(S>0){if(w<m)return;w<v&&(v=w)}return m>0&&(i[0]=a+m*x,i[1]=l+m*S),v<1&&(e[0]=a+v*x,e[1]=l+v*S),!0}}}}}var bm=1e9,tv=-bm;function uX(i,e,t,n){function r(h,m){return i<=h&&h<=t&&e<=m&&m<=n}function s(h,m,v,x){var S=0,w=0;if(h==null||(S=a(h,v))!==(w=a(m,v))||u(h,m)<0^v>0)do x.point(S===0||S===3?i:t,S>1?n:e);while((S=(S+v+4)%4)!==w);else x.point(m[0],m[1])}function a(h,m){return ir(h[0]-i)<di?m>0?0:3:ir(h[0]-t)<di?m>0?2:1:ir(h[1]-e)<di?m>0?1:0:m>0?3:2}function l(h,m){return u(h.x,m.x)}function u(h,m){var v=a(h,1),x=a(m,1);return v!==x?v-x:v===0?m[1]-h[1]:v===1?h[0]-m[0]:v===2?h[1]-m[1]:m[0]-h[0]}return function(h){var m=h,v=VD(),x,S,w,R,C,E,B,L,O,G,q,z={point:j,lineStart:ee,lineEnd:te,polygonStart:V,polygonEnd:Y};function j(ne,Q){r(ne,Q)&&m.point(ne,Q)}function F(){for(var ne=0,Q=0,ae=S.length;Q<ae;++Q)for(var de=S[Q],Te=1,be=de.length,ue=de[0],we,We,Ne=ue[0],ze=ue[1];Te<be;++Te)we=Ne,We=ze,ue=de[Te],Ne=ue[0],ze=ue[1],We<=n?ze>n&&(Ne-we)*(n-We)>(ze-We)*(i-we)&&++ne:ze<=n&&(Ne-we)*(n-We)<(ze-We)*(i-we)&&--ne;return ne}function V(){m=v,x=[],S=[],q=!0}function Y(){var ne=F(),Q=q&&ne,ae=(x=ug(x)).length;(Q||ae)&&(h.polygonStart(),Q&&(h.lineStart(),s(null,null,1,h),h.lineEnd()),ae&&HD(x,l,ne,s,h),h.polygonEnd()),m=h,x=S=w=null}function ee(){z.point=re,S&&S.push(w=[]),G=!0,O=!1,B=L=NaN}function te(){x&&(re(R,C),E&&O&&v.rejoin(),x.push(v.result())),z.point=j,O&&m.lineEnd()}function re(ne,Q){var ae=r(ne,Q);if(S&&w.push([ne,Q]),G)R=ne,C=Q,E=ae,G=!1,ae&&(m.lineStart(),m.point(ne,Q));else if(ae&&O)m.point(ne,Q);else{var de=[B=Math.max(tv,Math.min(bm,B)),L=Math.max(tv,Math.min(bm,L))],Te=[ne=Math.max(tv,Math.min(bm,ne)),Q=Math.max(tv,Math.min(bm,Q))];lX(de,Te,i,e,t,n)?(O||(m.lineStart(),m.point(de[0],de[1])),m.point(Te[0],Te[1]),ae||m.lineEnd(),q=!1):ae&&(m.lineStart(),m.point(ne,Q),q=!1)}B=ne,L=Q,O=ae}return z}}var gT,vT,jv,Wv,N0={sphere:ra,point:ra,lineStart:cX,lineEnd:ra,polygonStart:ra,polygonEnd:ra};function cX(){N0.point=fX,N0.lineEnd=hX}function hX(){N0.point=N0.lineEnd=ra}function fX(i,e){i*=Hn,e*=Hn,vT=i,jv=zn(e),Wv=ei(e),N0.point=AX}function AX(i,e){i*=Hn,e*=Hn;var t=zn(e),n=ei(e),r=ir(i-vT),s=ei(r),a=zn(r),l=n*a,u=Wv*t-jv*n*s,h=jv*t+Wv*n*s;gT.add(Zo(Lc(l*l+u*u),h)),vT=i,jv=t,Wv=n}function dX(i){return gT=new Ec,Ey(i,N0),+gT}var _T=[null,null],pX={type:"LineString",coordinates:_T};function Vh(i,e){return _T[0]=i,_T[1]=e,dX(pX)}var VR={Feature:function(i,e){return L_(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(L_(t[n].geometry,e))return!0;return!1}},HR={Sphere:function(){return!0},Point:function(i,e){return jR(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(jR(t[n],e))return!0;return!1},LineString:function(i,e){return WR(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(WR(t[n],e))return!0;return!1},Polygon:function(i,e){return $R(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if($R(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(L_(t[n],e))return!0;return!1}};function L_(i,e){return i&&HR.hasOwnProperty(i.type)?HR[i.type](i,e):!1}function jR(i,e){return Vh(i,e)===0}function WR(i,e){for(var t,n,r,s=0,a=i.length;s<a;s++){if(n=Vh(i[s],e),n===0||s>0&&(r=Vh(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<y_*r))return!0;t=n}return!1}function $R(i,e){return!!jD(i.map(mX),$D(e))}function mX(i){return i=i.map($D),i.pop(),i}function $D(i){return[i[0]*Hn,i[1]*Hn]}function gX(i,e){return(i&&VR.hasOwnProperty(i.type)?VR[i.type]:L_)(i,e)}function XR(i,e,t){var n=jd(i,e-di,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function YR(i,e,t){var n=jd(i,e-di,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function vX(){var i,e,t,n,r,s,a,l,u=10,h=u,m=90,v=360,x,S,w,R,C=2.5;function E(){return{type:"MultiLineString",coordinates:B()}}function B(){return jd(K2(n/m)*m,t,m).map(w).concat(jd(K2(l/v)*v,a,v).map(R)).concat(jd(K2(e/u)*u,i,u).filter(function(L){return ir(L%m)>di}).map(x)).concat(jd(K2(s/h)*h,r,h).filter(function(L){return ir(L%v)>di}).map(S))}return E.lines=function(){return B().map(function(L){return{type:"LineString",coordinates:L}})},E.outline=function(){return{type:"Polygon",coordinates:[w(n).concat(R(a).slice(1),w(t).reverse().slice(1),R(l).reverse().slice(1))]}},E.extent=function(L){return arguments.length?E.extentMajor(L).extentMinor(L):E.extentMinor()},E.extentMajor=function(L){return arguments.length?(n=+L[0][0],t=+L[1][0],l=+L[0][1],a=+L[1][1],n>t&&(L=n,n=t,t=L),l>a&&(L=l,l=a,a=L),E.precision(C)):[[n,l],[t,a]]},E.extentMinor=function(L){return arguments.length?(e=+L[0][0],i=+L[1][0],s=+L[0][1],r=+L[1][1],e>i&&(L=e,e=i,i=L),s>r&&(L=s,s=r,r=L),E.precision(C)):[[e,s],[i,r]]},E.step=function(L){return arguments.length?E.stepMajor(L).stepMinor(L):E.stepMinor()},E.stepMajor=function(L){return arguments.length?(m=+L[0],v=+L[1],E):[m,v]},E.stepMinor=function(L){return arguments.length?(u=+L[0],h=+L[1],E):[u,h]},E.precision=function(L){return arguments.length?(C=+L,x=XR(s,r,90),S=YR(e,i,C),w=XR(l,a,90),R=YR(n,t,C),E):C},E.extentMajor([[-180,-90+di],[180,90-di]]).extentMinor([[-180,-80-di],[180,80+di]])}function _X(){return vX()()}function pM(i,e){var t=i[0]*Hn,n=i[1]*Hn,r=e[0]*Hn,s=e[1]*Hn,a=ei(n),l=zn(n),u=ei(s),h=zn(s),m=a*ei(t),v=a*zn(t),x=u*ei(r),S=u*zn(r),w=2*Uc(Lc(MR(s-n)+a*u*MR(r-t))),R=zn(w),C=w?function(E){var B=zn(E*=w)/R,L=zn(w-E)/R,O=L*m+B*x,G=L*v+B*S,q=L*l+B*h;return[Zo(G,O)*kr,Zo(q,Lc(O*O+G*G))*kr]}:function(){return[t*kr,n*kr]};return C.distance=w,C}const QR=i=>i;var D0=1/0,U_=D0,Ag=-D0,B_=Ag,KR={point:yX,lineStart:ra,lineEnd:ra,polygonStart:ra,polygonEnd:ra,result:function(){var i=[[D0,U_],[Ag,B_]];return Ag=B_=-(U_=D0=1/0),i}};function yX(i,e){i<D0&&(D0=i),i>Ag&&(Ag=i),e<U_&&(U_=e),e>B_&&(B_=e)}function mM(i){return function(e){var t=new yT;for(var n in i)t[n]=i[n];return t.stream=e,t}}function yT(){}yT.prototype={constructor:yT,point:function(i,e){this.stream.point(i,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function gM(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),Ey(t,i.stream(KR)),e(KR.result()),n!=null&&i.clipExtent(n),i}function XD(i,e,t){return gM(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],a=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),l=+e[0][0]+(r-a*(n[1][0]+n[0][0]))/2,u=+e[0][1]+(s-a*(n[1][1]+n[0][1]))/2;i.scale(150*a).translate([l,u])},t)}function xX(i,e,t){return XD(i,[[0,0],e],t)}function bX(i,e,t){return gM(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),a=(r-s*(n[1][0]+n[0][0]))/2,l=-s*n[0][1];i.scale(150*s).translate([a,l])},t)}function SX(i,e,t){return gM(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),a=-s*n[0][0],l=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([a,l])},t)}var ZR=16,TX=ei(30*Hn);function JR(i,e){return+e?MX(i,e):wX(i)}function wX(i){return mM({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function MX(i,e){function t(n,r,s,a,l,u,h,m,v,x,S,w,R,C){var E=h-n,B=m-r,L=E*E+B*B;if(L>4*e&&R--){var O=a+x,G=l+S,q=u+w,z=Lc(O*O+G*G+q*q),j=Uc(q/=z),F=ir(ir(q)-1)<di||ir(s-v)<di?(s+v)/2:Zo(G,O),V=i(F,j),Y=V[0],ee=V[1],te=Y-n,re=ee-r,ne=B*te-E*re;(ne*ne/L>e||ir((E*te+B*re)/L-.5)>.3||a*x+l*S+u*w<TX)&&(t(n,r,s,a,l,u,Y,ee,F,O/=z,G/=z,q,R,C),C.point(Y,ee),t(Y,ee,F,O,G,q,h,m,v,x,S,w,R,C))}}return function(n){var r,s,a,l,u,h,m,v,x,S,w,R,C={point:E,lineStart:B,lineEnd:O,polygonStart:function(){n.polygonStart(),C.lineStart=G},polygonEnd:function(){n.polygonEnd(),C.lineStart=B}};function E(j,F){j=i(j,F),n.point(j[0],j[1])}function B(){v=NaN,C.point=L,n.lineStart()}function L(j,F){var V=hA([j,F]),Y=i(j,F);t(v,x,m,S,w,R,v=Y[0],x=Y[1],m=j,S=V[0],w=V[1],R=V[2],ZR,n),n.point(v,x)}function O(){C.point=E,n.lineEnd()}function G(){B(),C.point=q,C.lineEnd=z}function q(j,F){L(r=j,F),s=v,a=x,l=S,u=w,h=R,C.point=L}function z(){t(v,x,m,S,w,R,s,a,r,l,u,h,ZR,n),C.lineEnd=O,O()}return C}}var EX=mM({point:function(i,e){this.stream.point(i*Hn,e*Hn)}});function CX(i){return mM({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function RX(i,e,t,n,r){function s(a,l){return a*=n,l*=r,[e+i*a,t-i*l]}return s.invert=function(a,l){return[(a-e)/i*n,(t-l)/i*r]},s}function e6(i,e,t,n,r,s){if(!s)return RX(i,e,t,n,r);var a=ei(s),l=zn(s),u=a*i,h=l*i,m=a/i,v=l/i,x=(l*t-a*e)/i,S=(l*e+a*t)/i;function w(R,C){return R*=n,C*=r,[u*R-h*C+e,t-h*R-u*C]}return w.invert=function(R,C){return[n*(m*R-v*C+x),r*(S-v*R-m*C)]},w}function NX(i){return DX(function(){return i})()}function DX(i){var e,t=150,n=480,r=250,s=0,a=0,l=0,u=0,h=0,m,v=0,x=1,S=1,w=null,R=qR,C=null,E,B,L,O=QR,G=.5,q,z,j,F,V;function Y(ne){return j(ne[0]*Hn,ne[1]*Hn)}function ee(ne){return ne=j.invert(ne[0],ne[1]),ne&&[ne[0]*kr,ne[1]*kr]}Y.stream=function(ne){return F&&V===ne?F:F=EX(CX(m)(R(q(O(V=ne)))))},Y.preclip=function(ne){return arguments.length?(R=ne,w=void 0,re()):R},Y.postclip=function(ne){return arguments.length?(O=ne,C=E=B=L=null,re()):O},Y.clipAngle=function(ne){return arguments.length?(R=+ne?oX(w=ne*Hn):(w=null,qR),re()):w*kr},Y.clipExtent=function(ne){return arguments.length?(O=ne==null?(C=E=B=L=null,QR):uX(C=+ne[0][0],E=+ne[0][1],B=+ne[1][0],L=+ne[1][1]),re()):C==null?null:[[C,E],[B,L]]},Y.scale=function(ne){return arguments.length?(t=+ne,te()):t},Y.translate=function(ne){return arguments.length?(n=+ne[0],r=+ne[1],te()):[n,r]},Y.center=function(ne){return arguments.length?(s=ne[0]%360*Hn,a=ne[1]%360*Hn,te()):[s*kr,a*kr]},Y.rotate=function(ne){return arguments.length?(l=ne[0]%360*Hn,u=ne[1]%360*Hn,h=ne.length>2?ne[2]%360*Hn:0,te()):[l*kr,u*kr,h*kr]},Y.angle=function(ne){return arguments.length?(v=ne%360*Hn,te()):v*kr},Y.reflectX=function(ne){return arguments.length?(x=ne?-1:1,te()):x<0},Y.reflectY=function(ne){return arguments.length?(S=ne?-1:1,te()):S<0},Y.precision=function(ne){return arguments.length?(q=JR(z,G=ne*ne),re()):Lc(G)},Y.fitExtent=function(ne,Q){return XD(Y,ne,Q)},Y.fitSize=function(ne,Q){return xX(Y,ne,Q)},Y.fitWidth=function(ne,Q){return bX(Y,ne,Q)},Y.fitHeight=function(ne,Q){return SX(Y,ne,Q)};function te(){var ne=e6(t,0,0,x,S,v).apply(null,e(s,a)),Q=e6(t,n-ne[0],r-ne[1],x,S,v);return m=qD(l,u,h),z=pT(e,Q),j=pT(m,z),q=JR(z,G),re()}function re(){return F=V=null,Y}return function(){return e=i.apply(this,arguments),Y.invert=e.invert&&ee,te()}}function PX(i){return function(e,t){var n=Lc(e*e+t*t),r=i(n),s=zn(r),a=ei(r);return[Zo(e*s,n*a),Uc(n&&t*s/n)]}}function vM(i,e){return[i,k$(G$(($a+e)/2))]}vM.invert=function(i,e){return[i,2*AM(F$(e))-$a]};function YD(i,e){var t=ei(e),n=1+ei(i)*t;return[t*zn(i)/n,zn(e)/n]}YD.invert=PX(function(i){return 2*AM(i)});function LX(){return NX(YD).scale(250).clipAngle(142)}function xT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function UX(i){if(Array.isArray(i))return i}function BX(i){if(Array.isArray(i))return xT(i)}function Pm(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function OX(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function IX(i,e,t){return e=O_(e),$X(i,KD()?Reflect.construct(e,[],O_(i).constructor):e.apply(i,t))}function QD(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function FX(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function fi(i,e){return i.get(Pm(i,e))}function xh(i,e,t){QD(i,e),e.set(i,t)}function bh(i,e,t){return i.set(Pm(i,e),t),t}function kX(i,e){QD(i,e),e.add(i)}function zX(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,JD(n.key),n)}}function GX(i,e,t){return e&&zX(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function yd(i,e,t){return(e=JD(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function O_(i){return O_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},O_(i)}function qX(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&bT(i,e)}function KD(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KD=function(){return!!i})()}function VX(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function HX(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function jX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WX(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $X(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return OX(i)}function bT(i,e){return bT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},bT(i,e)}function $v(i,e){return UX(i)||HX(i,e)||eP(i,e)||jX()}function ZD(i){return BX(i)||VX(i)||eP(i)||WX()}function XX(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function JD(i){var e=XX(i,"string");return typeof e=="symbol"?e:e+""}function eP(i,e){if(i){if(typeof i=="string")return xT(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?xT(i,e):void 0}}var tP=function(e){e instanceof Array?e.forEach(tP):(e.map&&e.map.dispose(),e.dispose())},nP=function(e){e.geometry&&e.geometry.dispose(),e.material&&tP(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(nP)},t6=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),nP(t)}};function iP(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function YX(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),a=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-a*180/Math.PI-(a<-Math.PI/2?360:0),r}}function Mf(i){return i*Math.PI/180}var rP=function(e){return 1-(vM(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},I3=function(e){return Math.max(0,Math.min(1,rP(e)))},n6=function(e){return .5-vM.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},QX=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=Pc().domain([1,0]).range([t,n]).clamp(!0),s=Pc().domain([I3(t),I3(n)]).range([1,0]).clamp(!0),a=function(v){return s(I3(r(v)))},l=e.array,u=0,h=l.length;u<h;u+=2)l[u+1]=a(l[u+1]);e.needsUpdate=!0},i6=function(e,t,n,r){var s=Math.pow(2,e),a=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),l=(90-r)/180;t&&(l=Math.max(0,Math.min(1,rP(l))));var u=Math.floor(l*s);return[a,u]},ST=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,l=[],u=Math.pow(2,e),h=360/u,m=180/u,v=s===void 0?u-1:s,x=a===void 0?u-1:a,S=n,w=Math.min(u-1,v);S<=w;S++)for(var R=r,C=Math.min(u-1,x);R<=C;R++){var E=R,B=m;if(t){E=R===0?R:n6(R/u)*u;var L=R+1===u?R+1:n6((R+1)/u)*u;B=(L-E)*180/u}var O=-180+(S+.5)*h,G=90-(E*180/u+B/2),q=B;l.push({x:S,y:R,lng:O,lat:G,latLen:q})}return l},KX=6,ZX=7,JX=3,eY=90,Ql=new WeakMap,Nh=new WeakMap,F3=new WeakMap,nv=new WeakMap,Vo=new WeakMap,I_=new WeakMap,r0=new WeakMap,Ef=new WeakMap,iv=new WeakSet,tY=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,a=r.minLevel,l=a===void 0?0:a,u=r.maxLevel,h=u===void 0?17:u,m=r.mercatorProjection,v=m===void 0?!0:m;return FX(this,e),n=IX(this,e),kX(n,iv),xh(n,Ql,void 0),xh(n,Nh,void 0),xh(n,F3,void 0),xh(n,nv,void 0),xh(n,Vo,{}),xh(n,I_,void 0),xh(n,r0,void 0),xh(n,Ef,void 0),yd(n,"minLevel",void 0),yd(n,"maxLevel",void 0),yd(n,"thresholds",ZD(new Array(30)).map(function(x,S){return 8/Math.pow(2,S)})),yd(n,"curvatureResolution",5),yd(n,"tileMargin",0),yd(n,"clearTiles",function(){Object.values(fi(Vo,n)).forEach(function(x){x.forEach(function(S){S.obj&&(n.remove(S.obj),t6(S.obj),delete S.obj)})}),bh(Vo,n,{})}),bh(Ql,n,t),n.tileUrl=s,bh(Nh,n,v),n.minLevel=l,n.maxLevel=h,n.level=0,n.add(bh(Ef,n,new zi(new Eu(fi(Ql,n)*.99,180,90),new pA({color:0})))),fi(Ef,n).visible=!1,fi(Ef,n).material.polygonOffset=!0,fi(Ef,n).material.polygonOffsetUnits=3,fi(Ef,n).material.polygonOffsetFactor=1,n}return qX(e,i),GX(e,[{key:"tileUrl",get:function(){return fi(F3,this)},set:function(n){bh(F3,this,n),this.updatePov(fi(r0,this))}},{key:"level",get:function(){return fi(nv,this)},set:function(n){var r,s=this;fi(Vo,this)[n]||Pm(iv,this,nY).call(this,n);var a=fi(nv,this);if(bh(nv,this,n),!(n===a||a===void 0)){if(fi(Ef,this).visible=n>0,fi(Vo,this)[n].forEach(function(u){return u.obj&&(u.obj.material.depthWrite=!0)}),a<n&&((r=fi(Vo,this)[a])===null||r===void 0||r.forEach(function(u){return u.obj&&(u.obj.material.depthWrite=!1)})),a>n)for(var l=n+1;l<=a;l++)fi(Vo,this)[l]&&fi(Vo,this)[l].forEach(function(u){u.obj&&(s.remove(u.obj),t6(u.obj),delete u.obj)});Pm(iv,this,r6).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof _y))){bh(r0,this,n);var s;if(bh(I_,this,function(m){if(!m.hullPnts){var v=360/Math.pow(2,r.level),x=m.lng,S=m.lat,w=m.latLen,R=x-v/2,C=x+v/2,E=S-w/2,B=S+w/2;m.hullPnts=[[S,x],[E,R],[B,R],[E,C],[B,C]].map(function(L){var O=$v(L,2),G=O[0],q=O[1];return iP(G,q,fi(Ql,r))}).map(function(L){var O=L.x,G=L.y,q=L.z;return new he(O,G,q)})}return s||(s=new Fg,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new kn().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),m.hullPnts.some(function(L){return s.containsPoint(L.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var a=n.position.clone(),l=a.distanceTo(this.getWorldPosition(new he)),u=(l-fi(Ql,this))/fi(Ql,this),h=this.thresholds.findIndex(function(m){return m&&m<=u});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,h<0?this.thresholds.length:h)),Pm(iv,this,r6).call(this)}}}}])})(ja);function nY(i){var e=this;if(i>ZX){fi(Vo,this)[i]=[];return}var t=fi(Vo,this)[i]=ST(i,fi(Nh,this));t.forEach(function(n){return n.centroid=iP(n.lat,n.lng,fi(Ql,e))}),t.octree=gD().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function r6(){var i=this;if(!(!this.tileUrl||this.level===void 0||!fi(Vo,this).hasOwnProperty(this.level))&&!(!fi(I_,this)&&this.level>KX)){var e=fi(Vo,this)[this.level];if(fi(r0,this)){var t=this.worldToLocal(fi(r0,this).position.clone());if(e.octree){var n,r=this.worldToLocal(fi(r0,this).position.clone()),s=(r.length()-fi(Ql,this))*JX;e=(n=e.octree).findAllWithinRadius.apply(n,ZD(r).concat([s]))}else{var a=YX(t),l=(a.r/fi(Ql,this)-1)*eY,u=l/Math.cos(Mf(a.lat)),h=[a.lng-u,a.lng+u],m=[a.lat+l,a.lat-l],v=i6(this.level,fi(Nh,this),h[0],m[0]),x=$v(v,2),S=x[0],w=x[1],R=i6(this.level,fi(Nh,this),h[1],m[1]),C=$v(R,2),E=C[0],B=C[1];!e.record&&(e.record={});var L=e.record;if(!L.hasOwnProperty("".concat(Math.round((S+E)/2),"_").concat(Math.round((w+B)/2))))e=ST(this.level,fi(Nh,this),S,w,E,B).map(function(j){var F="".concat(j.x,"_").concat(j.y);return L.hasOwnProperty(F)?L[F]:(L[F]=j,e.push(j),j)});else{for(var O=[],G=S;G<=E;G++)for(var q=w;q<=B;q++){var z="".concat(G,"_").concat(q);L.hasOwnProperty(z)||(L[z]=ST(this.level,fi(Nh,this),G,q,G,q)[0],e.push(L[z])),O.push(L[z])}e=O}}}e.filter(function(j){return!j.obj}).filter(fi(I_,this)||function(){return!0}).forEach(function(j){var F=j.x,V=j.y,Y=j.lng,ee=j.lat,te=j.latLen,re=360/Math.pow(2,i.level);if(!j.obj){var ne=re*(1-i.tileMargin),Q=te*(1-i.tileMargin),ae=Mf(Y),de=Mf(-ee),Te=new zi(new Eu(fi(Ql,i),Math.ceil(ne/i.curvatureResolution),Math.ceil(Q/i.curvatureResolution),Mf(90-ne/2)+ae,Mf(ne),Mf(90-Q/2)+de,Mf(Q)),new Vc);if(fi(Nh,i)){var be=[ee+te/2,ee-te/2].map(function(Ne){return .5-Ne/180}),ue=$v(be,2),we=ue[0],We=ue[1];QX(Te.geometry.attributes.uv,we,We)}j.obj=Te}j.loading||(j.loading=!0,new rM().load(i.tileUrl(F,V,i.level),function(Ne){var ze=j.obj;ze&&(Ne.colorSpace=_n,ze.material.map=Ne,ze.material.color=null,ze.material.needsUpdate=!0,i.add(ze)),j.loading=!1}))})}}function iY(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let s=sP(i,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let l,u,h;if(n&&(s=lY(i,e,s,t)),i.length>80*t){l=i[0],u=i[1];let m=l,v=u;for(let x=t;x<r;x+=t){const S=i[x],w=i[x+1];S<l&&(l=S),w<u&&(u=w),S>m&&(m=S),w>v&&(v=w)}h=Math.max(m-l,v-u),h=h!==0?32767/h:0}return dg(s,a,t,l,u,h,0),a}function sP(i,e,t,n,r){let s;if(r===_Y(i,e,t,n)>0)for(let a=e;a<t;a+=n)s=s6(a/n|0,i[a],i[a+1],s);else for(let a=t-n;a>=e;a-=n)s=s6(a/n|0,i[a],i[a+1],s);return s&&P0(s,s.next)&&(mg(s),s=s.next),s}function fA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(P0(t,t.next)||Dr(t.prev,t,t.next)===0)){if(mg(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function dg(i,e,t,n,r,s,a){if(!i)return;!a&&s&&AY(i,n,r,s);let l=i;for(;i.prev!==i.next;){const u=i.prev,h=i.next;if(s?sY(i,n,r,s):rY(i)){e.push(u.i,i.i,h.i),mg(i),i=h.next,l=h.next;continue}if(i=h,i===l){a?a===1?(i=aY(fA(i),e),dg(i,e,t,n,r,s,2)):a===2&&oY(i,e,t,n,r,s):dg(fA(i),e,t,n,r,s,1);break}}}function rY(i){const e=i.prev,t=i,n=i.next;if(Dr(e,t,n)>=0)return!1;const r=e.x,s=t.x,a=n.x,l=e.y,u=t.y,h=n.y,m=Math.min(r,s,a),v=Math.min(l,u,h),x=Math.max(r,s,a),S=Math.max(l,u,h);let w=n.next;for(;w!==e;){if(w.x>=m&&w.x<=x&&w.y>=v&&w.y<=S&&Sm(r,l,s,u,a,h,w.x,w.y)&&Dr(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function sY(i,e,t,n){const r=i.prev,s=i,a=i.next;if(Dr(r,s,a)>=0)return!1;const l=r.x,u=s.x,h=a.x,m=r.y,v=s.y,x=a.y,S=Math.min(l,u,h),w=Math.min(m,v,x),R=Math.max(l,u,h),C=Math.max(m,v,x),E=TT(S,w,e,t,n),B=TT(R,C,e,t,n);let L=i.prevZ,O=i.nextZ;for(;L&&L.z>=E&&O&&O.z<=B;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Sm(l,m,u,v,h,x,L.x,L.y)&&Dr(L.prev,L,L.next)>=0||(L=L.prevZ,O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Sm(l,m,u,v,h,x,O.x,O.y)&&Dr(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;L&&L.z>=E;){if(L.x>=S&&L.x<=R&&L.y>=w&&L.y<=C&&L!==r&&L!==a&&Sm(l,m,u,v,h,x,L.x,L.y)&&Dr(L.prev,L,L.next)>=0)return!1;L=L.prevZ}for(;O&&O.z<=B;){if(O.x>=S&&O.x<=R&&O.y>=w&&O.y<=C&&O!==r&&O!==a&&Sm(l,m,u,v,h,x,O.x,O.y)&&Dr(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function aY(i,e){let t=i;do{const n=t.prev,r=t.next.next;!P0(n,r)&&oP(n,t,t.next,r)&&pg(n,r)&&pg(r,n)&&(e.push(n.i,t.i,r.i),mg(t),mg(t.next),t=i=r),t=t.next}while(t!==i);return fA(t)}function oY(i,e,t,n,r,s){let a=i;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&mY(a,l)){let u=lP(a,l);a=fA(a,a.next),u=fA(u,u.next),dg(a,e,t,n,r,s,0),dg(u,e,t,n,r,s,0);return}l=l.next}a=a.next}while(a!==i)}function lY(i,e,t,n){const r=[];for(let s=0,a=e.length;s<a;s++){const l=e[s]*n,u=s<a-1?e[s+1]*n:i.length,h=sP(i,l,u,n,!1);h===h.next&&(h.steiner=!0),r.push(pY(h))}r.sort(uY);for(let s=0;s<r.length;s++)t=cY(r[s],t);return t}function uY(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function cY(i,e){const t=hY(i,e);if(!t)return e;const n=lP(t,i);return fA(n,n.next),fA(t,t.next)}function hY(i,e){let t=e;const n=i.x,r=i.y;let s=-1/0,a;if(P0(i,t))return t;do{if(P0(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const v=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(v<=n&&v>s&&(s=v,a=t.x<t.next.x?t:t.next,v===n))return a}t=t.next}while(t!==e);if(!a)return null;const l=a,u=a.x,h=a.y;let m=1/0;t=a;do{if(n>=t.x&&t.x>=u&&n!==t.x&&aP(r<h?n:s,r,u,h,r<h?s:n,r,t.x,t.y)){const v=Math.abs(r-t.y)/(n-t.x);pg(t,i)&&(v<m||v===m&&(t.x>a.x||t.x===a.x&&fY(a,t)))&&(a=t,m=v)}t=t.next}while(t!==l);return a}function fY(i,e){return Dr(i.prev,i,e.prev)<0&&Dr(e.next,i,i.next)<0}function AY(i,e,t,n){let r=i;do r.z===0&&(r.z=TT(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,dY(r)}function dY(i){let e,t=1;do{let n=i,r;i=null;let s=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)?(r=n,n=n.nextZ,l--):(r=a,a=a.nextZ,u--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=a}s.nextZ=null,t*=2}while(e>1);return i}function TT(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function pY(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function aP(i,e,t,n,r,s,a,l){return(r-a)*(e-l)>=(i-a)*(s-l)&&(i-a)*(n-l)>=(t-a)*(e-l)&&(t-a)*(s-l)>=(r-a)*(n-l)}function Sm(i,e,t,n,r,s,a,l){return!(i===a&&e===l)&&aP(i,e,t,n,r,s,a,l)}function mY(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!gY(i,e)&&(pg(i,e)&&pg(e,i)&&vY(i,e)&&(Dr(i.prev,i,e.prev)||Dr(i,e.prev,e))||P0(i,e)&&Dr(i.prev,i,i.next)>0&&Dr(e.prev,e,e.next)>0)}function Dr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function P0(i,e){return i.x===e.x&&i.y===e.y}function oP(i,e,t,n){const r=sv(Dr(i,e,t)),s=sv(Dr(i,e,n)),a=sv(Dr(t,n,i)),l=sv(Dr(t,n,e));return!!(r!==s&&a!==l||r===0&&rv(i,t,e)||s===0&&rv(i,n,e)||a===0&&rv(t,i,n)||l===0&&rv(t,e,n))}function rv(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function sv(i){return i>0?1:i<0?-1:0}function gY(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&oP(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function pg(i,e){return Dr(i.prev,i,i.next)<0?Dr(i,e,i.next)>=0&&Dr(i,i.prev,e)>=0:Dr(i,e,i.prev)<0||Dr(i,i.next,e)<0}function vY(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function lP(i,e){const t=wT(i.i,i.x,i.y),n=wT(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function s6(i,e,t,n){const r=wT(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function mg(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function wT(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function _Y(i,e,t,n){let r=0;for(let s=e,a=t-n;s<t;s+=n)r+=(i[a]-i[s])*(i[s+1]+i[a+1]),a=s;return r}function F_(i){const e=[],t=[],n=i[0][0].length;let r=0,s=0;for(const a of i){for(const l of a)for(let u=0;u<n;u++)e.push(l[u]);s&&(r+=s,t.push(r)),s=a.length}return{vertices:e,holes:t,dimensions:n}}function MT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function yY(i){if(Array.isArray(i))return i}function xY(i){if(Array.isArray(i))return MT(i)}function bY(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function SY(i,e,t){return e=k_(e),PY(i,uP()?Reflect.construct(e,[],k_(i).constructor):e.apply(i,t))}function TY(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function wY(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function MY(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=_M(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(u){throw u},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,a=!0,l=!1;return{s:function(){t=t.call(i)},n:function(){var u=t.next();return a=u.done,u},e:function(u){l=!0,s=u},f:function(){try{a||t.return==null||t.return()}finally{if(l)throw s}}}}function k_(i){return k_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k_(i)}function EY(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&ET(i,e)}function uP(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uP=function(){return!!i})()}function CY(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function RY(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function NY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DY(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PY(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bY(i)}function ET(i,e){return ET=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ET(i,e)}function nm(i,e){return yY(i)||RY(i,e)||_M(i,e)||NY()}function LY(i){return xY(i)||CY(i)||_M(i)||DY()}function _M(i,e){if(i){if(typeof i=="string")return MT(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?MT(i,e):void 0}}var a6=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var a=Vh(s,r)*180/Math.PI;if(a>t)for(var l=pM(r,s),u=r.length>2||s.length>2?fg(r[2]||0,s[2]||0):null,h=u?function(x){return[].concat(LY(l(x)),[u(x)])}:l,m=1/Math.ceil(a/t),v=m;v<1;)n.push(h(v)),v+=m}n.push(r=s)}),n},CT=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Ki,Float32BufferAttribute:Mi},UY=new CT.BufferGeometry().setAttribute?"setAttribute":"addAttribute",cP=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;TY(this,e),n=SY(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var a=({Point:m,MultiPoint:v,LineString:x,MultiLineString:S,Polygon:w,MultiPolygon:R}[t.type]||function(){return[]})(t.coordinates,r),l=[],u=[],h=0;a.forEach(function(C){var E=l.length;im({indices:l,vertices:u},C),n.addGroup(E,l.length-E,h++)}),l.length&&n.setIndex(l),u.length&&n[UY]("position",new CT.Float32BufferAttribute(u,3));function m(C,E){var B=k3(C[1],C[0],E+(C[2]||0)),L=[];return[{vertices:B,indices:L}]}function v(C,E){var B={vertices:[],indices:[]};return C.map(function(L){return m(L,E)}).forEach(function(L){var O=nm(L,1),G=O[0];im(B,G)}),[B]}function x(C,E){for(var B=a6(C,s).map(function(j){var F=nm(j,3),V=F[0],Y=F[1],ee=F[2],te=ee===void 0?0:ee;return k3(Y,V,E+te)}),L=F_([B]),O=L.vertices,G=Math.round(O.length/3),q=[],z=1;z<G;z++)q.push(z-1,z);return[{vertices:O,indices:q}]}function S(C,E){var B={vertices:[],indices:[]};return C.map(function(L){return x(L,E)}).forEach(function(L){var O=nm(L,1),G=O[0];im(B,G)}),[B]}function w(C,E){for(var B=C.map(function(ne){return a6(ne,s).map(function(Q){var ae=nm(Q,3),de=ae[0],Te=ae[1],be=ae[2],ue=be===void 0?0:be;return k3(Te,de,E+ue)})}),L=F_(B),O=L.vertices,G=L.holes,q=G[0]||1/0,z=O.slice(0,q*3),j=O.slice(q*3),F=new Set(G),V=Math.round(O.length/3),Y=[],ee=[],te=1;te<V;te++)F.has(te)||(te<q?Y.push(te-1,te):ee.push(te-1-q,te-q));var re=[{indices:Y,vertices:z}];return G.length&&re.push({indices:ee,vertices:j}),re}function R(C,E){var B={vertices:[],indices:[]},L={vertices:[],indices:[]};C.map(function(G){return w(G,E)}).forEach(function(G){var q=nm(G,2),z=q[0],j=q[1];im(B,z),j&&im(L,j)});var O=[B];return L.vertices.length&&O.push(L),O}return n}return EY(e,i),wY(e)})(CT.BufferGeometry);function im(i,e){var t=Math.round(i.vertices.length/3);o6(i.vertices,e.vertices),o6(i.indices,e.indices.map(function(n){return n+t}))}function o6(i,e){var t=MY(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function k3(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function BY(i,e,t=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(a){if(a.normalized||a.isInterleavedBufferAttribute){const l=new Float32Array(a.count*a.itemSize);for(let u=0,h=0;u<a.count;u++)l[h++]=a.getX(u),l[h++]=a.getY(u),a.itemSize>2&&(l[h++]=a.getZ(u));return l}return a.array instanceof Float32Array?a.array:new Float32Array(a.array)}const r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let a=3;a<s.length;a+=4)s[a]*=-1;return r.setAttribute("tangent",new wr(s,4)),i!==r&&i.copy(r),i}function OY(i,e=!1){const t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},a={},l=i[0].morphTargetsRelative,u=new Ki;let h=0;for(let m=0;m<i.length;++m){const v=i[m];let x=0;if(t!==(v.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const S in v.attributes){if(!n.has(S))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+'. All geometries must have compatible attributes; make sure "'+S+'" attribute exists among all geometries, or in none of them.'),null;s[S]===void 0&&(s[S]=[]),s[S].push(v.attributes[S]),x++}if(x!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". Make sure all geometries have the same number of attributes."),null;if(l!==v.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const S in v.morphAttributes){if(!r.has(S))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+".  .morphAttributes must be consistent throughout all geometries."),null;a[S]===void 0&&(a[S]=[]),a[S].push(v.morphAttributes[S])}if(e){let S;if(t)S=v.index.count;else if(v.attributes.position!==void 0)S=v.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". The geometry must have either an index or a position attribute"),null;u.addGroup(h,S,m),h+=S}}if(t){let m=0;const v=[];for(let x=0;x<i.length;++x){const S=i[x].index;for(let w=0;w<S.count;++w)v.push(S.getX(w)+m);m+=i[x].attributes.position.count}u.setIndex(v)}for(const m in s){const v=RT(s[m]);if(!v)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+m+" attribute."),null;u.setAttribute(m,v)}for(const m in a){const v=a[m][0].length;if(v===0)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[m]=[];for(let x=0;x<v;++x){const S=[];for(let R=0;R<a[m].length;++R)S.push(a[m][R][x]);const w=RT(S);if(!w)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+m+" morphAttribute."),null;u.morphAttributes[m].push(w)}}return u}function RT(i){let e,t,n,r=-1,s=0;for(let h=0;h<i.length;++h){const m=i[h];if(e===void 0&&(e=m.array.constructor),e!==m.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=m.itemSize),t!==m.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=m.normalized),n!==m.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=m.gpuType),r!==m.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=m.count*t}const a=new e(s),l=new wr(a,t,n);let u=0;for(let h=0;h<i.length;++h){const m=i[h];if(m.isInterleavedBufferAttribute){const v=u/t;for(let x=0,S=m.count;x<S;x++)for(let w=0;w<t;w++){const R=m.getComponent(x,w);l.setComponent(x+v,w,R)}}else a.set(m.array,u);u+=m.count*t}return r!==void 0&&(l.gpuType=r),l}function IY(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?z_(i):i.isInstancedBufferAttribute?new Ig().copy(i):new wr().copy(i)}function FY(i){let e,t=0,n=0;for(let h=0,m=i.length;h<m;++h){const v=i[h];if(e===void 0&&(e=v.array.constructor),e!==v.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=v.array.length,n+=v.itemSize}const r=new Qw(new e(t),n);let s=0;const a=[],l=["getX","getY","getZ","getW"],u=["setX","setY","setZ","setW"];for(let h=0,m=i.length;h<m;h++){const v=i[h],x=v.itemSize,S=v.count,w=new nu(r,x,s,v.normalized);a.push(w),s+=x;for(let R=0;R<S;R++)for(let C=0;C<x;C++)w[u[C]](R,v[l[C]](R))}return a}function z_(i){const e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n);let a;i.isInstancedInterleavedBufferAttribute?a=new Ig(s,n,r,i.meshPerAttribute):a=new wr(s,n,r);for(let l=0;l<t;l++)a.setX(l,i.getX(l)),n>=2&&a.setY(l,i.getY(l)),n>=3&&a.setZ(l,i.getZ(l)),n>=4&&a.setW(l,i.getW(l));return a}function kY(i){const e=i.attributes,t=i.morphTargets,n=new Map;for(const r in e){const s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,z_(s)),e[r]=n.get(s))}for(const r in t){const s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,z_(s)),t[r]=n.get(s))}}function zY(i){let e=0;for(const n in i.attributes){const r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}const t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function GY(i,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count;let a=0;const l=Object.keys(i.attributes),u={},h={},m=[],v=["getX","getY","getZ","getW"],x=["setX","setY","setZ","setW"];for(let B=0,L=l.length;B<L;B++){const O=l[B],G=i.attributes[O];u[O]=new G.constructor(new G.array.constructor(G.count*G.itemSize),G.itemSize,G.normalized);const q=i.morphAttributes[O];q&&(h[O]||(h[O]=[]),q.forEach((z,j)=>{const F=new z.array.constructor(z.count*z.itemSize);h[O][j]=new z.constructor(F,z.itemSize,z.normalized)}))}const S=e*.5,w=Math.log10(1/e),R=Math.pow(10,w),C=S*R;for(let B=0;B<s;B++){const L=n?n.getX(B):B;let O="";for(let G=0,q=l.length;G<q;G++){const z=l[G],j=i.getAttribute(z),F=j.itemSize;for(let V=0;V<F;V++)O+=`${~~(j[v[V]](L)*R+C)},`}if(O in t)m.push(t[O]);else{for(let G=0,q=l.length;G<q;G++){const z=l[G],j=i.getAttribute(z),F=i.morphAttributes[z],V=j.itemSize,Y=u[z],ee=h[z];for(let te=0;te<V;te++){const re=v[te],ne=x[te];if(Y[ne](a,j[re](L)),F)for(let Q=0,ae=F.length;Q<ae;Q++)ee[Q][ne](a,F[Q][re](L))}}t[O]=a,m.push(a),a++}}const E=i.clone();for(const B in i.attributes){const L=u[B];if(E.setAttribute(B,new L.constructor(L.array.slice(0,a*L.itemSize),L.itemSize,L.normalized)),B in h)for(let O=0;O<h[B].length;O++){const G=h[B][O];E.morphAttributes[B][O]=new G.constructor(G.array.slice(0,a*G.itemSize),G.itemSize,G.normalized)}}return E.setIndex(m),E}function qY(i,e){if(e===HF)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===jC||e===jF){let t=i.getIndex();if(t===null){const a=[],l=i.getAttribute("position");if(l!==void 0){for(let u=0;u<l.count;u++)a.push(u);i.setIndex(a),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}const n=t.count-2,r=[];if(e===jC)for(let a=1;a<=n;a++)r.push(t.getX(0)),r.push(t.getX(a)),r.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(r.push(t.getX(a)),r.push(t.getX(a+1)),r.push(t.getX(a+2))):(r.push(t.getX(a+2)),r.push(t.getX(a+1)),r.push(t.getX(a)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function VY(i){const e=new he,t=new he,n=new he,r=new he,s=new he,a=new he,l=new he,u=new he,h=new he;function m(Te,be,ue,we,We,Ne,ze,Se){e.fromBufferAttribute(be,We),t.fromBufferAttribute(be,Ne),n.fromBufferAttribute(be,ze);const Ce=Te.morphTargetInfluences;if(ue&&Ce){l.set(0,0,0),u.set(0,0,0),h.set(0,0,0);for(let dt=0,At=ue.length;dt<At;dt++){const wt=Ce[dt],Ft=ue[dt];wt!==0&&(r.fromBufferAttribute(Ft,We),s.fromBufferAttribute(Ft,Ne),a.fromBufferAttribute(Ft,ze),we?(l.addScaledVector(r,wt),u.addScaledVector(s,wt),h.addScaledVector(a,wt)):(l.addScaledVector(r.sub(e),wt),u.addScaledVector(s.sub(t),wt),h.addScaledVector(a.sub(n),wt)))}e.add(l),t.add(u),n.add(h)}Te.isSkinnedMesh&&(Te.applyBoneTransform(We,e),Te.applyBoneTransform(Ne,t),Te.applyBoneTransform(ze,n)),Se[We*3+0]=e.x,Se[We*3+1]=e.y,Se[We*3+2]=e.z,Se[Ne*3+0]=t.x,Se[Ne*3+1]=t.y,Se[Ne*3+2]=t.z,Se[ze*3+0]=n.x,Se[ze*3+1]=n.y,Se[ze*3+2]=n.z}const v=i.geometry,x=i.material;let S,w,R;const C=v.index,E=v.attributes.position,B=v.morphAttributes.position,L=v.morphTargetsRelative,O=v.attributes.normal,G=v.morphAttributes.position,q=v.groups,z=v.drawRange;let j,F,V,Y,ee,te,re;const ne=new Float32Array(E.count*E.itemSize),Q=new Float32Array(O.count*O.itemSize);if(C!==null)if(Array.isArray(x))for(j=0,V=q.length;j<V;j++)for(ee=q[j],te=Math.max(ee.start,z.start),re=Math.min(ee.start+ee.count,z.start+z.count),F=te,Y=re;F<Y;F+=3)S=C.getX(F),w=C.getX(F+1),R=C.getX(F+2),m(i,E,B,L,S,w,R,ne),m(i,O,G,L,S,w,R,Q);else for(te=Math.max(0,z.start),re=Math.min(C.count,z.start+z.count),j=te,V=re;j<V;j+=3)S=C.getX(j),w=C.getX(j+1),R=C.getX(j+2),m(i,E,B,L,S,w,R,ne),m(i,O,G,L,S,w,R,Q);else if(Array.isArray(x))for(j=0,V=q.length;j<V;j++)for(ee=q[j],te=Math.max(ee.start,z.start),re=Math.min(ee.start+ee.count,z.start+z.count),F=te,Y=re;F<Y;F+=3)S=F,w=F+1,R=F+2,m(i,E,B,L,S,w,R,ne),m(i,O,G,L,S,w,R,Q);else for(te=Math.max(0,z.start),re=Math.min(E.count,z.start+z.count),j=te,V=re;j<V;j+=3)S=j,w=j+1,R=j+2,m(i,E,B,L,S,w,R,ne),m(i,O,G,L,S,w,R,Q);const ae=new Mi(ne,3),de=new Mi(Q,3);return{positionAttribute:E,normalAttribute:O,morphedPositionAttribute:ae,morphedNormalAttribute:de}}function HY(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((a,l)=>a.materialIndex!==l.materialIndex?a.materialIndex-l.materialIndex:a.start-l.start),i.getIndex()===null){const a=i.getAttribute("position"),l=[];for(let u=0;u<a.count;u+=3)l.push(u,u+1,u+2);i.setIndex(l)}const t=i.getIndex(),n=[];for(let a=0;a<e.length;a++){const l=e[a],u=l.start,h=u+l.count;for(let m=u;m<h;m++)n.push(t.getX(m))}i.dispose(),i.setIndex(n);let r=0;for(let a=0;a<e.length;a++){const l=e[a];l.start=r,r+=l.count}let s=e[0];i.groups=[s];for(let a=1;a<e.length;a++){const l=e[a];s.materialIndex===l.materialIndex?s.count+=l.count:(s=l,i.groups.push(s))}return i}function jY(i,e=Math.PI/3){const t=Math.cos(e),n=(1+1e-10)*100,r=[new he,new he,new he],s=new he,a=new he,l=new he,u=new he;function h(R){const C=~~(R.x*n),E=~~(R.y*n),B=~~(R.z*n);return`${C},${E},${B}`}const m=i.index?i.toNonIndexed():i,v=m.attributes.position,x={};for(let R=0,C=v.count/3;R<C;R++){const E=3*R,B=r[0].fromBufferAttribute(v,E+0),L=r[1].fromBufferAttribute(v,E+1),O=r[2].fromBufferAttribute(v,E+2);s.subVectors(O,L),a.subVectors(B,L);const G=new he().crossVectors(s,a).normalize();for(let q=0;q<3;q++){const z=r[q],j=h(z);j in x||(x[j]=[]),x[j].push(G)}}const S=new Float32Array(v.count*3),w=new wr(S,3,!1);for(let R=0,C=v.count/3;R<C;R++){const E=3*R,B=r[0].fromBufferAttribute(v,E+0),L=r[1].fromBufferAttribute(v,E+1),O=r[2].fromBufferAttribute(v,E+2);s.subVectors(O,L),a.subVectors(B,L),l.crossVectors(s,a).normalize();for(let G=0;G<3;G++){const q=r[G],z=h(q),j=x[z];u.set(0,0,0);for(let F=0,V=j.length;F<V;F++){const Y=j[F];l.dot(Y)>t&&u.add(Y)}u.normalize(),w.setXYZ(E+G,u.x,u.y,u.z)}}return m.setAttribute("normal",w),m}const yM=Object.freeze(Object.defineProperty({__proto__:null,computeMikkTSpaceTangents:BY,computeMorphedAttributes:VY,deepCloneAttribute:IY,deinterleaveAttribute:z_,deinterleaveGeometry:kY,estimateBytesUsed:zY,interleaveAttributes:FY,mergeAttributes:RT,mergeGeometries:OY,mergeGroups:HY,mergeVertices:GY,toCreasedNormals:jY,toTrianglesDrawMode:qY},Symbol.toStringTag,{value:"Module"}));var Rt=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function G_(i){"@babel/helpers - typeof";return G_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G_(i)}var WY=/^\s+/,$Y=/\s+$/;function yn(i,e){if(i=i||"",e=e||{},i instanceof yn)return i;if(!(this instanceof yn))return new yn(i,e);var t=XY(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}yn.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,a,l;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?a=n/12.92:a=Math.pow((n+.055)/1.055,2.4),r<=.03928?l=r/12.92:l=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*a+.0722*l},setAlpha:function(e){return this._a=hP(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=u6(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=u6(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=l6(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=l6(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return c6(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return ZY(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Sr(this._r,255)*100)+"%",g:Math.round(Sr(this._g,255)*100)+"%",b:Math.round(Sr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%)":"rgba("+Math.round(Sr(this._r,255)*100)+"%, "+Math.round(Sr(this._g,255)*100)+"%, "+Math.round(Sr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:cQ[c6(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+h6(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=yn(e);n="#"+h6(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return yn(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(nQ,arguments)},brighten:function(){return this._applyModification(iQ,arguments)},darken:function(){return this._applyModification(rQ,arguments)},desaturate:function(){return this._applyModification(JY,arguments)},saturate:function(){return this._applyModification(eQ,arguments)},greyscale:function(){return this._applyModification(tQ,arguments)},spin:function(){return this._applyModification(sQ,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(lQ,arguments)},complement:function(){return this._applyCombination(aQ,arguments)},monochromatic:function(){return this._applyCombination(uQ,arguments)},splitcomplement:function(){return this._applyCombination(oQ,arguments)},triad:function(){return this._applyCombination(f6,[3])},tetrad:function(){return this._applyCombination(f6,[4])}};yn.fromRatio=function(i,e){if(G_(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=Tm(i[n]));i=t}return yn(i,e)};function XY(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,a=!1,l=!1;return typeof i=="string"&&(i=dQ(i)),G_(i)=="object"&&(gc(i.r)&&gc(i.g)&&gc(i.b)?(e=YY(i.r,i.g,i.b),a=!0,l=String(i.r).substr(-1)==="%"?"prgb":"rgb"):gc(i.h)&&gc(i.s)&&gc(i.v)?(n=Tm(i.s),r=Tm(i.v),e=KY(i.h,n,r),a=!0,l="hsv"):gc(i.h)&&gc(i.s)&&gc(i.l)&&(n=Tm(i.s),s=Tm(i.l),e=QY(i.h,n,s),a=!0,l="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=hP(t),{ok:a,format:i.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function YY(i,e,t){return{r:Sr(i,255)*255,g:Sr(e,255)*255,b:Sr(t,255)*255}}function l6(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,a,l=(n+r)/2;if(n==r)s=a=0;else{var u=n-r;switch(a=l>.5?u/(2-n-r):u/(n+r),n){case i:s=(e-t)/u+(e<t?6:0);break;case e:s=(t-i)/u+2;break;case t:s=(i-e)/u+4;break}s/=6}return{h:s,s:a,l}}function QY(i,e,t){var n,r,s;i=Sr(i,360),e=Sr(e,100),t=Sr(t,100);function a(h,m,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?h+(m-h)*6*v:v<1/2?m:v<2/3?h+(m-h)*(2/3-v)*6:h}if(e===0)n=r=s=t;else{var l=t<.5?t*(1+e):t+e-t*e,u=2*t-l;n=a(u,l,i+1/3),r=a(u,l,i),s=a(u,l,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function u6(i,e,t){i=Sr(i,255),e=Sr(e,255),t=Sr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,a,l=n,u=n-r;if(a=n===0?0:u/n,n==r)s=0;else{switch(n){case i:s=(e-t)/u+(e<t?6:0);break;case e:s=(t-i)/u+2;break;case t:s=(i-e)/u+4;break}s/=6}return{h:s,s:a,v:l}}function KY(i,e,t){i=Sr(i,360)*6,e=Sr(e,100),t=Sr(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),a=t*(1-r*e),l=t*(1-(1-r)*e),u=n%6,h=[t,a,s,s,l,t][u],m=[l,t,t,a,s,s][u],v=[s,s,l,t,t,a][u];return{r:h*255,g:m*255,b:v*255}}function c6(i,e,t,n){var r=[El(Math.round(i).toString(16)),El(Math.round(e).toString(16)),El(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function ZY(i,e,t,n,r){var s=[El(Math.round(i).toString(16)),El(Math.round(e).toString(16)),El(Math.round(t).toString(16)),El(fP(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function h6(i,e,t,n){var r=[El(fP(n)),El(Math.round(i).toString(16)),El(Math.round(e).toString(16)),El(Math.round(t).toString(16))];return r.join("")}yn.equals=function(i,e){return!i||!e?!1:yn(i).toRgbString()==yn(e).toRgbString()};yn.random=function(){return yn.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function JY(i,e){e=e===0?0:e||10;var t=yn(i).toHsl();return t.s-=e/100,t.s=Cy(t.s),yn(t)}function eQ(i,e){e=e===0?0:e||10;var t=yn(i).toHsl();return t.s+=e/100,t.s=Cy(t.s),yn(t)}function tQ(i){return yn(i).desaturate(100)}function nQ(i,e){e=e===0?0:e||10;var t=yn(i).toHsl();return t.l+=e/100,t.l=Cy(t.l),yn(t)}function iQ(i,e){e=e===0?0:e||10;var t=yn(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),yn(t)}function rQ(i,e){e=e===0?0:e||10;var t=yn(i).toHsl();return t.l-=e/100,t.l=Cy(t.l),yn(t)}function sQ(i,e){var t=yn(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,yn(t)}function aQ(i){var e=yn(i).toHsl();return e.h=(e.h+180)%360,yn(e)}function f6(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=yn(i).toHsl(),n=[yn(i)],r=360/e,s=1;s<e;s++)n.push(yn({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function oQ(i){var e=yn(i).toHsl(),t=e.h;return[yn(i),yn({h:(t+72)%360,s:e.s,l:e.l}),yn({h:(t+216)%360,s:e.s,l:e.l})]}function lQ(i,e,t){e=e||6,t=t||30;var n=yn(i).toHsl(),r=360/t,s=[yn(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(yn(n));return s}function uQ(i,e){e=e||6;for(var t=yn(i).toHsv(),n=t.h,r=t.s,s=t.v,a=[],l=1/e;e--;)a.push(yn({h:n,s:r,v:s})),s=(s+l)%1;return a}yn.mix=function(i,e,t){t=t===0?0:t||50;var n=yn(i).toRgb(),r=yn(e).toRgb(),s=t/100,a={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return yn(a)};yn.readability=function(i,e){var t=yn(i),n=yn(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};yn.isReadable=function(i,e,t){var n=yn.readability(i,e),r,s;switch(s=!1,r=pQ(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};yn.mostReadable=function(i,e,t){var n=null,r=0,s,a,l,u;t=t||{},a=t.includeFallbackColors,l=t.level,u=t.size;for(var h=0;h<e.length;h++)s=yn.readability(i,e[h]),s>r&&(r=s,n=yn(e[h]));return yn.isReadable(i,n,{level:l,size:u})||!a?n:(t.includeFallbackColors=!1,yn.mostReadable(i,["#fff","#000"],t))};var NT=yn.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},cQ=yn.hexNames=hQ(NT);function hQ(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function hP(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Sr(i,e){fQ(i)&&(i="100%");var t=AQ(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function Cy(i){return Math.min(1,Math.max(0,i))}function _o(i){return parseInt(i,16)}function fQ(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function AQ(i){return typeof i=="string"&&i.indexOf("%")!=-1}function El(i){return i.length==1?"0"+i:""+i}function Tm(i){return i<=1&&(i=i*100+"%"),i}function fP(i){return Math.round(parseFloat(i)*255).toString(16)}function A6(i){return _o(i)/255}var bl=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function gc(i){return!!bl.CSS_UNIT.exec(i)}function dQ(i){i=i.replace(WY,"").replace($Y,"").toLowerCase();var e=!1;if(NT[i])i=NT[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=bl.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=bl.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=bl.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=bl.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=bl.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=bl.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=bl.hex8.exec(i))?{r:_o(t[1]),g:_o(t[2]),b:_o(t[3]),a:A6(t[4]),format:e?"name":"hex8"}:(t=bl.hex6.exec(i))?{r:_o(t[1]),g:_o(t[2]),b:_o(t[3]),format:e?"name":"hex"}:(t=bl.hex4.exec(i))?{r:_o(t[1]+""+t[1]),g:_o(t[2]+""+t[2]),b:_o(t[3]+""+t[3]),a:A6(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=bl.hex3.exec(i))?{r:_o(t[1]+""+t[1]),g:_o(t[2]+""+t[2]),b:_o(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function pQ(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function DT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function mQ(i){if(Array.isArray(i))return i}function gQ(i){if(Array.isArray(i))return DT(i)}function AP(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function vQ(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _Q(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ta(i,e){return i.get(AP(i,e))}function xd(i,e,t){vQ(i,e),e.set(i,t)}function av(i,e,t){return i.set(AP(i,e),t),t}function yQ(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,RQ(n.key),n)}}function xQ(i,e,t){return e&&yQ(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function bQ(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function SQ(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function TQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wQ(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MQ(i,e){return mQ(i)||SQ(i,e)||dP(i,e)||TQ()}function EQ(i){return gQ(i)||bQ(i)||dP(i)||wQ()}function CQ(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function RQ(i){var e=CQ(i,"string");return typeof e=="symbol"?e:e+""}function dP(i,e){if(i){if(typeof i=="string")return DT(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?DT(i,e):void 0}}var bd=new WeakMap,rm=new WeakMap,Sd=new WeakMap,z3=new WeakMap,G3=new WeakMap,q3=new WeakMap,NQ=(function(){function i(){_Q(this,i),xd(this,bd,new Map),xd(this,rm,new Map),xd(this,Sd,function(e){return e}),xd(this,z3,function(){return{}}),xd(this,G3,function(){}),xd(this,q3,function(){})}return xQ(i,[{key:"getObj",value:function(t){return ta(bd,this).get(ta(Sd,this).call(this,t))}},{key:"getData",value:function(t){return ta(rm,this).get(t)}},{key:"entries",value:function(){return EQ(ta(rm,this).entries()).map(function(t){var n=MQ(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return av(Sd,this,Rt(t)),this}},{key:"onCreateObj",value:function(t){return av(z3,this,t),this}},{key:"onUpdateObj",value:function(t){return av(G3,this,t),this}},{key:"onRemoveObj",value:function(t){return av(q3,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!ta(bd,n).has(ta(Sd,n).call(n,s))}).forEach(function(s){var a=ta(z3,n).call(n,s);ta(bd,n).set(ta(Sd,n).call(n,s),a),ta(rm,n).set(a,s)});var r=new Map(t.map(function(s){return[ta(Sd,n).call(n,s),s]}));return ta(bd,this).forEach(function(s,a){r.has(a)?ta(G3,n).call(n,s,r.get(a)):(ta(q3,n).call(n,s,a),ta(bd,n).delete(a),ta(rm,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})(),Xv={exports:{}},DQ=Xv.exports,d6;function PQ(){return d6||(d6=1,(function(i,e){(function(t,n){i.exports=n()})(DQ,function(){return(function(t){function n(s){if(r[s])return r[s].exports;var a=r[s]={exports:{},id:s,loaded:!1};return t[s].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)})([function(t,n,r){var s=r(1),a=(function(){function l(u,h,m){u===void 0&&(u=NaN),h===void 0&&(h=NaN),m===void 0&&(m=!1),this._minFPS=h,this._maxFPS=u,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new s.default,this._onPause=new s.default,this._onTick=new s.default,this._onTickOncePerFrame=new s.default,m||this.resume()}return l.prototype.updateOnce=function(u){u(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},l.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},l.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},l.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(l.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"timeScale",{get:function(){return this._timeScale},set:function(u){this._timeScale!==u&&(this._timeScale=u)},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),l.prototype.animateOnce=function(){var u=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return u.onFrame()})},l.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},l.prototype.update=function(u,h){h===void 0&&(h=!0),this._currentTick++,this._currentTime+=u,this._tickDeltaTime=u,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),h&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},l.prototype.getTimer=function(){return Date.now()},l})();Object.defineProperty(n,"__esModule",{value:!0}),n.default=a},function(t,n,r){(function(s,a){t.exports=a()})(this,function(){return(function(s){function a(u){if(l[u])return l[u].exports;var h=l[u]={exports:{},id:u,loaded:!1};return s[u].call(h.exports,h,h.exports,a),h.loaded=!0,h.exports}var l={};return a.m=s,a.c=l,a.p="",a(0)})([function(s,a){var l=(function(){function u(){this.functions=[]}return u.prototype.add=function(h){return this.functions.indexOf(h)===-1&&(this.functions.push(h),!0)},u.prototype.remove=function(h){var m=this.functions.indexOf(h);return m>-1&&(this.functions.splice(m,1),!0)},u.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},u.prototype.dispatch=function(){for(var h=[],m=0;m<arguments.length;m++)h[m]=arguments[m];var v=this.functions.concat();v.forEach(function(x){x.apply(void 0,h)})},Object.defineProperty(u.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),u})();Object.defineProperty(a,"__esModule",{value:!0}),a.default=l}])})}])})})(Xv)),Xv.exports}var LQ=PQ();const L0=S7(LQ),Cc=11102230246251565e-32,na=134217729,UQ=(3+8*Cc)*Cc;function V3(i,e,t,n,r){let s,a,l,u,h=e[0],m=n[0],v=0,x=0;m>h==m>-h?(s=h,h=e[++v]):(s=m,m=n[++x]);let S=0;if(v<i&&x<t)for(m>h==m>-h?(a=h+s,l=s-(a-h),h=e[++v]):(a=m+s,l=s-(a-m),m=n[++x]),s=a,l!==0&&(r[S++]=l);v<i&&x<t;)m>h==m>-h?(a=s+h,u=a-s,l=s-(a-u)+(h-u),h=e[++v]):(a=s+m,u=a-s,l=s-(a-u)+(m-u),m=n[++x]),s=a,l!==0&&(r[S++]=l);for(;v<i;)a=s+h,u=a-s,l=s-(a-u)+(h-u),h=e[++v],s=a,l!==0&&(r[S++]=l);for(;x<t;)a=s+m,u=a-s,l=s-(a-u)+(m-u),m=n[++x],s=a,l!==0&&(r[S++]=l);return(s!==0||S===0)&&(r[S++]=s),S}function BQ(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function qg(i){return new Float64Array(i)}const OQ=(3+16*Cc)*Cc,IQ=(2+12*Cc)*Cc,FQ=(9+64*Cc)*Cc*Cc,Td=qg(4),p6=qg(8),m6=qg(12),g6=qg(16),va=qg(4);function kQ(i,e,t,n,r,s,a){let l,u,h,m,v,x,S,w,R,C,E,B,L,O,G,q,z,j;const F=i-r,V=t-r,Y=e-s,ee=n-s;O=F*ee,x=na*F,S=x-(x-F),w=F-S,x=na*ee,R=x-(x-ee),C=ee-R,G=w*C-(O-S*R-w*R-S*C),q=Y*V,x=na*Y,S=x-(x-Y),w=Y-S,x=na*V,R=x-(x-V),C=V-R,z=w*C-(q-S*R-w*R-S*C),E=G-z,v=G-E,Td[0]=G-(E+v)+(v-z),B=O+E,v=B-O,L=O-(B-v)+(E-v),E=L-q,v=L-E,Td[1]=L-(E+v)+(v-q),j=B+E,v=j-B,Td[2]=B-(j-v)+(E-v),Td[3]=j;let te=BQ(4,Td),re=IQ*a;if(te>=re||-te>=re||(v=i-F,l=i-(F+v)+(v-r),v=t-V,h=t-(V+v)+(v-r),v=e-Y,u=e-(Y+v)+(v-s),v=n-ee,m=n-(ee+v)+(v-s),l===0&&u===0&&h===0&&m===0)||(re=FQ*a+UQ*Math.abs(te),te+=F*m+ee*l-(Y*h+V*u),te>=re||-te>=re))return te;O=l*ee,x=na*l,S=x-(x-l),w=l-S,x=na*ee,R=x-(x-ee),C=ee-R,G=w*C-(O-S*R-w*R-S*C),q=u*V,x=na*u,S=x-(x-u),w=u-S,x=na*V,R=x-(x-V),C=V-R,z=w*C-(q-S*R-w*R-S*C),E=G-z,v=G-E,va[0]=G-(E+v)+(v-z),B=O+E,v=B-O,L=O-(B-v)+(E-v),E=L-q,v=L-E,va[1]=L-(E+v)+(v-q),j=B+E,v=j-B,va[2]=B-(j-v)+(E-v),va[3]=j;const ne=V3(4,Td,4,va,p6);O=F*m,x=na*F,S=x-(x-F),w=F-S,x=na*m,R=x-(x-m),C=m-R,G=w*C-(O-S*R-w*R-S*C),q=Y*h,x=na*Y,S=x-(x-Y),w=Y-S,x=na*h,R=x-(x-h),C=h-R,z=w*C-(q-S*R-w*R-S*C),E=G-z,v=G-E,va[0]=G-(E+v)+(v-z),B=O+E,v=B-O,L=O-(B-v)+(E-v),E=L-q,v=L-E,va[1]=L-(E+v)+(v-q),j=B+E,v=j-B,va[2]=B-(j-v)+(E-v),va[3]=j;const Q=V3(ne,p6,4,va,m6);O=l*m,x=na*l,S=x-(x-l),w=l-S,x=na*m,R=x-(x-m),C=m-R,G=w*C-(O-S*R-w*R-S*C),q=u*h,x=na*u,S=x-(x-u),w=u-S,x=na*h,R=x-(x-h),C=h-R,z=w*C-(q-S*R-w*R-S*C),E=G-z,v=G-E,va[0]=G-(E+v)+(v-z),B=O+E,v=B-O,L=O-(B-v)+(E-v),E=L-q,v=L-E,va[1]=L-(E+v)+(v-q),j=B+E,v=j-B,va[2]=B-(j-v)+(E-v),va[3]=j;const ae=V3(Q,m6,4,va,g6);return g6[ae-1]}function wm(i,e,t,n,r,s){const a=(e-s)*(t-r),l=(i-r)*(n-s),u=a-l,h=Math.abs(a+l);return Math.abs(u)>=OQ*h?u:-kQ(i,e,t,n,r,s,h)}const v6=Math.pow(2,-52),ov=new Uint32Array(512);class gg{static from(e,t=HQ,n=jQ){const r=e.length,s=new Float64Array(r*2);for(let a=0;a<r;a++){const l=e[a];s[2*a]=t(l),s[2*a+1]=n(l)}return new gg(s)}constructor(e){const t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,a=e.length>>1;let l=1/0,u=1/0,h=-1/0,m=-1/0;for(let F=0;F<a;F++){const V=e[2*F],Y=e[2*F+1];V<l&&(l=V),Y<u&&(u=Y),V>h&&(h=V),Y>m&&(m=Y),this._ids[F]=F}const v=(l+h)/2,x=(u+m)/2;let S,w,R;for(let F=0,V=1/0;F<a;F++){const Y=H3(v,x,e[2*F],e[2*F+1]);Y<V&&(S=F,V=Y)}const C=e[2*S],E=e[2*S+1];for(let F=0,V=1/0;F<a;F++){if(F===S)continue;const Y=H3(C,E,e[2*F],e[2*F+1]);Y<V&&Y>0&&(w=F,V=Y)}let B=e[2*w],L=e[2*w+1],O=1/0;for(let F=0;F<a;F++){if(F===S||F===w)continue;const V=qQ(C,E,B,L,e[2*F],e[2*F+1]);V<O&&(R=F,O=V)}let G=e[2*R],q=e[2*R+1];if(O===1/0){for(let Y=0;Y<a;Y++)this._dists[Y]=e[2*Y]-e[0]||e[2*Y+1]-e[1];$d(this._ids,this._dists,0,a-1);const F=new Uint32Array(a);let V=0;for(let Y=0,ee=-1/0;Y<a;Y++){const te=this._ids[Y],re=this._dists[te];re>ee&&(F[V++]=te,ee=re)}this.hull=F.subarray(0,V),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(wm(C,E,B,L,G,q)<0){const F=w,V=B,Y=L;w=R,B=G,L=q,R=F,G=V,q=Y}const z=VQ(C,E,B,L,G,q);this._cx=z.x,this._cy=z.y;for(let F=0;F<a;F++)this._dists[F]=H3(e[2*F],e[2*F+1],z.x,z.y);$d(this._ids,this._dists,0,a-1),this._hullStart=S;let j=3;n[S]=t[R]=w,n[w]=t[S]=R,n[R]=t[w]=S,r[S]=0,r[w]=1,r[R]=2,s.fill(-1),s[this._hashKey(C,E)]=S,s[this._hashKey(B,L)]=w,s[this._hashKey(G,q)]=R,this.trianglesLen=0,this._addTriangle(S,w,R,-1,-1,-1);for(let F=0,V,Y;F<this._ids.length;F++){const ee=this._ids[F],te=e[2*ee],re=e[2*ee+1];if(F>0&&Math.abs(te-V)<=v6&&Math.abs(re-Y)<=v6||(V=te,Y=re,ee===S||ee===w||ee===R))continue;let ne=0;for(let be=0,ue=this._hashKey(te,re);be<this._hashSize&&(ne=s[(ue+be)%this._hashSize],!(ne!==-1&&ne!==n[ne]));be++);ne=t[ne];let Q=ne,ae;for(;ae=n[Q],wm(te,re,e[2*Q],e[2*Q+1],e[2*ae],e[2*ae+1])>=0;)if(Q=ae,Q===ne){Q=-1;break}if(Q===-1)continue;let de=this._addTriangle(Q,ee,n[Q],-1,-1,r[Q]);r[ee]=this._legalize(de+2),r[Q]=de,j++;let Te=n[Q];for(;ae=n[Te],wm(te,re,e[2*Te],e[2*Te+1],e[2*ae],e[2*ae+1])<0;)de=this._addTriangle(Te,ee,ae,r[ee],-1,r[Te]),r[ee]=this._legalize(de+2),n[Te]=Te,j--,Te=ae;if(Q===ne)for(;ae=t[Q],wm(te,re,e[2*ae],e[2*ae+1],e[2*Q],e[2*Q+1])<0;)de=this._addTriangle(ae,ee,Q,-1,r[Q],r[ae]),this._legalize(de+2),r[ae]=de,n[Q]=Q,j--,Q=ae;this._hullStart=t[ee]=Q,n[Q]=t[Te]=ee,n[ee]=Te,s[this._hashKey(te,re)]=ee,s[this._hashKey(e[2*Q],e[2*Q+1])]=Q}this.hull=new Uint32Array(j);for(let F=0,V=this._hullStart;F<j;F++)this.hull[F]=V,V=n[V];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(zQ(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let s=0,a=0;for(;;){const l=n[e],u=e-e%3;if(a=u+(e+2)%3,l===-1){if(s===0)break;e=ov[--s];continue}const h=l-l%3,m=u+(e+1)%3,v=h+(l+2)%3,x=t[a],S=t[e],w=t[m],R=t[v];if(GQ(r[2*x],r[2*x+1],r[2*S],r[2*S+1],r[2*w],r[2*w+1],r[2*R],r[2*R+1])){t[e]=R,t[l]=x;const E=n[v];if(E===-1){let L=this._hullStart;do{if(this._hullTri[L]===v){this._hullTri[L]=e;break}L=this._hullPrev[L]}while(L!==this._hullStart)}this._link(e,E),this._link(l,n[a]),this._link(a,v);const B=h+(l+1)%3;s<ov.length&&(ov[s++]=B)}else{if(s===0)break;e=ov[--s]}}return a}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,a){const l=this.trianglesLen;return this._triangles[l]=e,this._triangles[l+1]=t,this._triangles[l+2]=n,this._link(l,r),this._link(l+1,s),this._link(l+2,a),this.trianglesLen+=3,l}}function zQ(i,e){const t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function H3(i,e,t,n){const r=i-t,s=e-n;return r*r+s*s}function GQ(i,e,t,n,r,s,a,l){const u=i-a,h=e-l,m=t-a,v=n-l,x=r-a,S=s-l,w=u*u+h*h,R=m*m+v*v,C=x*x+S*S;return u*(v*C-R*S)-h*(m*C-R*x)+w*(m*S-v*x)<0}function qQ(i,e,t,n,r,s){const a=t-i,l=n-e,u=r-i,h=s-e,m=a*a+l*l,v=u*u+h*h,x=.5/(a*h-l*u),S=(h*m-l*v)*x,w=(a*v-u*m)*x;return S*S+w*w}function VQ(i,e,t,n,r,s){const a=t-i,l=n-e,u=r-i,h=s-e,m=a*a+l*l,v=u*u+h*h,x=.5/(a*h-l*u),S=i+(h*m-l*v)*x,w=e+(a*v-u*m)*x;return{x:S,y:w}}function $d(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){const s=i[r],a=e[s];let l=r-1;for(;l>=t&&e[i[l]]>a;)i[l+1]=i[l--];i[l+1]=s}else{const r=t+n>>1;let s=t+1,a=n;sm(i,r,s),e[i[t]]>e[i[n]]&&sm(i,t,n),e[i[s]]>e[i[n]]&&sm(i,s,n),e[i[t]]>e[i[s]]&&sm(i,t,s);const l=i[s],u=e[l];for(;;){do s++;while(e[i[s]]<u);do a--;while(e[i[a]]>u);if(a<s)break;sm(i,s,a)}i[t+1]=i[a],i[a]=l,n-s+1>=a-t?($d(i,e,s,n),$d(i,e,t,a-1)):($d(i,e,t,a-1),$d(i,e,s,n))}}function sm(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}function HQ(i){return i[0]}function jQ(i){return i[1]}function WQ(i,e){var t,n,r=0,s,a,l,u,h,m,v,x=i[0],S=i[1],w=e.length;for(t=0;t<w;t++){n=0;var R=e[t],C=R.length-1;if(m=R[0],m[0]!==R[C][0]&&m[1]!==R[C][1])throw new Error("First and last coordinates in a ring must be the same");for(a=m[0]-x,l=m[1]-S,n;n<C;n++){if(v=R[n+1],u=v[0]-x,h=v[1]-S,l===0&&h===0){if(u<=0&&a>=0||a<=0&&u>=0)return 0}else if(h>=0&&l<=0||h<=0&&l>=0){if(s=wm(a,u,l,h,0,0),s===0)return 0;(s>0&&h>0&&l<=0||s<0&&h<=0&&l>0)&&r++}m=v,l=h,a=u}}return r%2!==0}function $Q(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function XQ(i){return i.type==="Feature"?i.geometry:i}function YQ(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");const n=$Q(i),r=XQ(e),s=r.type,a=e.bbox;let l=r.coordinates;if(a&&QQ(n,a)===!1)return!1;s==="Polygon"&&(l=[l]);let u=!1;for(var h=0;h<l.length;++h){const m=WQ(n,l[h]);if(m===0)return!t.ignoreBoundary;m&&(u=!0)}return u}function QQ(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var KQ=YQ;const _6=1e-6;class $f{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;const r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>_6||Math.abs(this._y1-s)>_6)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class PT{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class ZQ{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this;let s,a;const l=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let R=0,C=0,E=n.length,B,L;R<E;R+=3,C+=2){const O=n[R]*2,G=n[R+1]*2,q=n[R+2]*2,z=e[O],j=e[O+1],F=e[G],V=e[G+1],Y=e[q],ee=e[q+1],te=F-z,re=V-j,ne=Y-z,Q=ee-j,ae=(te*Q-re*ne)*2;if(Math.abs(ae)<1e-9){if(s===void 0){s=a=0;for(const Te of t)s+=e[Te*2],a+=e[Te*2+1];s/=t.length,a/=t.length}const de=1e9*Math.sign((s-z)*Q-(a-j)*ne);B=(z+Y)/2-de*Q,L=(j+ee)/2+de*ne}else{const de=1/ae,Te=te*te+re*re,be=ne*ne+Q*Q;B=z+(Q*Te-re*be)*de,L=j+(te*be-ne*Te)*de}l[C]=B,l[C+1]=L}let u=t[t.length-1],h,m=u*4,v,x=e[2*u],S,w=e[2*u+1];r.fill(0);for(let R=0;R<t.length;++R)u=t[R],h=m,v=x,S=w,m=u*4,x=e[2*u],w=e[2*u+1],r[h+2]=r[m]=S-w,r[h+3]=r[m+1]=x-v}render(e){const t=e==null?e=new $f:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:a,vectors:l}=this;if(s.length<=1)return null;for(let m=0,v=n.length;m<v;++m){const x=n[m];if(x<m)continue;const S=Math.floor(m/3)*2,w=Math.floor(x/3)*2,R=a[S],C=a[S+1],E=a[w],B=a[w+1];this._renderSegment(R,C,E,B,e)}let u,h=s[s.length-1];for(let m=0;m<s.length;++m){u=h,h=s[m];const v=Math.floor(r[h]/3)*2,x=a[v],S=a[v+1],w=u*4,R=this._project(x,S,l[w+2],l[w+3]);R&&this._renderSegment(x,S,R[0],R[1],e)}return t&&t.value()}renderBounds(e){const t=e==null?e=new $f:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){const n=t==null?t=new $f:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let a=2;a<s;a+=2)(r[a]!==r[a-2]||r[a+1]!==r[a-1])&&t.lineTo(r[a],r[a+1]);return t.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){const r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){const t=new PT;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let a;const l=this._regioncode(e,t),u=this._regioncode(n,r);l===0&&u===0?(s.moveTo(e,t),s.lineTo(n,r)):(a=this._clipSegment(e,t,n,r,l,u))&&(s.moveTo(a[0],a[1]),s.lineTo(a[2],a[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){const t=this._clip(e);if(t)for(const n of this.delaunay.neighbors(e)){const r=this._clip(n);if(r){e:for(let s=0,a=t.length;s<a;s+=2)for(let l=0,u=r.length;l<u;l+=2)if(t[s]===r[l]&&t[s+1]===r[l+1]&&t[(s+2)%a]===r[(l+u-2)%u]&&t[(s+3)%a]===r[(l+u-1)%u]){yield n;break e}}}}_cell(e){const{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,a=n[e];if(a===-1)return null;const l=[];let u=a;do{const h=Math.floor(u/3);if(l.push(t[h*2],t[h*2+1]),u=u%3===2?u-2:u+1,s[u]!==e)break;u=r[u]}while(u!==a&&u!==-1);return l}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const t=this._cell(e);if(t===null)return null;const{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){const n=t.length;let r=null,s,a,l=t[n-2],u=t[n-1],h,m=this._regioncode(l,u),v,x=0;for(let S=0;S<n;S+=2)if(s=l,a=u,l=t[S],u=t[S+1],h=m,m=this._regioncode(l,u),h===0&&m===0)v=x,x=0,r?r.push(l,u):r=[l,u];else{let w,R,C,E,B;if(h===0){if((w=this._clipSegment(s,a,l,u,h,m))===null)continue;[R,C,E,B]=w}else{if((w=this._clipSegment(l,u,s,a,m,h))===null)continue;[E,B,R,C]=w,v=x,x=this._edgecode(R,C),v&&x&&this._edge(e,v,x,r,r.length),r?r.push(R,C):r=[R,C]}v=x,x=this._edgecode(E,B),v&&x&&this._edge(e,v,x,r,r.length),r?r.push(E,B):r=[E,B]}if(r)v=x,x=this._edgecode(r[0],r[1]),v&&x&&this._edge(e,v,x,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,a){const l=s<a;for(l&&([e,t,n,r,s,a]=[n,r,e,t,a,s]);;){if(s===0&&a===0)return l?[n,r,e,t]:[e,t,n,r];if(s&a)return null;let u,h,m=s||a;m&8?(u=e+(n-e)*(this.ymax-t)/(r-t),h=this.ymax):m&4?(u=e+(n-e)*(this.ymin-t)/(r-t),h=this.ymin):m&2?(h=t+(r-t)*(this.xmax-e)/(n-e),u=this.xmax):(h=t+(r-t)*(this.xmin-e)/(n-e),u=this.xmin),s?(e=u,t=h,s=this._regioncode(e,t)):(n=u,r=h,a=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,a){let l=Array.from(t),u;if((u=this._project(l[0],l[1],n,r))&&l.unshift(u[0],u[1]),(u=this._project(l[l.length-2],l[l.length-1],s,a))&&l.push(u[0],u[1]),l=this._clipFinite(e,l))for(let h=0,m=l.length,v,x=this._edgecode(l[m-2],l[m-1]);h<m;h+=2)v=x,x=this._edgecode(l[h],l[h+1]),v&&x&&(h=this._edge(e,v,x,l,h),m=l.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(l=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return l}_edge(e,t,n,r,s){for(;t!==n;){let a,l;switch(t){case 5:t=4;continue;case 4:t=6,a=this.xmax,l=this.ymin;break;case 6:t=2;continue;case 2:t=10,a=this.xmax,l=this.ymax;break;case 10:t=8;continue;case 8:t=9,a=this.xmin,l=this.ymax;break;case 9:t=1;continue;case 1:t=5,a=this.xmin,l=this.ymin;break}(r[s]!==a||r[s+1]!==l)&&this.contains(e,a,l)&&(r.splice(s,0,a,l),s+=2)}return s}_project(e,t,n,r){let s=1/0,a,l,u;if(r<0){if(t<=this.ymin)return null;(a=(this.ymin-t)/r)<s&&(u=this.ymin,l=e+(s=a)*n)}else if(r>0){if(t>=this.ymax)return null;(a=(this.ymax-t)/r)<s&&(u=this.ymax,l=e+(s=a)*n)}if(n>0){if(e>=this.xmax)return null;(a=(this.xmax-e)/n)<s&&(l=this.xmax,u=t+(s=a)*r)}else if(n<0){if(e<=this.xmin)return null;(a=(this.xmin-e)/n)<s&&(l=this.xmin,u=t+(s=a)*r)}return[l,u]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){const n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}}const JQ=2*Math.PI,wd=Math.pow;function eK(i){return i[0]}function tK(i){return i[1]}function nK(i){const{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){const r=2*e[n],s=2*e[n+1],a=2*e[n+2];if((t[a]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[a+1]-t[r+1])>1e-10)return!1}return!0}function iK(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}class xM{static from(e,t=eK,n=tK,r){return new xM("length"in e?rK(e,t,n,r):Float64Array.from(sK(e,t,n,r)))}constructor(e){this._delaunator=new gg(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&nK(e)){this.collinear=Int32Array.from({length:t.length/2},(x,S)=>S).sort((x,S)=>t[2*x]-t[2*S]||t[2*x+1]-t[2*S+1]);const u=this.collinear[0],h=this.collinear[this.collinear.length-1],m=[t[2*u],t[2*u+1],t[2*h],t[2*h+1]],v=1e-8*Math.hypot(m[3]-m[1],m[2]-m[0]);for(let x=0,S=t.length/2;x<S;++x){const w=iK(t[2*x],t[2*x+1],v);t[2*x]=w[0],t[2*x+1]=w[1]}this._delaunator=new gg(t)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,a=this.inedges.fill(-1),l=this._hullIndex.fill(-1);for(let u=0,h=n.length;u<h;++u){const m=s[u%3===2?u-2:u+1];(n[u]===-1||a[m]===-1)&&(a[m]=u)}for(let u=0,h=r.length;u<h;++u)l[r[u]]=u;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],a[r[0]]=1,r.length===2&&(a[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new ZQ(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:a,collinear:l}=this;if(l){const v=l.indexOf(e);v>0&&(yield l[v-1]),v<l.length-1&&(yield l[v+1]);return}const u=t[e];if(u===-1)return;let h=u,m=-1;do{if(yield m=a[h],h=h%3===2?h-2:h+1,a[h]!==e)return;if(h=s[h],h===-1){const v=n[(r[e]+1)%n.length];v!==m&&(yield v);return}}while(h!==u)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;const r=n;let s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){const{inedges:r,hull:s,_hullIndex:a,halfedges:l,triangles:u,points:h}=this;if(r[e]===-1||!h.length)return(e+1)%(h.length>>1);let m=e,v=wd(t-h[e*2],2)+wd(n-h[e*2+1],2);const x=r[e];let S=x;do{let w=u[S];const R=wd(t-h[w*2],2)+wd(n-h[w*2+1],2);if(R<v&&(v=R,m=w),S=S%3===2?S-2:S+1,u[S]!==e)break;if(S=l[S],S===-1){if(S=s[(a[e]+1)%s.length],S!==w&&wd(t-h[S*2],2)+wd(n-h[S*2+1],2)<v)return S;break}}while(S!==x);return m}render(e){const t=e==null?e=new $f:void 0,{points:n,halfedges:r,triangles:s}=this;for(let a=0,l=r.length;a<l;++a){const u=r[a];if(u<a)continue;const h=s[a]*2,m=s[u]*2;e.moveTo(n[h],n[h+1]),e.lineTo(n[m],n[m+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;const n=e==null?e=new $f:void 0,{points:r}=this;for(let s=0,a=r.length;s<a;s+=2){const l=r[s],u=r[s+1];e.moveTo(l+t,u),e.arc(l,u,t,0,JQ)}return n&&n.value()}renderHull(e){const t=e==null?e=new $f:void 0,{hull:n,points:r}=this,s=n[0]*2,a=n.length;e.moveTo(r[s],r[s+1]);for(let l=1;l<a;++l){const u=2*n[l];e.lineTo(r[u],r[u+1])}return e.closePath(),t&&t.value()}hullPolygon(){const e=new PT;return this.renderHull(e),e.value()}renderTriangle(e,t){const n=t==null?t=new $f:void 0,{points:r,triangles:s}=this,a=s[e*=3]*2,l=s[e+1]*2,u=s[e+2]*2;return t.moveTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1]),t.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){const t=new PT;return this.renderTriangle(e,t),t.value()}}function rK(i,e,t,n){const r=i.length,s=new Float64Array(r*2);for(let a=0;a<r;++a){const l=i[a];s[a*2]=e.call(n,l,a,i),s[a*2+1]=t.call(n,l,a,i)}return s}function*sK(i,e,t,n){let r=0;for(const s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}const bM=Math.PI,y6=bM/2,x6=180/bM,b6=bM/180,aK=Math.atan2,S6=Math.cos,oK=Math.max,lK=Math.min,T6=Math.sin,uK=Math.sign||function(i){return i>0?1:i<0?-1:0},pP=Math.sqrt;function cK(i){return i>1?y6:i<-1?-y6:Math.asin(i)}function mP(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function So(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function q_(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function V_(i){var e=pP(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function SM(i){return[aK(i[1],i[0])*x6,cK(oK(-1,lK(1,i[2])))*x6]}function uu(i){const e=i[0]*b6,t=i[1]*b6,n=S6(t);return[n*S6(e),n*T6(e),T6(t)]}function TM(i){return i=i.map(e=>uu(e)),mP(i[0],So(i[2],i[1]))}function hK(i){const e=AK(i),t=pK(e),n=dK(t,i),r=gK(t,i.length),s=fK(r,i),a=mK(t,i),{polygons:l,centers:u}=vK(a,t,i),h=_K(l),m=xK(t,i),v=yK(n,t);return{delaunay:e,edges:n,triangles:t,centers:u,neighbors:r,polygons:l,mesh:h,hull:m,urquhart:v,find:s}}function fK(i,e){function t(n,r){let s=n[0]-r[0],a=n[1]-r[1],l=n[2]-r[2];return s*s+a*a+l*l}return function(r,s,a){a===void 0&&(a=0);let l,u,h=a;const m=uu([r,s]);do l=a,a=null,u=t(m,uu(e[l])),i[l].forEach(v=>{let x=t(m,uu(e[v]));if(x<u){u=x,a=v,h=v;return}});while(a!==null);return h}}function AK(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);const t=eX(i[e]),n=LX().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);const r=[];let s=1;for(let v=0,x=i.length;v<x;v++){let S=i[v][0]**2+i[v][1]**2;!isFinite(S)||S>1e32?r.push(v):S>s&&(s=S)}const a=1e6*pP(s);r.forEach(v=>i[v]=[a,0]),i.push([0,a]),i.push([-a,0]),i.push([0,-a]);const l=xM.from(i);l.projection=n;const{triangles:u,halfedges:h,inedges:m}=l;for(let v=0,x=h.length;v<x;v++)if(h[v]<0){const S=v%3==2?v-2:v+1,w=v%3==0?v+2:v-1,R=h[S],C=h[w];h[R]=C,h[C]=R,h[S]=h[w]=-1,u[v]=u[S]=u[w]=e,m[u[R]]=R%3==0?R+2:R-1,m[u[C]]=C%3==0?C+2:C-1,v+=2-v%3}else u[v]>i.length-3-1&&(u[v]=e);return l}function dK(i,e){const t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(TM(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(A_([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function pK(i){const{triangles:e}=i;if(!e)return[];const t=[];for(let n=0,r=e.length/3;n<r;n++){const s=e[3*n],a=e[3*n+1],l=e[3*n+2];s!==a&&a!==l&&t.push([s,l,a])}return t}function mK(i,e){return i.map(t=>{const n=t.map(s=>e[s]).map(uu),r=q_(q_(So(n[1],n[0]),So(n[2],n[1])),So(n[0],n[2]));return SM(V_(r))})}function gK(i,e){const t=[];return i.forEach(n=>{for(let r=0;r<3;r++){const s=n[r],a=n[(r+1)%3];t[s]=t[s]||[],t[s].push(a)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function vK(i,e,t){const n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){const l=uu(t[0]),u=uu(t[1]),h=V_(q_(l,u)),m=V_(So(l,u)),v=So(h,m),x=[h,So(h,v),So(So(h,v),v),So(So(So(h,v),v),v)].map(SM).map(a);return n.push(x),n.push(x.slice().reverse()),{polygons:n,centers:r}}}e.forEach((l,u)=>{for(let h=0;h<3;h++){const m=l[h],v=l[(h+1)%3],x=l[(h+2)%3];n[m]=n[m]||[],n[m].push([v,x,u,[m,v,x]])}});const s=n.map(l=>{const u=[l[0][2]];let h=l[0][1];for(let m=1;m<l.length;m++)for(let v=0;v<l.length;v++)if(l[v][0]==h){h=l[v][1],u.push(l[v][2]);break}if(u.length>2)return u;if(u.length==2){const m=w6(t[l[0][3][0]],t[l[0][3][1]],r[u[0]]),v=w6(t[l[0][3][2]],t[l[0][3][0]],r[u[0]]),x=a(m),S=a(v);return[u[0],S,u[1],x]}});function a(l){let u=-1;return r.slice(e.length,1/0).forEach((h,m)=>{h[0]===l[0]&&h[1]===l[1]&&(u=m+e.length)}),u<0&&(u=r.length,r.push(l)),u}return{polygons:s,centers:r}}function w6(i,e,t){i=uu(i),e=uu(e),t=uu(t);const n=uK(mP(So(e,i),t));return SM(V_(q_(i,e)).map(r=>n*r))}function _K(i){const e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function yK(i,e){return function(t){const n=new Map,r=new Map;return i.forEach((s,a)=>{const l=s.join("-");n.set(l,t[a]),r.set(l,!0)}),e.forEach(s=>{let a=0,l=-1;for(let u=0;u<3;u++){let h=A_([s[u],s[(u+1)%3]]).join("-");n.get(h)>a&&(a=n.get(h),l=h)}r.set(l,!1)}),i.map(s=>r.get(s.join("-")))}}function xK(i,e){const t=new Set,n=[];i.map(l=>{if(!(TM(l.map(u=>e[u>e.length?0:u]))>1e-12))for(let u=0;u<3;u++){let h=[l[u],l[(u+1)%3]],m=`${h[0]}-${h[1]}`;t.has(m)?t.delete(m):t.add(`${h[1]}-${h[0]}`)}});const r=new Map;let s;if(t.forEach(l=>{l=l.split("-").map(Number),r.set(l[0],l[1]),s=l[0]}),s===void 0)return n;let a=s;do{n.push(a);let l=r.get(a);r.set(a,-1),a=l}while(a>-1&&a!==s);return n}function bK(i){const e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){const n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=hK(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return OR(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return OR(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;const n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(a=>e.delaunay.centers[a])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>TM(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;const n=e.delaunay.edges.map(s=>Vh(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,a)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[a],urquhart:!!r[a]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;const{centers:n,polygons:r}=e.delaunay,s=[];for(const a of r)if(a)for(let l=a.length,u=a[l-1],h=a[0],m=0;m<l;u=h,h=a[++m])h>u&&s.push([n[u],n[h]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||Vh([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);const n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function LT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function SK(i){if(Array.isArray(i))return i}function TK(i){if(Array.isArray(i))return LT(i)}function wK(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function MK(i,e,t){return e=H_(e),UK(i,gP()?Reflect.construct(e,[],H_(i).constructor):e.apply(i,t))}function EK(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function CK(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function H_(i){return H_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},H_(i)}function RK(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&UT(i,e)}function gP(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gP=function(){return!!i})()}function NK(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function DK(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function PK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LK(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UK(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wK(i)}function UT(i,e){return UT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},UT(i,e)}function Kl(i,e){return SK(i)||DK(i,e)||vP(i,e)||PK()}function j3(i){return TK(i)||NK(i)||vP(i)||LK()}function vP(i,e){if(i){if(typeof i=="string")return LT(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?LT(i,e):void 0}}function BK(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=OK(i,n),s=ug(r),a=IK(i,n),l=[].concat(j3(s),j3(a)),u={type:"Polygon",coordinates:i},h=FD(u),m=Kl(h,2),v=Kl(m[0],2),x=v[0],S=v[1],w=Kl(m[1],2),R=w[0],C=w[1],E=x>R||C>=89||S<=-89,B=[];if(E){var L=bK(l).triangles(),O=new Map(l.map(function(ae,de){var Te=Kl(ae,2),be=Te[0],ue=Te[1];return["".concat(be,"-").concat(ue),de]}));L.features.forEach(function(ae){var de,Te=ae.geometry.coordinates[0].slice(0,3).reverse(),be=[];if(Te.forEach(function(we){var We=Kl(we,2),Ne=We[0],ze=We[1],Se="".concat(Ne,"-").concat(ze);O.has(Se)&&be.push(O.get(Se))}),be.length===3){if(be.some(function(we){return we<s.length})){var ue=ae.properties.circumcenter;if(!BT(ue,u,E))return}(de=B).push.apply(de,be)}})}else if(a.length)for(var F=gg.from(l),V=function(de){var Te,be=[2,1,0].map(function(We){return F.triangles[de+We]}),ue=be.map(function(We){return l[We]});if(be.some(function(We){return We<s.length})){var we=[0,1].map(function(We){return $W(ue,function(Ne){return Ne[We]})});if(!BT(we,u,E))return 1}(Te=B).push.apply(Te,j3(be))},Y=0,ee=F.triangles.length;Y<ee;Y+=3)V(Y);else{var G=F_(r),q=G.vertices,z=G.holes,j=z===void 0?[]:z;B=iY(q,j,2)}var te=Pc(A_(l,function(ae){return ae[0]}),[0,1]),re=Pc(A_(l,function(ae){return ae[1]}),[0,1]),ne=l.map(function(ae){var de=Kl(ae,2),Te=de[0],be=de[1];return[te(Te),re(be)]}),Q={points:l,indices:B,uvs:ne};return{contour:r,triangles:Q}}function OK(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var a=Vh(s,r)*180/Math.PI;if(a>e)for(var l=pM(r,s),u=1/Math.ceil(a/e),h=u;h<1;)n.push(l(h)),h+=u}n.push(r=s)}),n})}function IK(i,e){var t={type:"Polygon",coordinates:i},n=FD(t),r=Kl(n,2),s=Kl(r[0],2),a=s[0],l=s[1],u=Kl(r[1],2),h=u[0],m=u[1];if(Math.min(Math.abs(h-a),Math.abs(m-l))<e)return[];var v=a>h||m>=89||l<=-89;return FK(e,{minLng:a,maxLng:h,minLat:l,maxLat:m}).filter(function(x){return BT(x,t,v)})}function FK(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,a=Math.round(Math.pow(360/i,2)/Math.PI),l=(1+Math.sqrt(5))/2,u=function(E){return E/l*360%360-180},h=function(E){return Math.acos(2*E/a-1)/Math.PI*180-90},m=function(E){return a*(Math.cos((E+90)*Math.PI/180)+1)/2},v=[s!==void 0?Math.ceil(m(s)):0,r!==void 0?Math.floor(m(r)):a-1],x=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(C){return C<=n}:n===void 0?function(C){return C>=t}:n>=t?function(C){return C>=t&&C<=n}:function(C){return C>=t||C<=n},S=[],w=v[0];w<=v[1];w++){var R=u(w);x(R)&&S.push([R,h(w)])}return S}function BT(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?gX(e,i):KQ(i,e)}var Yv=window.THREE?window.THREE:{BufferGeometry:Ki,Float32BufferAttribute:Mi},M6=new Yv.BufferGeometry().setAttribute?"setAttribute":"addAttribute",wM=(function(i){function e(t,n,r,s,a,l,u){var h;EK(this,e),h=MK(this,e),h.type="ConicPolygonGeometry",h.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:a,includeSides:l,curvatureResolution:u},n=n||0,r=r||1,s=s!==void 0?s:!0,a=a!==void 0?a:!0,l=l!==void 0?l:!0,u=u||5;var m=BK(t,{resolution:u}),v=m.contour,x=m.triangles,S=ug(x.uvs),w=[],R=[],C=[],E=0,B=function(z){var j=Math.round(w.length/3),F=C.length;w=w.concat(z.vertices),R=R.concat(z.uvs),C=C.concat(j?z.indices.map(function(V){return V+j}):z.indices),h.addGroup(F,C.length-F,E++)};l&&B(O()),s&&B(G(n,!1)),a&&B(G(r,!0)),h.setIndex(C),h[M6]("position",new Yv.Float32BufferAttribute(w,3)),h[M6]("uv",new Yv.Float32BufferAttribute(R,2)),h.computeVertexNormals();function L(q,z){var j=typeof z=="function"?z:function(){return z},F=q.map(function(V){return V.map(function(Y){var ee=Kl(Y,2),te=ee[0],re=ee[1];return kK(re,te,j(te,re))})});return F_(F)}function O(){for(var q=L(v,n),z=q.vertices,j=q.holes,F=L(v,r),V=F.vertices,Y=ug([V,z]),ee=Math.round(V.length/3),te=new Set(j),re=0,ne=[],Q=0;Q<ee;Q++){var ae=Q+1;if(ae===ee)ae=re;else if(te.has(ae)){var de=ae;ae=re,re=de}ne.push(Q,Q+ee,ae+ee),ne.push(ae+ee,ae,Q)}for(var Te=[],be=1;be>=0;be--)for(var ue=0;ue<ee;ue+=1)Te.push(ue/(ee-1),be);return{indices:ne,vertices:Y,uvs:Te}}function G(q){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:z?x.indices:x.indices.slice().reverse(),vertices:L([x.points],q).vertices,uvs:S}}return h}return RK(e,i),CK(e)})(Yv.BufferGeometry);function kK(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function OT(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function zK(i){if(Array.isArray(i))return i}function GK(i){if(Array.isArray(i))return OT(i)}function qK(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function VK(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function HK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jK(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WK(i,e){if(i==null)return{};var t,n,r=$K(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function $K(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function XK(i,e){return zK(i)||VK(i,e)||_P(i,e)||HK()}function YK(i){return GK(i)||qK(i)||_P(i)||jK()}function QK(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function KK(i){var e=QK(i,"string");return typeof e=="symbol"?e:e+""}function _P(i,e){if(i){if(typeof i=="string")return OT(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?OT(i,e):void 0}}var ZK=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(l){return{keyAccessor:l,isProp:!(l instanceof Function)}}),s=i.reduce(function(l,u){var h=l,m=u;return r.forEach(function(v,x){var S=v.keyAccessor,w=v.isProp,R;if(w){var C=m,E=C[S],B=WK(C,[S].map(KK));R=E,m=B}else R=S(m,x);x+1<r.length?(h.hasOwnProperty(R)||(h[R]={}),h=h[R]):t?(h.hasOwnProperty(R)||(h[R]=[]),h[R].push(m)):h[R]=m}),l},{});t instanceof Function&&(function l(u){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;h===r.length?Object.keys(u).forEach(function(m){return u[m]=t(u[m])}):Object.values(u).forEach(function(m){return l(m,h+1)})})(s);var a=s;return n&&(a=[],(function l(u){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];h.length===r.length?a.push({keys:h,vals:u}):Object.entries(u).forEach(function(m){var v=XK(m,2),x=v[0],S=v[1];return l(S,[].concat(YK(h),[x]))})})(s),e instanceof Array&&e.length===0&&a.length===1&&(a[0].keys=[])),a}),Ti=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r="";function s(Ze){return e.locateFile?e.locateFile(Ze,r):r+Ze}var a;typeof document<"u"&&document.currentScript&&(r=document.currentScript.src),r.indexOf("blob:")!==0?r=r.substr(0,r.lastIndexOf("/")+1):r="",a=function(vt,zt,at){var d=new XMLHttpRequest;d.open("GET",vt,!0),d.responseType="arraybuffer",d.onload=function(){if(d.status==200||d.status==0&&d.response){zt(d.response);return}var $n=Vt(vt);if($n){zt($n.buffer);return}at()},d.onerror=at,d.send(null)};var l=e.print||console.log.bind(console),u=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&e.arguments;var h=0,m=function(Ze){h=Ze},v=function(){return h},x=8;function S(Ze,vt,zt,at){switch(zt=zt||"i8",zt.charAt(zt.length-1)==="*"&&(zt="i32"),zt){case"i1":ee[Ze>>0]=vt;break;case"i8":ee[Ze>>0]=vt;break;case"i16":re[Ze>>1]=vt;break;case"i32":ne[Ze>>2]=vt;break;case"i64":pe=[vt>>>0,(Re=vt,+rt(Re)>=1?Re>0?(ht(+Gt(Re/4294967296),4294967295)|0)>>>0:~~+ce((Re-+(~~Re>>>0))/4294967296)>>>0:0)],ne[Ze>>2]=pe[0],ne[Ze+4>>2]=pe[1];break;case"float":Q[Ze>>2]=vt;break;case"double":ae[Ze>>3]=vt;break;default:Jr("invalid type for setValue: "+zt)}}function w(Ze,vt,zt){switch(vt=vt||"i8",vt.charAt(vt.length-1)==="*"&&(vt="i32"),vt){case"i1":return ee[Ze>>0];case"i8":return ee[Ze>>0];case"i16":return re[Ze>>1];case"i32":return ne[Ze>>2];case"i64":return ne[Ze>>2];case"float":return Q[Ze>>2];case"double":return ae[Ze>>3];default:Jr("invalid type for getValue: "+vt)}return null}var R=!1;function C(Ze,vt){Ze||Jr("Assertion failed: "+vt)}function E(Ze){var vt=e["_"+Ze];return C(vt,"Cannot call unknown function "+Ze+", make sure it is exported"),vt}function B(Ze,vt,zt,at,d){var J={string:function(Fn){var cs=0;if(Fn!=null&&Fn!==0){var Ma=(Fn.length<<2)+1;cs=tt(Ma),j(Fn,cs,Ma)}return cs},array:function(Fn){var cs=tt(Fn.length);return F(Fn,cs),cs}};function $n(Fn){return vt==="string"?q(Fn):vt==="boolean"?!!Fn:Fn}var Gn=E(Ze),Xn=[],un=0;if(at)for(var qn=0;qn<at.length;qn++){var Hs=J[zt[qn]];Hs?(un===0&&(un=qt()),Xn[qn]=Hs(at[qn])):Xn[qn]=at[qn]}var li=Gn.apply(null,Xn);return li=$n(li),un!==0&&St(un),li}function L(Ze,vt,zt,at){zt=zt||[];var d=zt.every(function($n){return $n==="number"}),J=vt!=="string";return J&&d&&!at?E(Ze):function(){return B(Ze,vt,zt,arguments)}}var O=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function G(Ze,vt,zt){for(var at=vt+zt,d=vt;Ze[d]&&!(d>=at);)++d;if(d-vt>16&&Ze.subarray&&O)return O.decode(Ze.subarray(vt,d));for(var J="";vt<d;){var $n=Ze[vt++];if(!($n&128)){J+=String.fromCharCode($n);continue}var Gn=Ze[vt++]&63;if(($n&224)==192){J+=String.fromCharCode(($n&31)<<6|Gn);continue}var Xn=Ze[vt++]&63;if(($n&240)==224?$n=($n&15)<<12|Gn<<6|Xn:$n=($n&7)<<18|Gn<<12|Xn<<6|Ze[vt++]&63,$n<65536)J+=String.fromCharCode($n);else{var un=$n-65536;J+=String.fromCharCode(55296|un>>10,56320|un&1023)}}return J}function q(Ze,vt){return Ze?G(te,Ze,vt):""}function z(Ze,vt,zt,at){if(!(at>0))return 0;for(var d=zt,J=zt+at-1,$n=0;$n<Ze.length;++$n){var Gn=Ze.charCodeAt($n);if(Gn>=55296&&Gn<=57343){var Xn=Ze.charCodeAt(++$n);Gn=65536+((Gn&1023)<<10)|Xn&1023}if(Gn<=127){if(zt>=J)break;vt[zt++]=Gn}else if(Gn<=2047){if(zt+1>=J)break;vt[zt++]=192|Gn>>6,vt[zt++]=128|Gn&63}else if(Gn<=65535){if(zt+2>=J)break;vt[zt++]=224|Gn>>12,vt[zt++]=128|Gn>>6&63,vt[zt++]=128|Gn&63}else{if(zt+3>=J)break;vt[zt++]=240|Gn>>18,vt[zt++]=128|Gn>>12&63,vt[zt++]=128|Gn>>6&63,vt[zt++]=128|Gn&63}}return vt[zt]=0,zt-d}function j(Ze,vt,zt){return z(Ze,te,vt,zt)}typeof TextDecoder<"u"&&new TextDecoder("utf-16le");function F(Ze,vt){ee.set(Ze,vt)}function V(Ze,vt){return Ze%vt>0&&(Ze+=vt-Ze%vt),Ze}var Y,ee,te,re,ne,Q,ae;function de(Ze){Y=Ze,e.HEAP8=ee=new Int8Array(Ze),e.HEAP16=re=new Int16Array(Ze),e.HEAP32=ne=new Int32Array(Ze),e.HEAPU8=te=new Uint8Array(Ze),e.HEAPU16=new Uint16Array(Ze),e.HEAPU32=new Uint32Array(Ze),e.HEAPF32=Q=new Float32Array(Ze),e.HEAPF64=ae=new Float64Array(Ze)}var Te=5271536,be=28624,ue=e.TOTAL_MEMORY||33554432;e.buffer?Y=e.buffer:Y=new ArrayBuffer(ue),ue=Y.byteLength,de(Y),ne[be>>2]=Te;function we(Ze){for(;Ze.length>0;){var vt=Ze.shift();if(typeof vt=="function"){vt();continue}var zt=vt.func;typeof zt=="number"?vt.arg===void 0?e.dynCall_v(zt):e.dynCall_vi(zt,vt.arg):zt(vt.arg===void 0?null:vt.arg)}}var We=[],Ne=[],ze=[],Se=[];function Ce(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Ft(e.preRun.shift());we(We)}function dt(){we(Ne)}function At(){we(ze)}function wt(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)$e(e.postRun.shift());we(Se)}function Ft(Ze){We.unshift(Ze)}function $e(Ze){Se.unshift(Ze)}var rt=Math.abs,ce=Math.ceil,Gt=Math.floor,ht=Math.min,Pt=0,yt=null;function en(Ze){Pt++,e.monitorRunDependencies&&e.monitorRunDependencies(Pt)}function xt(Ze){if(Pt--,e.monitorRunDependencies&&e.monitorRunDependencies(Pt),Pt==0&&yt){var vt=yt;yt=null,vt()}}e.preloadedImages={},e.preloadedAudios={};var fe=null,X="data:application/octet-stream;base64,";function le(Ze){return String.prototype.startsWith?Ze.startsWith(X):Ze.indexOf(X)===0}var Re,pe;fe="data:application/octet-stream;base64,[encoded data, 37208 characters]";var Me=28640;function nt(Ze,vt,zt,at){Jr("Assertion failed: "+q(Ze)+", at: "+[vt?q(vt):"unknown filename",zt,at?q(at):"unknown function"])}function lt(){return ee.length}function Ot(Ze,vt,zt){te.set(te.subarray(vt,vt+zt),Ze)}function jt(Ze){return e.___errno_location&&(ne[e.___errno_location()>>2]=Ze),Ze}function pt(Ze){Jr("OOM")}function Yt(Ze){try{var vt=new ArrayBuffer(Ze);return vt.byteLength!=Ze?void 0:(new Int8Array(vt).set(ee),bt(vt),de(vt),1)}catch{}}function rn(Ze){var vt=lt(),zt=16777216,at=2147483648-zt;if(Ze>at)return!1;for(var d=16777216,J=Math.max(vt,d);J<Ze;)J<=536870912?J=V(2*J,zt):J=Math.min(V((3*J+2147483648)/4,zt),at);var $n=Yt(J);return!!$n}var $t=typeof atob=="function"?atob:function(Ze){var vt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",zt="",at,d,J,$n,Gn,Xn,un,qn=0;Ze=Ze.replace(/[^A-Za-z0-9\+\/\=]/g,"");do $n=vt.indexOf(Ze.charAt(qn++)),Gn=vt.indexOf(Ze.charAt(qn++)),Xn=vt.indexOf(Ze.charAt(qn++)),un=vt.indexOf(Ze.charAt(qn++)),at=$n<<2|Gn>>4,d=(Gn&15)<<4|Xn>>2,J=(Xn&3)<<6|un,zt=zt+String.fromCharCode(at),Xn!==64&&(zt=zt+String.fromCharCode(d)),un!==64&&(zt=zt+String.fromCharCode(J));while(qn<Ze.length);return zt};function kt(Ze){try{for(var vt=$t(Ze),zt=new Uint8Array(vt.length),at=0;at<vt.length;++at)zt[at]=vt.charCodeAt(at);return zt}catch{throw new Error("Converting base64 string to bytes failed.")}}function Vt(Ze){if(le(Ze))return kt(Ze.slice(X.length))}var Nn={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},_i={b:m,c:v,d:nt,e:jt,f:lt,g:Ot,h:rn,i:pt,o:Me,p:be},me=(function(Ze,vt,zt){"almost asm";var at=new Ze.Int8Array(zt),d=new Ze.Int32Array(zt);new Ze.Uint8Array(zt),new Ze.Float32Array(zt);var J=new Ze.Float64Array(zt),$n=vt.o|0,Gn=vt.p|0,Xn=Ze.Math.floor,un=Ze.Math.abs,qn=Ze.Math.sqrt,Hs=Ze.Math.pow,li=Ze.Math.cos,Fn=Ze.Math.sin,cs=Ze.Math.tan,Ma=Ze.Math.acos,Ul=Ze.Math.asin,oe=Ze.Math.atan,Fe=Ze.Math.atan2,Qe=Ze.Math.ceil,Xe=Ze.Math.imul,ke=Ze.Math.min,It=Ze.Math.max,Xt=Ze.Math.clz32,mt=vt.b,Z=vt.c,Bt=vt.d,bn=vt.e,fn=vt.f,ui=vt.g,ci=vt.h,yi=vt.i,K=28656;function Un(A){return at=new Int8Array(A),d=new Int32Array(A),J=new Float64Array(A),zt=A,!0}function mn(A){A=A|0;var f=0;return f=K,K=K+A|0,K=K+15&-16,f|0}function yr(){return K|0}function hi(A){A=A|0,K=A}function bs(A,f){A=A|0,K=A}function fa(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;return(A|0)<0?(f=2,f|0):(A|0)>13780509?(f=Hu(15,f)|0,f|0):(p=((A|0)<0)<<31>>31,y=fr(A|0,p|0,3,0)|0,_=Z()|0,p=Qt(A|0,p|0,1,0)|0,p=fr(y|0,_|0,p|0,Z()|0)|0,p=Qt(p|0,Z()|0,1,0)|0,A=Z()|0,d[f>>2]=p,d[f+4>>2]=A,f=0,f|0)}function ye(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,ot(A,f,p,_,0)|0}function ot(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0;if(U=K,K=K+16|0,M=U,!(Nt(A,f,p,_,y)|0))return _=0,K=U,_|0;do if((p|0)>=0){if((p|0)>13780509){if(T=Hu(15,M)|0,T|0)break;N=M,M=d[N>>2]|0,N=d[N+4>>2]|0}else T=((p|0)<0)<<31>>31,I=fr(p|0,T|0,3,0)|0,N=Z()|0,T=Qt(p|0,T|0,1,0)|0,T=fr(I|0,N|0,T|0,Z()|0)|0,T=Qt(T|0,Z()|0,1,0)|0,N=Z()|0,d[M>>2]=T,d[M+4>>2]=N,M=T;if(uo(_|0,0,M<<3|0)|0,y|0){uo(y|0,0,M<<2|0)|0,T=Jt(A,f,p,_,y,M,N,0)|0;break}T=Ks(M,4)|0,T?(I=Jt(A,f,p,_,T,M,N,0)|0,An(T),T=I):T=13}else T=2;while(!1);return I=T,K=U,I|0}function Nt(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0;if(Pe=K,K=K+16|0,Ae=Pe,ve=Pe+8|0,ge=Ae,d[ge>>2]=A,d[ge+4>>2]=f,(p|0)<0)return ve=2,K=Pe,ve|0;if(T=_,d[T>>2]=A,d[T+4>>2]=f,T=(y|0)!=0,T&&(d[y>>2]=0),Ci(A,f)|0)return ve=9,K=Pe,ve|0;d[ve>>2]=0;e:do if((p|0)>=1)if(T)for(H=1,I=0,ie=0,ge=1,T=A;;){if(!(I|ie)){if(T=cn(T,f,4,ve,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,Ci(T,f)|0){T=9;break e}}if(T=cn(T,f,d[26800+(ie<<2)>>2]|0,ve,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,A=_+(H<<3)|0,d[A>>2]=T,d[A+4>>2]=f,d[y+(H<<2)>>2]=ge,A=I+1|0,M=(A|0)==(ge|0),N=ie+1|0,U=(N|0)==6,Ci(T,f)|0){T=9;break e}if(ge=ge+(U&M&1)|0,(ge|0)>(p|0)){T=0;break}else H=H+1|0,I=M?0:A,ie=M?U?0:N:ie}else for(H=1,I=0,ie=0,ge=1,T=A;;){if(!(I|ie)){if(T=cn(T,f,4,ve,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,Ci(T,f)|0){T=9;break e}}if(T=cn(T,f,d[26800+(ie<<2)>>2]|0,ve,Ae)|0,T|0)break e;if(f=Ae,T=d[f>>2]|0,f=d[f+4>>2]|0,A=_+(H<<3)|0,d[A>>2]=T,d[A+4>>2]=f,A=I+1|0,M=(A|0)==(ge|0),N=ie+1|0,U=(N|0)==6,Ci(T,f)|0){T=9;break e}if(ge=ge+(U&M&1)|0,(ge|0)>(p|0)){T=0;break}else H=H+1|0,I=M?0:A,ie=M?U?0:N:ie}else T=0;while(!1);return ve=T,K=Pe,ve|0}function Jt(A,f,p,_,y,T,M,N){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0,M=M|0,N=N|0;var U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0;if(Pe=K,K=K+16|0,Ae=Pe+8|0,ve=Pe,U=ec(A|0,f|0,T|0,M|0)|0,H=Z()|0,ie=_+(U<<3)|0,Ie=ie,Ye=d[Ie>>2]|0,Ie=d[Ie+4>>2]|0,I=(Ye|0)==(A|0)&(Ie|0)==(f|0),!((Ye|0)==0&(Ie|0)==0|I))do U=Qt(U|0,H|0,1,0)|0,U=th(U|0,Z()|0,T|0,M|0)|0,H=Z()|0,ie=_+(U<<3)|0,Ye=ie,Ie=d[Ye>>2]|0,Ye=d[Ye+4>>2]|0,I=(Ie|0)==(A|0)&(Ye|0)==(f|0);while(!((Ie|0)==0&(Ye|0)==0|I));if(U=y+(U<<2)|0,I&&(d[U>>2]|0)<=(N|0)||(Ye=ie,d[Ye>>2]=A,d[Ye+4>>2]=f,d[U>>2]=N,(N|0)>=(p|0)))return Ye=0,K=Pe,Ye|0;switch(I=N+1|0,d[Ae>>2]=0,U=cn(A,f,2,Ae,ve)|0,U|0){case 9:{ge=9;break}case 0:{U=ve,U=Jt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U||(ge=9);break}}e:do if((ge|0)==9){switch(d[Ae>>2]=0,U=cn(A,f,3,Ae,ve)|0,U|0){case 9:break;case 0:{if(U=ve,U=Jt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,1,Ae,ve)|0,U|0){case 9:break;case 0:{if(U=ve,U=Jt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,5,Ae,ve)|0,U|0){case 9:break;case 0:{if(U=ve,U=Jt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,4,Ae,ve)|0,U|0){case 9:break;case 0:{if(U=ve,U=Jt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}switch(d[Ae>>2]=0,U=cn(A,f,6,Ae,ve)|0,U|0){case 9:break;case 0:{if(U=ve,U=Jt(d[U>>2]|0,d[U+4>>2]|0,p,_,y,T,M,I)|0,U|0)break e;break}default:break e}return Ye=0,K=Pe,Ye|0}while(!1);return Ye=U,K=Pe,Ye|0}function cn(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0;if(p>>>0>6)return y=1,y|0;if(ie=(d[_>>2]|0)%6|0,d[_>>2]=ie,(ie|0)>0){T=0;do p=Uu(p)|0,T=T+1|0;while((T|0)<(d[_>>2]|0))}if(ie=Mt(A|0,f|0,45)|0,Z()|0,H=ie&127,H>>>0>121)return y=5,y|0;U=$s(A,f)|0,T=Mt(A|0,f|0,52)|0,Z()|0,T=T&15;e:do if(!T)I=8;else{for(;;){if(M=(15-T|0)*3|0,N=Mt(A|0,f|0,M|0)|0,Z()|0,N=N&7,(N|0)==7){f=5;break}if(ve=(Ss(T)|0)==0,T=T+-1|0,ge=Dt(7,0,M|0)|0,f=f&~(Z()|0),Ae=Dt(d[(ve?432:16)+(N*28|0)+(p<<2)>>2]|0,0,M|0)|0,M=Z()|0,p=d[(ve?640:224)+(N*28|0)+(p<<2)>>2]|0,A=Ae|A&~ge,f=M|f,!p){p=0;break e}if(!T){I=8;break e}}return f|0}while(!1);(I|0)==8&&(ve=d[848+(H*28|0)+(p<<2)>>2]|0,Ae=Dt(ve|0,0,45)|0,A=Ae|A,f=Z()|0|f&-1040385,p=d[4272+(H*28|0)+(p<<2)>>2]|0,(ve&127|0)==127&&(ve=Dt(d[848+(H*28|0)+20>>2]|0,0,45)|0,f=Z()|0|f&-1040385,p=d[4272+(H*28|0)+20>>2]|0,A=ku(ve|A,f)|0,f=Z()|0,d[_>>2]=(d[_>>2]|0)+1)),N=Mt(A|0,f|0,45)|0,Z()|0,N=N&127;e:do if(Bi(N)|0){t:do if(($s(A,f)|0)==1){if((H|0)!=(N|0))if(Ru(N,d[7696+(H*28|0)>>2]|0)|0){A=hp(A,f)|0,M=1,f=Z()|0;break}else Bt(27795,26864,533,26872);switch(U|0){case 3:{A=ku(A,f)|0,f=Z()|0,d[_>>2]=(d[_>>2]|0)+1,M=0;break t}case 5:{A=hp(A,f)|0,f=Z()|0,d[_>>2]=(d[_>>2]|0)+5,M=0;break t}case 0:return ve=9,ve|0;default:return ve=1,ve|0}}else M=0;while(!1);if((p|0)>0){T=0;do A=cp(A,f)|0,f=Z()|0,T=T+1|0;while((T|0)!=(p|0))}if((H|0)!=(N|0)){if(!(Wc(N)|0)){if((M|0)!=0|($s(A,f)|0)!=5)break;d[_>>2]=(d[_>>2]|0)+1;break}switch(ie&127){case 8:case 118:break e}($s(A,f)|0)!=3&&(d[_>>2]=(d[_>>2]|0)+1)}}else if((p|0)>0){T=0;do A=ku(A,f)|0,f=Z()|0,T=T+1|0;while((T|0)!=(p|0))}while(!1);return d[_>>2]=((d[_>>2]|0)+p|0)%6|0,ve=y,d[ve>>2]=A,d[ve+4>>2]=f,ve=0,ve|0}function Yn(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,xi(A,f,p,_)|0?(uo(_|0,0,p*48|0)|0,_=js(A,f,p,_)|0,_|0):(_=0,_|0)}function xi(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0;if(ve=K,K=K+16|0,ge=ve,Ae=ve+8|0,ie=ge,d[ie>>2]=A,d[ie+4>>2]=f,(p|0)<0)return Ae=2,K=ve,Ae|0;if(!p)return Ae=_,d[Ae>>2]=A,d[Ae+4>>2]=f,Ae=0,K=ve,Ae|0;d[Ae>>2]=0;e:do if(Ci(A,f)|0)A=9;else{y=0,ie=A;do{if(A=cn(ie,f,4,Ae,ge)|0,A|0)break e;if(f=ge,ie=d[f>>2]|0,f=d[f+4>>2]|0,y=y+1|0,Ci(ie,f)|0){A=9;break e}}while((y|0)<(p|0));H=_,d[H>>2]=ie,d[H+4>>2]=f,H=p+-1|0,I=0,A=1;do{if(y=26800+(I<<2)|0,(I|0)==5)for(M=d[y>>2]|0,T=0,y=A;;){if(A=ge,A=cn(d[A>>2]|0,d[A+4>>2]|0,M,Ae,ge)|0,A|0)break e;if((T|0)!=(H|0))if(U=ge,N=d[U>>2]|0,U=d[U+4>>2]|0,A=_+(y<<3)|0,d[A>>2]=N,d[A+4>>2]=U,!(Ci(N,U)|0))A=y+1|0;else{A=9;break e}else A=y;if(T=T+1|0,(T|0)>=(p|0))break;y=A}else for(M=ge,U=d[y>>2]|0,N=0,y=A,T=d[M>>2]|0,M=d[M+4>>2]|0;;){if(A=cn(T,M,U,Ae,ge)|0,A|0)break e;if(M=ge,T=d[M>>2]|0,M=d[M+4>>2]|0,A=_+(y<<3)|0,d[A>>2]=T,d[A+4>>2]=M,A=y+1|0,Ci(T,M)|0){A=9;break e}if(N=N+1|0,(N|0)>=(p|0))break;y=A}I=I+1|0}while(I>>>0<6);A=ge,A=(ie|0)==(d[A>>2]|0)&&(f|0)==(d[A+4>>2]|0)?0:9}while(!1);return Ae=A,K=ve,Ae|0}function js(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0;if(ie=K,K=K+16|0,M=ie,!p)return d[_>>2]=A,d[_+4>>2]=f,_=0,K=ie,_|0;do if((p|0)>=0){if((p|0)>13780509){if(y=Hu(15,M)|0,y|0)break;T=M,y=d[T>>2]|0,T=d[T+4>>2]|0}else y=((p|0)<0)<<31>>31,H=fr(p|0,y|0,3,0)|0,T=Z()|0,y=Qt(p|0,y|0,1,0)|0,y=fr(H|0,T|0,y|0,Z()|0)|0,y=Qt(y|0,Z()|0,1,0)|0,T=Z()|0,H=M,d[H>>2]=y,d[H+4>>2]=T;if(I=Ks(y,8)|0,!I)y=13;else{if(H=Ks(y,4)|0,!H){An(I),y=13;break}if(y=Jt(A,f,p,I,H,y,T,0)|0,y|0){An(I),An(H);break}if(f=d[M>>2]|0,M=d[M+4>>2]|0,(M|0)>0|(M|0)==0&f>>>0>0){y=0,N=0,U=0;do A=I+(N<<3)|0,T=d[A>>2]|0,A=d[A+4>>2]|0,!((T|0)==0&(A|0)==0)&&(d[H+(N<<2)>>2]|0)==(p|0)&&(ge=_+(y<<3)|0,d[ge>>2]=T,d[ge+4>>2]=A,y=y+1|0),N=Qt(N|0,U|0,1,0)|0,U=Z()|0;while((U|0)<(M|0)|(U|0)==(M|0)&N>>>0<f>>>0)}An(I),An(H),y=0}}else y=2;while(!1);return ge=y,K=ie,ge|0}function pi(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;for(N=K,K=K+16|0,T=N,M=N+8|0,y=(Ci(A,f)|0)==0,y=y?1:2;;){if(d[M>>2]=0,I=(cn(A,f,y,M,T)|0)==0,U=T,I&((d[U>>2]|0)==(p|0)?(d[U+4>>2]|0)==(_|0):0)){A=4;break}if(y=y+1|0,y>>>0>=7){y=7,A=4;break}}return(A|0)==4?(K=N,y|0):0}function Pr(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;if(N=K,K=K+48|0,y=N+16|0,T=N+8|0,M=N,p=Ra(p)|0,p|0)return M=p,K=N,M|0;if(I=A,U=d[I+4>>2]|0,p=T,d[p>>2]=d[I>>2],d[p+4>>2]=U,pa(T,y),p=sf(y,f,M)|0,!p){if(f=d[T>>2]|0,T=d[A+8>>2]|0,(T|0)>0){y=d[A+12>>2]|0,p=0;do f=(d[y+(p<<3)>>2]|0)+f|0,p=p+1|0;while((p|0)<(T|0))}p=M,y=d[p>>2]|0,p=d[p+4>>2]|0,T=((f|0)<0)<<31>>31,(p|0)<(T|0)|(p|0)==(T|0)&y>>>0<f>>>0?(p=M,d[p>>2]=f,d[p+4>>2]=T,p=T):f=y,U=Qt(f|0,p|0,12,0)|0,I=Z()|0,p=M,d[p>>2]=U,d[p+4>>2]=I,p=_,d[p>>2]=U,d[p+4>>2]=I,p=0}return I=p,K=N,I|0}function Ei(A,f,p,_,y,T,M){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0,M=M|0;var N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0,sn=0,tn=0,Bn=0,En=0,Qn=0,Tn=0,on=0,Ut=0,vn=0,ii=0,wn=0,Ri=0,ws=0,Al=0;if(ii=K,K=K+64|0,Tn=ii+48|0,on=ii+32|0,Ut=ii+24|0,Lt=ii+8|0,sn=ii,U=d[A>>2]|0,(U|0)<=0)return vn=0,K=ii,vn|0;for(tn=A+4|0,Bn=Tn+8|0,En=on+8|0,Qn=Lt+8|0,N=0,Ge=0;;){I=d[tn>>2]|0,qe=I+(Ge<<4)|0,d[Tn>>2]=d[qe>>2],d[Tn+4>>2]=d[qe+4>>2],d[Tn+8>>2]=d[qe+8>>2],d[Tn+12>>2]=d[qe+12>>2],(Ge|0)==(U+-1|0)?(d[on>>2]=d[I>>2],d[on+4>>2]=d[I+4>>2],d[on+8>>2]=d[I+8>>2],d[on+12>>2]=d[I+12>>2]):(qe=I+(Ge+1<<4)|0,d[on>>2]=d[qe>>2],d[on+4>>2]=d[qe+4>>2],d[on+8>>2]=d[qe+8>>2],d[on+12>>2]=d[qe+12>>2]),U=a1(Tn,on,_,Ut)|0;e:do if(U)I=0,N=U;else if(U=Ut,I=d[U>>2]|0,U=d[U+4>>2]|0,(U|0)>0|(U|0)==0&I>>>0>0){Ye=0,qe=0;t:for(;;){if(Ri=1/(+(I>>>0)+4294967296*+(U|0)),Al=+J[Tn>>3],U=Ur(I|0,U|0,Ye|0,qe|0)|0,ws=+(U>>>0)+4294967296*+(Z()|0),wn=+(Ye>>>0)+4294967296*+(qe|0),J[Lt>>3]=Ri*(Al*ws)+Ri*(+J[on>>3]*wn),J[Qn>>3]=Ri*(+J[Bn>>3]*ws)+Ri*(+J[En>>3]*wn),U=PA(Lt,_,sn)|0,U|0){N=U;break}Ie=sn,Pe=d[Ie>>2]|0,Ie=d[Ie+4>>2]|0,ge=ec(Pe|0,Ie|0,f|0,p|0)|0,H=Z()|0,U=M+(ge<<3)|0,ie=U,I=d[ie>>2]|0,ie=d[ie+4>>2]|0;n:do if((I|0)==0&(ie|0)==0)Le=U,vn=16;else for(Ae=0,ve=0;;){if((Ae|0)>(p|0)|(Ae|0)==(p|0)&ve>>>0>f>>>0){N=1;break t}if((I|0)==(Pe|0)&(ie|0)==(Ie|0))break n;if(U=Qt(ge|0,H|0,1,0)|0,ge=th(U|0,Z()|0,f|0,p|0)|0,H=Z()|0,ve=Qt(ve|0,Ae|0,1,0)|0,Ae=Z()|0,U=M+(ge<<3)|0,ie=U,I=d[ie>>2]|0,ie=d[ie+4>>2]|0,(I|0)==0&(ie|0)==0){Le=U,vn=16;break}}while(!1);if((vn|0)==16&&(vn=0,!((Pe|0)==0&(Ie|0)==0))&&(ve=Le,d[ve>>2]=Pe,d[ve+4>>2]=Ie,ve=T+(d[y>>2]<<3)|0,d[ve>>2]=Pe,d[ve+4>>2]=Ie,ve=y,ve=Qt(d[ve>>2]|0,d[ve+4>>2]|0,1,0)|0,Pe=Z()|0,Ie=y,d[Ie>>2]=ve,d[Ie+4>>2]=Pe),Ye=Qt(Ye|0,qe|0,1,0)|0,qe=Z()|0,U=Ut,I=d[U>>2]|0,U=d[U+4>>2]|0,!((U|0)>(qe|0)|(U|0)==(qe|0)&I>>>0>Ye>>>0)){I=1;break e}}I=0}else I=1;while(!1);if(Ge=Ge+1|0,!I){vn=21;break}if(U=d[A>>2]|0,(Ge|0)>=(U|0)){N=0,vn=21;break}}return(vn|0)==21?(K=ii,N|0):0}function Zh(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0,sn=0,tn=0,Bn=0,En=0,Qn=0,Tn=0,on=0,Ut=0,vn=0,ii=0,wn=0,Ri=0,ws=0;if(ws=K,K=K+112|0,vn=ws+80|0,U=ws+72|0,ii=ws,wn=ws+56|0,y=Ra(p)|0,y|0)return Ri=y,K=ws,Ri|0;if(I=A+8|0,Ri=Fo((d[I>>2]<<5)+32|0)|0,!Ri)return Ri=13,K=ws,Ri|0;if(Na(A,Ri),y=Ra(p)|0,!y){if(on=A,Ut=d[on+4>>2]|0,y=U,d[y>>2]=d[on>>2],d[y+4>>2]=Ut,pa(U,vn),y=sf(vn,f,ii)|0,y)on=0,Ut=0;else{if(y=d[U>>2]|0,T=d[I>>2]|0,(T|0)>0){M=d[A+12>>2]|0,p=0;do y=(d[M+(p<<3)>>2]|0)+y|0,p=p+1|0;while((p|0)!=(T|0));p=y}else p=y;y=ii,T=d[y>>2]|0,y=d[y+4>>2]|0,M=((p|0)<0)<<31>>31,(y|0)<(M|0)|(y|0)==(M|0)&T>>>0<p>>>0?(y=ii,d[y>>2]=p,d[y+4>>2]=M,y=M):p=T,on=Qt(p|0,y|0,12,0)|0,Ut=Z()|0,y=ii,d[y>>2]=on,d[y+4>>2]=Ut,y=0}if(!y){if(p=Ks(on,8)|0,!p)return An(Ri),Ri=13,K=ws,Ri|0;if(N=Ks(on,8)|0,!N)return An(Ri),An(p),Ri=13,K=ws,Ri|0;Qn=vn,d[Qn>>2]=0,d[Qn+4>>2]=0,Qn=A,Tn=d[Qn+4>>2]|0,y=U,d[y>>2]=d[Qn>>2],d[y+4>>2]=Tn,y=Ei(U,on,Ut,f,vn,p,N)|0;e:do if(y)An(p),An(N),An(Ri);else{t:do if((d[I>>2]|0)>0){for(M=A+12|0,T=0;y=Ei((d[M>>2]|0)+(T<<3)|0,on,Ut,f,vn,p,N)|0,T=T+1|0,!(y|0);)if((T|0)>=(d[I>>2]|0))break t;An(p),An(N),An(Ri);break e}while(!1);(Ut|0)>0|(Ut|0)==0&on>>>0>0&&uo(N|0,0,on<<3|0)|0,Tn=vn,Qn=d[Tn+4>>2]|0;t:do if((Qn|0)>0|(Qn|0)==0&(d[Tn>>2]|0)>>>0>0){tn=p,Bn=N,En=p,Qn=N,Tn=p,y=p,Le=p,Lt=N,sn=N,p=N;n:for(;;){for(Ie=0,Ye=0,qe=0,Ge=0,T=0,M=0;;){N=ii,U=N+56|0;do d[N>>2]=0,N=N+4|0;while((N|0)<(U|0));if(f=tn+(Ie<<3)|0,I=d[f>>2]|0,f=d[f+4>>2]|0,Nt(I,f,1,ii,0)|0){N=ii,U=N+56|0;do d[N>>2]=0,N=N+4|0;while((N|0)<(U|0));N=Ks(7,4)|0,N|0&&(Jt(I,f,1,ii,N,7,0,0)|0,An(N))}for(Pe=0;;){ve=ii+(Pe<<3)|0,Ae=d[ve>>2]|0,ve=d[ve+4>>2]|0;i:do if((Ae|0)==0&(ve|0)==0)N=T,U=M;else{if(H=ec(Ae|0,ve|0,on|0,Ut|0)|0,I=Z()|0,N=_+(H<<3)|0,f=N,U=d[f>>2]|0,f=d[f+4>>2]|0,!((U|0)==0&(f|0)==0)){ie=0,ge=0;do{if((ie|0)>(Ut|0)|(ie|0)==(Ut|0)&ge>>>0>on>>>0)break n;if((U|0)==(Ae|0)&(f|0)==(ve|0)){N=T,U=M;break i}N=Qt(H|0,I|0,1,0)|0,H=th(N|0,Z()|0,on|0,Ut|0)|0,I=Z()|0,ge=Qt(ge|0,ie|0,1,0)|0,ie=Z()|0,N=_+(H<<3)|0,f=N,U=d[f>>2]|0,f=d[f+4>>2]|0}while(!((U|0)==0&(f|0)==0))}if((Ae|0)==0&(ve|0)==0){N=T,U=M;break}Ol(Ae,ve,wn)|0,Da(A,Ri,wn)|0&&(ge=Qt(T|0,M|0,1,0)|0,M=Z()|0,ie=N,d[ie>>2]=Ae,d[ie+4>>2]=ve,T=Bn+(T<<3)|0,d[T>>2]=Ae,d[T+4>>2]=ve,T=ge),N=T,U=M}while(!1);if(Pe=Pe+1|0,Pe>>>0>=7)break;T=N,M=U}if(Ie=Qt(Ie|0,Ye|0,1,0)|0,Ye=Z()|0,qe=Qt(qe|0,Ge|0,1,0)|0,Ge=Z()|0,M=vn,T=d[M>>2]|0,M=d[M+4>>2]|0,(Ge|0)<(M|0)|(Ge|0)==(M|0)&qe>>>0<T>>>0)T=N,M=U;else break}if((M|0)>0|(M|0)==0&T>>>0>0){T=0,M=0;do Ge=tn+(T<<3)|0,d[Ge>>2]=0,d[Ge+4>>2]=0,T=Qt(T|0,M|0,1,0)|0,M=Z()|0,Ge=vn,qe=d[Ge+4>>2]|0;while((M|0)<(qe|0)|((M|0)==(qe|0)?T>>>0<(d[Ge>>2]|0)>>>0:0))}if(Ge=vn,d[Ge>>2]=N,d[Ge+4>>2]=U,(U|0)>0|(U|0)==0&N>>>0>0)Pe=p,Ie=sn,Ye=Tn,qe=Lt,Ge=Bn,p=Le,sn=y,Lt=En,Le=Pe,y=Ie,Tn=Qn,Qn=Ye,En=qe,Bn=tn,tn=Ge;else break t}An(En),An(Qn),An(Ri),y=1;break e}else y=N;while(!1);An(Ri),An(p),An(y),y=0}while(!1);return Ri=y,K=ws,Ri|0}}return An(Ri),Ri=y,K=ws,Ri|0}function Bl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;if(H=K,K=K+176|0,U=H,(f|0)<1)return Io(p,0,0),I=0,K=H,I|0;for(N=A,N=Mt(d[N>>2]|0,d[N+4>>2]|0,52)|0,Z()|0,Io(p,(f|0)>6?f:6,N&15),N=0;_=A+(N<<3)|0,_=Il(d[_>>2]|0,d[_+4>>2]|0,U)|0,!(_|0);){if(_=d[U>>2]|0,(_|0)>0){M=0;do T=U+8+(M<<4)|0,M=M+1|0,_=U+8+(((M|0)%(_|0)|0)<<4)|0,y=Zu(p,_,T)|0,y?Ku(p,y)|0:VA(p,T,_)|0,_=d[U>>2]|0;while((M|0)<(_|0))}if(N=N+1|0,(N|0)>=(f|0)){_=0,I=13;break}}return(I|0)==13?(K=H,_|0):(GA(p),I=_,K=H,I|0)}function nl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;if(T=K,K=K+32|0,_=T,y=T+16|0,A=Bl(A,f,y)|0,A|0)return p=A,K=T,p|0;if(d[p>>2]=0,d[p+4>>2]=0,d[p+8>>2]=0,A=qA(y)|0,A|0)do{f=M1(p)|0;do OA(f,A)|0,M=A+16|0,d[_>>2]=d[M>>2],d[_+4>>2]=d[M+4>>2],d[_+8>>2]=d[M+8>>2],d[_+12>>2]=d[M+12>>2],Ku(y,A)|0,A=As(y,_)|0;while((A|0)!=0);A=qA(y)|0}while((A|0)!=0);return GA(y),A=Rx(p)|0,A?(Wu(p),M=A,K=T,M|0):(M=0,K=T,M|0)}function Bi(A){return A=A|0,A>>>0>121?(A=0,A|0):(A=d[7696+(A*28|0)+16>>2]|0,A|0)}function Wc(A){return A=A|0,(A|0)==4|(A|0)==117|0}function Po(A){return A=A|0,d[11120+((d[A>>2]|0)*216|0)+((d[A+4>>2]|0)*72|0)+((d[A+8>>2]|0)*24|0)+(d[A+12>>2]<<3)>>2]|0}function ep(A){return A=A|0,d[11120+((d[A>>2]|0)*216|0)+((d[A+4>>2]|0)*72|0)+((d[A+8>>2]|0)*24|0)+(d[A+12>>2]<<3)+4>>2]|0}function tp(A,f){A=A|0,f=f|0,A=7696+(A*28|0)|0,d[f>>2]=d[A>>2],d[f+4>>2]=d[A+4>>2],d[f+8>>2]=d[A+8>>2],d[f+12>>2]=d[A+12>>2]}function $c(A,f){A=A|0,f=f|0;var p=0,_=0;if(f>>>0>20)return f=-1,f|0;do if((d[11120+(f*216|0)>>2]|0)!=(A|0))if((d[11120+(f*216|0)+8>>2]|0)!=(A|0))if((d[11120+(f*216|0)+16>>2]|0)!=(A|0))if((d[11120+(f*216|0)+24>>2]|0)!=(A|0))if((d[11120+(f*216|0)+32>>2]|0)!=(A|0))if((d[11120+(f*216|0)+40>>2]|0)!=(A|0))if((d[11120+(f*216|0)+48>>2]|0)!=(A|0))if((d[11120+(f*216|0)+56>>2]|0)!=(A|0))if((d[11120+(f*216|0)+64>>2]|0)!=(A|0))if((d[11120+(f*216|0)+72>>2]|0)!=(A|0))if((d[11120+(f*216|0)+80>>2]|0)!=(A|0))if((d[11120+(f*216|0)+88>>2]|0)!=(A|0))if((d[11120+(f*216|0)+96>>2]|0)!=(A|0))if((d[11120+(f*216|0)+104>>2]|0)!=(A|0))if((d[11120+(f*216|0)+112>>2]|0)!=(A|0))if((d[11120+(f*216|0)+120>>2]|0)!=(A|0))if((d[11120+(f*216|0)+128>>2]|0)!=(A|0))if((d[11120+(f*216|0)+136>>2]|0)==(A|0))A=2,p=1,_=2;else{if((d[11120+(f*216|0)+144>>2]|0)==(A|0)){A=0,p=2,_=0;break}if((d[11120+(f*216|0)+152>>2]|0)==(A|0)){A=0,p=2,_=1;break}if((d[11120+(f*216|0)+160>>2]|0)==(A|0)){A=0,p=2,_=2;break}if((d[11120+(f*216|0)+168>>2]|0)==(A|0)){A=1,p=2,_=0;break}if((d[11120+(f*216|0)+176>>2]|0)==(A|0)){A=1,p=2,_=1;break}if((d[11120+(f*216|0)+184>>2]|0)==(A|0)){A=1,p=2,_=2;break}if((d[11120+(f*216|0)+192>>2]|0)==(A|0)){A=2,p=2,_=0;break}if((d[11120+(f*216|0)+200>>2]|0)==(A|0)){A=2,p=2,_=1;break}if((d[11120+(f*216|0)+208>>2]|0)==(A|0)){A=2,p=2,_=2;break}else A=-1;return A|0}else A=2,p=1,_=1;else A=2,p=1,_=0;else A=1,p=1,_=2;else A=1,p=1,_=1;else A=1,p=1,_=0;else A=0,p=1,_=2;else A=0,p=1,_=1;else A=0,p=1,_=0;else A=2,p=0,_=2;else A=2,p=0,_=1;else A=2,p=0,_=0;else A=1,p=0,_=2;else A=1,p=0,_=1;else A=1,p=0,_=0;else A=0,p=0,_=2;else A=0,p=0,_=1;else A=0,p=0,_=0;while(!1);return f=d[11120+(f*216|0)+(p*72|0)+(A*24|0)+(_<<3)+4>>2]|0,f|0}function Ru(A,f){return A=A|0,f=f|0,(d[7696+(A*28|0)+20>>2]|0)==(f|0)?(f=1,f|0):(f=(d[7696+(A*28|0)+24>>2]|0)==(f|0),f|0)}function SA(A,f){return A=A|0,f=f|0,d[848+(A*28|0)+(f<<2)>>2]|0}function Jh(A,f){return A=A|0,f=f|0,(d[848+(A*28|0)>>2]|0)==(f|0)?(f=0,f|0):(d[848+(A*28|0)+4>>2]|0)==(f|0)?(f=1,f|0):(d[848+(A*28|0)+8>>2]|0)==(f|0)?(f=2,f|0):(d[848+(A*28|0)+12>>2]|0)==(f|0)?(f=3,f|0):(d[848+(A*28|0)+16>>2]|0)==(f|0)?(f=4,f|0):(d[848+(A*28|0)+20>>2]|0)==(f|0)?(f=5,f|0):((d[848+(A*28|0)+24>>2]|0)==(f|0)?6:7)|0}function s1(){return 122}function ef(A){A=A|0;var f=0,p=0,_=0;f=0;do Dt(f|0,0,45)|0,_=Z()|0|134225919,p=A+(f<<3)|0,d[p>>2]=-1,d[p+4>>2]=_,f=f+1|0;while((f|0)!=122);return 0}function il(A){A=A|0;var f=0,p=0,_=0;return _=+J[A+16>>3],p=+J[A+24>>3],f=_-p,+(_<p?f+6.283185307179586:f)}function TA(A){return A=A|0,+J[A+16>>3]<+J[A+24>>3]|0}function tf(A){return A=A|0,+(+J[A>>3]-+J[A+8>>3])}function Lo(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;return p=+J[f>>3],!(p>=+J[A+8>>3])||!(p<=+J[A>>3])?(f=0,f|0):(_=+J[A+16>>3],p=+J[A+24>>3],y=+J[f+8>>3],f=y>=p,A=y<=_&1,_<p?f&&(A=1):f||(A=0),f=(A|0)!=0,f|0)}function nf(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;return+J[A>>3]<+J[f+8>>3]||+J[A+8>>3]>+J[f>>3]?(_=0,_|0):(T=+J[A+16>>3],p=A+24|0,H=+J[p>>3],M=T<H,_=f+16|0,I=+J[_>>3],y=f+24|0,U=+J[y>>3],N=I<U,f=H-I<U-T,A=M?N|f?1:2:0,f=N?M?1:f?2:1:0,T=+Xs(T,A),T<+Xs(+J[y>>3],f)||(H=+Xs(+J[p>>3],A),H>+Xs(+J[_>>3],f))?(N=0,N|0):(N=1,N|0))}function wA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0;T=+J[A+16>>3],U=+J[A+24>>3],A=T<U,N=+J[f+16>>3],M=+J[f+24>>3],y=N<M,f=U-N<M-T,d[p>>2]=A?y|f?1:2:0,d[_>>2]=y?A?1:f?2:1:0}function np(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;return+J[A>>3]<+J[f>>3]||+J[A+8>>3]>+J[f+8>>3]?(_=0,_|0):(_=A+16|0,U=+J[_>>3],T=+J[A+24>>3],M=U<T,p=f+16|0,H=+J[p>>3],y=f+24|0,I=+J[y>>3],N=H<I,f=T-H<I-U,A=M?N|f?1:2:0,f=N?M?1:f?2:1:0,T=+Xs(T,A),T<=+Xs(+J[y>>3],f)?(H=+Xs(+J[_>>3],A),N=H>=+Xs(+J[p>>3],f),N|0):(N=0,N|0))}function rf(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;y=K,K=K+176|0,_=y,d[_>>2]=4,N=+J[f>>3],J[_+8>>3]=N,T=+J[f+16>>3],J[_+16>>3]=T,J[_+24>>3]=N,N=+J[f+24>>3],J[_+32>>3]=N,M=+J[f+8>>3],J[_+40>>3]=M,J[_+48>>3]=N,J[_+56>>3]=M,J[_+64>>3]=T,f=_+72|0,p=f+96|0;do d[f>>2]=0,f=f+4|0;while((f|0)<(p|0));Gl(A|0,_|0,168)|0,K=y}function sf(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0;ve=K,K=K+288|0,H=ve+264|0,ie=ve+96|0,I=ve,N=I,U=N+96|0;do d[N>>2]=0,N=N+4|0;while((N|0)<(U|0));return f=qu(f,I)|0,f|0?(Ae=f,K=ve,Ae|0):(U=I,I=d[U>>2]|0,U=d[U+4>>2]|0,Ol(I,U,H)|0,Il(I,U,ie)|0,M=+Zc(H,ie+8|0),J[H>>3]=+J[A>>3],U=H+8|0,J[U>>3]=+J[A+16>>3],J[ie>>3]=+J[A+8>>3],I=ie+8|0,J[I>>3]=+J[A+24>>3],y=+Zc(H,ie),Ie=+J[U>>3]-+J[I>>3],T=+un(+Ie),Pe=+J[H>>3]-+J[ie>>3],_=+un(+Pe),!(Ie==0|Pe==0)&&(Ie=+Af(+T,+_),Ie=+Qe(+(y*y/+df(+(Ie/+df(+T,+_)),3)/(M*(M*2.59807621135)*.8))),J[$n>>3]=Ie,ge=~~Ie>>>0,Ae=+un(Ie)>=1?Ie>0?~~+ke(+Xn(Ie/4294967296),4294967295)>>>0:~~+Qe((Ie-+(~~Ie>>>0))/4294967296)>>>0:0,(d[$n+4>>2]&2146435072|0)!=2146435072)?(ie=(ge|0)==0&(Ae|0)==0,f=p,d[f>>2]=ie?1:ge,d[f+4>>2]=ie?0:Ae,f=0):f=1,Ae=f,K=ve,Ae|0)}function a1(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0;I=K,K=K+288|0,M=I+264|0,N=I+96|0,U=I,y=U,T=y+96|0;do d[y>>2]=0,y=y+4|0;while((y|0)<(T|0));return p=qu(p,U)|0,p|0?(_=p,K=I,_|0):(p=U,y=d[p>>2]|0,p=d[p+4>>2]|0,Ol(y,p,M)|0,Il(y,p,N)|0,H=+Zc(M,N+8|0),H=+Qe(+(+Zc(A,f)/(H*2))),J[$n>>3]=H,p=~~H>>>0,y=+un(H)>=1?H>0?~~+ke(+Xn(H/4294967296),4294967295)>>>0:~~+Qe((H-+(~~H>>>0))/4294967296)>>>0:0,(d[$n+4>>2]&2146435072|0)==2146435072?(_=1,K=I,_|0):(U=(p|0)==0&(y|0)==0,d[_>>2]=U?1:p,d[_+4>>2]=U?0:y,_=0,K=I,_|0))}function Ws(A,f){A=A|0,f=+f;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;T=A+16|0,M=+J[T>>3],p=A+24|0,y=+J[p>>3],_=M-y,_=M<y?_+6.283185307179586:_,I=+J[A>>3],N=A+8|0,U=+J[N>>3],H=I-U,_=(_*f-_)*.5,f=(H*f-H)*.5,I=I+f,J[A>>3]=I>1.5707963267948966?1.5707963267948966:I,f=U-f,J[N>>3]=f<-1.5707963267948966?-1.5707963267948966:f,f=M+_,f=f>3.141592653589793?f+-6.283185307179586:f,J[T>>3]=f<-3.141592653589793?f+6.283185307179586:f,f=y-_,f=f>3.141592653589793?f+-6.283185307179586:f,J[p>>3]=f<-3.141592653589793?f+6.283185307179586:f}function Nu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0,d[A>>2]=f,d[A+4>>2]=p,d[A+8>>2]=_}function MA(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0;ie=f+8|0,d[ie>>2]=0,U=+J[A>>3],M=+un(+U),I=+J[A+8>>3],N=+un(+I)*1.1547005383792515,M=M+N*.5,p=~~M,A=~~N,M=M-+(p|0),N=N-+(A|0);do if(M<.5)if(M<.3333333333333333)if(d[f>>2]=p,N<(M+1)*.5){d[f+4>>2]=A;break}else{A=A+1|0,d[f+4>>2]=A;break}else if(ge=1-M,A=(!(N<ge)&1)+A|0,d[f+4>>2]=A,ge<=N&N<M*2){p=p+1|0,d[f>>2]=p;break}else{d[f>>2]=p;break}else{if(!(M<.6666666666666666))if(p=p+1|0,d[f>>2]=p,N<M*.5){d[f+4>>2]=A;break}else{A=A+1|0,d[f+4>>2]=A;break}if(N<1-M){if(d[f+4>>2]=A,M*2+-1<N){d[f>>2]=p;break}}else A=A+1|0,d[f+4>>2]=A;p=p+1|0,d[f>>2]=p}while(!1);do if(U<0)if(A&1){H=(A+1|0)/2|0,H=Ur(p|0,((p|0)<0)<<31>>31|0,H|0,((H|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-((+(H>>>0)+4294967296*+(Z()|0))*2+1)),d[f>>2]=p;break}else{H=(A|0)/2|0,H=Ur(p|0,((p|0)<0)<<31>>31|0,H|0,((H|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-(+(H>>>0)+4294967296*+(Z()|0))*2),d[f>>2]=p;break}while(!1);H=f+4|0,I<0&&(p=p-((A<<1|1|0)/2|0)|0,d[f>>2]=p,A=0-A|0,d[H>>2]=A),_=A-p|0,(p|0)<0?(y=0-p|0,d[H>>2]=_,d[ie>>2]=y,d[f>>2]=0,A=_,p=0):y=0,(A|0)<0&&(p=p-A|0,d[f>>2]=p,y=y-A|0,d[ie>>2]=y,d[H>>2]=0,A=0),T=p-y|0,_=A-y|0,(y|0)<0&&(d[f>>2]=T,d[H>>2]=_,d[ie>>2]=0,A=_,p=T,y=0),_=(A|0)<(p|0)?A:p,_=(y|0)<(_|0)?y:_,!((_|0)<=0)&&(d[f>>2]=p-_,d[H>>2]=A-_,d[ie>>2]=y-_)}function Lr(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0;f=d[A>>2]|0,M=A+4|0,p=d[M>>2]|0,(f|0)<0&&(p=p-f|0,d[M>>2]=p,T=A+8|0,d[T>>2]=(d[T>>2]|0)-f,d[A>>2]=0,f=0),(p|0)<0?(f=f-p|0,d[A>>2]=f,T=A+8|0,y=(d[T>>2]|0)-p|0,d[T>>2]=y,d[M>>2]=0,p=0):(y=A+8|0,T=y,y=d[y>>2]|0),(y|0)<0&&(f=f-y|0,d[A>>2]=f,p=p-y|0,d[M>>2]=p,d[T>>2]=0,y=0),_=(p|0)<(f|0)?p:f,_=(y|0)<(_|0)?y:_,!((_|0)<=0)&&(d[A>>2]=f-_,d[M>>2]=p-_,d[T>>2]=y-_)}function Du(A,f){A=A|0,f=f|0;var p=0,_=0;_=d[A+8>>2]|0,p=+((d[A+4>>2]|0)-_|0),J[f>>3]=+((d[A>>2]|0)-_|0)-p*.5,J[f+8>>3]=p*.8660254037844386}function hs(A,f,p){A=A|0,f=f|0,p=p|0,d[p>>2]=(d[f>>2]|0)+(d[A>>2]|0),d[p+4>>2]=(d[f+4>>2]|0)+(d[A+4>>2]|0),d[p+8>>2]=(d[f+8>>2]|0)+(d[A+8>>2]|0)}function af(A,f,p){A=A|0,f=f|0,p=p|0,d[p>>2]=(d[A>>2]|0)-(d[f>>2]|0),d[p+4>>2]=(d[A+4>>2]|0)-(d[f+4>>2]|0),d[p+8>>2]=(d[A+8>>2]|0)-(d[f+8>>2]|0)}function Xc(A,f){A=A|0,f=f|0;var p=0,_=0;p=Xe(d[A>>2]|0,f)|0,d[A>>2]=p,p=A+4|0,_=Xe(d[p>>2]|0,f)|0,d[p>>2]=_,A=A+8|0,f=Xe(d[A>>2]|0,f)|0,d[A>>2]=f}function Pu(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;M=d[A>>2]|0,N=(M|0)<0,_=(d[A+4>>2]|0)-(N?M:0)|0,T=(_|0)<0,y=(T?0-_|0:0)+((d[A+8>>2]|0)-(N?M:0))|0,p=(y|0)<0,A=p?0:y,f=(T?0:_)-(p?y:0)|0,y=(N?0:M)-(T?_:0)-(p?y:0)|0,p=(f|0)<(y|0)?f:y,p=(A|0)<(p|0)?A:p,_=(p|0)>0,A=A-(_?p:0)|0,f=f-(_?p:0)|0;e:do switch(y-(_?p:0)|0){case 0:switch(f|0){case 0:return N=(A|0)==0?0:(A|0)==1?1:7,N|0;case 1:return N=(A|0)==0?2:(A|0)==1?3:7,N|0;default:break e}case 1:switch(f|0){case 0:return N=(A|0)==0?4:(A|0)==1?5:7,N|0;case 1:{if(!A)A=6;else break e;return A|0}default:break e}}while(!1);return N=7,N|0}function o1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0;if(U=A+8|0,M=d[U>>2]|0,N=(d[A>>2]|0)-M|0,I=A+4|0,M=(d[I>>2]|0)-M|0,N>>>0>715827881|M>>>0>715827881){if(_=(N|0)>0,y=2147483647-N|0,T=-2147483648-N|0,(_?(y|0)<(N|0):(T|0)>(N|0))||(p=N<<1,_?(2147483647-p|0)<(N|0):(-2147483648-p|0)>(N|0))||((M|0)>0?(2147483647-M|0)<(M|0):(-2147483648-M|0)>(M|0))||(f=N*3|0,p=M<<1,(_?(y|0)<(p|0):(T|0)>(p|0))||((N|0)>-1?(f|-2147483648|0)>=(M|0):(f^-2147483648|0)<(M|0))))return I=1,I|0}else p=M<<1,f=N*3|0;return _=cl(+(f-M|0)*.14285714285714285)|0,d[A>>2]=_,y=cl(+(p+N|0)*.14285714285714285)|0,d[I>>2]=y,d[U>>2]=0,p=(y|0)<(_|0),f=p?_:y,p=p?y:_,(p|0)<0&&(((p|0)==-2147483648||((f|0)>0?(2147483647-f|0)<(p|0):(-2147483648-f|0)>(p|0)))&&Bt(27795,26892,354,26903),((f|0)>-1?(f|-2147483648|0)>=(p|0):(f^-2147483648|0)<(p|0))&&Bt(27795,26892,354,26903)),f=y-_|0,(_|0)<0?(p=0-_|0,d[I>>2]=f,d[U>>2]=p,d[A>>2]=0,_=0):(f=y,p=0),(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[U>>2]=p,d[I>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[I>>2]=y,d[U>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,(_|0)<=0?(I=0,I|0):(d[A>>2]=y-_,d[I>>2]=f-_,d[U>>2]=p-_,I=0,I|0)}function cx(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(M=A+8|0,y=d[M>>2]|0,T=(d[A>>2]|0)-y|0,N=A+4|0,y=(d[N>>2]|0)-y|0,T>>>0>715827881|y>>>0>715827881){if(p=(T|0)>0,(p?(2147483647-T|0)<(T|0):(-2147483648-T|0)>(T|0))||(f=T<<1,_=(y|0)>0,_?(2147483647-y|0)<(y|0):(-2147483648-y|0)>(y|0)))return N=1,N|0;if(U=y<<1,(_?(2147483647-U|0)<(y|0):(-2147483648-U|0)>(y|0))||(p?(2147483647-f|0)<(y|0):(-2147483648-f|0)>(y|0))||(p=y*3|0,(y|0)>-1?(p|-2147483648|0)>=(T|0):(p^-2147483648|0)<(T|0)))return U=1,U|0}else p=y*3|0,f=T<<1;return _=cl(+(f+y|0)*.14285714285714285)|0,d[A>>2]=_,y=cl(+(p-T|0)*.14285714285714285)|0,d[N>>2]=y,d[M>>2]=0,p=(y|0)<(_|0),f=p?_:y,p=p?y:_,(p|0)<0&&(((p|0)==-2147483648||((f|0)>0?(2147483647-f|0)<(p|0):(-2147483648-f|0)>(p|0)))&&Bt(27795,26892,402,26917),((f|0)>-1?(f|-2147483648|0)>=(p|0):(f^-2147483648|0)<(p|0))&&Bt(27795,26892,402,26917)),f=y-_|0,(_|0)<0?(p=0-_|0,d[N>>2]=f,d[M>>2]=p,d[A>>2]=0,_=0):(f=y,p=0),(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[M>>2]=p,d[N>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,(_|0)<=0?(U=0,U|0):(d[A>>2]=y-_,d[N>>2]=f-_,d[M>>2]=p-_,U=0,U|0)}function hx(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;M=A+8|0,p=d[M>>2]|0,f=(d[A>>2]|0)-p|0,N=A+4|0,p=(d[N>>2]|0)-p|0,_=cl(+((f*3|0)-p|0)*.14285714285714285)|0,d[A>>2]=_,f=cl(+((p<<1)+f|0)*.14285714285714285)|0,d[N>>2]=f,d[M>>2]=0,p=f-_|0,(_|0)<0?(T=0-_|0,d[N>>2]=p,d[M>>2]=T,d[A>>2]=0,f=p,_=0,p=T):p=0,(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[M>>2]=p,d[N>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,!((_|0)<=0)&&(d[A>>2]=y-_,d[N>>2]=f-_,d[M>>2]=p-_)}function l1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;M=A+8|0,p=d[M>>2]|0,f=(d[A>>2]|0)-p|0,N=A+4|0,p=(d[N>>2]|0)-p|0,_=cl(+((f<<1)+p|0)*.14285714285714285)|0,d[A>>2]=_,f=cl(+((p*3|0)-f|0)*.14285714285714285)|0,d[N>>2]=f,d[M>>2]=0,p=f-_|0,(_|0)<0?(T=0-_|0,d[N>>2]=p,d[M>>2]=T,d[A>>2]=0,f=p,_=0,p=T):p=0,(f|0)<0&&(_=_-f|0,d[A>>2]=_,p=p-f|0,d[M>>2]=p,d[N>>2]=0,f=0),T=_-p|0,y=f-p|0,(p|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,f=y,y=T,p=0):y=_,_=(f|0)<(y|0)?f:y,_=(p|0)<(_|0)?p:_,!((_|0)<=0)&&(d[A>>2]=y-_,d[N>>2]=f-_,d[M>>2]=p-_)}function Yc(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;f=d[A>>2]|0,M=A+4|0,p=d[M>>2]|0,N=A+8|0,_=d[N>>2]|0,y=p+(f*3|0)|0,d[A>>2]=y,p=_+(p*3|0)|0,d[M>>2]=p,f=(_*3|0)+f|0,d[N>>2]=f,_=p-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=_,d[N>>2]=f,d[A>>2]=0,p=_,_=0):_=y,(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function Lu(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=d[A>>2]|0,M=A+4|0,f=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,_=(f*3|0)+y|0,y=p+(y*3|0)|0,d[A>>2]=y,d[M>>2]=_,f=(p*3|0)+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,y=0):p=_,(p|0)<0&&(y=y-p|0,d[A>>2]=y,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=y-f|0,_=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=_,d[N>>2]=0,y=T,f=0):_=p,p=(_|0)<(y|0)?_:y,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=y-p,d[M>>2]=_-p,d[N>>2]=f-p)}function u1(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;(f+-1|0)>>>0>=6||(y=(d[15440+(f*12|0)>>2]|0)+(d[A>>2]|0)|0,d[A>>2]=y,N=A+4|0,_=(d[15440+(f*12|0)+4>>2]|0)+(d[N>>2]|0)|0,d[N>>2]=_,M=A+8|0,f=(d[15440+(f*12|0)+8>>2]|0)+(d[M>>2]|0)|0,d[M>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[N>>2]=p,d[M>>2]=f,d[A>>2]=0,_=0):(p=_,_=y),(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[M>>2]=f,d[N>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[N>>2]=y,d[M>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[N>>2]=y-p,d[M>>2]=f-p))}function c1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=d[A>>2]|0,M=A+4|0,f=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,_=f+y|0,y=p+y|0,d[A>>2]=y,d[M>>2]=_,f=p+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,_=0):(p=_,_=y),(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function EA(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;f=d[A>>2]|0,M=A+4|0,_=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,y=_+f|0,d[A>>2]=y,_=p+_|0,d[M>>2]=_,f=p+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,_=0):(p=_,_=y),(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function Uu(A){switch(A=A|0,A|0){case 1:{A=5;break}case 5:{A=4;break}case 4:{A=6;break}case 6:{A=2;break}case 2:{A=3;break}case 3:{A=1;break}}return A|0}function rl(A){switch(A=A|0,A|0){case 1:{A=3;break}case 3:{A=2;break}case 2:{A=6;break}case 6:{A=4;break}case 4:{A=5;break}case 5:{A=1;break}}return A|0}function h1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;f=d[A>>2]|0,M=A+4|0,p=d[M>>2]|0,N=A+8|0,_=d[N>>2]|0,y=p+(f<<1)|0,d[A>>2]=y,p=_+(p<<1)|0,d[M>>2]=p,f=(_<<1)+f|0,d[N>>2]=f,_=p-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=_,d[N>>2]=f,d[A>>2]=0,p=_,_=0):_=y,(p|0)<0&&(_=_-p|0,d[A>>2]=_,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=_-f|0,y=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=y,d[N>>2]=0,_=T,f=0):y=p,p=(y|0)<(_|0)?y:_,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=_-p,d[M>>2]=y-p,d[N>>2]=f-p)}function f1(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=d[A>>2]|0,M=A+4|0,f=d[M>>2]|0,N=A+8|0,p=d[N>>2]|0,_=(f<<1)+y|0,y=p+(y<<1)|0,d[A>>2]=y,d[M>>2]=_,f=(p<<1)+f|0,d[N>>2]=f,p=_-y|0,(y|0)<0?(f=f-y|0,d[M>>2]=p,d[N>>2]=f,d[A>>2]=0,y=0):p=_,(p|0)<0&&(y=y-p|0,d[A>>2]=y,f=f-p|0,d[N>>2]=f,d[M>>2]=0,p=0),T=y-f|0,_=p-f|0,(f|0)<0?(d[A>>2]=T,d[M>>2]=_,d[N>>2]=0,y=T,f=0):_=p,p=(_|0)<(y|0)?_:y,p=(f|0)<(p|0)?f:p,!((p|0)<=0)&&(d[A>>2]=y-p,d[M>>2]=_-p,d[N>>2]=f-p)}function ip(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;return M=(d[A>>2]|0)-(d[f>>2]|0)|0,N=(M|0)<0,_=(d[A+4>>2]|0)-(d[f+4>>2]|0)-(N?M:0)|0,T=(_|0)<0,y=(N?0-M|0:0)+(d[A+8>>2]|0)-(d[f+8>>2]|0)+(T?0-_|0:0)|0,A=(y|0)<0,f=A?0:y,p=(T?0:_)-(A?y:0)|0,y=(N?0:M)-(T?_:0)-(A?y:0)|0,A=(p|0)<(y|0)?p:y,A=(f|0)<(A|0)?f:A,_=(A|0)>0,f=f-(_?A:0)|0,p=p-(_?A:0)|0,A=y-(_?A:0)|0,A=(A|0)>-1?A:0-A|0,p=(p|0)>-1?p:0-p|0,f=(f|0)>-1?f:0-f|0,f=(p|0)>(f|0)?p:f,((A|0)>(f|0)?A:f)|0}function fx(A,f){A=A|0,f=f|0;var p=0;p=d[A+8>>2]|0,d[f>>2]=(d[A>>2]|0)-p,d[f+4>>2]=(d[A+4>>2]|0)-p}function rp(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0;return _=d[A>>2]|0,d[f>>2]=_,y=d[A+4>>2]|0,M=f+4|0,d[M>>2]=y,N=f+8|0,d[N>>2]=0,p=(y|0)<(_|0),A=p?_:y,p=p?y:_,(p|0)<0&&((p|0)==-2147483648||((A|0)>0?(2147483647-A|0)<(p|0):(-2147483648-A|0)>(p|0))||((A|0)>-1?(A|-2147483648|0)>=(p|0):(A^-2147483648|0)<(p|0)))?(f=1,f|0):(A=y-_|0,(_|0)<0?(p=0-_|0,d[M>>2]=A,d[N>>2]=p,d[f>>2]=0,_=0):(A=y,p=0),(A|0)<0&&(_=_-A|0,d[f>>2]=_,p=p-A|0,d[N>>2]=p,d[M>>2]=0,A=0),T=_-p|0,y=A-p|0,(p|0)<0?(d[f>>2]=T,d[M>>2]=y,d[N>>2]=0,A=y,y=T,p=0):y=_,_=(A|0)<(y|0)?A:y,_=(p|0)<(_|0)?p:_,(_|0)<=0?(f=0,f|0):(d[f>>2]=y-_,d[M>>2]=A-_,d[N>>2]=p-_,f=0,f|0))}function A1(A){A=A|0;var f=0,p=0,_=0,y=0;f=A+8|0,y=d[f>>2]|0,p=y-(d[A>>2]|0)|0,d[A>>2]=p,_=A+4|0,A=(d[_>>2]|0)-y|0,d[_>>2]=A,d[f>>2]=0-(A+p)}function Ax(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;p=d[A>>2]|0,f=0-p|0,d[A>>2]=f,M=A+8|0,d[M>>2]=0,N=A+4|0,_=d[N>>2]|0,y=_+p|0,(p|0)>0?(d[N>>2]=y,d[M>>2]=p,d[A>>2]=0,f=0,_=y):p=0,(_|0)<0?(T=f-_|0,d[A>>2]=T,p=p-_|0,d[M>>2]=p,d[N>>2]=0,y=T-p|0,f=0-p|0,(p|0)<0?(d[A>>2]=y,d[N>>2]=f,d[M>>2]=0,_=f,p=0):(_=0,y=T)):y=f,f=(_|0)<(y|0)?_:y,f=(p|0)<(f|0)?p:f,!((f|0)<=0)&&(d[A>>2]=y-f,d[N>>2]=_-f,d[M>>2]=p-f)}function dx(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0;if(ie=K,K=K+64|0,H=ie,N=ie+56|0,!(!0&(f&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return y=5,K=ie,y|0;if((A|0)==(p|0)&(f|0)==(_|0))return d[y>>2]=0,y=0,K=ie,y|0;if(M=Mt(A|0,f|0,52)|0,Z()|0,M=M&15,I=Mt(p|0,_|0,52)|0,Z()|0,(M|0)!=(I&15|0))return y=12,K=ie,y|0;if(T=M+-1|0,M>>>0>1){Fu(A,f,T,H)|0,Fu(p,_,T,N)|0,I=H,U=d[I>>2]|0,I=d[I+4>>2]|0;e:do if((U|0)==(d[N>>2]|0)&&(I|0)==(d[N+4>>2]|0)){M=(M^15)*3|0,T=Mt(A|0,f|0,M|0)|0,Z()|0,T=T&7,M=Mt(p|0,_|0,M|0)|0,Z()|0,M=M&7;do if((T|0)==0|(M|0)==0)d[y>>2]=1,T=0;else if((T|0)==7)T=5;else{if((T|0)==1|(M|0)==1&&Ci(U,I)|0){T=5;break}if((d[15536+(T<<2)>>2]|0)!=(M|0)&&(d[15568+(T<<2)>>2]|0)!=(M|0))break e;d[y>>2]=1,T=0}while(!1);return y=T,K=ie,y|0}while(!1)}T=H,M=T+56|0;do d[T>>2]=0,T=T+4|0;while((T|0)<(M|0));return ye(A,f,1,H)|0,f=H,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0))&&(f=H+8|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=H+16|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=H+24|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=H+32|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))&&(f=H+40|0,!((d[f>>2]|0)==(p|0)&&(d[f+4>>2]|0)==(_|0)))?(T=H+48|0,T=((d[T>>2]|0)==(p|0)?(d[T+4>>2]|0)==(_|0):0)&1):T=1,d[y>>2]=T,y=0,K=ie,y|0}function d1(A,f,p,_,y){return A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,p=pi(A,f,p,_)|0,(p|0)==7?(y=11,y|0):(_=Dt(p|0,0,56)|0,f=f&-2130706433|(Z()|0)|268435456,d[y>>2]=A|_,d[y+4>>2]=f,y=0,y|0)}function px(A,f,p){return A=A|0,f=f|0,p=p|0,!0&(f&2013265920|0)==268435456?(d[p>>2]=A,d[p+4>>2]=f&-2130706433|134217728,p=0,p|0):(p=6,p|0)}function mx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;return y=K,K=K+16|0,_=y,d[_>>2]=0,!0&(f&2013265920|0)==268435456?(T=Mt(A|0,f|0,56)|0,Z()|0,_=cn(A,f&-2130706433|134217728,T&7,_,p)|0,K=y,_|0):(_=6,K=y,_|0)}function p1(A,f){A=A|0,f=f|0;var p=0;switch(p=Mt(A|0,f|0,56)|0,Z()|0,p&7){case 0:case 7:return p=0,p|0}return p=f&-2130706433|134217728,!(!0&(f&2013265920|0)==268435456)||!0&(f&117440512|0)==16777216&(Ci(A,p)|0)!=0?(p=0,p|0):(p=NA(A,p)|0,p|0)}function gx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;return y=K,K=K+16|0,_=y,!0&(f&2013265920|0)==268435456?(T=f&-2130706433|134217728,M=p,d[M>>2]=A,d[M+4>>2]=T,d[_>>2]=0,f=Mt(A|0,f|0,56)|0,Z()|0,_=cn(A,T,f&7,_,p+8|0)|0,K=y,_|0):(_=6,K=y,_|0)}function vx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;return y=(Ci(A,f)|0)==0,f=f&-2130706433,_=p,d[_>>2]=y?A:0,d[_+4>>2]=y?f|285212672:0,_=p+8|0,d[_>>2]=A,d[_+4>>2]=f|301989888,_=p+16|0,d[_>>2]=A,d[_+4>>2]=f|318767104,_=p+24|0,d[_>>2]=A,d[_+4>>2]=f|335544320,_=p+32|0,d[_>>2]=A,d[_+4>>2]=f|352321536,p=p+40|0,d[p>>2]=A,d[p+4>>2]=f|369098752,0}function CA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;return M=K,K=K+16|0,y=M,T=f&-2130706433|134217728,!0&(f&2013265920|0)==268435456?(_=Mt(A|0,f|0,56)|0,Z()|0,_=Sp(A,T,_&7)|0,(_|0)==-1?(d[p>>2]=0,T=6,K=M,T|0):(zu(A,T,y)|0&&Bt(27795,26932,282,26947),f=Mt(A|0,f|0,52)|0,Z()|0,f=f&15,Ci(A,T)|0?sp(y,f,_,2,p):RA(y,f,_,2,p),T=0,K=M,T|0)):(T=6,K=M,T|0)}function _x(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;_=K,K=K+16|0,y=_,yx(A,f,p,y),MA(y,p+4|0),K=_}function yx(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0;if(N=K,K=K+16|0,U=N,xx(A,p,U),T=+Ma(+(1-+J[U>>3]*.5)),T<1e-16){d[_>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,d[_+12>>2]=0,K=N;return}if(U=d[p>>2]|0,y=+J[15920+(U*24|0)>>3],y=+Kc(y-+Kc(+Ex(15600+(U<<4)|0,A))),Ss(f)|0?M=+Kc(y+-.3334731722518321):M=y,y=+cs(+T)*2.618033988749896,(f|0)>0){A=0;do y=y*2.6457513110645907,A=A+1|0;while((A|0)!=(f|0))}T=+li(+M)*y,J[_>>3]=T,M=+Fn(+M)*y,J[_+8>>3]=M,K=N}function xx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(T=K,K=K+32|0,y=T,Yu(A,y),d[f>>2]=0,J[p>>3]=5,_=+ar(16400,y),_<+J[p>>3]&&(d[f>>2]=0,J[p>>3]=_),_=+ar(16424,y),_<+J[p>>3]&&(d[f>>2]=1,J[p>>3]=_),_=+ar(16448,y),_<+J[p>>3]&&(d[f>>2]=2,J[p>>3]=_),_=+ar(16472,y),_<+J[p>>3]&&(d[f>>2]=3,J[p>>3]=_),_=+ar(16496,y),_<+J[p>>3]&&(d[f>>2]=4,J[p>>3]=_),_=+ar(16520,y),_<+J[p>>3]&&(d[f>>2]=5,J[p>>3]=_),_=+ar(16544,y),_<+J[p>>3]&&(d[f>>2]=6,J[p>>3]=_),_=+ar(16568,y),_<+J[p>>3]&&(d[f>>2]=7,J[p>>3]=_),_=+ar(16592,y),_<+J[p>>3]&&(d[f>>2]=8,J[p>>3]=_),_=+ar(16616,y),_<+J[p>>3]&&(d[f>>2]=9,J[p>>3]=_),_=+ar(16640,y),_<+J[p>>3]&&(d[f>>2]=10,J[p>>3]=_),_=+ar(16664,y),_<+J[p>>3]&&(d[f>>2]=11,J[p>>3]=_),_=+ar(16688,y),_<+J[p>>3]&&(d[f>>2]=12,J[p>>3]=_),_=+ar(16712,y),_<+J[p>>3]&&(d[f>>2]=13,J[p>>3]=_),_=+ar(16736,y),_<+J[p>>3]&&(d[f>>2]=14,J[p>>3]=_),_=+ar(16760,y),_<+J[p>>3]&&(d[f>>2]=15,J[p>>3]=_),_=+ar(16784,y),_<+J[p>>3]&&(d[f>>2]=16,J[p>>3]=_),_=+ar(16808,y),_<+J[p>>3]&&(d[f>>2]=17,J[p>>3]=_),_=+ar(16832,y),_<+J[p>>3]&&(d[f>>2]=18,J[p>>3]=_),_=+ar(16856,y),!(_<+J[p>>3])){K=T;return}d[f>>2]=19,J[p>>3]=_,K=T}function Bu(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0;if(T=+zl(A),T<1e-16){f=15600+(f<<4)|0,d[y>>2]=d[f>>2],d[y+4>>2]=d[f+4>>2],d[y+8>>2]=d[f+8>>2],d[y+12>>2]=d[f+12>>2];return}if(M=+Fe(+ +J[A+8>>3],+ +J[A>>3]),(p|0)>0){A=0;do T=T*.37796447300922725,A=A+1|0;while((A|0)!=(p|0))}N=T*.3333333333333333,_?(p=(Ss(p)|0)==0,T=+oe(+((p?N:N*.37796447300922725)*.381966011250105))):(T=+oe(+(T*.381966011250105)),Ss(p)|0&&(M=+Kc(M+.3334731722518321))),Cx(15600+(f<<4)|0,+Kc(+J[15920+(f*24|0)>>3]-M),T,y)}function of(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;_=K,K=K+16|0,y=_,Du(A+4|0,y),Bu(y,d[A>>2]|0,f,0,p),K=_}function sp(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0,sn=0,tn=0,Bn=0,En=0,Qn=0,Tn=0,on=0,Ut=0,vn=0,ii=0,wn=0;if(vn=K,K=K+272|0,T=vn+256|0,qe=vn+240|0,Tn=vn,on=vn+224|0,Ut=vn+208|0,Ge=vn+176|0,Le=vn+160|0,Lt=vn+192|0,sn=vn+144|0,tn=vn+128|0,Bn=vn+112|0,En=vn+96|0,Qn=vn+80|0,d[T>>2]=f,d[qe>>2]=d[A>>2],d[qe+4>>2]=d[A+4>>2],d[qe+8>>2]=d[A+8>>2],d[qe+12>>2]=d[A+12>>2],ap(qe,T,Tn),d[y>>2]=0,qe=_+p+((_|0)==5&1)|0,(qe|0)<=(p|0)){K=vn;return}U=d[T>>2]|0,I=on+4|0,H=Ge+4|0,ie=p+5|0,ge=16880+(U<<2)|0,Ae=16960+(U<<2)|0,ve=tn+8|0,Pe=Bn+8|0,Ie=En+8|0,Ye=Ut+4|0,N=p;e:for(;;){M=Tn+(((N|0)%5|0)<<4)|0,d[Ut>>2]=d[M>>2],d[Ut+4>>2]=d[M+4>>2],d[Ut+8>>2]=d[M+8>>2],d[Ut+12>>2]=d[M+12>>2];do;while((Ou(Ut,U,0,1)|0)==2);if((N|0)>(p|0)&(Ss(f)|0)!=0){if(d[Ge>>2]=d[Ut>>2],d[Ge+4>>2]=d[Ut+4>>2],d[Ge+8>>2]=d[Ut+8>>2],d[Ge+12>>2]=d[Ut+12>>2],Du(I,Le),_=d[Ge>>2]|0,T=d[17040+(_*80|0)+(d[on>>2]<<2)>>2]|0,d[Ge>>2]=d[18640+(_*80|0)+(T*20|0)>>2],M=d[18640+(_*80|0)+(T*20|0)+16>>2]|0,(M|0)>0){A=0;do c1(H),A=A+1|0;while((A|0)<(M|0))}switch(M=18640+(_*80|0)+(T*20|0)+4|0,d[Lt>>2]=d[M>>2],d[Lt+4>>2]=d[M+4>>2],d[Lt+8>>2]=d[M+8>>2],Xc(Lt,(d[ge>>2]|0)*3|0),hs(H,Lt,H),Lr(H),Du(H,sn),ii=+(d[Ae>>2]|0),J[tn>>3]=ii*3,J[ve>>3]=0,wn=ii*-1.5,J[Bn>>3]=wn,J[Pe>>3]=ii*2.598076211353316,J[En>>3]=wn,J[Ie>>3]=ii*-2.598076211353316,d[17040+((d[Ge>>2]|0)*80|0)+(d[Ut>>2]<<2)>>2]|0){case 1:{A=Bn,_=tn;break}case 3:{A=En,_=Bn;break}case 2:{A=tn,_=En;break}default:{A=12;break e}}xp(Le,sn,_,A,Qn),Bu(Qn,d[Ge>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1}if((N|0)<(ie|0)&&(Du(Ye,Ge),Bu(Ge,d[Ut>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1),d[on>>2]=d[Ut>>2],d[on+4>>2]=d[Ut+4>>2],d[on+8>>2]=d[Ut+8>>2],d[on+12>>2]=d[Ut+12>>2],N=N+1|0,(N|0)>=(qe|0)){A=3;break}}if((A|0)==3){K=vn;return}else(A|0)==12&&Bt(26970,27017,572,27027)}function ap(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0;U=K,K=K+128|0,_=U+64|0,y=U,T=_,M=20240,N=T+60|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));T=y,M=20304,N=T+60|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));N=(Ss(d[f>>2]|0)|0)==0,_=N?_:y,y=A+4|0,h1(y),f1(y),Ss(d[f>>2]|0)|0&&(Lu(y),d[f>>2]=(d[f>>2]|0)+1),d[p>>2]=d[A>>2],f=p+4|0,hs(y,_,f),Lr(f),d[p+16>>2]=d[A>>2],f=p+20|0,hs(y,_+12|0,f),Lr(f),d[p+32>>2]=d[A>>2],f=p+36|0,hs(y,_+24|0,f),Lr(f),d[p+48>>2]=d[A>>2],f=p+52|0,hs(y,_+36|0,f),Lr(f),d[p+64>>2]=d[A>>2],p=p+68|0,hs(y,_+48|0,p),Lr(p),K=U}function Ou(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0;if(ve=K,K=K+32|0,ge=ve+12|0,N=ve,Ae=A+4|0,ie=d[16960+(f<<2)>>2]|0,H=(_|0)!=0,ie=H?ie*3|0:ie,y=d[Ae>>2]|0,I=A+8|0,M=d[I>>2]|0,H){if(T=A+12|0,_=d[T>>2]|0,y=M+y+_|0,(y|0)==(ie|0))return Ae=1,K=ve,Ae|0;U=T}else U=A+12|0,_=d[U>>2]|0,y=M+y+_|0;if((y|0)<=(ie|0))return Ae=0,K=ve,Ae|0;do if((_|0)>0){if(_=d[A>>2]|0,(M|0)>0){T=18640+(_*80|0)+60|0,_=A;break}_=18640+(_*80|0)+40|0,p?(Nu(ge,ie,0,0),af(Ae,ge,N),EA(N),hs(N,ge,Ae),T=_,_=A):(T=_,_=A)}else T=18640+((d[A>>2]|0)*80|0)+20|0,_=A;while(!1);if(d[_>>2]=d[T>>2],y=T+16|0,(d[y>>2]|0)>0){_=0;do c1(Ae),_=_+1|0;while((_|0)<(d[y>>2]|0))}return A=T+4|0,d[ge>>2]=d[A>>2],d[ge+4>>2]=d[A+4>>2],d[ge+8>>2]=d[A+8>>2],f=d[16880+(f<<2)>>2]|0,Xc(ge,H?f*3|0:f),hs(Ae,ge,Ae),Lr(Ae),H?_=((d[I>>2]|0)+(d[Ae>>2]|0)+(d[U>>2]|0)|0)==(ie|0)?1:2:_=2,Ae=_,K=ve,Ae|0}function m1(A,f){A=A|0,f=f|0;var p=0;do p=Ou(A,f,0,1)|0;while((p|0)==2);return p|0}function RA(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0,sn=0,tn=0,Bn=0,En=0,Qn=0,Tn=0;if(En=K,K=K+240|0,T=En+224|0,Lt=En+208|0,sn=En,tn=En+192|0,Bn=En+176|0,Ie=En+160|0,Ye=En+144|0,qe=En+128|0,Ge=En+112|0,Le=En+96|0,d[T>>2]=f,d[Lt>>2]=d[A>>2],d[Lt+4>>2]=d[A+4>>2],d[Lt+8>>2]=d[A+8>>2],d[Lt+12>>2]=d[A+12>>2],op(Lt,T,sn),d[y>>2]=0,Pe=_+p+((_|0)==6&1)|0,(Pe|0)<=(p|0)){K=En;return}U=d[T>>2]|0,I=p+6|0,H=16960+(U<<2)|0,ie=Ye+8|0,ge=qe+8|0,Ae=Ge+8|0,ve=tn+4|0,M=0,N=p,_=-1;e:for(;;){if(T=(N|0)%6|0,A=sn+(T<<4)|0,d[tn>>2]=d[A>>2],d[tn+4>>2]=d[A+4>>2],d[tn+8>>2]=d[A+8>>2],d[tn+12>>2]=d[A+12>>2],A=M,M=Ou(tn,U,0,1)|0,(N|0)>(p|0)&(Ss(f)|0)!=0&&(A|0)!=1&&(d[tn>>2]|0)!=(_|0)){switch(Du(sn+(((T+5|0)%6|0)<<4)+4|0,Bn),Du(sn+(T<<4)+4|0,Ie),Qn=+(d[H>>2]|0),J[Ye>>3]=Qn*3,J[ie>>3]=0,Tn=Qn*-1.5,J[qe>>3]=Tn,J[ge>>3]=Qn*2.598076211353316,J[Ge>>3]=Tn,J[Ae>>3]=Qn*-2.598076211353316,T=d[Lt>>2]|0,d[17040+(T*80|0)+(((_|0)==(T|0)?d[tn>>2]|0:_)<<2)>>2]|0){case 1:{A=qe,_=Ye;break}case 3:{A=Ge,_=qe;break}case 2:{A=Ye,_=Ge;break}default:{A=8;break e}}xp(Bn,Ie,_,A,Le),!(bp(Bn,Le)|0)&&!(bp(Ie,Le)|0)&&(Bu(Le,d[Lt>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1)}if((N|0)<(I|0)&&(Du(ve,Bn),Bu(Bn,d[tn>>2]|0,U,1,y+8+(d[y>>2]<<4)|0),d[y>>2]=(d[y>>2]|0)+1),N=N+1|0,(N|0)>=(Pe|0)){A=3;break}else _=d[tn>>2]|0}if((A|0)==3){K=En;return}else(A|0)==8&&Bt(27054,27017,737,27099)}function op(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0;U=K,K=K+160|0,_=U+80|0,y=U,T=_,M=20368,N=T+72|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));T=y,M=20448,N=T+72|0;do d[T>>2]=d[M>>2],T=T+4|0,M=M+4|0;while((T|0)<(N|0));N=(Ss(d[f>>2]|0)|0)==0,_=N?_:y,y=A+4|0,h1(y),f1(y),Ss(d[f>>2]|0)|0&&(Lu(y),d[f>>2]=(d[f>>2]|0)+1),d[p>>2]=d[A>>2],f=p+4|0,hs(y,_,f),Lr(f),d[p+16>>2]=d[A>>2],f=p+20|0,hs(y,_+12|0,f),Lr(f),d[p+32>>2]=d[A>>2],f=p+36|0,hs(y,_+24|0,f),Lr(f),d[p+48>>2]=d[A>>2],f=p+52|0,hs(y,_+36|0,f),Lr(f),d[p+64>>2]=d[A>>2],f=p+68|0,hs(y,_+48|0,f),Lr(f),d[p+80>>2]=d[A>>2],p=p+84|0,hs(y,_+60|0,p),Lr(p),K=U}function Qc(A,f){return A=A|0,f=f|0,f=Mt(A|0,f|0,52)|0,Z()|0,f&15|0}function g1(A,f){return A=A|0,f=f|0,f=Mt(A|0,f|0,45)|0,Z()|0,f&127|0}function bx(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,(p+-1|0)>>>0>14?(_=4,_|0):(p=Mt(A|0,f|0,(15-p|0)*3|0)|0,Z()|0,d[_>>2]=p&7,_=0,_|0)}function Sx(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;if(A>>>0>15)return _=4,_|0;if(f>>>0>121)return _=17,_|0;M=Dt(A|0,0,52)|0,y=Z()|0,N=Dt(f|0,0,45)|0,y=y|(Z()|0)|134225919;e:do if((A|0)>=1){for(N=1,M=(at[20528+f>>0]|0)!=0,T=-1;;){if(f=d[p+(N+-1<<2)>>2]|0,f>>>0>6){y=18,f=10;break}if(!((f|0)==0|M^1))if((f|0)==1){y=19,f=10;break}else M=0;if(I=(15-N|0)*3|0,U=Dt(7,0,I|0)|0,y=y&~(Z()|0),f=Dt(f|0,((f|0)<0)<<31>>31|0,I|0)|0,T=f|T&~U,y=Z()|0|y,(N|0)<(A|0))N=N+1|0;else break e}if((f|0)==10)return y|0}else T=-1;while(!1);return I=_,d[I>>2]=T,d[I+4>>2]=y,I=0,I|0}function NA(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;return!(!0&(f&-16777216|0)==134217728)||(_=Mt(A|0,f|0,52)|0,Z()|0,_=_&15,p=Mt(A|0,f|0,45)|0,Z()|0,p=p&127,p>>>0>121)?(A=0,A|0):(M=(_^15)*3|0,y=Mt(A|0,f|0,M|0)|0,M=Dt(y|0,Z()|0,M|0)|0,y=Z()|0,T=Ur(-1227133514,-1171,M|0,y|0)|0,!((M&613566756&T|0)==0&(y&4681&(Z()|0)|0)==0)||(M=(_*3|0)+19|0,T=Dt(~A|0,~f|0,M|0)|0,M=Mt(T|0,Z()|0,M|0)|0,!((_|0)==15|(M|0)==0&(Z()|0)==0))?(M=0,M|0):!(at[20528+p>>0]|0)||(f=f&8191,(A|0)==0&(f|0)==0)?(M=1,M|0):(M=ff(A|0,f|0)|0,Z()|0,((63-M|0)%3|0|0)!=0|0))}function v1(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;return!0&(f&-16777216|0)==134217728&&(_=Mt(A|0,f|0,52)|0,Z()|0,_=_&15,p=Mt(A|0,f|0,45)|0,Z()|0,p=p&127,p>>>0<=121)&&(M=(_^15)*3|0,y=Mt(A|0,f|0,M|0)|0,M=Dt(y|0,Z()|0,M|0)|0,y=Z()|0,T=Ur(-1227133514,-1171,M|0,y|0)|0,(M&613566756&T|0)==0&(y&4681&(Z()|0)|0)==0)&&(M=(_*3|0)+19|0,T=Dt(~A|0,~f|0,M|0)|0,M=Mt(T|0,Z()|0,M|0)|0,(_|0)==15|(M|0)==0&(Z()|0)==0)&&(!(at[20528+p>>0]|0)||(p=f&8191,(A|0)==0&(p|0)==0)||(M=ff(A|0,p|0)|0,Z()|0,(63-M|0)%3|0|0))||p1(A,f)|0?(M=1,M|0):(M=(ul(A,f)|0)!=0&1,M|0)}function Iu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0;if(y=Dt(f|0,0,52)|0,T=Z()|0,p=Dt(p|0,0,45)|0,p=T|(Z()|0)|134225919,(f|0)<1){T=-1,_=p,f=A,d[f>>2]=T,A=A+4|0,d[A>>2]=_;return}for(T=1,y=-1;M=(15-T|0)*3|0,N=Dt(7,0,M|0)|0,p=p&~(Z()|0),M=Dt(_|0,0,M|0)|0,y=y&~N|M,p=p|(Z()|0),(T|0)!=(f|0);)T=T+1|0;N=A,M=N,d[M>>2]=y,N=N+4|0,d[N>>2]=p}function Fu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;if(T=Mt(A|0,f|0,52)|0,Z()|0,T=T&15,p>>>0>15)return _=4,_|0;if((T|0)<(p|0))return _=12,_|0;if((T|0)==(p|0))return d[_>>2]=A,d[_+4>>2]=f,_=0,_|0;if(y=Dt(p|0,0,52)|0,y=y|A,A=Z()|0|f&-15728641,(T|0)>(p|0))do f=Dt(7,0,(14-p|0)*3|0)|0,p=p+1|0,y=f|y,A=Z()|0|A;while((p|0)<(T|0));return d[_>>2]=y,d[_+4>>2]=A,_=0,_|0}function lf(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;if(T=Mt(A|0,f|0,52)|0,Z()|0,T=T&15,!((p|0)<16&(T|0)<=(p|0)))return _=4,_|0;y=p-T|0,p=Mt(A|0,f|0,45)|0,Z()|0;e:do if(!(Bi(p&127)|0))p=Bo(7,0,y,((y|0)<0)<<31>>31)|0,y=Z()|0;else{t:do if(T|0){for(p=1;M=Dt(7,0,(15-p|0)*3|0)|0,!!((M&A|0)==0&((Z()|0)&f|0)==0);)if(p>>>0<T>>>0)p=p+1|0;else break t;p=Bo(7,0,y,((y|0)<0)<<31>>31)|0,y=Z()|0;break e}while(!1);p=Bo(7,0,y,((y|0)<0)<<31>>31)|0,p=fr(p|0,Z()|0,5,0)|0,p=Qt(p|0,Z()|0,-5,-1)|0,p=ko(p|0,Z()|0,6,0)|0,p=Qt(p|0,Z()|0,1,0)|0,y=Z()|0}while(!1);return M=_,d[M>>2]=p,d[M+4>>2]=y,M=0,M|0}function Ci(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;if(y=Mt(A|0,f|0,45)|0,Z()|0,!(Bi(y&127)|0))return y=0,y|0;y=Mt(A|0,f|0,52)|0,Z()|0,y=y&15;e:do if(!y)p=0;else for(_=1;;){if(p=Mt(A|0,f|0,(15-_|0)*3|0)|0,Z()|0,p=p&7,p|0)break e;if(_>>>0<y>>>0)_=_+1|0;else{p=0;break}}while(!1);return y=(p|0)==0&1,y|0}function _1(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0;if(M=K,K=K+16|0,T=M,sl(T,A,f,p),f=T,A=d[f>>2]|0,f=d[f+4>>2]|0,(A|0)==0&(f|0)==0)return K=M,0;y=0,p=0;do N=_+(y<<3)|0,d[N>>2]=A,d[N+4>>2]=f,y=Qt(y|0,p|0,1,0)|0,p=Z()|0,uf(T),N=T,A=d[N>>2]|0,f=d[N+4>>2]|0;while(!((A|0)==0&(f|0)==0));return K=M,0}function lp(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,(_|0)<(p|0)?(p=f,_=A,mt(p|0),_|0):(p=Dt(-1,-1,((_-p|0)*3|0)+3|0)|0,_=Dt(~p|0,~(Z()|0)|0,(15-_|0)*3|0)|0,p=~(Z()|0)&f,_=~_&A,mt(p|0),_|0)}function DA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0;return y=Mt(A|0,f|0,52)|0,Z()|0,y=y&15,(p|0)<16&(y|0)<=(p|0)?((y|0)<(p|0)&&(y=Dt(-1,-1,((p+-1-y|0)*3|0)+3|0)|0,y=Dt(~y|0,~(Z()|0)|0,(15-p|0)*3|0)|0,f=~(Z()|0)&f,A=~y&A),y=Dt(p|0,0,52)|0,p=f&-15728641|(Z()|0),d[_>>2]=A|y,d[_+4>>2]=p,_=0,_|0):(_=4,_|0)}function up(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0,sn=0,tn=0,Bn=0,En=0,Qn=0,Tn=0,on=0,Ut=0;if((p|0)==0&(_|0)==0)return Ut=0,Ut|0;if(y=A,T=d[y>>2]|0,y=d[y+4>>2]|0,!0&(y&15728640|0)==0){if(!((_|0)>0|(_|0)==0&p>>>0>0)||(Ut=f,d[Ut>>2]=T,d[Ut+4>>2]=y,(p|0)==1&(_|0)==0))return Ut=0,Ut|0;y=1,T=0;do Tn=A+(y<<3)|0,on=d[Tn+4>>2]|0,Ut=f+(y<<3)|0,d[Ut>>2]=d[Tn>>2],d[Ut+4>>2]=on,y=Qt(y|0,T|0,1,0)|0,T=Z()|0;while((T|0)<(_|0)|(T|0)==(_|0)&y>>>0<p>>>0);return y=0,y|0}if(Qn=p<<3,on=Fo(Qn)|0,!on)return Ut=13,Ut|0;if(Gl(on|0,A|0,Qn|0)|0,Tn=Ks(p,8)|0,!Tn)return An(on),Ut=13,Ut|0;e:for(;;){y=on,I=d[y>>2]|0,y=d[y+4>>2]|0,Bn=Mt(I|0,y|0,52)|0,Z()|0,Bn=Bn&15,En=Bn+-1|0,tn=(Bn|0)!=0,sn=(_|0)>0|(_|0)==0&p>>>0>0;t:do if(tn&sn){if(qe=Dt(En|0,0,52)|0,Ge=Z()|0,En>>>0>15){if(!((I|0)==0&(y|0)==0)){Ut=16;break e}for(T=0,A=0;;){if(T=Qt(T|0,A|0,1,0)|0,A=Z()|0,!((A|0)<(_|0)|(A|0)==(_|0)&T>>>0<p>>>0))break t;if(M=on+(T<<3)|0,Lt=d[M>>2]|0,M=d[M+4>>2]|0,!((Lt|0)==0&(M|0)==0)){y=M,Ut=16;break e}}}for(N=I,A=y,T=0,M=0;;){if(!((N|0)==0&(A|0)==0)){if(!(!0&(A&117440512|0)==0)){Ut=21;break e}if(H=Mt(N|0,A|0,52)|0,Z()|0,H=H&15,(H|0)<(En|0)){y=12,Ut=27;break e}if((H|0)!=(En|0)&&(N=N|qe,A=A&-15728641|Ge,H>>>0>=Bn>>>0)){U=En;do Lt=Dt(7,0,(14-U|0)*3|0)|0,U=U+1|0,N=Lt|N,A=Z()|0|A;while(U>>>0<H>>>0)}if(ge=ec(N|0,A|0,p|0,_|0)|0,Ae=Z()|0,U=Tn+(ge<<3)|0,H=U,ie=d[H>>2]|0,H=d[H+4>>2]|0,!((ie|0)==0&(H|0)==0)){Ie=0,Ye=0;do{if((Ie|0)>(_|0)|(Ie|0)==(_|0)&Ye>>>0>p>>>0){Ut=31;break e}if((ie|0)==(N|0)&(H&-117440513|0)==(A|0)){ve=Mt(ie|0,H|0,56)|0,Z()|0,ve=ve&7,Pe=ve+1|0,Lt=Mt(ie|0,H|0,45)|0,Z()|0;n:do if(!(Bi(Lt&127)|0))H=7;else{if(ie=Mt(ie|0,H|0,52)|0,Z()|0,ie=ie&15,!ie){H=6;break}for(H=1;;){if(Lt=Dt(7,0,(15-H|0)*3|0)|0,!((Lt&N|0)==0&((Z()|0)&A|0)==0)){H=7;break n}if(H>>>0<ie>>>0)H=H+1|0;else{H=6;break}}}while(!1);if((ve+2|0)>>>0>H>>>0){Ut=41;break e}Lt=Dt(Pe|0,0,56)|0,A=Z()|0|A&-117440513,Le=U,d[Le>>2]=0,d[Le+4>>2]=0,N=Lt|N}else ge=Qt(ge|0,Ae|0,1,0)|0,ge=th(ge|0,Z()|0,p|0,_|0)|0,Ae=Z()|0;Ye=Qt(Ye|0,Ie|0,1,0)|0,Ie=Z()|0,U=Tn+(ge<<3)|0,H=U,ie=d[H>>2]|0,H=d[H+4>>2]|0}while(!((ie|0)==0&(H|0)==0))}Lt=U,d[Lt>>2]=N,d[Lt+4>>2]=A}if(T=Qt(T|0,M|0,1,0)|0,M=Z()|0,!((M|0)<(_|0)|(M|0)==(_|0)&T>>>0<p>>>0))break t;A=on+(T<<3)|0,N=d[A>>2]|0,A=d[A+4>>2]|0}}while(!1);if(Lt=Qt(p|0,_|0,5,0)|0,Le=Z()|0,Le>>>0<0|(Le|0)==0&Lt>>>0<11){Ut=85;break}if(Lt=ko(p|0,_|0,6,0)|0,Z()|0,Lt=Ks(Lt,8)|0,!Lt){Ut=48;break}do if(sn){for(Pe=0,A=0,ve=0,Ie=0;;){if(H=Tn+(Pe<<3)|0,M=H,T=d[M>>2]|0,M=d[M+4>>2]|0,(T|0)==0&(M|0)==0)Le=ve;else{ie=Mt(T|0,M|0,56)|0,Z()|0,ie=ie&7,N=ie+1|0,ge=M&-117440513,Le=Mt(T|0,M|0,45)|0,Z()|0;t:do if(Bi(Le&127)|0){if(Ae=Mt(T|0,M|0,52)|0,Z()|0,Ae=Ae&15,Ae|0)for(U=1;;){if(Le=Dt(7,0,(15-U|0)*3|0)|0,!((T&Le|0)==0&(ge&(Z()|0)|0)==0))break t;if(U>>>0<Ae>>>0)U=U+1|0;else break}M=Dt(N|0,0,56)|0,T=M|T,M=Z()|0|ge,N=H,d[N>>2]=T,d[N+4>>2]=M,N=ie+2|0}while(!1);(N|0)==7?(Le=Lt+(A<<3)|0,d[Le>>2]=T,d[Le+4>>2]=M&-117440513,A=Qt(A|0,ve|0,1,0)|0,Le=Z()|0):Le=ve}if(Pe=Qt(Pe|0,Ie|0,1,0)|0,Ie=Z()|0,(Ie|0)<(_|0)|(Ie|0)==(_|0)&Pe>>>0<p>>>0)ve=Le;else break}if(sn){if(Ye=En>>>0>15,qe=Dt(En|0,0,52)|0,Ge=Z()|0,!tn){for(T=0,U=0,N=0,M=0;(I|0)==0&(y|0)==0||(En=f+(T<<3)|0,d[En>>2]=I,d[En+4>>2]=y,T=Qt(T|0,U|0,1,0)|0,U=Z()|0),N=Qt(N|0,M|0,1,0)|0,M=Z()|0,!!((M|0)<(_|0)|(M|0)==(_|0)&N>>>0<p>>>0);)y=on+(N<<3)|0,I=d[y>>2]|0,y=d[y+4>>2]|0;y=Le;break}for(T=0,U=0,M=0,N=0;;){do if(!((I|0)==0&(y|0)==0)){if(Ae=Mt(I|0,y|0,52)|0,Z()|0,Ae=Ae&15,Ye|(Ae|0)<(En|0)){Ut=80;break e}if((Ae|0)!=(En|0)){if(H=I|qe,ie=y&-15728641|Ge,Ae>>>0>=Bn>>>0){ge=En;do tn=Dt(7,0,(14-ge|0)*3|0)|0,ge=ge+1|0,H=tn|H,ie=Z()|0|ie;while(ge>>>0<Ae>>>0)}}else H=I,ie=y;ve=ec(H|0,ie|0,p|0,_|0)|0,ge=0,Ae=0,Ie=Z()|0;do{if((ge|0)>(_|0)|(ge|0)==(_|0)&Ae>>>0>p>>>0){Ut=81;break e}if(tn=Tn+(ve<<3)|0,Pe=d[tn+4>>2]|0,(Pe&-117440513|0)==(ie|0)&&(d[tn>>2]|0)==(H|0)){Ut=65;break}tn=Qt(ve|0,Ie|0,1,0)|0,ve=th(tn|0,Z()|0,p|0,_|0)|0,Ie=Z()|0,Ae=Qt(Ae|0,ge|0,1,0)|0,ge=Z()|0,tn=Tn+(ve<<3)|0}while(!((d[tn>>2]|0)==(H|0)&&(d[tn+4>>2]|0)==(ie|0)));if((Ut|0)==65&&(Ut=0,!0&(Pe&117440512|0)==100663296))break;tn=f+(T<<3)|0,d[tn>>2]=I,d[tn+4>>2]=y,T=Qt(T|0,U|0,1,0)|0,U=Z()|0}while(!1);if(M=Qt(M|0,N|0,1,0)|0,N=Z()|0,!((N|0)<(_|0)|(N|0)==(_|0)&M>>>0<p>>>0))break;y=on+(M<<3)|0,I=d[y>>2]|0,y=d[y+4>>2]|0}y=Le}else T=0,y=Le}else T=0,A=0,y=0;while(!1);if(uo(Tn|0,0,Qn|0)|0,Gl(on|0,Lt|0,A<<3|0)|0,An(Lt),(A|0)==0&(y|0)==0){Ut=89;break}else f=f+(T<<3)|0,_=y,p=A}if((Ut|0)==16)!0&(y&117440512|0)==0?(y=4,Ut=27):Ut=21;else if((Ut|0)==31)Bt(27795,27122,620,27132);else{if((Ut|0)==41)return An(on),An(Tn),Ut=10,Ut|0;if((Ut|0)==48)return An(on),An(Tn),Ut=13,Ut|0;(Ut|0)==80?Bt(27795,27122,711,27132):(Ut|0)==81?Bt(27795,27122,723,27132):(Ut|0)==85&&(Gl(f|0,on|0,p<<3|0)|0,Ut=89)}return(Ut|0)==21?(An(on),An(Tn),Ut=5,Ut|0):(Ut|0)==27?(An(on),An(Tn),Ut=y,Ut|0):(Ut|0)==89?(An(on),An(Tn),Ut=0,Ut|0):0}function y1(A,f,p,_,y,T,M){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0,M=M|0;var N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0;if(Pe=K,K=K+16|0,ve=Pe,!((p|0)>0|(p|0)==0&f>>>0>0))return ve=0,K=Pe,ve|0;if((M|0)>=16)return ve=12,K=Pe,ve|0;ge=0,Ae=0,ie=0,N=0;e:for(;;){if(I=A+(ge<<3)|0,U=d[I>>2]|0,I=d[I+4>>2]|0,H=Mt(U|0,I|0,52)|0,Z()|0,(H&15|0)>(M|0)){N=12,U=11;break}if(sl(ve,U,I,M),H=ve,I=d[H>>2]|0,H=d[H+4>>2]|0,(I|0)==0&(H|0)==0)U=ie;else{U=ie;do{if(!((N|0)<(T|0)|(N|0)==(T|0)&U>>>0<y>>>0)){U=10;break e}ie=_+(U<<3)|0,d[ie>>2]=I,d[ie+4>>2]=H,U=Qt(U|0,N|0,1,0)|0,N=Z()|0,uf(ve),ie=ve,I=d[ie>>2]|0,H=d[ie+4>>2]|0}while(!((I|0)==0&(H|0)==0))}if(ge=Qt(ge|0,Ae|0,1,0)|0,Ae=Z()|0,(Ae|0)<(p|0)|(Ae|0)==(p|0)&ge>>>0<f>>>0)ie=U;else{N=0,U=11;break}}return(U|0)==10?(ve=14,K=Pe,ve|0):(U|0)==11?(K=Pe,N|0):0}function x1(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0;ge=K,K=K+16|0,ie=ge;e:do if((p|0)>0|(p|0)==0&f>>>0>0){for(I=0,M=0,T=0,H=0;;){if(U=A+(I<<3)|0,N=d[U>>2]|0,U=d[U+4>>2]|0,!((N|0)==0&(U|0)==0)&&(U=(lf(N,U,_,ie)|0)==0,N=ie,M=Qt(d[N>>2]|0,d[N+4>>2]|0,M|0,T|0)|0,T=Z()|0,!U)){T=12;break}if(I=Qt(I|0,H|0,1,0)|0,H=Z()|0,!((H|0)<(p|0)|(H|0)==(p|0)&I>>>0<f>>>0))break e}return K=ge,T|0}else M=0,T=0;while(!1);return d[y>>2]=M,d[y+4>>2]=T,y=0,K=ge,y|0}function b1(A,f){return A=A|0,f=f|0,f=Mt(A|0,f|0,52)|0,Z()|0,f&1|0}function $s(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;if(y=Mt(A|0,f|0,52)|0,Z()|0,y=y&15,!y)return y=0,y|0;for(_=1;;){if(p=Mt(A|0,f|0,(15-_|0)*3|0)|0,Z()|0,p=p&7,p|0){_=5;break}if(_>>>0<y>>>0)_=_+1|0;else{p=0,_=5;break}}return(_|0)==5?p|0:0}function cp(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(U=Mt(A|0,f|0,52)|0,Z()|0,U=U&15,!U)return N=f,U=A,mt(N|0),U|0;for(N=1,p=0;;){T=(15-N|0)*3|0,_=Dt(7,0,T|0)|0,y=Z()|0,M=Mt(A|0,f|0,T|0)|0,Z()|0,T=Dt(Uu(M&7)|0,0,T|0)|0,M=Z()|0,A=T|A&~_,f=M|f&~y;e:do if(!p)if((T&_|0)==0&(M&y|0)==0)p=0;else if(_=Mt(A|0,f|0,52)|0,Z()|0,_=_&15,!_)p=1;else{p=1;t:for(;;){switch(M=Mt(A|0,f|0,(15-p|0)*3|0)|0,Z()|0,M&7){case 1:break t;case 0:break;default:{p=1;break e}}if(p>>>0<_>>>0)p=p+1|0;else{p=1;break e}}for(p=1;;)if(M=(15-p|0)*3|0,y=Mt(A|0,f|0,M|0)|0,Z()|0,T=Dt(7,0,M|0)|0,f=f&~(Z()|0),M=Dt(Uu(y&7)|0,0,M|0)|0,A=A&~T|M,f=f|(Z()|0),p>>>0<_>>>0)p=p+1|0;else{p=1;break}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return mt(f|0),A|0}function ku(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;if(_=Mt(A|0,f|0,52)|0,Z()|0,_=_&15,!_)return p=f,_=A,mt(p|0),_|0;for(p=1;T=(15-p|0)*3|0,M=Mt(A|0,f|0,T|0)|0,Z()|0,y=Dt(7,0,T|0)|0,f=f&~(Z()|0),T=Dt(Uu(M&7)|0,0,T|0)|0,A=T|A&~y,f=Z()|0|f,p>>>0<_>>>0;)p=p+1|0;return mt(f|0),A|0}function Tx(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(U=Mt(A|0,f|0,52)|0,Z()|0,U=U&15,!U)return N=f,U=A,mt(N|0),U|0;for(N=1,p=0;;){T=(15-N|0)*3|0,_=Dt(7,0,T|0)|0,y=Z()|0,M=Mt(A|0,f|0,T|0)|0,Z()|0,T=Dt(rl(M&7)|0,0,T|0)|0,M=Z()|0,A=T|A&~_,f=M|f&~y;e:do if(!p)if((T&_|0)==0&(M&y|0)==0)p=0;else if(_=Mt(A|0,f|0,52)|0,Z()|0,_=_&15,!_)p=1;else{p=1;t:for(;;){switch(M=Mt(A|0,f|0,(15-p|0)*3|0)|0,Z()|0,M&7){case 1:break t;case 0:break;default:{p=1;break e}}if(p>>>0<_>>>0)p=p+1|0;else{p=1;break e}}for(p=1;;)if(y=(15-p|0)*3|0,T=Dt(7,0,y|0)|0,M=f&~(Z()|0),f=Mt(A|0,f|0,y|0)|0,Z()|0,f=Dt(rl(f&7)|0,0,y|0)|0,A=A&~T|f,f=M|(Z()|0),p>>>0<_>>>0)p=p+1|0;else{p=1;break}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return mt(f|0),A|0}function hp(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;if(_=Mt(A|0,f|0,52)|0,Z()|0,_=_&15,!_)return p=f,_=A,mt(p|0),_|0;for(p=1;M=(15-p|0)*3|0,T=Dt(7,0,M|0)|0,y=f&~(Z()|0),f=Mt(A|0,f|0,M|0)|0,Z()|0,f=Dt(rl(f&7)|0,0,M|0)|0,A=f|A&~T,f=Z()|0|y,p>>>0<_>>>0;)p=p+1|0;return mt(f|0),A|0}function Aa(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;if(U=K,K=K+64|0,N=U+40|0,_=U+24|0,y=U+12|0,T=U,Dt(f|0,0,52)|0,p=Z()|0|134225919,!f)return(d[A+4>>2]|0)>2||(d[A+8>>2]|0)>2||(d[A+12>>2]|0)>2?(M=0,N=0,mt(M|0),K=U,N|0):(Dt(Po(A)|0,0,45)|0,M=Z()|0|p,N=-1,mt(M|0),K=U,N|0);if(d[N>>2]=d[A>>2],d[N+4>>2]=d[A+4>>2],d[N+8>>2]=d[A+8>>2],d[N+12>>2]=d[A+12>>2],M=N+4|0,(f|0)>0)for(A=-1;d[_>>2]=d[M>>2],d[_+4>>2]=d[M+4>>2],d[_+8>>2]=d[M+8>>2],f&1?(hx(M),d[y>>2]=d[M>>2],d[y+4>>2]=d[M+4>>2],d[y+8>>2]=d[M+8>>2],Yc(y)):(l1(M),d[y>>2]=d[M>>2],d[y+4>>2]=d[M+4>>2],d[y+8>>2]=d[M+8>>2],Lu(y)),af(_,y,T),Lr(T),H=(15-f|0)*3|0,I=Dt(7,0,H|0)|0,p=p&~(Z()|0),H=Dt(Pu(T)|0,0,H|0)|0,A=H|A&~I,p=Z()|0|p,(f|0)>1;)f=f+-1|0;else A=-1;e:do if((d[M>>2]|0)<=2&&(d[N+8>>2]|0)<=2&&(d[N+12>>2]|0)<=2){if(_=Po(N)|0,f=Dt(_|0,0,45)|0,f=f|A,A=Z()|0|p&-1040385,T=ep(N)|0,!(Bi(_)|0)){if((T|0)<=0)break;for(y=0;;){if(_=Mt(f|0,A|0,52)|0,Z()|0,_=_&15,_)for(p=1;H=(15-p|0)*3|0,N=Mt(f|0,A|0,H|0)|0,Z()|0,I=Dt(7,0,H|0)|0,A=A&~(Z()|0),H=Dt(Uu(N&7)|0,0,H|0)|0,f=f&~I|H,A=A|(Z()|0),p>>>0<_>>>0;)p=p+1|0;if(y=y+1|0,(y|0)==(T|0))break e}}y=Mt(f|0,A|0,52)|0,Z()|0,y=y&15;t:do if(y){p=1;n:for(;;){switch(H=Mt(f|0,A|0,(15-p|0)*3|0)|0,Z()|0,H&7){case 1:break n;case 0:break;default:break t}if(p>>>0<y>>>0)p=p+1|0;else break t}if(Ru(_,d[N>>2]|0)|0)for(p=1;N=(15-p|0)*3|0,I=Dt(7,0,N|0)|0,H=A&~(Z()|0),A=Mt(f|0,A|0,N|0)|0,Z()|0,A=Dt(rl(A&7)|0,0,N|0)|0,f=f&~I|A,A=H|(Z()|0),p>>>0<y>>>0;)p=p+1|0;else for(p=1;H=(15-p|0)*3|0,N=Mt(f|0,A|0,H|0)|0,Z()|0,I=Dt(7,0,H|0)|0,A=A&~(Z()|0),H=Dt(Uu(N&7)|0,0,H|0)|0,f=f&~I|H,A=A|(Z()|0),p>>>0<y>>>0;)p=p+1|0}while(!1);if((T|0)>0){p=0;do f=cp(f,A)|0,A=Z()|0,p=p+1|0;while((p|0)!=(T|0))}}else f=0,A=0;while(!1);return I=A,H=f,mt(I|0),K=U,H|0}function Ss(A){return A=A|0,(A|0)%2|0|0}function PA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;return y=K,K=K+16|0,_=y,f>>>0>15?(_=4,K=y,_|0):(d[A+4>>2]&2146435072|0)==2146435072||(d[A+8+4>>2]&2146435072|0)==2146435072?(_=3,K=y,_|0):(_x(A,f,_),f=Aa(_,f)|0,_=Z()|0,d[p>>2]=f,d[p+4>>2]=_,(f|0)==0&(_|0)==0&&Bt(27795,27122,1050,27145),_=0,K=y,_|0)}function LA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;if(y=p+4|0,T=Mt(A|0,f|0,52)|0,Z()|0,T=T&15,M=Mt(A|0,f|0,45)|0,Z()|0,_=(T|0)==0,Bi(M&127)|0){if(_)return M=1,M|0;_=1}else{if(_)return M=0,M|0;(d[y>>2]|0)==0&&(d[p+8>>2]|0)==0?_=(d[p+12>>2]|0)!=0&1:_=1}for(p=1;p&1?Yc(y):Lu(y),M=Mt(A|0,f|0,(15-p|0)*3|0)|0,Z()|0,u1(y,M&7),p>>>0<T>>>0;)p=p+1|0;return _|0}function zu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;if(H=K,K=K+16|0,U=H,I=Mt(A|0,f|0,45)|0,Z()|0,I=I&127,I>>>0>121)return d[p>>2]=0,d[p+4>>2]=0,d[p+8>>2]=0,d[p+12>>2]=0,I=5,K=H,I|0;e:do if((Bi(I)|0)!=0&&(T=Mt(A|0,f|0,52)|0,Z()|0,T=T&15,(T|0)!=0)){_=1;t:for(;;){switch(N=Mt(A|0,f|0,(15-_|0)*3|0)|0,Z()|0,N&7){case 5:break t;case 0:break;default:{_=f;break e}}if(_>>>0<T>>>0)_=_+1|0;else{_=f;break e}}for(y=1,_=f;f=(15-y|0)*3|0,M=Dt(7,0,f|0)|0,N=_&~(Z()|0),_=Mt(A|0,_|0,f|0)|0,Z()|0,_=Dt(rl(_&7)|0,0,f|0)|0,A=A&~M|_,_=N|(Z()|0),y>>>0<T>>>0;)y=y+1|0}else _=f;while(!1);if(N=7696+(I*28|0)|0,d[p>>2]=d[N>>2],d[p+4>>2]=d[N+4>>2],d[p+8>>2]=d[N+8>>2],d[p+12>>2]=d[N+12>>2],!(LA(A,_,p)|0))return I=0,K=H,I|0;if(M=p+4|0,d[U>>2]=d[M>>2],d[U+4>>2]=d[M+4>>2],d[U+8>>2]=d[M+8>>2],T=Mt(A|0,_|0,52)|0,Z()|0,N=T&15,T&1?(Lu(M),T=N+1|0):T=N,!(Bi(I)|0))_=0;else{e:do if(!N)_=0;else for(f=1;;){if(y=Mt(A|0,_|0,(15-f|0)*3|0)|0,Z()|0,y=y&7,y|0){_=y;break e}if(f>>>0<N>>>0)f=f+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(Ou(p,T,_,0)|0))(T|0)!=(N|0)&&(d[M>>2]=d[U>>2],d[M+4>>2]=d[U+4>>2],d[M+8>>2]=d[U+8>>2]);else{if(Bi(I)|0)do;while((Ou(p,T,0,0)|0)!=0);(T|0)!=(N|0)&&l1(M)}return I=0,K=H,I|0}function Ol(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;return T=K,K=K+16|0,_=T,y=zu(A,f,_)|0,y|0?(K=T,y|0):(y=Mt(A|0,f|0,52)|0,Z()|0,of(_,y&15,p),y=0,K=T,y|0)}function Il(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0;if(M=K,K=K+16|0,T=M,_=zu(A,f,T)|0,_|0)return T=_,K=M,T|0;_=Mt(A|0,f|0,45)|0,Z()|0,_=(Bi(_&127)|0)==0,y=Mt(A|0,f|0,52)|0,Z()|0,y=y&15;e:do if(!_){if(y|0)for(_=1;;){if(N=Dt(7,0,(15-_|0)*3|0)|0,!((N&A|0)==0&((Z()|0)&f|0)==0))break e;if(_>>>0<y>>>0)_=_+1|0;else break}return sp(T,y,0,5,p),N=0,K=M,N|0}while(!1);return RA(T,y,0,6,p),N=0,K=M,N|0}function wx(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(y=Mt(A|0,f|0,45)|0,Z()|0,!(Bi(y&127)|0))return y=2,d[p>>2]=y,0;if(y=Mt(A|0,f|0,52)|0,Z()|0,y=y&15,!y)return y=5,d[p>>2]=y,0;for(_=1;;){if(T=Dt(7,0,(15-_|0)*3|0)|0,!((T&A|0)==0&((Z()|0)&f|0)==0)){_=2,A=6;break}if(_>>>0<y>>>0)_=_+1|0;else{_=5,A=6;break}}return(A|0)==6&&(d[p>>2]=_),0}function Gu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0;ie=K,K=K+128|0,I=ie+112|0,T=ie+96|0,H=ie,y=Mt(A|0,f|0,52)|0,Z()|0,N=y&15,d[I>>2]=N,M=Mt(A|0,f|0,45)|0,Z()|0,M=M&127;e:do if(Bi(M)|0){if(N|0)for(_=1;;){if(U=Dt(7,0,(15-_|0)*3|0)|0,!((U&A|0)==0&((Z()|0)&f|0)==0)){y=0;break e}if(_>>>0<N>>>0)_=_+1|0;else break}if(y&1)y=1;else return U=Dt(N+1|0,0,52)|0,H=Z()|0|f&-15728641,I=Dt(7,0,(14-N|0)*3|0)|0,H=Gu((U|A)&~I,H&~(Z()|0),p)|0,K=ie,H|0}else y=0;while(!1);if(_=zu(A,f,T)|0,!_){y?(ap(T,I,H),U=5):(op(T,I,H),U=6);e:do if(Bi(M)|0)if(!N)A=5;else for(_=1;;){if(M=Dt(7,0,(15-_|0)*3|0)|0,!((M&A|0)==0&((Z()|0)&f|0)==0)){A=2;break e}if(_>>>0<N>>>0)_=_+1|0;else{A=5;break}}else A=2;while(!1);uo(p|0,-1,A<<2|0)|0;e:do if(y)for(T=0;;){if(M=H+(T<<4)|0,m1(M,d[I>>2]|0)|0,M=d[M>>2]|0,N=d[p>>2]|0,(N|0)==-1|(N|0)==(M|0))_=p;else{y=0;do{if(y=y+1|0,y>>>0>=A>>>0){_=1;break e}_=p+(y<<2)|0,N=d[_>>2]|0}while(!((N|0)==-1|(N|0)==(M|0)))}if(d[_>>2]=M,T=T+1|0,T>>>0>=U>>>0){_=0;break}}else for(T=0;;){if(M=H+(T<<4)|0,Ou(M,d[I>>2]|0,0,1)|0,M=d[M>>2]|0,N=d[p>>2]|0,(N|0)==-1|(N|0)==(M|0))_=p;else{y=0;do{if(y=y+1|0,y>>>0>=A>>>0){_=1;break e}_=p+(y<<2)|0,N=d[_>>2]|0}while(!((N|0)==-1|(N|0)==(M|0)))}if(d[_>>2]=M,T=T+1|0,T>>>0>=U>>>0){_=0;break}}while(!1)}return H=_,K=ie,H|0}function fp(){return 12}function qu(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(A>>>0>15)return N=4,N|0;if(Dt(A|0,0,52)|0,N=Z()|0|134225919,!A){p=0,_=0;do Bi(_)|0&&(Dt(_|0,0,45)|0,M=N|(Z()|0),A=f+(p<<3)|0,d[A>>2]=-1,d[A+4>>2]=M,p=p+1|0),_=_+1|0;while((_|0)!=122);return p=0,p|0}p=0,M=0;do{if(Bi(M)|0){for(Dt(M|0,0,45)|0,_=1,y=-1,T=N|(Z()|0);U=Dt(7,0,(15-_|0)*3|0)|0,y=y&~U,T=T&~(Z()|0),(_|0)!=(A|0);)_=_+1|0;U=f+(p<<3)|0,d[U>>2]=y,d[U+4>>2]=T,p=p+1|0}M=M+1|0}while((M|0)!=122);return p=0,p|0}function Ap(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0;if(qe=K,K=K+16|0,Ie=qe,Ye=Mt(A|0,f|0,52)|0,Z()|0,Ye=Ye&15,p>>>0>15)return Ye=4,K=qe,Ye|0;if((Ye|0)<(p|0))return Ye=12,K=qe,Ye|0;if((Ye|0)!=(p|0))if(T=Dt(p|0,0,52)|0,T=T|A,N=Z()|0|f&-15728641,(Ye|0)>(p|0)){U=p;do Pe=Dt(7,0,(14-U|0)*3|0)|0,U=U+1|0,T=Pe|T,N=Z()|0|N;while((U|0)<(Ye|0));Pe=T}else Pe=T;else Pe=A,N=f;ve=Mt(Pe|0,N|0,45)|0,Z()|0;e:do if(Bi(ve&127)|0){if(U=Mt(Pe|0,N|0,52)|0,Z()|0,U=U&15,U|0)for(T=1;;){if(ve=Dt(7,0,(15-T|0)*3|0)|0,!((ve&Pe|0)==0&((Z()|0)&N|0)==0)){I=33;break e}if(T>>>0<U>>>0)T=T+1|0;else break}if(ve=_,d[ve>>2]=0,d[ve+4>>2]=0,(Ye|0)>(p|0)){for(ve=f&-15728641,Ae=Ye;;){if(ge=Ae,Ae=Ae+-1|0,Ae>>>0>15|(Ye|0)<(Ae|0)){I=19;break}if((Ye|0)!=(Ae|0))if(T=Dt(Ae|0,0,52)|0,T=T|A,U=Z()|0|ve,(Ye|0)<(ge|0))ie=T;else{I=Ae;do ie=Dt(7,0,(14-I|0)*3|0)|0,I=I+1|0,T=ie|T,U=Z()|0|U;while((I|0)<(Ye|0));ie=T}else ie=A,U=f;if(H=Mt(ie|0,U|0,45)|0,Z()|0,!(Bi(H&127)|0))T=0;else{H=Mt(ie|0,U|0,52)|0,Z()|0,H=H&15;t:do if(!H)T=0;else for(I=1;;){if(T=Mt(ie|0,U|0,(15-I|0)*3|0)|0,Z()|0,T=T&7,T|0)break t;if(I>>>0<H>>>0)I=I+1|0;else{T=0;break}}while(!1);T=(T|0)==0&1}if(U=Mt(A|0,f|0,(15-ge|0)*3|0)|0,Z()|0,U=U&7,(U|0)==7){y=5,I=42;break}if(T=(T|0)!=0,(U|0)==1&T){y=5,I=42;break}if(ie=U+(((U|0)!=0&T)<<31>>31)|0,ie|0&&(I=Ye-ge|0,I=Bo(7,0,I,((I|0)<0)<<31>>31)|0,H=Z()|0,T?(T=fr(I|0,H|0,5,0)|0,T=Qt(T|0,Z()|0,-5,-1)|0,T=ko(T|0,Z()|0,6,0)|0,T=Qt(T|0,Z()|0,1,0)|0,U=Z()|0):(T=I,U=H),ge=ie+-1|0,ge=fr(I|0,H|0,ge|0,((ge|0)<0)<<31>>31|0)|0,ge=Qt(T|0,U|0,ge|0,Z()|0)|0,ie=Z()|0,H=_,H=Qt(ge|0,ie|0,d[H>>2]|0,d[H+4>>2]|0)|0,ie=Z()|0,ge=_,d[ge>>2]=H,d[ge+4>>2]=ie),(Ae|0)<=(p|0)){I=37;break}}if((I|0)==19)Bt(27795,27122,1367,27158);else if((I|0)==37){M=_,y=d[M+4>>2]|0,M=d[M>>2]|0;break}else if((I|0)==42)return K=qe,y|0}else y=0,M=0}else I=33;while(!1);e:do if((I|0)==33)if(ve=_,d[ve>>2]=0,d[ve+4>>2]=0,(Ye|0)>(p|0)){for(T=Ye;;){if(y=Mt(A|0,f|0,(15-T|0)*3|0)|0,Z()|0,y=y&7,(y|0)==7){y=5;break}if(M=Ye-T|0,M=Bo(7,0,M,((M|0)<0)<<31>>31)|0,y=fr(M|0,Z()|0,y|0,0)|0,M=Z()|0,ve=_,M=Qt(d[ve>>2]|0,d[ve+4>>2]|0,y|0,M|0)|0,y=Z()|0,ve=_,d[ve>>2]=M,d[ve+4>>2]=y,T=T+-1|0,(T|0)<=(p|0))break e}return K=qe,y|0}else y=0,M=0;while(!1);return lf(Pe,N,Ye,Ie)|0&&Bt(27795,27122,1327,27173),Ye=Ie,Ie=d[Ye+4>>2]|0,((y|0)>-1|(y|0)==-1&M>>>0>4294967295)&((Ie|0)>(y|0)|((Ie|0)==(y|0)?(d[Ye>>2]|0)>>>0>M>>>0:0))?(Ye=0,K=qe,Ye|0):(Bt(27795,27122,1407,27158),0)}function S1(A,f,p,_,y,T){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0;var M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0;if(ie=K,K=K+16|0,M=ie,y>>>0>15)return T=4,K=ie,T|0;if(N=Mt(p|0,_|0,52)|0,Z()|0,N=N&15,(N|0)>(y|0))return T=12,K=ie,T|0;if(lf(p,_,y,M)|0&&Bt(27795,27122,1327,27173),H=M,I=d[H+4>>2]|0,!(((f|0)>-1|(f|0)==-1&A>>>0>4294967295)&((I|0)>(f|0)|((I|0)==(f|0)?(d[H>>2]|0)>>>0>A>>>0:0))))return T=2,K=ie,T|0;H=y-N|0,y=Dt(y|0,0,52)|0,U=Z()|0|_&-15728641,I=T,d[I>>2]=y|p,d[I+4>>2]=U,I=Mt(p|0,_|0,45)|0,Z()|0;e:do if(Bi(I&127)|0){if(N|0)for(M=1;;){if(I=Dt(7,0,(15-M|0)*3|0)|0,!((I&p|0)==0&((Z()|0)&_|0)==0))break e;if(M>>>0<N>>>0)M=M+1|0;else break}if((H|0)<1)return T=0,K=ie,T|0;for(I=N^15,_=-1,U=1,M=1;;){N=H-U|0,N=Bo(7,0,N,((N|0)<0)<<31>>31)|0,p=Z()|0;do if(M)if(M=fr(N|0,p|0,5,0)|0,M=Qt(M|0,Z()|0,-5,-1)|0,M=ko(M|0,Z()|0,6,0)|0,y=Z()|0,(f|0)>(y|0)|(f|0)==(y|0)&A>>>0>M>>>0){f=Qt(A|0,f|0,-1,-1)|0,f=Ur(f|0,Z()|0,M|0,y|0)|0,M=Z()|0,ge=T,ve=d[ge>>2]|0,ge=d[ge+4>>2]|0,Pe=(I+_|0)*3|0,Ae=Dt(7,0,Pe|0)|0,ge=ge&~(Z()|0),_=ko(f|0,M|0,N|0,p|0)|0,A=Z()|0,y=Qt(_|0,A|0,2,0)|0,Pe=Dt(y|0,Z()|0,Pe|0)|0,ge=Z()|0|ge,y=T,d[y>>2]=Pe|ve&~Ae,d[y+4>>2]=ge,A=fr(_|0,A|0,N|0,p|0)|0,A=Ur(f|0,M|0,A|0,Z()|0)|0,M=0,f=Z()|0;break}else{Pe=T,Ae=d[Pe>>2]|0,Pe=d[Pe+4>>2]|0,ve=Dt(7,0,(I+_|0)*3|0)|0,Pe=Pe&~(Z()|0),M=T,d[M>>2]=Ae&~ve,d[M+4>>2]=Pe,M=1;break}else Ae=T,y=d[Ae>>2]|0,Ae=d[Ae+4>>2]|0,_=(I+_|0)*3|0,ge=Dt(7,0,_|0)|0,Ae=Ae&~(Z()|0),Pe=ko(A|0,f|0,N|0,p|0)|0,M=Z()|0,_=Dt(Pe|0,M|0,_|0)|0,Ae=Z()|0|Ae,ve=T,d[ve>>2]=_|y&~ge,d[ve+4>>2]=Ae,M=fr(Pe|0,M|0,N|0,p|0)|0,A=Ur(A|0,f|0,M|0,Z()|0)|0,M=0,f=Z()|0;while(!1);if((H|0)>(U|0))_=~U,U=U+1|0;else{f=0;break}}return K=ie,f|0}while(!1);if((H|0)<1)return Pe=0,K=ie,Pe|0;for(y=N^15,M=1;;)if(ve=H-M|0,ve=Bo(7,0,ve,((ve|0)<0)<<31>>31)|0,Pe=Z()|0,U=T,p=d[U>>2]|0,U=d[U+4>>2]|0,N=(y-M|0)*3|0,_=Dt(7,0,N|0)|0,U=U&~(Z()|0),ge=ko(A|0,f|0,ve|0,Pe|0)|0,Ae=Z()|0,N=Dt(ge|0,Ae|0,N|0)|0,U=Z()|0|U,I=T,d[I>>2]=N|p&~_,d[I+4>>2]=U,Pe=fr(ge|0,Ae|0,ve|0,Pe|0)|0,A=Ur(A|0,f|0,Pe|0,Z()|0)|0,f=Z()|0,(H|0)<=(M|0)){f=0;break}else M=M+1|0;return K=ie,f|0}function sl(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;y=Mt(f|0,p|0,52)|0,Z()|0,y=y&15,(f|0)==0&(p|0)==0|((_|0)>15|(y|0)>(_|0))?(T=-1,f=-1,p=0,y=0):(f=lp(f,p,y+1|0,_)|0,M=(Z()|0)&-15728641,p=Dt(_|0,0,52)|0,p=f|p,M=M|(Z()|0),f=(Ci(p,M)|0)==0,T=y,f=f?-1:_,y=M),M=A,d[M>>2]=p,d[M+4>>2]=y,d[A+8>>2]=T,d[A+12>>2]=f}function Vu(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;if(y=Mt(A|0,f|0,52)|0,Z()|0,y=y&15,T=_+8|0,d[T>>2]=y,(A|0)==0&(f|0)==0|((p|0)>15|(y|0)>(p|0))){p=_,d[p>>2]=0,d[p+4>>2]=0,d[T>>2]=-1,d[_+12>>2]=-1;return}if(A=lp(A,f,y+1|0,p)|0,T=(Z()|0)&-15728641,y=Dt(p|0,0,52)|0,y=A|y,T=T|(Z()|0),A=_,d[A>>2]=y,d[A+4>>2]=T,A=_+12|0,Ci(y,T)|0){d[A>>2]=p;return}else{d[A>>2]=-1;return}}function uf(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0;if(p=A,f=d[p>>2]|0,p=d[p+4>>2]|0,!((f|0)==0&(p|0)==0)&&(_=Mt(f|0,p|0,52)|0,Z()|0,_=_&15,N=Dt(1,0,(_^15)*3|0)|0,f=Qt(N|0,Z()|0,f|0,p|0)|0,p=Z()|0,N=A,d[N>>2]=f,d[N+4>>2]=p,N=A+8|0,M=d[N>>2]|0,!((_|0)<(M|0)))){for(U=A+12|0,T=_;;){if((T|0)==(M|0)){_=5;break}if(I=(T|0)==(d[U>>2]|0),y=(15-T|0)*3|0,_=Mt(f|0,p|0,y|0)|0,Z()|0,_=_&7,I&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(I=Dt(1,0,y|0)|0,f=Qt(f|0,p|0,I|0,Z()|0)|0,p=Z()|0,I=A,d[I>>2]=f,d[I+4>>2]=p,(T|0)>(M|0))T=T+-1|0;else{_=10;break}}if((_|0)==5){I=A,d[I>>2]=0,d[I+4>>2]=0,d[N>>2]=-1,d[U>>2]=-1;return}else if((_|0)==7){M=Dt(1,0,y|0)|0,M=Qt(f|0,p|0,M|0,Z()|0)|0,N=Z()|0,I=A,d[I>>2]=M,d[I+4>>2]=N,d[U>>2]=T+-1;return}else if((_|0)==10)return}}function Kc(A){A=+A;var f=0;return f=A<0?A+6.283185307179586:A,+(A>=6.283185307179586?f+-6.283185307179586:f)}function Ea(A,f){return A=A|0,f=f|0,+un(+(+J[A>>3]-+J[f>>3]))<17453292519943298e-27?(f=+un(+(+J[A+8>>3]-+J[f+8>>3]))<17453292519943298e-27,f|0):(f=0,f|0)}function Xs(A,f){switch(A=+A,f=f|0,f|0){case 1:{A=A<0?A+6.283185307179586:A;break}case 2:{A=A>0?A+-6.283185307179586:A;break}}return+A}function T1(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=+J[f>>3],_=+J[A>>3],T=+Fn(+((y-_)*.5)),p=+Fn(+((+J[f+8>>3]-+J[A+8>>3])*.5)),p=T*T+p*(+li(+y)*+li(+_)*p),+(+Fe(+ +qn(+p),+ +qn(+(1-p)))*2)}function Zc(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=+J[f>>3],_=+J[A>>3],T=+Fn(+((y-_)*.5)),p=+Fn(+((+J[f+8>>3]-+J[A+8>>3])*.5)),p=T*T+p*(+li(+y)*+li(+_)*p),+(+Fe(+ +qn(+p),+ +qn(+(1-p)))*2*6371.007180918475)}function Mx(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=+J[f>>3],_=+J[A>>3],T=+Fn(+((y-_)*.5)),p=+Fn(+((+J[f+8>>3]-+J[A+8>>3])*.5)),p=T*T+p*(+li(+y)*+li(+_)*p),+(+Fe(+ +qn(+p),+ +qn(+(1-p)))*2*6371.007180918475*1e3)}function Ex(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0;return T=+J[f>>3],_=+li(+T),y=+J[f+8>>3]-+J[A+8>>3],M=_*+Fn(+y),p=+J[A>>3],+ +Fe(+M,+(+Fn(+T)*+li(+p)-+li(+y)*(_*+Fn(+p))))}function Cx(A,f,p,_){A=A|0,f=+f,p=+p,_=_|0;var y=0,T=0,M=0,N=0;if(p<1e-16){d[_>>2]=d[A>>2],d[_+4>>2]=d[A+4>>2],d[_+8>>2]=d[A+8>>2],d[_+12>>2]=d[A+12>>2];return}T=f<0?f+6.283185307179586:f,T=f>=6.283185307179586?T+-6.283185307179586:T;do if(T<1e-16)f=+J[A>>3]+p,J[_>>3]=f,y=_;else{if(y=+un(+(T+-3.141592653589793))<1e-16,f=+J[A>>3],y){f=f-p,J[_>>3]=f,y=_;break}if(M=+li(+p),p=+Fn(+p),f=M*+Fn(+f)+ +li(+T)*(p*+li(+f)),f=f>1?1:f,f=+Ul(+(f<-1?-1:f)),J[_>>3]=f,+un(+(f+-1.5707963267948966))<1e-16){J[_>>3]=1.5707963267948966,J[_+8>>3]=0;return}if(+un(+(f+1.5707963267948966))<1e-16){J[_>>3]=-1.5707963267948966,J[_+8>>3]=0;return}if(N=1/+li(+f),T=p*+Fn(+T)*N,p=+J[A>>3],f=N*((M-+Fn(+f)*+Fn(+p))/+li(+p)),M=T>1?1:T,f=f>1?1:f,f=+J[A+8>>3]+ +Fe(+(M<-1?-1:M),+(f<-1?-1:f)),f>3.141592653589793)do f=f+-6.283185307179586;while(f>3.141592653589793);if(f<-3.141592653589793)do f=f+6.283185307179586;while(f<-3.141592653589793);J[_+8>>3]=f;return}while(!1);if(+un(+(f+-1.5707963267948966))<1e-16){J[y>>3]=1.5707963267948966,J[_+8>>3]=0;return}if(+un(+(f+1.5707963267948966))<1e-16){J[y>>3]=-1.5707963267948966,J[_+8>>3]=0;return}if(f=+J[A+8>>3],f>3.141592653589793)do f=f+-6.283185307179586;while(f>3.141592653589793);if(f<-3.141592653589793)do f=f+6.283185307179586;while(f<-3.141592653589793);J[_+8>>3]=f}function dp(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(J[f>>3]=+J[20656+(A<<3)>>3],f=0,f|0)}function w1(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(J[f>>3]=+J[20784+(A<<3)>>3],f=0,f|0)}function pp(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(J[f>>3]=+J[20912+(A<<3)>>3],f=0,f|0)}function oo(A,f){return A=A|0,f=f|0,A>>>0>15?(f=4,f|0):(J[f>>3]=+J[21040+(A<<3)>>3],f=0,f|0)}function Hu(A,f){A=A|0,f=f|0;var p=0;return A>>>0>15?(f=4,f|0):(p=Bo(7,0,A,((A|0)<0)<<31>>31)|0,p=fr(p|0,Z()|0,120,0)|0,A=Z()|0,d[f>>2]=p|2,d[f+4>>2]=A,f=0,f|0)}function da(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0;return ge=+J[f>>3],H=+J[A>>3],U=+Fn(+((ge-H)*.5)),T=+J[f+8>>3],I=+J[A+8>>3],M=+Fn(+((T-I)*.5)),N=+li(+H),ie=+li(+ge),M=U*U+M*(ie*N*M),M=+Fe(+ +qn(+M),+ +qn(+(1-M)))*2,U=+J[p>>3],ge=+Fn(+((U-ge)*.5)),_=+J[p+8>>3],T=+Fn(+((_-T)*.5)),y=+li(+U),T=ge*ge+T*(ie*y*T),T=+Fe(+ +qn(+T),+ +qn(+(1-T)))*2,U=+Fn(+((H-U)*.5)),_=+Fn(+((I-_)*.5)),_=U*U+_*(N*y*_),_=+Fe(+ +qn(+_),+ +qn(+(1-_)))*2,y=(M+T+_)*.5,+(+oe(+ +qn(+(+cs(+(y*.5))*+cs(+((y-M)*.5))*+cs(+((y-T)*.5))*+cs(+((y-_)*.5)))))*4)}function Fl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0;if(N=K,K=K+192|0,T=N+168|0,M=N,y=Ol(A,f,T)|0,y|0)return p=y,K=N,p|0;if(Il(A,f,M)|0&&Bt(27795,27190,415,27199),f=d[M>>2]|0,(f|0)>0){if(_=+da(M+8|0,M+8+(((f|0)!=1&1)<<4)|0,T)+0,(f|0)!=1){A=1;do y=A,A=A+1|0,_=_+ +da(M+8+(y<<4)|0,M+8+(((A|0)%(f|0)|0)<<4)|0,T);while((A|0)<(f|0))}}else _=0;return J[p>>3]=_,p=0,K=N,p|0}function mp(A,f,p){return A=A|0,f=f|0,p=p|0,A=Fl(A,f,p)|0,A|0||(J[p>>3]=+J[p>>3]*6371.007180918475*6371.007180918475),A|0}function UA(A,f,p){return A=A|0,f=f|0,p=p|0,A=Fl(A,f,p)|0,A|0||(J[p>>3]=+J[p>>3]*6371.007180918475*6371.007180918475*1e3*1e3),A|0}function BA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;if(N=K,K=K+176|0,M=N,A=CA(A,f,M)|0,A|0)return M=A,K=N,M|0;if(J[p>>3]=0,A=d[M>>2]|0,(A|0)<=1)return M=0,K=N,M|0;f=A+-1|0,A=0,_=+J[M+8>>3],y=+J[M+16>>3],T=0;do A=A+1|0,I=_,_=+J[M+8+(A<<4)>>3],H=+Fn(+((_-I)*.5)),U=y,y=+J[M+8+(A<<4)+8>>3],U=+Fn(+((y-U)*.5)),U=H*H+U*(+li(+_)*+li(+I)*U),T=T+ +Fe(+ +qn(+U),+ +qn(+(1-U)))*2;while((A|0)<(f|0));return J[p>>3]=T,M=0,K=N,M|0}function gp(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;if(N=K,K=K+176|0,M=N,A=CA(A,f,M)|0,A|0)return M=A,T=+J[p>>3],T=T*6371.007180918475,J[p>>3]=T,K=N,M|0;if(J[p>>3]=0,A=d[M>>2]|0,(A|0)<=1)return M=0,T=0,T=T*6371.007180918475,J[p>>3]=T,K=N,M|0;f=A+-1|0,A=0,_=+J[M+8>>3],y=+J[M+16>>3],T=0;do A=A+1|0,I=_,_=+J[M+8+(A<<4)>>3],H=+Fn(+((_-I)*.5)),U=y,y=+J[M+8+(A<<4)+8>>3],U=+Fn(+((y-U)*.5)),U=H*H+U*(+li(+I)*+li(+_)*U),T=T+ +Fe(+ +qn(+U),+ +qn(+(1-U)))*2;while((A|0)!=(f|0));return J[p>>3]=T,M=0,H=T,H=H*6371.007180918475,J[p>>3]=H,K=N,M|0}function ju(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;if(N=K,K=K+176|0,M=N,A=CA(A,f,M)|0,A|0)return M=A,T=+J[p>>3],T=T*6371.007180918475,T=T*1e3,J[p>>3]=T,K=N,M|0;if(J[p>>3]=0,A=d[M>>2]|0,(A|0)<=1)return M=0,T=0,T=T*6371.007180918475,T=T*1e3,J[p>>3]=T,K=N,M|0;f=A+-1|0,A=0,_=+J[M+8>>3],y=+J[M+16>>3],T=0;do A=A+1|0,I=_,_=+J[M+8+(A<<4)>>3],H=+Fn(+((_-I)*.5)),U=y,y=+J[M+8+(A<<4)+8>>3],U=+Fn(+((y-U)*.5)),U=H*H+U*(+li(+I)*+li(+_)*U),T=T+ +Fe(+ +qn(+U),+ +qn(+(1-U)))*2;while((A|0)!=(f|0));return J[p>>3]=T,M=0,H=T,H=H*6371.007180918475,H=H*1e3,J[p>>3]=H,K=N,M|0}function M1(A){A=A|0;var f=0,p=0,_=0;return f=Ks(1,12)|0,f||Bt(27280,27235,49,27293),p=A+4|0,_=d[p>>2]|0,_|0?(_=_+8|0,d[_>>2]=f,d[p>>2]=f,f|0):(d[A>>2]|0&&Bt(27310,27235,61,27333),_=A,d[_>>2]=f,d[p>>2]=f,f|0)}function OA(A,f){A=A|0,f=f|0;var p=0,_=0;return _=Fo(24)|0,_||Bt(27347,27235,78,27361),d[_>>2]=d[f>>2],d[_+4>>2]=d[f+4>>2],d[_+8>>2]=d[f+8>>2],d[_+12>>2]=d[f+12>>2],d[_+16>>2]=0,f=A+4|0,p=d[f>>2]|0,p|0?(d[p+16>>2]=_,d[f>>2]=_,_|0):(d[A>>2]|0&&Bt(27376,27235,82,27361),d[A>>2]=_,d[f>>2]=_,_|0)}function Wu(A){A=A|0;var f=0,p=0,_=0,y=0;if(A)for(_=1;;){if(f=d[A>>2]|0,f|0)do{if(p=d[f>>2]|0,p|0)do y=p,p=d[p+16>>2]|0,An(y);while((p|0)!=0);y=f,f=d[f+8>>2]|0,An(y)}while((f|0)!=0);if(f=A,A=d[A+8>>2]|0,_||An(f),A)_=0;else break}}function Rx(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0,sn=0,tn=0,Bn=0,En=0,Qn=0,Tn=0,on=0,Ut=0,vn=0,ii=0,wn=0;if(y=A+8|0,d[y>>2]|0)return wn=1,wn|0;if(_=d[A>>2]|0,!_)return wn=0,wn|0;f=_,p=0;do p=p+1|0,f=d[f+8>>2]|0;while((f|0)!=0);if(p>>>0<2)return wn=0,wn|0;vn=Fo(p<<2)|0,vn||Bt(27396,27235,317,27415),Ut=Fo(p<<5)|0,Ut||Bt(27437,27235,321,27415),d[A>>2]=0,sn=A+4|0,d[sn>>2]=0,d[y>>2]=0,p=0,on=0,Lt=0,ie=0;e:for(;;){if(H=d[_>>2]|0,H){T=0,M=H;do{if(U=+J[M+8>>3],f=M,M=d[M+16>>2]|0,I=(M|0)==0,y=I?H:M,N=+J[y+8>>3],+un(+(U-N))>3.141592653589793){wn=14;break}T=T+(N-U)*(+J[f>>3]+ +J[y>>3])}while(!I);if((wn|0)==14){wn=0,T=0,f=H;do Le=+J[f+8>>3],Tn=f+16|0,Qn=d[Tn>>2]|0,Qn=(Qn|0)==0?H:Qn,Ge=+J[Qn+8>>3],T=T+(+J[f>>3]+ +J[Qn>>3])*((Ge<0?Ge+6.283185307179586:Ge)-(Le<0?Le+6.283185307179586:Le)),f=d[((f|0)==0?_:Tn)>>2]|0;while((f|0)!=0)}T>0?(d[vn+(on<<2)>>2]=_,on=on+1|0,y=Lt,f=ie):wn=19}else wn=19;if((wn|0)==19){wn=0;do if(p){if(f=p+8|0,d[f>>2]|0){wn=21;break e}if(p=Ks(1,12)|0,!p){wn=23;break e}d[f>>2]=p,y=p+4|0,M=p,f=ie}else if(ie){y=sn,M=ie+8|0,f=_,p=A;break}else if(d[A>>2]|0){wn=27;break e}else{y=sn,M=A,f=_,p=A;break}while(!1);if(d[M>>2]=_,d[y>>2]=_,M=Ut+(Lt<<5)|0,I=d[_>>2]|0,I){for(H=Ut+(Lt<<5)+8|0,J[H>>3]=17976931348623157e292,ie=Ut+(Lt<<5)+24|0,J[ie>>3]=17976931348623157e292,J[M>>3]=-17976931348623157e292,ge=Ut+(Lt<<5)+16|0,J[ge>>3]=-17976931348623157e292,Ye=17976931348623157e292,qe=-17976931348623157e292,y=0,Ae=I,U=17976931348623157e292,Pe=17976931348623157e292,Ie=-17976931348623157e292,N=-17976931348623157e292;T=+J[Ae>>3],Le=+J[Ae+8>>3],Ae=d[Ae+16>>2]|0,ve=(Ae|0)==0,Ge=+J[(ve?I:Ae)+8>>3],T<U&&(J[H>>3]=T,U=T),Le<Pe&&(J[ie>>3]=Le,Pe=Le),T>Ie?J[M>>3]=T:T=Ie,Le>N&&(J[ge>>3]=Le,N=Le),Ye=Le>0&Le<Ye?Le:Ye,qe=Le<0&Le>qe?Le:qe,y=y|+un(+(Le-Ge))>3.141592653589793,!ve;)Ie=T;y&&(J[ge>>3]=qe,J[ie>>3]=Ye)}else d[M>>2]=0,d[M+4>>2]=0,d[M+8>>2]=0,d[M+12>>2]=0,d[M+16>>2]=0,d[M+20>>2]=0,d[M+24>>2]=0,d[M+28>>2]=0;y=Lt+1|0}if(Tn=_+8|0,_=d[Tn>>2]|0,d[Tn>>2]=0,_)Lt=y,ie=f;else{wn=45;break}}if((wn|0)==21)Bt(27213,27235,35,27247);else if((wn|0)==23)Bt(27267,27235,37,27247);else if((wn|0)==27)Bt(27310,27235,61,27333);else if((wn|0)==45){e:do if((on|0)>0){for(Tn=(y|0)==0,En=y<<2,Qn=(A|0)==0,Bn=0,f=0;;){if(tn=d[vn+(Bn<<2)>>2]|0,Tn)wn=73;else{if(Lt=Fo(En)|0,!Lt){wn=50;break}if(sn=Fo(En)|0,!sn){wn=52;break}t:do if(Qn)p=0;else{for(y=0,p=0,M=A;_=Ut+(y<<5)|0,Ys(d[M>>2]|0,_,d[tn>>2]|0)|0?(d[Lt+(p<<2)>>2]=M,d[sn+(p<<2)>>2]=_,ve=p+1|0):ve=p,M=d[M+8>>2]|0,M;)y=y+1|0,p=ve;if((ve|0)>0)if(_=d[Lt>>2]|0,(ve|0)==1)p=_;else for(ge=0,Ae=-1,p=_,ie=_;;){for(I=d[ie>>2]|0,_=0,M=0;y=d[d[Lt+(M<<2)>>2]>>2]|0,(y|0)==(I|0)?H=_:H=_+((Ys(y,d[sn+(M<<2)>>2]|0,d[I>>2]|0)|0)&1)|0,M=M+1|0,(M|0)!=(ve|0);)_=H;if(y=(H|0)>(Ae|0),p=y?ie:p,_=ge+1|0,(_|0)==(ve|0))break t;ge=_,Ae=y?H:Ae,ie=d[Lt+(_<<2)>>2]|0}else p=0}while(!1);if(An(Lt),An(sn),p){if(y=p+4|0,_=d[y>>2]|0,_)p=_+8|0;else if(d[p>>2]|0){wn=70;break}d[p>>2]=tn,d[y>>2]=tn}else wn=73}if((wn|0)==73){if(wn=0,f=d[tn>>2]|0,f|0)do sn=f,f=d[f+16>>2]|0,An(sn);while((f|0)!=0);An(tn),f=1}if(Bn=Bn+1|0,(Bn|0)>=(on|0)){ii=f;break e}}(wn|0)==50?Bt(27452,27235,249,27471):(wn|0)==52?Bt(27490,27235,252,27471):(wn|0)==70&&Bt(27310,27235,61,27333)}else ii=0;while(!1);return An(vn),An(Ut),wn=ii,wn|0}return 0}function Ys(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;if(!(Lo(f,p)|0)||(f=TA(f)|0,_=+J[p>>3],y=+J[p+8>>3],y=f&y<0?y+6.283185307179586:y,A=d[A>>2]|0,!A))return A=0,A|0;if(f){f=0,I=y,p=A;e:for(;;){for(;M=+J[p>>3],y=+J[p+8>>3],p=p+16|0,H=d[p>>2]|0,H=(H|0)==0?A:H,T=+J[H>>3],N=+J[H+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_<T|_>U);)if(p=d[p>>2]|0,!p){p=22;break e}if(N=M<0?M+6.283185307179586:M,M=y<0?y+6.283185307179586:y,I=N==I|M==I?I+-2220446049250313e-31:I,U=N+(M-N)*((_-T)/(U-T)),(U<0?U+6.283185307179586:U)>I&&(f=f^1),p=d[p>>2]|0,!p){p=22;break}}if((p|0)==22)return f|0}else{f=0,I=y,p=A;e:for(;;){for(;M=+J[p>>3],y=+J[p+8>>3],p=p+16|0,H=d[p>>2]|0,H=(H|0)==0?A:H,T=+J[H>>3],N=+J[H+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_<T|_>U);)if(p=d[p>>2]|0,!p){p=22;break e}if(I=M==I|y==I?I+-2220446049250313e-31:I,M+(y-M)*((_-T)/(U-T))>I&&(f=f^1),p=d[p>>2]|0,!p){p=22;break}}if((p|0)==22)return f|0}return 0}function lo(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0;if(qe=K,K=K+32|0,Ye=qe+16|0,Ie=qe,T=Mt(A|0,f|0,52)|0,Z()|0,T=T&15,Ae=Mt(p|0,_|0,52)|0,Z()|0,(T|0)!=(Ae&15|0))return Ye=12,K=qe,Ye|0;if(I=Mt(A|0,f|0,45)|0,Z()|0,I=I&127,H=Mt(p|0,_|0,45)|0,Z()|0,H=H&127,I>>>0>121|H>>>0>121)return Ye=5,K=qe,Ye|0;if(Ae=(I|0)!=(H|0),Ae){if(N=Jh(I,H)|0,(N|0)==7)return Ye=1,K=qe,Ye|0;U=Jh(H,I)|0,(U|0)==7?Bt(27514,27538,161,27548):(ve=N,M=U)}else ve=0,M=0;ie=Bi(I)|0,ge=Bi(H)|0,d[Ye>>2]=0,d[Ye+4>>2]=0,d[Ye+8>>2]=0,d[Ye+12>>2]=0;do if(ve){if(H=d[4272+(I*28|0)+(ve<<2)>>2]|0,N=(H|0)>0,ge)if(N){I=0,U=p,N=_;do U=Tx(U,N)|0,N=Z()|0,M=rl(M)|0,(M|0)==1&&(M=rl(1)|0),I=I+1|0;while((I|0)!=(H|0));H=M,I=U,U=N}else H=M,I=p,U=_;else if(N){I=0,U=p,N=_;do U=hp(U,N)|0,N=Z()|0,M=rl(M)|0,I=I+1|0;while((I|0)!=(H|0));H=M,I=U,U=N}else H=M,I=p,U=_;if(LA(I,U,Ye)|0,Ae||Bt(27563,27538,191,27548),N=(ie|0)!=0,M=(ge|0)!=0,N&M&&Bt(27590,27538,192,27548),N){if(M=$s(A,f)|0,(M|0)==7){T=5;break}if(at[22e3+(M*7|0)+ve>>0]|0){T=1;break}U=d[21168+(M*28|0)+(ve<<2)>>2]|0,I=U}else if(M){if(M=$s(I,U)|0,(M|0)==7){T=5;break}if(at[22e3+(M*7|0)+H>>0]|0){T=1;break}I=0,U=d[21168+(H*28|0)+(M<<2)>>2]|0}else I=0,U=0;if((I|U|0)<0)T=5;else{if((U|0)>0){N=Ye+4|0,M=0;do EA(N),M=M+1|0;while((M|0)!=(U|0))}if(d[Ie>>2]=0,d[Ie+4>>2]=0,d[Ie+8>>2]=0,u1(Ie,ve),T|0)for(;Ss(T)|0?Yc(Ie):Lu(Ie),(T|0)>1;)T=T+-1|0;if((I|0)>0){T=0;do EA(Ie),T=T+1|0;while((T|0)!=(I|0))}Pe=Ye+4|0,hs(Pe,Ie,Pe),Lr(Pe),Pe=51}}else if(LA(p,_,Ye)|0,(ie|0)!=0&(ge|0)!=0)if((H|0)!=(I|0)&&Bt(27621,27538,261,27548),M=$s(A,f)|0,T=$s(p,_)|0,(M|0)==7|(T|0)==7)T=5;else if(at[22e3+(M*7|0)+T>>0]|0)T=1;else if(M=d[21168+(M*28|0)+(T<<2)>>2]|0,(M|0)>0){N=Ye+4|0,T=0;do EA(N),T=T+1|0;while((T|0)!=(M|0));Pe=51}else Pe=51;else Pe=51;while(!1);return(Pe|0)==51&&(T=Ye+4|0,d[y>>2]=d[T>>2],d[y+4>>2]=d[T+4>>2],d[y+8>>2]=d[T+8>>2],T=0),Ye=T,K=qe,Ye|0}function Uo(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0;if(Pe=K,K=K+48|0,I=Pe+36|0,M=Pe+24|0,N=Pe+12|0,U=Pe,y=Mt(A|0,f|0,52)|0,Z()|0,y=y&15,ge=Mt(A|0,f|0,45)|0,Z()|0,ge=ge&127,ge>>>0>121)return _=5,K=Pe,_|0;if(H=Bi(ge)|0,Dt(y|0,0,52)|0,Ie=Z()|0|134225919,T=_,d[T>>2]=-1,d[T+4>>2]=Ie,!y)return y=Pu(p)|0,(y|0)==7||(y=SA(ge,y)|0,(y|0)==127)?(Ie=1,K=Pe,Ie|0):(Ae=Dt(y|0,0,45)|0,ve=Z()|0,ge=_,ve=d[ge+4>>2]&-1040385|ve,Ie=_,d[Ie>>2]=d[ge>>2]|Ae,d[Ie+4>>2]=ve,Ie=0,K=Pe,Ie|0);for(d[I>>2]=d[p>>2],d[I+4>>2]=d[p+4>>2],d[I+8>>2]=d[p+8>>2],p=y;;){if(T=p,p=p+-1|0,d[M>>2]=d[I>>2],d[M+4>>2]=d[I+4>>2],d[M+8>>2]=d[I+8>>2],Ss(T)|0){if(y=o1(I)|0,y|0){p=13;break}d[N>>2]=d[I>>2],d[N+4>>2]=d[I+4>>2],d[N+8>>2]=d[I+8>>2],Yc(N)}else{if(y=cx(I)|0,y|0){p=13;break}d[N>>2]=d[I>>2],d[N+4>>2]=d[I+4>>2],d[N+8>>2]=d[I+8>>2],Lu(N)}if(af(M,N,U),Lr(U),y=_,qe=d[y>>2]|0,y=d[y+4>>2]|0,Ge=(15-T|0)*3|0,Ye=Dt(7,0,Ge|0)|0,y=y&~(Z()|0),Ge=Dt(Pu(U)|0,0,Ge|0)|0,y=Z()|0|y,Ie=_,d[Ie>>2]=Ge|qe&~Ye,d[Ie+4>>2]=y,(T|0)<=1){p=14;break}}e:do if((p|0)!=13&&(p|0)==14)if((d[I>>2]|0)<=1&&(d[I+4>>2]|0)<=1&&(d[I+8>>2]|0)<=1){p=Pu(I)|0,y=SA(ge,p)|0,(y|0)==127?U=0:U=Bi(y)|0;t:do if(p){if(H){if(y=$s(A,f)|0,(y|0)==7){y=5;break e}if(T=d[21376+(y*28|0)+(p<<2)>>2]|0,(T|0)>0){y=p,p=0;do y=Uu(y)|0,p=p+1|0;while((p|0)!=(T|0))}else y=p;if((y|0)==1){y=9;break e}p=SA(ge,y)|0,(p|0)==127&&Bt(27648,27538,411,27678),Bi(p)|0?Bt(27693,27538,412,27678):(ve=p,Ae=T,ie=y)}else ve=y,Ae=0,ie=p;if(N=d[4272+(ge*28|0)+(ie<<2)>>2]|0,(N|0)<=-1&&Bt(27724,27538,419,27678),!U){if((Ae|0)<0){y=5;break e}if(Ae|0){T=_,y=0,p=d[T>>2]|0,T=d[T+4>>2]|0;do p=ku(p,T)|0,T=Z()|0,Ge=_,d[Ge>>2]=p,d[Ge+4>>2]=T,y=y+1|0;while((y|0)<(Ae|0))}if((N|0)<=0){y=ve,p=58;break}for(T=_,y=0,p=d[T>>2]|0,T=d[T+4>>2]|0;;)if(p=ku(p,T)|0,T=Z()|0,Ge=_,d[Ge>>2]=p,d[Ge+4>>2]=T,y=y+1|0,(y|0)==(N|0)){y=ve,p=58;break t}}if(M=Jh(ve,ge)|0,(M|0)==7&&Bt(27514,27538,428,27678),y=_,p=d[y>>2]|0,y=d[y+4>>2]|0,(N|0)>0){T=0;do p=ku(p,y)|0,y=Z()|0,Ge=_,d[Ge>>2]=p,d[Ge+4>>2]=y,T=T+1|0;while((T|0)!=(N|0))}if(y=$s(p,y)|0,(y|0)==7&&Bt(27795,27538,440,27678),p=Wc(ve)|0,p=d[(p?21792:21584)+(M*28|0)+(y<<2)>>2]|0,(p|0)<0&&Bt(27795,27538,454,27678),!p)y=ve,p=58;else{M=_,y=0,T=d[M>>2]|0,M=d[M+4>>2]|0;do T=cp(T,M)|0,M=Z()|0,Ge=_,d[Ge>>2]=T,d[Ge+4>>2]=M,y=y+1|0;while((y|0)<(p|0));y=ve,p=58}}else if((H|0)!=0&(U|0)!=0){if(p=$s(A,f)|0,T=_,T=$s(d[T>>2]|0,d[T+4>>2]|0)|0,(p|0)==7|(T|0)==7){y=5;break e}if(T=d[21376+(p*28|0)+(T<<2)>>2]|0,(T|0)<0){y=5;break e}if(!T)p=59;else{N=_,p=0,M=d[N>>2]|0,N=d[N+4>>2]|0;do M=ku(M,N)|0,N=Z()|0,Ge=_,d[Ge>>2]=M,d[Ge+4>>2]=N,p=p+1|0;while((p|0)<(T|0));p=58}}else p=58;while(!1);if((p|0)==58&&U&&(p=59),(p|0)==59&&(Ge=_,($s(d[Ge>>2]|0,d[Ge+4>>2]|0)|0)==1)){y=9;break}Ge=_,Ye=d[Ge>>2]|0,Ge=d[Ge+4>>2]&-1040385,qe=Dt(y|0,0,45)|0,Ge=Ge|(Z()|0),y=_,d[y>>2]=Ye|qe,d[y+4>>2]=Ge,y=0}else y=1;while(!1);return Ge=y,K=Pe,Ge|0}function E1(A,f,p,_,y,T){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0;var M=0,N=0;return N=K,K=K+16|0,M=N,y?A=15:(A=lo(A,f,p,_,M)|0,A||(fx(M,T),A=0)),K=N,A|0}function IA(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0;return M=K,K=K+16|0,T=M,_?p=15:(p=rp(p,T)|0,p||(p=Uo(A,f,T,y)|0)),K=M,p|0}function $u(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0;return U=K,K=K+32|0,M=U+12|0,N=U,T=lo(A,f,A,f,M)|0,T|0?(N=T,K=U,N|0):(A=lo(A,f,p,_,N)|0,A|0?(N=A,K=U,N|0):(M=ip(M,N)|0,N=y,d[N>>2]=M,d[N+4>>2]=((M|0)<0)<<31>>31,N=0,K=U,N|0))}function vp(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0;return U=K,K=K+32|0,M=U+12|0,N=U,T=lo(A,f,A,f,M)|0,!T&&(T=lo(A,f,p,_,N)|0,!T)?(_=ip(M,N)|0,_=Qt(_|0,((_|0)<0)<<31>>31|0,1,0)|0,M=Z()|0,N=y,d[N>>2]=_,d[N+4>>2]=M,N=0,K=U,N|0):(N=T,K=U,N|0)}function C1(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0,sn=0,tn=0,Bn=0;if(tn=K,K=K+48|0,Lt=tn+24|0,M=tn+12|0,sn=tn,T=lo(A,f,A,f,Lt)|0,!T&&(T=lo(A,f,p,_,M)|0,!T)){Ge=ip(Lt,M)|0,Le=((Ge|0)<0)<<31>>31,d[Lt>>2]=0,d[Lt+4>>2]=0,d[Lt+8>>2]=0,d[M>>2]=0,d[M+4>>2]=0,d[M+8>>2]=0,lo(A,f,A,f,Lt)|0&&Bt(27795,27538,692,27747),lo(A,f,p,_,M)|0&&Bt(27795,27538,697,27747),A1(Lt),A1(M),H=(Ge|0)==0?0:1/+(Ge|0),p=d[Lt>>2]|0,Pe=H*+((d[M>>2]|0)-p|0),Ie=Lt+4|0,_=d[Ie>>2]|0,Ye=H*+((d[M+4>>2]|0)-_|0),qe=Lt+8|0,T=d[qe>>2]|0,H=H*+((d[M+8>>2]|0)-T|0),d[sn>>2]=p,ie=sn+4|0,d[ie>>2]=_,ge=sn+8|0,d[ge>>2]=T;e:do if((Ge|0)<0)T=0;else for(Ae=0,ve=0;;){U=+(ve>>>0)+4294967296*+(Ae|0),Bn=Pe*U+ +(p|0),N=Ye*U+ +(_|0),U=H*U+ +(T|0),p=~~+hl(+Bn),M=~~+hl(+N),T=~~+hl(+U),Bn=+un(+(+(p|0)-Bn)),N=+un(+(+(M|0)-N)),U=+un(+(+(T|0)-U));do if(Bn>N&Bn>U)p=0-(M+T)|0,_=M;else if(I=0-p|0,N>U){_=I-T|0;break}else{_=M,T=I-M|0;break}while(!1);if(d[sn>>2]=p,d[ie>>2]=_,d[ge>>2]=T,Ax(sn),T=Uo(A,f,sn,y+(ve<<3)|0)|0,T|0)break e;if(!((Ae|0)<(Le|0)|(Ae|0)==(Le|0)&ve>>>0<Ge>>>0)){T=0;break e}p=Qt(ve|0,Ae|0,1,0)|0,_=Z()|0,Ae=_,ve=p,p=d[Lt>>2]|0,_=d[Ie>>2]|0,T=d[qe>>2]|0}while(!1);return sn=T,K=tn,sn|0}return sn=T,K=tn,sn|0}function Bo(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;if((p|0)==0&(_|0)==0)return y=0,T=1,mt(y|0),T|0;T=A,y=f,A=1,f=0;do M=(p&1|0)==0&!0,A=fr((M?1:T)|0,(M?0:y)|0,A|0,f|0)|0,f=Z()|0,p=N1(p|0,_|0,1)|0,_=Z()|0,T=fr(T|0,y|0,T|0,y|0)|0,y=Z()|0;while(!((p|0)==0&(_|0)==0));return mt(f|0),A|0}function FA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0;N=K,K=K+16|0,T=N,M=Mt(A|0,f|0,52)|0,Z()|0,M=M&15;do if(M){if(y=Ol(A,f,T)|0,!y){I=+J[T>>3],U=1/+li(+I),H=+J[25968+(M<<3)>>3],J[p>>3]=I+H,J[p+8>>3]=I-H,I=+J[T+8>>3],U=H*U,J[p+16>>3]=U+I,J[p+24>>3]=I-U;break}return M=y,K=N,M|0}else{if(y=Mt(A|0,f|0,45)|0,Z()|0,y=y&127,y>>>0>121)return M=5,K=N,M|0;T=22064+(y<<5)|0,d[p>>2]=d[T>>2],d[p+4>>2]=d[T+4>>2],d[p+8>>2]=d[T+8>>2],d[p+12>>2]=d[T+12>>2],d[p+16>>2]=d[T+16>>2],d[p+20>>2]=d[T+20>>2],d[p+24>>2]=d[T+24>>2],d[p+28>>2]=d[T+28>>2];break}while(!1);return Ws(p,_?1.4:1.1),_=26096+(M<<3)|0,(d[_>>2]|0)==(A|0)&&(d[_+4>>2]|0)==(f|0)&&(J[p>>3]=1.5707963267948966),M=26224+(M<<3)|0,(d[M>>2]|0)==(A|0)&&(d[M+4>>2]|0)==(f|0)&&(J[p+8>>3]=-1.5707963267948966),+J[p>>3]!=1.5707963267948966&&+J[p+8>>3]!=-1.5707963267948966?(M=0,K=N,M|0):(J[p+16>>3]=3.141592653589793,J[p+24>>3]=-3.141592653589793,M=0,K=N,M|0)}function Ca(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0;I=K,K=K+48|0,M=I+32|0,T=I+40|0,N=I,Iu(M,0,0,0),U=d[M>>2]|0,M=d[M+4>>2]|0;do if(p>>>0<=15){if(y=Ra(_)|0,y|0){_=N,d[_>>2]=0,d[_+4>>2]=0,d[N+8>>2]=y,d[N+12>>2]=-1,_=N+16|0,U=N+29|0,d[_>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,at[_+12>>0]=0,at[U>>0]=at[T>>0]|0,at[U+1>>0]=at[T+1>>0]|0,at[U+2>>0]=at[T+2>>0]|0;break}if(y=Ks((d[f+8>>2]|0)+1|0,32)|0,y){Na(f,y),H=N,d[H>>2]=U,d[H+4>>2]=M,d[N+8>>2]=0,d[N+12>>2]=p,d[N+16>>2]=_,d[N+20>>2]=f,d[N+24>>2]=y,at[N+28>>0]=0,U=N+29|0,at[U>>0]=at[T>>0]|0,at[U+1>>0]=at[T+1>>0]|0,at[U+2>>0]=at[T+2>>0]|0;break}else{_=N,d[_>>2]=0,d[_+4>>2]=0,d[N+8>>2]=13,d[N+12>>2]=-1,_=N+16|0,U=N+29|0,d[_>>2]=0,d[_+4>>2]=0,d[_+8>>2]=0,at[_+12>>0]=0,at[U>>0]=at[T>>0]|0,at[U+1>>0]=at[T+1>>0]|0,at[U+2>>0]=at[T+2>>0]|0;break}}else U=N,d[U>>2]=0,d[U+4>>2]=0,d[N+8>>2]=4,d[N+12>>2]=-1,U=N+16|0,H=N+29|0,d[U>>2]=0,d[U+4>>2]=0,d[U+8>>2]=0,at[U+12>>0]=0,at[H>>0]=at[T>>0]|0,at[H+1>>0]=at[T+1>>0]|0,at[H+2>>0]=at[T+2>>0]|0;while(!1);al(N),d[A>>2]=d[N>>2],d[A+4>>2]=d[N+4>>2],d[A+8>>2]=d[N+8>>2],d[A+12>>2]=d[N+12>>2],d[A+16>>2]=d[N+16>>2],d[A+20>>2]=d[N+20>>2],d[A+24>>2]=d[N+24>>2],d[A+28>>2]=d[N+28>>2],K=I}function al(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0;if(Le=K,K=K+336|0,Ae=Le+168|0,ve=Le,_=A,p=d[_>>2]|0,_=d[_+4>>2]|0,(p|0)==0&(_|0)==0){K=Le;return}if(f=A+28|0,at[f>>0]|0?(p=Xu(p,_)|0,_=Z()|0):at[f>>0]=1,Ge=A+20|0,!(d[d[Ge>>2]>>2]|0)){f=A+24|0,p=d[f>>2]|0,p|0&&An(p),qe=A,d[qe>>2]=0,d[qe+4>>2]=0,d[A+8>>2]=0,d[Ge>>2]=0,d[A+12>>2]=-1,d[A+16>>2]=0,d[f>>2]=0,K=Le;return}qe=A+16|0,f=d[qe>>2]|0,y=f&15;e:do if((p|0)==0&(_|0)==0)Ye=A+24|0;else{Pe=A+12|0,ie=(y|0)==3,H=f&255,U=(y|1|0)==3,ge=A+24|0,I=(y+-1|0)>>>0<3,M=(y|2|0)==3,N=ve+8|0;t:for(;;){if(T=Mt(p|0,_|0,52)|0,Z()|0,T=T&15,(T|0)==(d[Pe>>2]|0)){switch(H&15){case 0:case 2:case 3:{if(y=Ol(p,_,Ae)|0,y|0){Ie=15;break t}if(Da(d[Ge>>2]|0,d[ge>>2]|0,Ae)|0){Ie=19;break t}break}}if(U&&(y=d[(d[Ge>>2]|0)+4>>2]|0,d[Ae>>2]=d[y>>2],d[Ae+4>>2]=d[y+4>>2],d[Ae+8>>2]=d[y+8>>2],d[Ae+12>>2]=d[y+12>>2],Lo(26832,Ae)|0)){if(PA(d[(d[Ge>>2]|0)+4>>2]|0,T,ve)|0){Ie=25;break}if(y=ve,(d[y>>2]|0)==(p|0)&&(d[y+4>>2]|0)==(_|0)){Ie=29;break}}if(I){if(y=Il(p,_,Ae)|0,y|0){Ie=32;break}if(FA(p,_,ve,0)|0){Ie=36;break}if(M&&Oo(d[Ge>>2]|0,d[ge>>2]|0,Ae,ve)|0){Ie=42;break}if(U&&zA(d[Ge>>2]|0,d[ge>>2]|0,Ae,ve)|0){Ie=42;break}}if(ie){if(f=FA(p,_,Ae,1)|0,y=d[ge>>2]|0,f|0){Ie=45;break}if(nf(y,Ae)|0){if(rf(ve,Ae),np(Ae,d[ge>>2]|0)|0){Ie=53;break}if(Da(d[Ge>>2]|0,d[ge>>2]|0,N)|0){Ie=53;break}if(zA(d[Ge>>2]|0,d[ge>>2]|0,ve,Ae)|0){Ie=53;break}}}}do if((T|0)<(d[Pe>>2]|0)){if(f=FA(p,_,Ae,1)|0,y=d[ge>>2]|0,f|0){Ie=58;break t}if(!(nf(y,Ae)|0)){Ie=73;break}if(np(d[ge>>2]|0,Ae)|0&&(rf(ve,Ae),Oo(d[Ge>>2]|0,d[ge>>2]|0,ve,Ae)|0)){Ie=65;break t}if(p=DA(p,_,T+1|0,ve)|0,p|0){Ie=67;break t}_=ve,p=d[_>>2]|0,_=d[_+4>>2]|0}else Ie=73;while(!1);if((Ie|0)==73&&(Ie=0,p=Xu(p,_)|0,_=Z()|0),(p|0)==0&(_|0)==0){Ye=ge;break e}}switch(Ie|0){case 15:{f=d[ge>>2]|0,f|0&&An(f),Ie=A,d[Ie>>2]=0,d[Ie+4>>2]=0,d[Ge>>2]=0,d[Pe>>2]=-1,d[qe>>2]=0,d[ge>>2]=0,d[A+8>>2]=y,Ie=20;break}case 19:{d[A>>2]=p,d[A+4>>2]=_,Ie=20;break}case 25:{Bt(27795,27761,470,27772);break}case 29:{d[A>>2]=p,d[A+4>>2]=_,K=Le;return}case 32:{f=d[ge>>2]|0,f|0&&An(f),Ye=A,d[Ye>>2]=0,d[Ye+4>>2]=0,d[Ge>>2]=0,d[Pe>>2]=-1,d[qe>>2]=0,d[ge>>2]=0,d[A+8>>2]=y,K=Le;return}case 36:{Bt(27795,27761,493,27772);break}case 42:{d[A>>2]=p,d[A+4>>2]=_,K=Le;return}case 45:{y|0&&An(y),Ie=A,d[Ie>>2]=0,d[Ie+4>>2]=0,d[Ge>>2]=0,d[Pe>>2]=-1,d[qe>>2]=0,d[ge>>2]=0,d[A+8>>2]=f,Ie=55;break}case 53:{d[A>>2]=p,d[A+4>>2]=_,Ie=55;break}case 58:{y|0&&An(y),Ie=A,d[Ie>>2]=0,d[Ie+4>>2]=0,d[Ge>>2]=0,d[Pe>>2]=-1,d[qe>>2]=0,d[ge>>2]=0,d[A+8>>2]=f,Ie=71;break}case 65:{d[A>>2]=p,d[A+4>>2]=_,Ie=71;break}case 67:{f=d[ge>>2]|0,f|0&&An(f),Ye=A,d[Ye>>2]=0,d[Ye+4>>2]=0,d[Ge>>2]=0,d[Pe>>2]=-1,d[qe>>2]=0,d[ge>>2]=0,d[A+8>>2]=p,K=Le;return}}if((Ie|0)==20){K=Le;return}else if((Ie|0)==55){K=Le;return}else if((Ie|0)==71){K=Le;return}}while(!1);f=d[Ye>>2]|0,f|0&&An(f),Ie=A,d[Ie>>2]=0,d[Ie+4>>2]=0,d[A+8>>2]=0,d[Ge>>2]=0,d[A+12>>2]=-1,d[qe>>2]=0,d[Ye>>2]=0,K=Le}function Xu(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0;ie=K,K=K+16|0,H=ie,_=Mt(A|0,f|0,52)|0,Z()|0,_=_&15,p=Mt(A|0,f|0,45)|0,Z()|0;do if(_){for(;p=Dt(_+4095|0,0,52)|0,y=Z()|0|f&-15728641,T=(15-_|0)*3|0,M=Dt(7,0,T|0)|0,N=Z()|0,p=p|A|M,y=y|N,U=Mt(A|0,f|0,T|0)|0,Z()|0,U=U&7,_=_+-1|0,!(U>>>0<6);)if(_)f=y,A=p;else{I=4;break}if((I|0)==4){p=Mt(p|0,y|0,45)|0,Z()|0;break}return H=(U|0)==0&(Ci(p,y)|0)!=0,H=Dt((H?2:1)+U|0,0,T|0)|0,I=Z()|0|f&~N,H=H|A&~M,mt(I|0),K=ie,H|0}while(!1);return p=p&127,p>>>0>120?(I=0,H=0,mt(I|0),K=ie,H|0):(Iu(H,0,p+1|0,0),I=d[H+4>>2]|0,H=d[H>>2]|0,mt(I|0),K=ie,H|0)}function kA(A,f,p,_,y,T){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0,T=T|0;var M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0;Ie=K,K=K+160|0,ie=Ie+80|0,N=Ie+64|0,ge=Ie+112|0,Pe=Ie,Ca(ie,A,f,p),I=ie,sl(N,d[I>>2]|0,d[I+4>>2]|0,f),I=N,U=d[I>>2]|0,I=d[I+4>>2]|0,M=d[ie+8>>2]|0,Ae=ge+4|0,d[Ae>>2]=d[ie>>2],d[Ae+4>>2]=d[ie+4>>2],d[Ae+8>>2]=d[ie+8>>2],d[Ae+12>>2]=d[ie+12>>2],d[Ae+16>>2]=d[ie+16>>2],d[Ae+20>>2]=d[ie+20>>2],d[Ae+24>>2]=d[ie+24>>2],d[Ae+28>>2]=d[ie+28>>2],Ae=Pe,d[Ae>>2]=U,d[Ae+4>>2]=I,Ae=Pe+8|0,d[Ae>>2]=M,A=Pe+12|0,f=ge,p=A+36|0;do d[A>>2]=d[f>>2],A=A+4|0,f=f+4|0;while((A|0)<(p|0));if(ge=Pe+48|0,d[ge>>2]=d[N>>2],d[ge+4>>2]=d[N+4>>2],d[ge+8>>2]=d[N+8>>2],d[ge+12>>2]=d[N+12>>2],(U|0)==0&(I|0)==0)return Pe=M,K=Ie,Pe|0;p=Pe+16|0,H=Pe+24|0,ie=Pe+28|0,M=0,N=0,f=U,A=I;do{if(!((M|0)<(y|0)|(M|0)==(y|0)&N>>>0<_>>>0)){ve=4;break}if(I=N,N=Qt(N|0,M|0,1,0)|0,M=Z()|0,I=T+(I<<3)|0,d[I>>2]=f,d[I+4>>2]=A,uf(ge),A=ge,f=d[A>>2]|0,A=d[A+4>>2]|0,(f|0)==0&(A|0)==0){if(al(p),f=p,A=d[f>>2]|0,f=d[f+4>>2]|0,(A|0)==0&(f|0)==0){ve=10;break}Vu(A,f,d[ie>>2]|0,ge),A=ge,f=d[A>>2]|0,A=d[A+4>>2]|0}I=Pe,d[I>>2]=f,d[I+4>>2]=A}while(!((f|0)==0&(A|0)==0));return(ve|0)==4?(A=Pe+40|0,f=d[A>>2]|0,f|0&&An(f),ve=Pe+16|0,d[ve>>2]=0,d[ve+4>>2]=0,d[H>>2]=0,d[Pe+36>>2]=0,d[ie>>2]=-1,d[Pe+32>>2]=0,d[A>>2]=0,Vu(0,0,0,ge),d[Pe>>2]=0,d[Pe+4>>2]=0,d[Ae>>2]=0,Pe=14,K=Ie,Pe|0):((ve|0)==10&&(d[Pe>>2]=0,d[Pe+4>>2]=0,d[Ae>>2]=d[H>>2]),Pe=d[Ae>>2]|0,K=Ie,Pe|0)}function cf(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0;if(ie=K,K=K+48|0,U=ie+32|0,N=ie+40|0,I=ie,!(d[A>>2]|0))return H=_,d[H>>2]=0,d[H+4>>2]=0,H=0,K=ie,H|0;Iu(U,0,0,0),M=U,y=d[M>>2]|0,M=d[M+4>>2]|0;do if(f>>>0>15)H=I,d[H>>2]=0,d[H+4>>2]=0,d[I+8>>2]=4,d[I+12>>2]=-1,H=I+16|0,p=I+29|0,d[H>>2]=0,d[H+4>>2]=0,d[H+8>>2]=0,at[H+12>>0]=0,at[p>>0]=at[N>>0]|0,at[p+1>>0]=at[N+1>>0]|0,at[p+2>>0]=at[N+2>>0]|0,p=4,H=9;else{if(p=Ra(p)|0,p|0){U=I,d[U>>2]=0,d[U+4>>2]=0,d[I+8>>2]=p,d[I+12>>2]=-1,U=I+16|0,H=I+29|0,d[U>>2]=0,d[U+4>>2]=0,d[U+8>>2]=0,at[U+12>>0]=0,at[H>>0]=at[N>>0]|0,at[H+1>>0]=at[N+1>>0]|0,at[H+2>>0]=at[N+2>>0]|0,H=9;break}if(p=Ks((d[A+8>>2]|0)+1|0,32)|0,!p){H=I,d[H>>2]=0,d[H+4>>2]=0,d[I+8>>2]=13,d[I+12>>2]=-1,H=I+16|0,p=I+29|0,d[H>>2]=0,d[H+4>>2]=0,d[H+8>>2]=0,at[H+12>>0]=0,at[p>>0]=at[N>>0]|0,at[p+1>>0]=at[N+1>>0]|0,at[p+2>>0]=at[N+2>>0]|0,p=13,H=9;break}Na(A,p),Ae=I,d[Ae>>2]=y,d[Ae+4>>2]=M,M=I+8|0,d[M>>2]=0,d[I+12>>2]=f,d[I+20>>2]=A,d[I+24>>2]=p,at[I+28>>0]=0,y=I+29|0,at[y>>0]=at[N>>0]|0,at[y+1>>0]=at[N+1>>0]|0,at[y+2>>0]=at[N+2>>0]|0,d[I+16>>2]=3,ge=+tf(p),ge=ge*+il(p),T=+un(+ +J[p>>3]),T=ge/+li(+ +df(+T,+ +un(+ +J[p+8>>3])))*6371.007180918475*6371.007180918475,y=I+12|0,p=d[y>>2]|0;e:do if((p|0)>0)do{if(dp(p+-1|0,U)|0,!(T/+J[U>>3]>10))break e;Ae=d[y>>2]|0,p=Ae+-1|0,d[y>>2]=p}while((Ae|0)>1);while(!1);if(al(I),y=_,d[y>>2]=0,d[y+4>>2]=0,y=I,p=d[y>>2]|0,y=d[y+4>>2]|0,!((p|0)==0&(y|0)==0))do lf(p,y,f,U)|0,N=U,A=_,N=Qt(d[A>>2]|0,d[A+4>>2]|0,d[N>>2]|0,d[N+4>>2]|0)|0,A=Z()|0,Ae=_,d[Ae>>2]=N,d[Ae+4>>2]=A,al(I),Ae=I,p=d[Ae>>2]|0,y=d[Ae+4>>2]|0;while(!((p|0)==0&(y|0)==0));p=d[M>>2]|0}while(!1);return Ae=p,K=ie,Ae|0}function Ts(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0;if(!(Lo(f,p)|0)||(f=TA(f)|0,_=+J[p>>3],y=+J[p+8>>3],y=f&y<0?y+6.283185307179586:y,ge=d[A>>2]|0,(ge|0)<=0))return ge=0,ge|0;if(ie=d[A+4>>2]|0,f){f=0,H=y,p=-1,A=0;e:for(;;){for(I=A;M=+J[ie+(I<<4)>>3],y=+J[ie+(I<<4)+8>>3],A=(p+2|0)%(ge|0)|0,T=+J[ie+(A<<4)>>3],N=+J[ie+(A<<4)+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_<T|_>U);)if(p=I+1|0,(p|0)>=(ge|0)){p=22;break e}else A=I,I=p,p=A;if(N=M<0?M+6.283185307179586:M,M=y<0?y+6.283185307179586:y,H=N==H|M==H?H+-2220446049250313e-31:H,U=N+(M-N)*((_-T)/(U-T)),(U<0?U+6.283185307179586:U)>H&&(f=f^1),A=I+1|0,(A|0)>=(ge|0)){p=22;break}else p=I}if((p|0)==22)return f|0}else{f=0,H=y,p=-1,A=0;e:for(;;){for(I=A;M=+J[ie+(I<<4)>>3],y=+J[ie+(I<<4)+8>>3],A=(p+2|0)%(ge|0)|0,T=+J[ie+(A<<4)>>3],N=+J[ie+(A<<4)+8>>3],M>T?(U=M,M=N):(U=T,T=M,M=y,y=N),_=_==T|_==U?_+2220446049250313e-31:_,!!(_<T|_>U);)if(p=I+1|0,(p|0)>=(ge|0)){p=22;break e}else A=I,I=p,p=A;if(H=M==H|y==H?H+-2220446049250313e-31:H,M+(y-M)*((_-T)/(U-T))>H&&(f=f^1),A=I+1|0,(A|0)>=(ge|0)){p=22;break}else p=I}if((p|0)==22)return f|0}return 0}function pa(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0;if(ve=d[A>>2]|0,!ve){d[f>>2]=0,d[f+4>>2]=0,d[f+8>>2]=0,d[f+12>>2]=0,d[f+16>>2]=0,d[f+20>>2]=0,d[f+24>>2]=0,d[f+28>>2]=0;return}if(Pe=f+8|0,J[Pe>>3]=17976931348623157e292,Ie=f+24|0,J[Ie>>3]=17976931348623157e292,J[f>>3]=-17976931348623157e292,Ye=f+16|0,J[Ye>>3]=-17976931348623157e292,!((ve|0)<=0)){for(ge=d[A+4>>2]|0,I=17976931348623157e292,H=-17976931348623157e292,ie=0,A=-1,T=17976931348623157e292,M=17976931348623157e292,U=-17976931348623157e292,_=-17976931348623157e292,Ae=0;p=+J[ge+(Ae<<4)>>3],N=+J[ge+(Ae<<4)+8>>3],A=A+2|0,y=+J[ge+(((A|0)==(ve|0)?0:A)<<4)+8>>3],p<T&&(J[Pe>>3]=p,T=p),N<M&&(J[Ie>>3]=N,M=N),p>U?J[f>>3]=p:p=U,N>_&&(J[Ye>>3]=N,_=N),I=N>0&N<I?N:I,H=N<0&N>H?N:H,ie=ie|+un(+(N-y))>3.141592653589793,A=Ae+1|0,(A|0)!=(ve|0);)qe=Ae,U=p,Ae=A,A=qe;ie&&(J[Ye>>3]=H,J[Ie>>3]=I)}}function Ra(A){return A=A|0,(A>>>0<4?0:15)|0}function Na(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0,sn=0,tn=0;if(ve=d[A>>2]|0,ve){if(Pe=f+8|0,J[Pe>>3]=17976931348623157e292,Ie=f+24|0,J[Ie>>3]=17976931348623157e292,J[f>>3]=-17976931348623157e292,Ye=f+16|0,J[Ye>>3]=-17976931348623157e292,(ve|0)>0){for(y=d[A+4>>2]|0,ge=17976931348623157e292,Ae=-17976931348623157e292,_=0,p=-1,U=17976931348623157e292,I=17976931348623157e292,ie=-17976931348623157e292,M=-17976931348623157e292,qe=0;T=+J[y+(qe<<4)>>3],H=+J[y+(qe<<4)+8>>3],sn=p+2|0,N=+J[y+(((sn|0)==(ve|0)?0:sn)<<4)+8>>3],T<U&&(J[Pe>>3]=T,U=T),H<I&&(J[Ie>>3]=H,I=H),T>ie?J[f>>3]=T:T=ie,H>M&&(J[Ye>>3]=H,M=H),ge=H>0&H<ge?H:ge,Ae=H<0&H>Ae?H:Ae,_=_|+un(+(H-N))>3.141592653589793,p=qe+1|0,(p|0)!=(ve|0);)sn=qe,ie=T,qe=p,p=sn;_&&(J[Ye>>3]=Ae,J[Ie>>3]=ge)}}else d[f>>2]=0,d[f+4>>2]=0,d[f+8>>2]=0,d[f+12>>2]=0,d[f+16>>2]=0,d[f+20>>2]=0,d[f+24>>2]=0,d[f+28>>2]=0;if(sn=A+8|0,p=d[sn>>2]|0,!((p|0)<=0)){Lt=A+12|0,Le=0;do if(y=d[Lt>>2]|0,_=Le,Le=Le+1|0,Ie=f+(Le<<5)|0,Ye=d[y+(_<<3)>>2]|0,Ye){if(qe=f+(Le<<5)+8|0,J[qe>>3]=17976931348623157e292,A=f+(Le<<5)+24|0,J[A>>3]=17976931348623157e292,J[Ie>>3]=-17976931348623157e292,Ge=f+(Le<<5)+16|0,J[Ge>>3]=-17976931348623157e292,(Ye|0)>0){for(ve=d[y+(_<<3)+4>>2]|0,ge=17976931348623157e292,Ae=-17976931348623157e292,y=0,_=-1,Pe=0,U=17976931348623157e292,I=17976931348623157e292,H=-17976931348623157e292,M=-17976931348623157e292;T=+J[ve+(Pe<<4)>>3],ie=+J[ve+(Pe<<4)+8>>3],_=_+2|0,N=+J[ve+(((_|0)==(Ye|0)?0:_)<<4)+8>>3],T<U&&(J[qe>>3]=T,U=T),ie<I&&(J[A>>3]=ie,I=ie),T>H?J[Ie>>3]=T:T=H,ie>M&&(J[Ge>>3]=ie,M=ie),ge=ie>0&ie<ge?ie:ge,Ae=ie<0&ie>Ae?ie:Ae,y=y|+un(+(ie-N))>3.141592653589793,_=Pe+1|0,(_|0)!=(Ye|0);)tn=Pe,Pe=_,H=T,_=tn;y&&(J[Ge>>3]=Ae,J[A>>3]=ge)}}else d[Ie>>2]=0,d[Ie+4>>2]=0,d[Ie+8>>2]=0,d[Ie+12>>2]=0,d[Ie+16>>2]=0,d[Ie+20>>2]=0,d[Ie+24>>2]=0,d[Ie+28>>2]=0,p=d[sn>>2]|0;while((Le|0)<(p|0))}}function Da(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(!(Ts(A,f,p)|0))return y=0,y|0;if(y=A+8|0,(d[y>>2]|0)<=0)return y=1,y|0;for(_=A+12|0,A=0;;){if(T=A,A=A+1|0,Ts((d[_>>2]|0)+(T<<3)|0,f+(A<<5)|0,p)|0){A=0,_=6;break}if((A|0)>=(d[y>>2]|0)){A=1,_=6;break}}return(_|0)==6?A|0:0}function Oo(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0;if(I=K,K=K+16|0,N=I,M=p+8|0,!(Ts(A,f,M)|0))return U=0,K=I,U|0;U=A+8|0;e:do if((d[U>>2]|0)>0){for(T=A+12|0,y=0;;){if(H=y,y=y+1|0,Ts((d[T>>2]|0)+(H<<3)|0,f+(y<<5)|0,M)|0){y=0;break}if((y|0)>=(d[U>>2]|0))break e}return K=I,y|0}while(!1);if(hf(A,f,p,_)|0)return H=0,K=I,H|0;d[N>>2]=d[p>>2],d[N+4>>2]=M,y=d[U>>2]|0;e:do if((y|0)>0)for(A=A+12|0,M=0,T=y;;){if(y=d[A>>2]|0,(d[y+(M<<3)>>2]|0)>0){if(Ts(N,_,d[y+(M<<3)+4>>2]|0)|0){y=0;break e}if(y=M+1|0,hf((d[A>>2]|0)+(M<<3)|0,f+(y<<5)|0,p,_)|0){y=0;break e}T=d[U>>2]|0}else y=M+1|0;if((y|0)<(T|0))M=y;else{y=1;break}}else y=1;while(!1);return H=y,K=I,H|0}function hf(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0,sn=0,tn=0,Bn=0;if(sn=K,K=K+176|0,qe=sn+172|0,y=sn+168|0,Ge=sn,!(nf(f,_)|0))return A=0,K=sn,A|0;if(wA(f,_,qe,y),Gl(Ge|0,p|0,168)|0,(d[p>>2]|0)>0){f=0;do tn=Ge+8+(f<<4)+8|0,Ye=+Xs(+J[tn>>3],d[y>>2]|0),J[tn>>3]=Ye,f=f+1|0;while((f|0)<(d[p>>2]|0))}Pe=+J[_>>3],Ie=+J[_+8>>3],Ye=+Xs(+J[_+16>>3],d[y>>2]|0),Ae=+Xs(+J[_+24>>3],d[y>>2]|0);e:do if((d[A>>2]|0)>0){if(_=A+4|0,y=d[Ge>>2]|0,(y|0)<=0){for(f=0;;)if(f=f+1|0,(f|0)>=(d[A>>2]|0)){f=0;break e}}for(p=0;;){if(f=d[_>>2]|0,ge=+J[f+(p<<4)>>3],ve=+Xs(+J[f+(p<<4)+8>>3],d[qe>>2]|0),f=d[_>>2]|0,p=p+1|0,tn=(p|0)%(d[A>>2]|0)|0,T=+J[f+(tn<<4)>>3],M=+Xs(+J[f+(tn<<4)+8>>3],d[qe>>2]|0),!(ge>=Pe)|!(T>=Pe)&&!(ge<=Ie)|!(T<=Ie)&&!(ve<=Ae)|!(M<=Ae)&&!(ve>=Ye)|!(M>=Ye)){ie=T-ge,I=M-ve,f=0;do if(Bn=f,f=f+1|0,tn=(f|0)==(y|0)?0:f,T=+J[Ge+8+(Bn<<4)+8>>3],M=+J[Ge+8+(tn<<4)+8>>3]-T,N=+J[Ge+8+(Bn<<4)>>3],U=+J[Ge+8+(tn<<4)>>3]-N,H=ie*M-I*U,H!=0&&(Le=ve-T,Lt=ge-N,U=(Le*U-M*Lt)/H,!(U<0|U>1))&&(H=(ie*Le-I*Lt)/H,H>=0&H<=1)){f=1;break e}while((f|0)<(y|0))}if((p|0)>=(d[A>>2]|0)){f=0;break}}}else f=0;while(!1);return Bn=f,K=sn,Bn|0}function zA(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0;if(hf(A,f,p,_)|0)return T=1,T|0;if(T=A+8|0,(d[T>>2]|0)<=0)return T=0,T|0;for(y=A+12|0,A=0;;){if(M=A,A=A+1|0,hf((d[y>>2]|0)+(M<<3)|0,f+(A<<5)|0,p,_)|0){A=1,y=6;break}if((A|0)>=(d[T>>2]|0)){A=0,y=6;break}}return(y|0)==6?A|0:0}function _p(){return 8}function R1(){return 16}function fs(){return 168}function sr(){return 8}function mi(){return 16}function kl(){return 12}function Pa(){return 8}function yp(A){return A=A|0,+(+((d[A>>2]|0)>>>0)+4294967296*+(d[A+4>>2]|0))}function zl(A){A=A|0;var f=0,p=0;return p=+J[A>>3],f=+J[A+8>>3],+ +qn(+(p*p+f*f))}function xp(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0;I=+J[A>>3],U=+J[f>>3]-I,N=+J[A+8>>3],M=+J[f+8>>3]-N,ie=+J[p>>3],T=+J[_>>3]-ie,ge=+J[p+8>>3],H=+J[_+8>>3]-ge,T=(T*(N-ge)-(I-ie)*H)/(U*H-M*T),J[y>>3]=I+U*T,J[y+8>>3]=N+M*T}function bp(A,f){return A=A|0,f=f|0,+un(+(+J[A>>3]-+J[f>>3]))<11920928955078125e-23?(f=+un(+(+J[A+8>>3]-+J[f+8>>3]))<11920928955078125e-23,f|0):(f=0,f|0)}function ar(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;return y=+J[A>>3]-+J[f>>3],_=+J[A+8>>3]-+J[f+8>>3],p=+J[A+16>>3]-+J[f+16>>3],+(y*y+_*_+p*p)}function Yu(A,f){A=A|0,f=f|0;var p=0,_=0,y=0;p=+J[A>>3],_=+li(+p),p=+Fn(+p),J[f+16>>3]=p,p=+J[A+8>>3],y=_*+li(+p),J[f>>3]=y,p=_*+Fn(+p),J[f+8>>3]=p}function Sp(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if(T=K,K=K+16|0,y=T,_=Ci(A,f)|0,(p+-1|0)>>>0>5||(_=(_|0)!=0,(p|0)==1&_))return y=-1,K=T,y|0;do if(ol(A,f,y)|0)_=-1;else if(_){_=((d[26352+(p<<2)>>2]|0)+5-(d[y>>2]|0)|0)%5|0;break}else{_=((d[26384+(p<<2)>>2]|0)+6-(d[y>>2]|0)|0)%6|0;break}while(!1);return y=_,K=T,y|0}function ol(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0;if(H=K,K=K+32|0,N=H+16|0,U=H,_=zu(A,f,N)|0,_|0)return p=_,K=H,p|0;T=g1(A,f)|0,I=$s(A,f)|0,tp(T,U),_=$c(T,d[N>>2]|0)|0;do if(Bi(T)|0){do switch(T|0){case 4:{y=0;break}case 14:{y=1;break}case 24:{y=2;break}case 38:{y=3;break}case 49:{y=4;break}case 58:{y=5;break}case 63:{y=6;break}case 72:{y=7;break}case 83:{y=8;break}case 97:{y=9;break}case 107:{y=10;break}case 117:{y=11;break}default:Bt(27795,27797,75,27806)}while(!1);if(M=d[26416+(y*24|0)+8>>2]|0,f=d[26416+(y*24|0)+16>>2]|0,A=d[N>>2]|0,(A|0)!=(d[U>>2]|0)&&(U=Wc(T)|0,A=d[N>>2]|0,U|(A|0)==(f|0)&&(_=(_+1|0)%6|0)),(I|0)==3&(A|0)==(f|0)){_=(_+5|0)%6|0;break}(I|0)==5&(A|0)==(M|0)&&(_=(_+1|0)%6|0)}while(!1);return d[p>>2]=_,p=0,K=H,p|0}function Qs(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0;if(Ge=K,K=K+32|0,qe=Ge+24|0,Ie=Ge+20|0,ve=Ge+8|0,Ae=Ge+16|0,ge=Ge,U=(Ci(A,f)|0)==0,U=U?6:5,H=Mt(A|0,f|0,52)|0,Z()|0,H=H&15,U>>>0<=p>>>0)return _=2,K=Ge,_|0;ie=(H|0)==0,!ie&&(Pe=Dt(7,0,(H^15)*3|0)|0,(Pe&A|0)==0&((Z()|0)&f|0)==0)?y=p:T=4;e:do if((T|0)==4){if(y=(Ci(A,f)|0)!=0,((y?4:5)|0)<(p|0)||ol(A,f,qe)|0||(T=(d[qe>>2]|0)+p|0,y?y=26704+(((T|0)%5|0)<<2)|0:y=26736+(((T|0)%6|0)<<2)|0,Pe=d[y>>2]|0,(Pe|0)==7))return _=1,K=Ge,_|0;d[Ie>>2]=0,y=cn(A,f,Pe,Ie,ve)|0;do if(!y){if(N=ve,I=d[N>>2]|0,N=d[N+4>>2]|0,M=N>>>0<f>>>0|(N|0)==(f|0)&I>>>0<A>>>0,T=M?I:A,M=M?N:f,!ie&&(ie=Dt(7,0,(H^15)*3|0)|0,(I&ie|0)==0&(N&(Z()|0)|0)==0))y=p;else{if(N=(p+-1+U|0)%(U|0)|0,y=Ci(A,f)|0,(N|0)<0&&Bt(27795,27797,248,27822),U=(y|0)!=0,((U?4:5)|0)<(N|0)&&Bt(27795,27797,248,27822),ol(A,f,qe)|0&&Bt(27795,27797,248,27822),y=(d[qe>>2]|0)+N|0,U?y=26704+(((y|0)%5|0)<<2)|0:y=26736+(((y|0)%6|0)<<2)|0,N=d[y>>2]|0,(N|0)==7&&Bt(27795,27797,248,27822),d[Ae>>2]=0,y=cn(A,f,N,Ae,ge)|0,y|0)break;I=ge,U=d[I>>2]|0,I=d[I+4>>2]|0;do if(I>>>0<M>>>0|(I|0)==(M|0)&U>>>0<T>>>0){if(Ci(U,I)|0?T=pi(U,I,A,f)|0:T=d[26800+((((d[Ae>>2]|0)+(d[26768+(N<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,y=Ci(U,I)|0,(T+-1|0)>>>0>5){y=-1,T=U,M=I;break}if(y=(y|0)!=0,(T|0)==1&y){y=-1,T=U,M=I;break}do if(ol(U,I,qe)|0)y=-1;else if(y){y=((d[26352+(T<<2)>>2]|0)+5-(d[qe>>2]|0)|0)%5|0;break}else{y=((d[26384+(T<<2)>>2]|0)+6-(d[qe>>2]|0)|0)%6|0;break}while(!1);T=U,M=I}else y=p;while(!1);N=ve,I=d[N>>2]|0,N=d[N+4>>2]|0}if((T|0)==(I|0)&(M|0)==(N|0)){if(U=(Ci(I,N)|0)!=0,U?A=pi(I,N,A,f)|0:A=d[26800+((((d[Ie>>2]|0)+(d[26768+(Pe<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,y=Ci(I,N)|0,(A+-1|0)>>>0<=5&&(Ye=(y|0)!=0,!((A|0)==1&Ye)))do if(ol(I,N,qe)|0)y=-1;else if(Ye){y=((d[26352+(A<<2)>>2]|0)+5-(d[qe>>2]|0)|0)%5|0;break}else{y=((d[26384+(A<<2)>>2]|0)+6-(d[qe>>2]|0)|0)%6|0;break}while(!1);else y=-1;y=y+1|0,y=(y|0)==6|U&(y|0)==5?0:y}f=M,A=T;break e}while(!1);return _=y,K=Ge,_|0}while(!1);return Ye=Dt(y|0,0,56)|0,qe=Z()|0|f&-2130706433|536870912,d[_>>2]=Ye|A,d[_+4>>2]=qe,_=0,K=Ge,_|0}function Qu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;return T=(Ci(A,f)|0)==0,_=Qs(A,f,0,p)|0,y=(_|0)==0,T?!y||(_=Qs(A,f,1,p+8|0)|0,_|0)||(_=Qs(A,f,2,p+16|0)|0,_|0)||(_=Qs(A,f,3,p+24|0)|0,_|0)||(_=Qs(A,f,4,p+32|0)|0,_)?(T=_,T|0):Qs(A,f,5,p+40|0)|0:!y||(_=Qs(A,f,1,p+8|0)|0,_|0)||(_=Qs(A,f,2,p+16|0)|0,_|0)||(_=Qs(A,f,3,p+24|0)|0,_|0)||(_=Qs(A,f,4,p+32|0)|0,_|0)?(T=_,T|0):(T=p+40|0,d[T>>2]=0,d[T+4>>2]=0,T=0,T|0)}function ll(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0,N=0,U=0;return U=K,K=K+192|0,y=U,T=U+168|0,M=Mt(A|0,f|0,56)|0,Z()|0,M=M&7,N=f&-2130706433|134217728,_=zu(A,N,T)|0,_|0?(N=_,K=U,N|0):(f=Mt(A|0,f|0,52)|0,Z()|0,f=f&15,Ci(A,N)|0?sp(T,f,M,1,y):RA(T,f,M,1,y),N=y+8|0,d[p>>2]=d[N>>2],d[p+4>>2]=d[N+4>>2],d[p+8>>2]=d[N+8>>2],d[p+12>>2]=d[N+12>>2],N=0,K=U,N|0)}function ul(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return y=K,K=K+16|0,p=y,!(!0&(f&2013265920|0)==536870912)||(_=f&-2130706433|134217728,!(NA(A,_)|0))?(_=0,K=y,_|0):(T=Mt(A|0,f|0,56)|0,Z()|0,T=(Qs(A,_,T&7,p)|0)==0,_=p,_=T&((d[_>>2]|0)==(A|0)?(d[_+4>>2]|0)==(f|0):0)&1,K=y,_|0)}function Io(A,f,p){A=A|0,f=f|0,p=p|0;var _=0;(f|0)>0?(_=Ks(f,4)|0,d[A>>2]=_,_||Bt(27835,27858,40,27872)):d[A>>2]=0,d[A+4>>2]=f,d[A+8>>2]=0,d[A+12>>2]=p}function GA(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0;y=A+4|0,T=A+12|0,M=A+8|0;e:for(;;){for(p=d[y>>2]|0,f=0;;){if((f|0)>=(p|0))break e;if(_=d[A>>2]|0,N=d[_+(f<<2)>>2]|0,!N)f=f+1|0;else break}f=_+(~~(+un(+(+Hs(10,+ +(15-(d[T>>2]|0)|0))*(+J[N>>3]+ +J[N+8>>3])))%+(p|0))>>>0<<2)|0,p=d[f>>2]|0;t:do if(p|0){if(_=N+32|0,(p|0)==(N|0))d[f>>2]=d[_>>2];else{if(p=p+32|0,f=d[p>>2]|0,!f)break;for(;(f|0)!=(N|0);)if(p=f+32|0,f=d[p>>2]|0,!f)break t;d[p>>2]=d[_>>2]}An(N),d[M>>2]=(d[M>>2]|0)+-1}while(!1)}An(d[A>>2]|0)}function qA(A){A=A|0;var f=0,p=0,_=0;for(_=d[A+4>>2]|0,p=0;;){if((p|0)>=(_|0)){f=0,p=4;break}if(f=d[(d[A>>2]|0)+(p<<2)>>2]|0,!f)p=p+1|0;else{p=4;break}}return(p|0)==4?f|0:0}function Ku(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;if(p=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+J[f>>3]+ +J[f+8>>3])))%+(d[A+4>>2]|0))>>>0,p=(d[A>>2]|0)+(p<<2)|0,_=d[p>>2]|0,!_)return T=1,T|0;T=f+32|0;do if((_|0)!=(f|0)){if(p=d[_+32>>2]|0,!p)return T=1,T|0;for(y=p;;){if((y|0)==(f|0)){y=8;break}if(p=d[y+32>>2]|0,p)_=y,y=p;else{p=1,y=10;break}}if((y|0)==8){d[_+32>>2]=d[T>>2];break}else if((y|0)==10)return p|0}else d[p>>2]=d[T>>2];while(!1);return An(f),T=A+8|0,d[T>>2]=(d[T>>2]|0)+-1,T=0,T|0}function VA(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;T=Fo(40)|0,T||Bt(27888,27858,98,27901),d[T>>2]=d[f>>2],d[T+4>>2]=d[f+4>>2],d[T+8>>2]=d[f+8>>2],d[T+12>>2]=d[f+12>>2],y=T+16|0,d[y>>2]=d[p>>2],d[y+4>>2]=d[p+4>>2],d[y+8>>2]=d[p+8>>2],d[y+12>>2]=d[p+12>>2],d[T+32>>2]=0,y=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+J[f>>3]+ +J[f+8>>3])))%+(d[A+4>>2]|0))>>>0,y=(d[A>>2]|0)+(y<<2)|0,_=d[y>>2]|0;do if(!_)d[y>>2]=T;else{for(;!(Ea(_,f)|0&&Ea(_+16|0,p)|0);)if(y=d[_+32>>2]|0,_=(y|0)==0?_:y,!(d[_+32>>2]|0)){M=10;break}if((M|0)==10){d[_+32>>2]=T;break}return An(T),M=_,M|0}while(!1);return M=A+8|0,d[M>>2]=(d[M>>2]|0)+1,M=T,M|0}function Zu(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0;if(y=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+J[f>>3]+ +J[f+8>>3])))%+(d[A+4>>2]|0))>>>0,y=d[(d[A>>2]|0)+(y<<2)>>2]|0,!y)return p=0,p|0;if(!p){for(A=y;;){if(Ea(A,f)|0){_=10;break}if(A=d[A+32>>2]|0,!A){A=0,_=10;break}}if((_|0)==10)return A|0}for(A=y;;){if(Ea(A,f)|0&&Ea(A+16|0,p)|0){_=10;break}if(A=d[A+32>>2]|0,!A){A=0,_=10;break}}return(_|0)==10?A|0:0}function As(A,f){A=A|0,f=f|0;var p=0;if(p=~~(+un(+(+Hs(10,+ +(15-(d[A+12>>2]|0)|0))*(+J[f>>3]+ +J[f+8>>3])))%+(d[A+4>>2]|0))>>>0,A=d[(d[A>>2]|0)+(p<<2)>>2]|0,!A)return p=0,p|0;for(;;){if(Ea(A,f)|0){f=5;break}if(A=d[A+32>>2]|0,!A){A=0,f=5;break}}return(f|0)==5?A|0:0}function HA(){return 27920}function cl(A){return A=+A,~~+pf(+A)|0}function Fo(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0,Pe=0,Ie=0,Ye=0,qe=0,Ge=0,Le=0,Lt=0;Lt=K,K=K+16|0,ge=Lt;do if(A>>>0<245){if(I=A>>>0<11?16:A+11&-8,A=I>>>3,ie=d[6981]|0,p=ie>>>A,p&3|0)return f=(p&1^1)+A|0,A=27964+(f<<1<<2)|0,p=A+8|0,_=d[p>>2]|0,y=_+8|0,T=d[y>>2]|0,(T|0)==(A|0)?d[6981]=ie&~(1<<f):(d[T+12>>2]=A,d[p>>2]=T),Le=f<<3,d[_+4>>2]=Le|3,Le=_+Le+4|0,d[Le>>2]=d[Le>>2]|1,Le=y,K=Lt,Le|0;if(H=d[6983]|0,I>>>0>H>>>0){if(p|0)return f=2<<A,f=p<<A&(f|0-f),f=(f&0-f)+-1|0,N=f>>>12&16,f=f>>>N,p=f>>>5&8,f=f>>>p,T=f>>>2&4,f=f>>>T,A=f>>>1&2,f=f>>>A,_=f>>>1&1,_=(p|N|T|A|_)+(f>>>_)|0,f=27964+(_<<1<<2)|0,A=f+8|0,T=d[A>>2]|0,N=T+8|0,p=d[N>>2]|0,(p|0)==(f|0)?(A=ie&~(1<<_),d[6981]=A):(d[p+12>>2]=f,d[A>>2]=p,A=ie),Le=_<<3,M=Le-I|0,d[T+4>>2]=I|3,y=T+I|0,d[y+4>>2]=M|1,d[T+Le>>2]=M,H|0&&(_=d[6986]|0,f=H>>>3,p=27964+(f<<1<<2)|0,f=1<<f,A&f?(A=p+8|0,f=d[A>>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=_,d[f+12>>2]=_,d[_+8>>2]=f,d[_+12>>2]=p),d[6983]=M,d[6986]=y,Le=N,K=Lt,Le|0;if(T=d[6982]|0,T){for(p=(T&0-T)+-1|0,y=p>>>12&16,p=p>>>y,_=p>>>5&8,p=p>>>_,M=p>>>2&4,p=p>>>M,N=p>>>1&2,p=p>>>N,U=p>>>1&1,U=d[28228+((_|y|M|N|U)+(p>>>U)<<2)>>2]|0,p=U,N=U,U=(d[U+4>>2]&-8)-I|0;A=d[p+16>>2]|0,!(!A&&(A=d[p+20>>2]|0,!A));)M=(d[A+4>>2]&-8)-I|0,y=M>>>0<U>>>0,p=A,N=y?A:N,U=y?M:U;if(M=N+I|0,M>>>0>N>>>0){y=d[N+24>>2]|0,f=d[N+12>>2]|0;do if((f|0)==(N|0)){if(A=N+20|0,f=d[A>>2]|0,!f&&(A=N+16|0,f=d[A>>2]|0,!f)){p=0;break}for(;;)if(_=f+20|0,p=d[_>>2]|0,p)f=p,A=_;else if(_=f+16|0,p=d[_>>2]|0,p)f=p,A=_;else break;d[A>>2]=0,p=f}else p=d[N+8>>2]|0,d[p+12>>2]=f,d[f+8>>2]=p,p=f;while(!1);do if(y|0){if(f=d[N+28>>2]|0,A=28228+(f<<2)|0,(N|0)==(d[A>>2]|0)){if(d[A>>2]=p,!p){d[6982]=T&~(1<<f);break}}else if(Le=y+16|0,d[((d[Le>>2]|0)==(N|0)?Le:y+20|0)>>2]=p,!p)break;d[p+24>>2]=y,f=d[N+16>>2]|0,f|0&&(d[p+16>>2]=f,d[f+24>>2]=p),f=d[N+20>>2]|0,f|0&&(d[p+20>>2]=f,d[f+24>>2]=p)}while(!1);return U>>>0<16?(Le=U+I|0,d[N+4>>2]=Le|3,Le=N+Le+4|0,d[Le>>2]=d[Le>>2]|1):(d[N+4>>2]=I|3,d[M+4>>2]=U|1,d[M+U>>2]=U,H|0&&(_=d[6986]|0,f=H>>>3,p=27964+(f<<1<<2)|0,f=1<<f,f&ie?(A=p+8|0,f=d[A>>2]|0):(d[6981]=f|ie,f=p,A=p+8|0),d[A>>2]=_,d[f+12>>2]=_,d[_+8>>2]=f,d[_+12>>2]=p),d[6983]=U,d[6986]=M),Le=N+8|0,K=Lt,Le|0}else ie=I}else ie=I}else ie=I}else if(A>>>0<=4294967231)if(A=A+11|0,I=A&-8,_=d[6982]|0,_){y=0-I|0,A=A>>>8,A?I>>>0>16777215?U=31:(ie=(A+1048320|0)>>>16&8,Pe=A<<ie,N=(Pe+520192|0)>>>16&4,Pe=Pe<<N,U=(Pe+245760|0)>>>16&2,U=14-(N|ie|U)+(Pe<<U>>>15)|0,U=I>>>(U+7|0)&1|U<<1):U=0,p=d[28228+(U<<2)>>2]|0;e:do if(!p)p=0,A=0,Pe=61;else for(A=0,N=I<<((U|0)==31?0:25-(U>>>1)|0),T=0;;){if(M=(d[p+4>>2]&-8)-I|0,M>>>0<y>>>0)if(M)A=p,y=M;else{A=p,y=0,Pe=65;break e}if(Pe=d[p+20>>2]|0,p=d[p+16+(N>>>31<<2)>>2]|0,T=(Pe|0)==0|(Pe|0)==(p|0)?T:Pe,p)N=N<<1;else{p=T,Pe=61;break}}while(!1);if((Pe|0)==61){if((p|0)==0&(A|0)==0){if(A=2<<U,A=(A|0-A)&_,!A){ie=I;break}ie=(A&0-A)+-1|0,M=ie>>>12&16,ie=ie>>>M,T=ie>>>5&8,ie=ie>>>T,N=ie>>>2&4,ie=ie>>>N,U=ie>>>1&2,ie=ie>>>U,p=ie>>>1&1,A=0,p=d[28228+((T|M|N|U|p)+(ie>>>p)<<2)>>2]|0}p?Pe=65:(N=A,M=y)}if((Pe|0)==65)for(T=p;;)if(ie=(d[T+4>>2]&-8)-I|0,p=ie>>>0<y>>>0,y=p?ie:y,A=p?T:A,p=d[T+16>>2]|0,p||(p=d[T+20>>2]|0),p)T=p;else{N=A,M=y;break}if((N|0)!=0&&M>>>0<((d[6983]|0)-I|0)>>>0&&(H=N+I|0,H>>>0>N>>>0)){T=d[N+24>>2]|0,f=d[N+12>>2]|0;do if((f|0)==(N|0)){if(A=N+20|0,f=d[A>>2]|0,!f&&(A=N+16|0,f=d[A>>2]|0,!f)){f=0;break}for(;;)if(y=f+20|0,p=d[y>>2]|0,p)f=p,A=y;else if(y=f+16|0,p=d[y>>2]|0,p)f=p,A=y;else break;d[A>>2]=0}else Le=d[N+8>>2]|0,d[Le+12>>2]=f,d[f+8>>2]=Le;while(!1);do if(T){if(A=d[N+28>>2]|0,p=28228+(A<<2)|0,(N|0)==(d[p>>2]|0)){if(d[p>>2]=f,!f){_=_&~(1<<A),d[6982]=_;break}}else if(Le=T+16|0,d[((d[Le>>2]|0)==(N|0)?Le:T+20|0)>>2]=f,!f)break;d[f+24>>2]=T,A=d[N+16>>2]|0,A|0&&(d[f+16>>2]=A,d[A+24>>2]=f),A=d[N+20>>2]|0,A&&(d[f+20>>2]=A,d[A+24>>2]=f)}while(!1);e:do if(M>>>0<16)Le=M+I|0,d[N+4>>2]=Le|3,Le=N+Le+4|0,d[Le>>2]=d[Le>>2]|1;else{if(d[N+4>>2]=I|3,d[H+4>>2]=M|1,d[H+M>>2]=M,f=M>>>3,M>>>0<256){p=27964+(f<<1<<2)|0,A=d[6981]|0,f=1<<f,A&f?(A=p+8|0,f=d[A>>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=H,d[f+12>>2]=H,d[H+8>>2]=f,d[H+12>>2]=p;break}if(f=M>>>8,f?M>>>0>16777215?p=31:(Ge=(f+1048320|0)>>>16&8,Le=f<<Ge,qe=(Le+520192|0)>>>16&4,Le=Le<<qe,p=(Le+245760|0)>>>16&2,p=14-(qe|Ge|p)+(Le<<p>>>15)|0,p=M>>>(p+7|0)&1|p<<1):p=0,f=28228+(p<<2)|0,d[H+28>>2]=p,A=H+16|0,d[A+4>>2]=0,d[A>>2]=0,A=1<<p,!(_&A)){d[6982]=_|A,d[f>>2]=H,d[H+24>>2]=f,d[H+12>>2]=H,d[H+8>>2]=H;break}f=d[f>>2]|0;t:do if((d[f+4>>2]&-8|0)!=(M|0)){for(_=M<<((p|0)==31?0:25-(p>>>1)|0);p=f+16+(_>>>31<<2)|0,A=d[p>>2]|0,!!A;)if((d[A+4>>2]&-8|0)==(M|0)){f=A;break t}else _=_<<1,f=A;d[p>>2]=H,d[H+24>>2]=f,d[H+12>>2]=H,d[H+8>>2]=H;break e}while(!1);Ge=f+8|0,Le=d[Ge>>2]|0,d[Le+12>>2]=H,d[Ge>>2]=H,d[H+8>>2]=Le,d[H+12>>2]=f,d[H+24>>2]=0}while(!1);return Le=N+8|0,K=Lt,Le|0}else ie=I}else ie=I;else ie=-1;while(!1);if(p=d[6983]|0,p>>>0>=ie>>>0)return f=p-ie|0,A=d[6986]|0,f>>>0>15?(Le=A+ie|0,d[6986]=Le,d[6983]=f,d[Le+4>>2]=f|1,d[A+p>>2]=f,d[A+4>>2]=ie|3):(d[6983]=0,d[6986]=0,d[A+4>>2]=p|3,Le=A+p+4|0,d[Le>>2]=d[Le>>2]|1),Le=A+8|0,K=Lt,Le|0;if(M=d[6984]|0,M>>>0>ie>>>0)return qe=M-ie|0,d[6984]=qe,Le=d[6987]|0,Ge=Le+ie|0,d[6987]=Ge,d[Ge+4>>2]=qe|1,d[Le+4>>2]=ie|3,Le=Le+8|0,K=Lt,Le|0;if(d[7099]|0?A=d[7101]|0:(d[7101]=4096,d[7100]=4096,d[7102]=-1,d[7103]=-1,d[7104]=0,d[7092]=0,d[7099]=ge&-16^1431655768,A=4096),N=ie+48|0,U=ie+47|0,T=A+U|0,y=0-A|0,I=T&y,I>>>0<=ie>>>0||(A=d[7091]|0,A|0&&(H=d[7089]|0,ge=H+I|0,ge>>>0<=H>>>0|ge>>>0>A>>>0)))return Le=0,K=Lt,Le|0;e:do if(d[7092]&4)f=0,Pe=143;else{p=d[6987]|0;t:do if(p){for(_=28372;ge=d[_>>2]|0,!(ge>>>0<=p>>>0&&(ge+(d[_+4>>2]|0)|0)>>>0>p>>>0);)if(A=d[_+8>>2]|0,A)_=A;else{Pe=128;break t}if(f=T-M&y,f>>>0<2147483647)if(A=fl(f|0)|0,(A|0)==((d[_>>2]|0)+(d[_+4>>2]|0)|0)){if((A|0)!=-1){M=f,T=A,Pe=145;break e}}else _=A,Pe=136;else f=0}else Pe=128;while(!1);do if((Pe|0)==128)if(p=fl(0)|0,(p|0)!=-1&&(f=p,Ae=d[7100]|0,ve=Ae+-1|0,f=((ve&f|0)==0?0:(ve+f&0-Ae)-f|0)+I|0,Ae=d[7089]|0,ve=f+Ae|0,f>>>0>ie>>>0&f>>>0<2147483647)){if(ge=d[7091]|0,ge|0&&ve>>>0<=Ae>>>0|ve>>>0>ge>>>0){f=0;break}if(A=fl(f|0)|0,(A|0)==(p|0)){M=f,T=p,Pe=145;break e}else _=A,Pe=136}else f=0;while(!1);do if((Pe|0)==136){if(p=0-f|0,!(N>>>0>f>>>0&(f>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){f=0;break}else{M=f,T=_,Pe=145;break e}if(A=d[7101]|0,A=U-f+A&0-A,A>>>0>=2147483647){M=f,T=_,Pe=145;break e}if((fl(A|0)|0)==-1){fl(p|0)|0,f=0;break}else{M=A+f|0,T=_,Pe=145;break e}}while(!1);d[7092]=d[7092]|4,Pe=143}while(!1);if((Pe|0)==143&&I>>>0<2147483647&&(qe=fl(I|0)|0,ve=fl(0)|0,Ie=ve-qe|0,Ye=Ie>>>0>(ie+40|0)>>>0,!((qe|0)==-1|Ye^1|qe>>>0<ve>>>0&((qe|0)!=-1&(ve|0)!=-1)^1))&&(M=Ye?Ie:f,T=qe,Pe=145),(Pe|0)==145){f=(d[7089]|0)+M|0,d[7089]=f,f>>>0>(d[7090]|0)>>>0&&(d[7090]=f),U=d[6987]|0;e:do if(U){for(f=28372;;){if(A=d[f>>2]|0,p=d[f+4>>2]|0,(T|0)==(A+p|0)){Pe=154;break}if(_=d[f+8>>2]|0,_)f=_;else break}if((Pe|0)==154&&(Ge=f+4|0,(d[f+12>>2]&8|0)==0)&&T>>>0>U>>>0&A>>>0<=U>>>0){d[Ge>>2]=p+M,Le=(d[6984]|0)+M|0,qe=U+8|0,qe=(qe&7|0)==0?0:0-qe&7,Ge=U+qe|0,qe=Le-qe|0,d[6987]=Ge,d[6984]=qe,d[Ge+4>>2]=qe|1,d[U+Le+4>>2]=40,d[6988]=d[7103];break}for(T>>>0<(d[6985]|0)>>>0&&(d[6985]=T),p=T+M|0,f=28372;;){if((d[f>>2]|0)==(p|0)){Pe=162;break}if(A=d[f+8>>2]|0,A)f=A;else break}if((Pe|0)==162&&(d[f+12>>2]&8|0)==0){d[f>>2]=T,H=f+4|0,d[H>>2]=(d[H>>2]|0)+M,H=T+8|0,H=T+((H&7|0)==0?0:0-H&7)|0,f=p+8|0,f=p+((f&7|0)==0?0:0-f&7)|0,I=H+ie|0,N=f-H-ie|0,d[H+4>>2]=ie|3;t:do if((U|0)==(f|0))Le=(d[6984]|0)+N|0,d[6984]=Le,d[6987]=I,d[I+4>>2]=Le|1;else{if((d[6986]|0)==(f|0)){Le=(d[6983]|0)+N|0,d[6983]=Le,d[6986]=I,d[I+4>>2]=Le|1,d[I+Le>>2]=Le;break}if(A=d[f+4>>2]|0,(A&3|0)==1){M=A&-8,_=A>>>3;n:do if(A>>>0<256)if(A=d[f+8>>2]|0,p=d[f+12>>2]|0,(p|0)==(A|0)){d[6981]=d[6981]&~(1<<_);break}else{d[A+12>>2]=p,d[p+8>>2]=A;break}else{T=d[f+24>>2]|0,A=d[f+12>>2]|0;do if((A|0)==(f|0)){if(p=f+16|0,_=p+4|0,A=d[_>>2]|0,A)p=_;else if(A=d[p>>2]|0,!A){A=0;break}for(;;)if(y=A+20|0,_=d[y>>2]|0,_)A=_,p=y;else if(y=A+16|0,_=d[y>>2]|0,_)A=_,p=y;else break;d[p>>2]=0}else Le=d[f+8>>2]|0,d[Le+12>>2]=A,d[A+8>>2]=Le;while(!1);if(!T)break;p=d[f+28>>2]|0,_=28228+(p<<2)|0;do if((d[_>>2]|0)!=(f|0)){if(Le=T+16|0,d[((d[Le>>2]|0)==(f|0)?Le:T+20|0)>>2]=A,!A)break n}else{if(d[_>>2]=A,A|0)break;d[6982]=d[6982]&~(1<<p);break n}while(!1);if(d[A+24>>2]=T,p=f+16|0,_=d[p>>2]|0,_|0&&(d[A+16>>2]=_,d[_+24>>2]=A),p=d[p+4>>2]|0,!p)break;d[A+20>>2]=p,d[p+24>>2]=A}while(!1);f=f+M|0,y=M+N|0}else y=N;if(f=f+4|0,d[f>>2]=d[f>>2]&-2,d[I+4>>2]=y|1,d[I+y>>2]=y,f=y>>>3,y>>>0<256){p=27964+(f<<1<<2)|0,A=d[6981]|0,f=1<<f,A&f?(A=p+8|0,f=d[A>>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=I,d[f+12>>2]=I,d[I+8>>2]=f,d[I+12>>2]=p;break}f=y>>>8;do if(!f)_=0;else{if(y>>>0>16777215){_=31;break}Ge=(f+1048320|0)>>>16&8,Le=f<<Ge,qe=(Le+520192|0)>>>16&4,Le=Le<<qe,_=(Le+245760|0)>>>16&2,_=14-(qe|Ge|_)+(Le<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1}while(!1);if(f=28228+(_<<2)|0,d[I+28>>2]=_,A=I+16|0,d[A+4>>2]=0,d[A>>2]=0,A=d[6982]|0,p=1<<_,!(A&p)){d[6982]=A|p,d[f>>2]=I,d[I+24>>2]=f,d[I+12>>2]=I,d[I+8>>2]=I;break}f=d[f>>2]|0;n:do if((d[f+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);p=f+16+(_>>>31<<2)|0,A=d[p>>2]|0,!!A;)if((d[A+4>>2]&-8|0)==(y|0)){f=A;break n}else _=_<<1,f=A;d[p>>2]=I,d[I+24>>2]=f,d[I+12>>2]=I,d[I+8>>2]=I;break t}while(!1);Ge=f+8|0,Le=d[Ge>>2]|0,d[Le+12>>2]=I,d[Ge>>2]=I,d[I+8>>2]=Le,d[I+12>>2]=f,d[I+24>>2]=0}while(!1);return Le=H+8|0,K=Lt,Le|0}for(f=28372;A=d[f>>2]|0,!(A>>>0<=U>>>0&&(Le=A+(d[f+4>>2]|0)|0,Le>>>0>U>>>0));)f=d[f+8>>2]|0;y=Le+-47|0,A=y+8|0,A=y+((A&7|0)==0?0:0-A&7)|0,y=U+16|0,A=A>>>0<y>>>0?U:A,f=A+8|0,p=M+-40|0,qe=T+8|0,qe=(qe&7|0)==0?0:0-qe&7,Ge=T+qe|0,qe=p-qe|0,d[6987]=Ge,d[6984]=qe,d[Ge+4>>2]=qe|1,d[T+p+4>>2]=40,d[6988]=d[7103],p=A+4|0,d[p>>2]=27,d[f>>2]=d[7093],d[f+4>>2]=d[7094],d[f+8>>2]=d[7095],d[f+12>>2]=d[7096],d[7093]=T,d[7094]=M,d[7096]=0,d[7095]=f,f=A+24|0;do Ge=f,f=f+4|0,d[f>>2]=7;while((Ge+8|0)>>>0<Le>>>0);if((A|0)!=(U|0)){if(T=A-U|0,d[p>>2]=d[p>>2]&-2,d[U+4>>2]=T|1,d[A>>2]=T,f=T>>>3,T>>>0<256){p=27964+(f<<1<<2)|0,A=d[6981]|0,f=1<<f,A&f?(A=p+8|0,f=d[A>>2]|0):(d[6981]=A|f,f=p,A=p+8|0),d[A>>2]=U,d[f+12>>2]=U,d[U+8>>2]=f,d[U+12>>2]=p;break}if(f=T>>>8,f?T>>>0>16777215?_=31:(Ge=(f+1048320|0)>>>16&8,Le=f<<Ge,qe=(Le+520192|0)>>>16&4,Le=Le<<qe,_=(Le+245760|0)>>>16&2,_=14-(qe|Ge|_)+(Le<<_>>>15)|0,_=T>>>(_+7|0)&1|_<<1):_=0,p=28228+(_<<2)|0,d[U+28>>2]=_,d[U+20>>2]=0,d[y>>2]=0,f=d[6982]|0,A=1<<_,!(f&A)){d[6982]=f|A,d[p>>2]=U,d[U+24>>2]=p,d[U+12>>2]=U,d[U+8>>2]=U;break}f=d[p>>2]|0;t:do if((d[f+4>>2]&-8|0)!=(T|0)){for(_=T<<((_|0)==31?0:25-(_>>>1)|0);p=f+16+(_>>>31<<2)|0,A=d[p>>2]|0,!!A;)if((d[A+4>>2]&-8|0)==(T|0)){f=A;break t}else _=_<<1,f=A;d[p>>2]=U,d[U+24>>2]=f,d[U+12>>2]=U,d[U+8>>2]=U;break e}while(!1);Ge=f+8|0,Le=d[Ge>>2]|0,d[Le+12>>2]=U,d[Ge>>2]=U,d[U+8>>2]=Le,d[U+12>>2]=f,d[U+24>>2]=0}}else Le=d[6985]|0,(Le|0)==0|T>>>0<Le>>>0&&(d[6985]=T),d[7093]=T,d[7094]=M,d[7096]=0,d[6990]=d[7099],d[6989]=-1,d[6994]=27964,d[6993]=27964,d[6996]=27972,d[6995]=27972,d[6998]=27980,d[6997]=27980,d[7e3]=27988,d[6999]=27988,d[7002]=27996,d[7001]=27996,d[7004]=28004,d[7003]=28004,d[7006]=28012,d[7005]=28012,d[7008]=28020,d[7007]=28020,d[7010]=28028,d[7009]=28028,d[7012]=28036,d[7011]=28036,d[7014]=28044,d[7013]=28044,d[7016]=28052,d[7015]=28052,d[7018]=28060,d[7017]=28060,d[7020]=28068,d[7019]=28068,d[7022]=28076,d[7021]=28076,d[7024]=28084,d[7023]=28084,d[7026]=28092,d[7025]=28092,d[7028]=28100,d[7027]=28100,d[7030]=28108,d[7029]=28108,d[7032]=28116,d[7031]=28116,d[7034]=28124,d[7033]=28124,d[7036]=28132,d[7035]=28132,d[7038]=28140,d[7037]=28140,d[7040]=28148,d[7039]=28148,d[7042]=28156,d[7041]=28156,d[7044]=28164,d[7043]=28164,d[7046]=28172,d[7045]=28172,d[7048]=28180,d[7047]=28180,d[7050]=28188,d[7049]=28188,d[7052]=28196,d[7051]=28196,d[7054]=28204,d[7053]=28204,d[7056]=28212,d[7055]=28212,Le=M+-40|0,qe=T+8|0,qe=(qe&7|0)==0?0:0-qe&7,Ge=T+qe|0,qe=Le-qe|0,d[6987]=Ge,d[6984]=qe,d[Ge+4>>2]=qe|1,d[T+Le+4>>2]=40,d[6988]=d[7103];while(!1);if(f=d[6984]|0,f>>>0>ie>>>0)return qe=f-ie|0,d[6984]=qe,Le=d[6987]|0,Ge=Le+ie|0,d[6987]=Ge,d[Ge+4>>2]=qe|1,d[Le+4>>2]=ie|3,Le=Le+8|0,K=Lt,Le|0}return Le=HA()|0,d[Le>>2]=12,Le=0,K=Lt,Le|0}function An(A){A=A|0;var f=0,p=0,_=0,y=0,T=0,M=0,N=0,U=0;if(A){p=A+-8|0,y=d[6985]|0,A=d[A+-4>>2]|0,f=A&-8,U=p+f|0;do if(A&1)N=p,M=p;else{if(_=d[p>>2]|0,!(A&3)||(M=p+(0-_)|0,T=_+f|0,M>>>0<y>>>0))return;if((d[6986]|0)==(M|0)){if(A=U+4|0,f=d[A>>2]|0,(f&3|0)!=3){N=M,f=T;break}d[6983]=T,d[A>>2]=f&-2,d[M+4>>2]=T|1,d[M+T>>2]=T;return}if(p=_>>>3,_>>>0<256)if(A=d[M+8>>2]|0,f=d[M+12>>2]|0,(f|0)==(A|0)){d[6981]=d[6981]&~(1<<p),N=M,f=T;break}else{d[A+12>>2]=f,d[f+8>>2]=A,N=M,f=T;break}y=d[M+24>>2]|0,A=d[M+12>>2]|0;do if((A|0)==(M|0)){if(f=M+16|0,p=f+4|0,A=d[p>>2]|0,A)f=p;else if(A=d[f>>2]|0,!A){A=0;break}for(;;)if(_=A+20|0,p=d[_>>2]|0,p)A=p,f=_;else if(_=A+16|0,p=d[_>>2]|0,p)A=p,f=_;else break;d[f>>2]=0}else N=d[M+8>>2]|0,d[N+12>>2]=A,d[A+8>>2]=N;while(!1);if(y){if(f=d[M+28>>2]|0,p=28228+(f<<2)|0,(d[p>>2]|0)==(M|0)){if(d[p>>2]=A,!A){d[6982]=d[6982]&~(1<<f),N=M,f=T;break}}else if(N=y+16|0,d[((d[N>>2]|0)==(M|0)?N:y+20|0)>>2]=A,!A){N=M,f=T;break}d[A+24>>2]=y,f=M+16|0,p=d[f>>2]|0,p|0&&(d[A+16>>2]=p,d[p+24>>2]=A),f=d[f+4>>2]|0,f?(d[A+20>>2]=f,d[f+24>>2]=A,N=M,f=T):(N=M,f=T)}else N=M,f=T}while(!1);if(!(M>>>0>=U>>>0)&&(A=U+4|0,_=d[A>>2]|0,!!(_&1))){if(_&2)d[A>>2]=_&-2,d[N+4>>2]=f|1,d[M+f>>2]=f,y=f;else{if((d[6987]|0)==(U|0)){if(U=(d[6984]|0)+f|0,d[6984]=U,d[6987]=N,d[N+4>>2]=U|1,(N|0)!=(d[6986]|0))return;d[6986]=0,d[6983]=0;return}if((d[6986]|0)==(U|0)){U=(d[6983]|0)+f|0,d[6983]=U,d[6986]=M,d[N+4>>2]=U|1,d[M+U>>2]=U;return}y=(_&-8)+f|0,p=_>>>3;do if(_>>>0<256)if(f=d[U+8>>2]|0,A=d[U+12>>2]|0,(A|0)==(f|0)){d[6981]=d[6981]&~(1<<p);break}else{d[f+12>>2]=A,d[A+8>>2]=f;break}else{T=d[U+24>>2]|0,A=d[U+12>>2]|0;do if((A|0)==(U|0)){if(f=U+16|0,p=f+4|0,A=d[p>>2]|0,A)f=p;else if(A=d[f>>2]|0,!A){p=0;break}for(;;)if(_=A+20|0,p=d[_>>2]|0,p)A=p,f=_;else if(_=A+16|0,p=d[_>>2]|0,p)A=p,f=_;else break;d[f>>2]=0,p=A}else p=d[U+8>>2]|0,d[p+12>>2]=A,d[A+8>>2]=p,p=A;while(!1);if(T|0){if(A=d[U+28>>2]|0,f=28228+(A<<2)|0,(d[f>>2]|0)==(U|0)){if(d[f>>2]=p,!p){d[6982]=d[6982]&~(1<<A);break}}else if(_=T+16|0,d[((d[_>>2]|0)==(U|0)?_:T+20|0)>>2]=p,!p)break;d[p+24>>2]=T,A=U+16|0,f=d[A>>2]|0,f|0&&(d[p+16>>2]=f,d[f+24>>2]=p),A=d[A+4>>2]|0,A|0&&(d[p+20>>2]=A,d[A+24>>2]=p)}}while(!1);if(d[N+4>>2]=y|1,d[M+y>>2]=y,(N|0)==(d[6986]|0)){d[6983]=y;return}}if(A=y>>>3,y>>>0<256){p=27964+(A<<1<<2)|0,f=d[6981]|0,A=1<<A,f&A?(f=p+8|0,A=d[f>>2]|0):(d[6981]=f|A,A=p,f=p+8|0),d[f>>2]=N,d[A+12>>2]=N,d[N+8>>2]=A,d[N+12>>2]=p;return}A=y>>>8,A?y>>>0>16777215?_=31:(M=(A+1048320|0)>>>16&8,U=A<<M,T=(U+520192|0)>>>16&4,U=U<<T,_=(U+245760|0)>>>16&2,_=14-(T|M|_)+(U<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1):_=0,A=28228+(_<<2)|0,d[N+28>>2]=_,d[N+20>>2]=0,d[N+16>>2]=0,f=d[6982]|0,p=1<<_;e:do if(!(f&p))d[6982]=f|p,d[A>>2]=N,d[N+24>>2]=A,d[N+12>>2]=N,d[N+8>>2]=N;else{A=d[A>>2]|0;t:do if((d[A+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);p=A+16+(_>>>31<<2)|0,f=d[p>>2]|0,!!f;)if((d[f+4>>2]&-8|0)==(y|0)){A=f;break t}else _=_<<1,A=f;d[p>>2]=N,d[N+24>>2]=A,d[N+12>>2]=N,d[N+8>>2]=N;break e}while(!1);M=A+8|0,U=d[M>>2]|0,d[U+12>>2]=N,d[M>>2]=N,d[N+8>>2]=U,d[N+12>>2]=A,d[N+24>>2]=0}while(!1);if(U=(d[6989]|0)+-1|0,d[6989]=U,!(U|0)){for(A=28380;A=d[A>>2]|0,A;)A=A+8|0;d[6989]=-1}}}}function Ks(A,f){A=A|0,f=f|0;var p=0;return A?(p=Xe(f,A)|0,(f|A)>>>0>65535&&(p=((p>>>0)/(A>>>0)|0|0)==(f|0)?p:-1)):p=0,A=Fo(p)|0,!A||!(d[A+-4>>2]&3)||uo(A|0,0,p|0)|0,A|0}function Qt(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,p=A+p>>>0,mt(f+_+(p>>>0<A>>>0|0)>>>0|0),p|0|0}function Ur(A,f,p,_){return A=A|0,f=f|0,p=p|0,_=_|0,_=f-_-(p>>>0>A>>>0|0)>>>0,mt(_|0),A-p>>>0|0|0}function Jc(A){return A=A|0,(A?31-(Xt(A^A-1)|0)|0:32)|0}function Ju(A,f,p,_,y){A=A|0,f=f|0,p=p|0,_=_|0,y=y|0;var T=0,M=0,N=0,U=0,I=0,H=0,ie=0,ge=0,Ae=0,ve=0;if(H=A,U=f,I=U,M=p,ge=_,N=ge,!I)return T=(y|0)!=0,N?T?(d[y>>2]=A|0,d[y+4>>2]=f&0,ge=0,y=0,mt(ge|0),y|0):(ge=0,y=0,mt(ge|0),y|0):(T&&(d[y>>2]=(H>>>0)%(M>>>0),d[y+4>>2]=0),ge=0,y=(H>>>0)/(M>>>0)>>>0,mt(ge|0),y|0);T=(N|0)==0;do if(M){if(!T){if(T=(Xt(N|0)|0)-(Xt(I|0)|0)|0,T>>>0<=31){ie=T+1|0,N=31-T|0,f=T-31>>31,M=ie,A=H>>>(ie>>>0)&f|I<<N,f=I>>>(ie>>>0)&f,T=0,N=H<<N;break}return y?(d[y>>2]=A|0,d[y+4>>2]=U|f&0,ge=0,y=0,mt(ge|0),y|0):(ge=0,y=0,mt(ge|0),y|0)}if(T=M-1|0,T&M|0){N=(Xt(M|0)|0)+33-(Xt(I|0)|0)|0,ve=64-N|0,ie=32-N|0,U=ie>>31,Ae=N-32|0,f=Ae>>31,M=N,A=ie-1>>31&I>>>(Ae>>>0)|(I<<ie|H>>>(N>>>0))&f,f=f&I>>>(N>>>0),T=H<<ve&U,N=(I<<ve|H>>>(Ae>>>0))&U|H<<ie&N-33>>31;break}return y|0&&(d[y>>2]=T&H,d[y+4>>2]=0),(M|0)==1?(Ae=U|f&0,ve=A|0|0,mt(Ae|0),ve|0):(ve=Jc(M|0)|0,Ae=I>>>(ve>>>0)|0,ve=I<<32-ve|H>>>(ve>>>0)|0,mt(Ae|0),ve|0)}else{if(T)return y|0&&(d[y>>2]=(I>>>0)%(M>>>0),d[y+4>>2]=0),Ae=0,ve=(I>>>0)/(M>>>0)>>>0,mt(Ae|0),ve|0;if(!H)return y|0&&(d[y>>2]=0,d[y+4>>2]=(I>>>0)%(N>>>0)),Ae=0,ve=(I>>>0)/(N>>>0)>>>0,mt(Ae|0),ve|0;if(T=N-1|0,!(T&N))return y|0&&(d[y>>2]=A|0,d[y+4>>2]=T&I|f&0),Ae=0,ve=I>>>((Jc(N|0)|0)>>>0),mt(Ae|0),ve|0;if(T=(Xt(N|0)|0)-(Xt(I|0)|0)|0,T>>>0<=30){f=T+1|0,N=31-T|0,M=f,A=I<<N|H>>>(f>>>0),f=I>>>(f>>>0),T=0,N=H<<N;break}return y?(d[y>>2]=A|0,d[y+4>>2]=U|f&0,Ae=0,ve=0,mt(Ae|0),ve|0):(Ae=0,ve=0,mt(Ae|0),ve|0)}while(!1);if(!M)I=N,U=0,N=0;else{ie=p|0|0,H=ge|_&0,I=Qt(ie|0,H|0,-1,-1)|0,p=Z()|0,U=N,N=0;do _=U,U=T>>>31|U<<1,T=N|T<<1,_=A<<1|_>>>31|0,ge=A>>>31|f<<1|0,Ur(I|0,p|0,_|0,ge|0)|0,ve=Z()|0,Ae=ve>>31|((ve|0)<0?-1:0)<<1,N=Ae&1,A=Ur(_|0,ge|0,Ae&ie|0,(((ve|0)<0?-1:0)>>31|((ve|0)<0?-1:0)<<1)&H|0)|0,f=Z()|0,M=M-1|0;while((M|0)!=0);I=U,U=0}return M=0,y|0&&(d[y>>2]=A,d[y+4>>2]=f),Ae=(T|0)>>>31|(I|M)<<1|(M<<1|T>>>31)&0|U,ve=(T<<1|0)&-2|N,mt(Ae|0),ve|0}function ko(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;return I=f>>31|((f|0)<0?-1:0)<<1,U=((f|0)<0?-1:0)>>31|((f|0)<0?-1:0)<<1,T=_>>31|((_|0)<0?-1:0)<<1,y=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,N=Ur(I^A|0,U^f|0,I|0,U|0)|0,M=Z()|0,A=T^I,f=y^U,Ur((Ju(N,M,Ur(T^p|0,y^_|0,T|0,y|0)|0,Z()|0,0)|0)^A|0,(Z()|0)^f|0,A|0,f|0)|0}function eh(A,f){A=A|0,f=f|0;var p=0,_=0,y=0,T=0;return T=A&65535,y=f&65535,p=Xe(y,T)|0,_=A>>>16,A=(p>>>16)+(Xe(y,_)|0)|0,y=f>>>16,f=Xe(y,T)|0,mt((A>>>16)+(Xe(y,_)|0)+(((A&65535)+f|0)>>>16)|0),A+f<<16|p&65535|0|0}function fr(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;return y=A,T=p,p=eh(y,T)|0,A=Z()|0,mt((Xe(f,T)|0)+(Xe(_,y)|0)+A|A&0|0),p|0|0|0}function th(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0,M=0,N=0,U=0,I=0;return y=K,K=K+16|0,N=y|0,M=f>>31|((f|0)<0?-1:0)<<1,T=((f|0)<0?-1:0)>>31|((f|0)<0?-1:0)<<1,I=_>>31|((_|0)<0?-1:0)<<1,U=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,A=Ur(M^A|0,T^f|0,M|0,T|0)|0,f=Z()|0,Ju(A,f,Ur(I^p|0,U^_|0,I|0,U|0)|0,Z()|0,N)|0,_=Ur(d[N>>2]^M|0,d[N+4>>2]^T|0,M|0,T|0)|0,p=Z()|0,K=y,mt(p|0),_|0}function ec(A,f,p,_){A=A|0,f=f|0,p=p|0,_=_|0;var y=0,T=0;return T=K,K=K+16|0,y=T|0,Ju(A,f,p,_,y)|0,K=T,mt(d[y+4>>2]|0),d[y>>2]|0|0}function N1(A,f,p){return A=A|0,f=f|0,p=p|0,(p|0)<32?(mt(f>>p|0),A>>>p|(f&(1<<p)-1)<<32-p):(mt(((f|0)<0?-1:0)|0),f>>p-32|0)}function Mt(A,f,p){return A=A|0,f=f|0,p=p|0,(p|0)<32?(mt(f>>>p|0),A>>>p|(f&(1<<p)-1)<<32-p):(mt(0),f>>>p-32|0)}function Dt(A,f,p){return A=A|0,f=f|0,p=p|0,(p|0)<32?(mt(f<<p|(A&(1<<p)-1<<32-p)>>>32-p|0),A<<p):(mt(A<<p-32|0),0)}function ff(A,f,p){return A=A|0,f=f|0,f=Xt(f)|0,(f|0)==32&&(f=f+(Xt(A)|0)|0),mt(0),f|0}function Af(A,f){return A=+A,f=+f,A!=A?+f:f!=f?+A:+It(+A,+f)}function df(A,f){return A=+A,f=+f,A!=A?+f:f!=f?+A:+ke(+A,+f)}function hl(A){return A=+A,A>=0?+Xn(A+.5):+Qe(A-.5)}function Gl(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0;if((p|0)>=8192)return ui(A|0,f|0,p|0)|0,A|0;if(T=A|0,y=A+p|0,(A&3)==(f&3)){for(;A&3;){if(!p)return T|0;at[A>>0]=at[f>>0]|0,A=A+1|0,f=f+1|0,p=p-1|0}for(p=y&-4|0,_=p-64|0;(A|0)<=(_|0);)d[A>>2]=d[f>>2],d[A+4>>2]=d[f+4>>2],d[A+8>>2]=d[f+8>>2],d[A+12>>2]=d[f+12>>2],d[A+16>>2]=d[f+16>>2],d[A+20>>2]=d[f+20>>2],d[A+24>>2]=d[f+24>>2],d[A+28>>2]=d[f+28>>2],d[A+32>>2]=d[f+32>>2],d[A+36>>2]=d[f+36>>2],d[A+40>>2]=d[f+40>>2],d[A+44>>2]=d[f+44>>2],d[A+48>>2]=d[f+48>>2],d[A+52>>2]=d[f+52>>2],d[A+56>>2]=d[f+56>>2],d[A+60>>2]=d[f+60>>2],A=A+64|0,f=f+64|0;for(;(A|0)<(p|0);)d[A>>2]=d[f>>2],A=A+4|0,f=f+4|0}else for(p=y-4|0;(A|0)<(p|0);)at[A>>0]=at[f>>0]|0,at[A+1>>0]=at[f+1>>0]|0,at[A+2>>0]=at[f+2>>0]|0,at[A+3>>0]=at[f+3>>0]|0,A=A+4|0,f=f+4|0;for(;(A|0)<(y|0);)at[A>>0]=at[f>>0]|0,A=A+1|0,f=f+1|0;return T|0}function uo(A,f,p){A=A|0,f=f|0,p=p|0;var _=0,y=0,T=0,M=0;if(T=A+p|0,f=f&255,(p|0)>=67){for(;A&3;)at[A>>0]=f,A=A+1|0;for(_=T&-4|0,M=f|f<<8|f<<16|f<<24,y=_-64|0;(A|0)<=(y|0);)d[A>>2]=M,d[A+4>>2]=M,d[A+8>>2]=M,d[A+12>>2]=M,d[A+16>>2]=M,d[A+20>>2]=M,d[A+24>>2]=M,d[A+28>>2]=M,d[A+32>>2]=M,d[A+36>>2]=M,d[A+40>>2]=M,d[A+44>>2]=M,d[A+48>>2]=M,d[A+52>>2]=M,d[A+56>>2]=M,d[A+60>>2]=M,A=A+64|0;for(;(A|0)<(_|0);)d[A>>2]=M,A=A+4|0}for(;(A|0)<(T|0);)at[A>>0]=f,A=A+1|0;return T-p|0}function pf(A){return A=+A,A>=0?+Xn(A+.5):+Qe(A-.5)}function fl(A){A=A|0;var f=0,p=0,_=0;return _=fn()|0,p=d[Gn>>2]|0,f=p+A|0,(A|0)>0&(f|0)<(p|0)|(f|0)<0?(yi(f|0)|0,bn(12),-1):(f|0)>(_|0)&&!(ci(f|0)|0)?(bn(12),-1):(d[Gn>>2]=f,p|0)}return{___divdi3:ko,___muldi3:fr,___remdi3:th,___uremdi3:ec,_areNeighborCells:dx,_bitshift64Ashr:N1,_bitshift64Lshr:Mt,_bitshift64Shl:Dt,_calloc:Ks,_cellAreaKm2:mp,_cellAreaM2:UA,_cellAreaRads2:Fl,_cellToBoundary:Il,_cellToCenterChild:DA,_cellToChildPos:Ap,_cellToChildren:_1,_cellToChildrenSize:lf,_cellToLatLng:Ol,_cellToLocalIj:E1,_cellToParent:Fu,_cellToVertex:Qs,_cellToVertexes:Qu,_cellsToDirectedEdge:d1,_cellsToLinkedMultiPolygon:nl,_childPosToCell:S1,_compactCells:up,_constructCell:Sx,_destroyLinkedMultiPolygon:Wu,_directedEdgeToBoundary:CA,_directedEdgeToCells:gx,_edgeLengthKm:gp,_edgeLengthM:ju,_edgeLengthRads:BA,_emscripten_replace_memory:Un,_free:An,_getBaseCellNumber:g1,_getDirectedEdgeDestination:mx,_getDirectedEdgeOrigin:px,_getHexagonAreaAvgKm2:dp,_getHexagonAreaAvgM2:w1,_getHexagonEdgeLengthAvgKm:pp,_getHexagonEdgeLengthAvgM:oo,_getIcosahedronFaces:Gu,_getIndexDigit:bx,_getNumCells:Hu,_getPentagons:qu,_getRes0Cells:ef,_getResolution:Qc,_greatCircleDistanceKm:Zc,_greatCircleDistanceM:Mx,_greatCircleDistanceRads:T1,_gridDisk:ye,_gridDiskDistances:ot,_gridDistance:$u,_gridPathCells:C1,_gridPathCellsSize:vp,_gridRing:Yn,_gridRingUnsafe:xi,_i64Add:Qt,_i64Subtract:Ur,_isPentagon:Ci,_isResClassIII:b1,_isValidCell:NA,_isValidDirectedEdge:p1,_isValidIndex:v1,_isValidVertex:ul,_latLngToCell:PA,_llvm_ctlz_i64:ff,_llvm_maxnum_f64:Af,_llvm_minnum_f64:df,_llvm_round_f64:hl,_localIjToCell:IA,_malloc:Fo,_maxFaceCount:wx,_maxGridDiskSize:fa,_maxPolygonToCellsSize:Pr,_maxPolygonToCellsSizeExperimental:cf,_memcpy:Gl,_memset:uo,_originToDirectedEdges:vx,_pentagonCount:fp,_polygonToCells:Zh,_polygonToCellsExperimental:kA,_readInt64AsDoubleFromPointer:yp,_res0CellCount:s1,_round:pf,_sbrk:fl,_sizeOfCellBoundary:fs,_sizeOfCoordIJ:Pa,_sizeOfGeoLoop:sr,_sizeOfGeoPolygon:mi,_sizeOfH3Index:_p,_sizeOfLatLng:R1,_sizeOfLinkedGeoPolygon:kl,_uncompactCells:y1,_uncompactCellsSize:x1,_vertexToLatLng:ll,establishStackSpace:bs,stackAlloc:mn,stackRestore:hi,stackSave:yr}})(Nn,_i,Y);e.___divdi3=me.___divdi3,e.___muldi3=me.___muldi3,e.___remdi3=me.___remdi3,e.___uremdi3=me.___uremdi3,e._areNeighborCells=me._areNeighborCells,e._bitshift64Ashr=me._bitshift64Ashr,e._bitshift64Lshr=me._bitshift64Lshr,e._bitshift64Shl=me._bitshift64Shl,e._calloc=me._calloc,e._cellAreaKm2=me._cellAreaKm2,e._cellAreaM2=me._cellAreaM2,e._cellAreaRads2=me._cellAreaRads2,e._cellToBoundary=me._cellToBoundary,e._cellToCenterChild=me._cellToCenterChild,e._cellToChildPos=me._cellToChildPos,e._cellToChildren=me._cellToChildren,e._cellToChildrenSize=me._cellToChildrenSize,e._cellToLatLng=me._cellToLatLng,e._cellToLocalIj=me._cellToLocalIj,e._cellToParent=me._cellToParent,e._cellToVertex=me._cellToVertex,e._cellToVertexes=me._cellToVertexes,e._cellsToDirectedEdge=me._cellsToDirectedEdge,e._cellsToLinkedMultiPolygon=me._cellsToLinkedMultiPolygon,e._childPosToCell=me._childPosToCell,e._compactCells=me._compactCells,e._constructCell=me._constructCell,e._destroyLinkedMultiPolygon=me._destroyLinkedMultiPolygon,e._directedEdgeToBoundary=me._directedEdgeToBoundary,e._directedEdgeToCells=me._directedEdgeToCells,e._edgeLengthKm=me._edgeLengthKm,e._edgeLengthM=me._edgeLengthM,e._edgeLengthRads=me._edgeLengthRads;var bt=e._emscripten_replace_memory=me._emscripten_replace_memory;e._free=me._free,e._getBaseCellNumber=me._getBaseCellNumber,e._getDirectedEdgeDestination=me._getDirectedEdgeDestination,e._getDirectedEdgeOrigin=me._getDirectedEdgeOrigin,e._getHexagonAreaAvgKm2=me._getHexagonAreaAvgKm2,e._getHexagonAreaAvgM2=me._getHexagonAreaAvgM2,e._getHexagonEdgeLengthAvgKm=me._getHexagonEdgeLengthAvgKm,e._getHexagonEdgeLengthAvgM=me._getHexagonEdgeLengthAvgM,e._getIcosahedronFaces=me._getIcosahedronFaces,e._getIndexDigit=me._getIndexDigit,e._getNumCells=me._getNumCells,e._getPentagons=me._getPentagons,e._getRes0Cells=me._getRes0Cells,e._getResolution=me._getResolution,e._greatCircleDistanceKm=me._greatCircleDistanceKm,e._greatCircleDistanceM=me._greatCircleDistanceM,e._greatCircleDistanceRads=me._greatCircleDistanceRads,e._gridDisk=me._gridDisk,e._gridDiskDistances=me._gridDiskDistances,e._gridDistance=me._gridDistance,e._gridPathCells=me._gridPathCells,e._gridPathCellsSize=me._gridPathCellsSize,e._gridRing=me._gridRing,e._gridRingUnsafe=me._gridRingUnsafe,e._i64Add=me._i64Add,e._i64Subtract=me._i64Subtract,e._isPentagon=me._isPentagon,e._isResClassIII=me._isResClassIII,e._isValidCell=me._isValidCell,e._isValidDirectedEdge=me._isValidDirectedEdge,e._isValidIndex=me._isValidIndex,e._isValidVertex=me._isValidVertex,e._latLngToCell=me._latLngToCell,e._llvm_ctlz_i64=me._llvm_ctlz_i64,e._llvm_maxnum_f64=me._llvm_maxnum_f64,e._llvm_minnum_f64=me._llvm_minnum_f64,e._llvm_round_f64=me._llvm_round_f64,e._localIjToCell=me._localIjToCell,e._malloc=me._malloc,e._maxFaceCount=me._maxFaceCount,e._maxGridDiskSize=me._maxGridDiskSize,e._maxPolygonToCellsSize=me._maxPolygonToCellsSize,e._maxPolygonToCellsSizeExperimental=me._maxPolygonToCellsSizeExperimental,e._memcpy=me._memcpy,e._memset=me._memset,e._originToDirectedEdges=me._originToDirectedEdges,e._pentagonCount=me._pentagonCount,e._polygonToCells=me._polygonToCells,e._polygonToCellsExperimental=me._polygonToCellsExperimental,e._readInt64AsDoubleFromPointer=me._readInt64AsDoubleFromPointer,e._res0CellCount=me._res0CellCount,e._round=me._round,e._sbrk=me._sbrk,e._sizeOfCellBoundary=me._sizeOfCellBoundary,e._sizeOfCoordIJ=me._sizeOfCoordIJ,e._sizeOfGeoLoop=me._sizeOfGeoLoop,e._sizeOfGeoPolygon=me._sizeOfGeoPolygon,e._sizeOfH3Index=me._sizeOfH3Index,e._sizeOfLatLng=me._sizeOfLatLng,e._sizeOfLinkedGeoPolygon=me._sizeOfLinkedGeoPolygon,e._uncompactCells=me._uncompactCells,e._uncompactCellsSize=me._uncompactCellsSize,e._vertexToLatLng=me._vertexToLatLng,e.establishStackSpace=me.establishStackSpace;var tt=e.stackAlloc=me.stackAlloc,St=e.stackRestore=me.stackRestore,qt=e.stackSave=me.stackSave;if(e.asm=me,e.cwrap=L,e.setValue=S,e.getValue=w,fe){le(fe)||(fe=s(fe));{en();var Ht=function(Ze){Ze.byteLength&&(Ze=new Uint8Array(Ze)),te.set(Ze,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,xt()},xn=function(){a(fe,Ht,function(){throw"could not load memory initializer "+fe})},qi=Vt(fe);if(qi)Ht(qi.buffer);else if(e.memoryInitializerRequest){var rr=function(){var Ze=e.memoryInitializerRequest,vt=Ze.response;if(Ze.status!==200&&Ze.status!==0){var zt=Vt(e.memoryInitializerRequestURL);if(zt)vt=zt.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Ze.status+", retrying "+fe),xn();return}}Ht(vt)};e.memoryInitializerRequest.response?setTimeout(rr,0):e.memoryInitializerRequest.addEventListener("load",rr)}else xn()}}var pn;yt=function Ze(){pn||$i(),pn||(yt=Ze)};function $i(Ze){if(Pt>0||(Ce(),Pt>0))return;function vt(){pn||(pn=!0,!R&&(dt(),At(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),wt()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),vt()},1)):vt()}e.run=$i;function Jr(Ze){throw e.onAbort&&e.onAbort(Ze),Ze+="",l(Ze),u(Ze),R=!0,"abort("+Ze+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=Jr,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return $i(),i})(typeof Ti=="object"?Ti:{}),Dn="number",Cn=Dn,Md=Dn,On=Dn,In=Dn,Cs=Dn,nn=Dn,JK=[["sizeOfH3Index",Dn],["sizeOfLatLng",Dn],["sizeOfCellBoundary",Dn],["sizeOfGeoLoop",Dn],["sizeOfGeoPolygon",Dn],["sizeOfLinkedGeoPolygon",Dn],["sizeOfCoordIJ",Dn],["readInt64AsDoubleFromPointer",Dn],["isValidCell",Md,[On,In]],["isValidIndex",Md,[On,In]],["latLngToCell",Cn,[Dn,Dn,Cs,nn]],["cellToLatLng",Cn,[On,In,nn]],["cellToBoundary",Cn,[On,In,nn]],["maxGridDiskSize",Cn,[Dn,nn]],["gridDisk",Cn,[On,In,Dn,nn]],["gridDiskDistances",Cn,[On,In,Dn,nn,nn]],["gridRing",Cn,[On,In,Dn,nn]],["gridRingUnsafe",Cn,[On,In,Dn,nn]],["maxPolygonToCellsSize",Cn,[nn,Cs,Dn,nn]],["polygonToCells",Cn,[nn,Cs,Dn,nn]],["maxPolygonToCellsSizeExperimental",Cn,[nn,Cs,Dn,nn]],["polygonToCellsExperimental",Cn,[nn,Cs,Dn,Dn,Dn,nn]],["cellsToLinkedMultiPolygon",Cn,[nn,Dn,nn]],["destroyLinkedMultiPolygon",null,[nn]],["compactCells",Cn,[nn,nn,Dn,Dn]],["uncompactCells",Cn,[nn,Dn,Dn,nn,Dn,Cs]],["uncompactCellsSize",Cn,[nn,Dn,Dn,Cs,nn]],["isPentagon",Md,[On,In]],["isResClassIII",Md,[On,In]],["getBaseCellNumber",Dn,[On,In]],["getResolution",Dn,[On,In]],["getIndexDigit",Dn,[On,In,Dn]],["constructCell",Cn,[Dn,Dn,nn,nn]],["maxFaceCount",Cn,[On,In,nn]],["getIcosahedronFaces",Cn,[On,In,nn]],["cellToParent",Cn,[On,In,Cs,nn]],["cellToChildren",Cn,[On,In,Cs,nn]],["cellToCenterChild",Cn,[On,In,Cs,nn]],["cellToChildrenSize",Cn,[On,In,Cs,nn]],["cellToChildPos",Cn,[On,In,Cs,nn]],["childPosToCell",Cn,[Dn,Dn,On,In,Cs,nn]],["areNeighborCells",Cn,[On,In,On,In,nn]],["cellsToDirectedEdge",Cn,[On,In,On,In,nn]],["getDirectedEdgeOrigin",Cn,[On,In,nn]],["getDirectedEdgeDestination",Cn,[On,In,nn]],["isValidDirectedEdge",Md,[On,In]],["directedEdgeToCells",Cn,[On,In,nn]],["originToDirectedEdges",Cn,[On,In,nn]],["directedEdgeToBoundary",Cn,[On,In,nn]],["gridDistance",Cn,[On,In,On,In,nn]],["gridPathCells",Cn,[On,In,On,In,nn]],["gridPathCellsSize",Cn,[On,In,On,In,nn]],["cellToLocalIj",Cn,[On,In,On,In,Dn,nn]],["localIjToCell",Cn,[On,In,nn,Dn,nn]],["getHexagonAreaAvgM2",Cn,[Cs,nn]],["getHexagonAreaAvgKm2",Cn,[Cs,nn]],["getHexagonEdgeLengthAvgM",Cn,[Cs,nn]],["getHexagonEdgeLengthAvgKm",Cn,[Cs,nn]],["greatCircleDistanceM",Dn,[nn,nn]],["greatCircleDistanceKm",Dn,[nn,nn]],["greatCircleDistanceRads",Dn,[nn,nn]],["cellAreaM2",Cn,[On,In,nn]],["cellAreaKm2",Cn,[On,In,nn]],["cellAreaRads2",Cn,[On,In,nn]],["edgeLengthM",Cn,[On,In,nn]],["edgeLengthKm",Cn,[On,In,nn]],["edgeLengthRads",Cn,[On,In,nn]],["getNumCells",Cn,[Cs,nn]],["getRes0Cells",Cn,[nn]],["res0CellCount",Dn],["getPentagons",Cn,[Dn,nn]],["pentagonCount",Dn],["cellToVertex",Cn,[On,In,Dn,nn]],["cellToVertexes",Cn,[On,In,nn]],["vertexToLatLng",Cn,[On,In,nn]],["isValidVertex",Md,[On,In]]],eZ=0,tZ=1,nZ=2,iZ=3,yP=4,rZ=5,sZ=6,aZ=7,oZ=8,lZ=9,uZ=10,cZ=11,hZ=12,fZ=13,AZ=14,dZ=15,pZ=16,mZ=17,gZ=18,vZ=19,Kr={};Kr[eZ]="Success";Kr[tZ]="The operation failed but a more specific error is not available";Kr[nZ]="Argument was outside of acceptable range";Kr[iZ]="Latitude or longitude arguments were outside of acceptable range";Kr[yP]="Resolution argument was outside of acceptable range";Kr[rZ]="Cell argument was not valid";Kr[sZ]="Directed edge argument was not valid";Kr[aZ]="Undirected edge argument was not valid";Kr[oZ]="Vertex argument was not valid";Kr[lZ]="Pentagon distortion was encountered";Kr[uZ]="Duplicate input";Kr[cZ]="Cell arguments were not neighbors";Kr[hZ]="Cell arguments had incompatible resolutions";Kr[fZ]="Memory allocation failed";Kr[AZ]="Bounds of provided memory were insufficient";Kr[dZ]="Mode or flags argument was not valid";Kr[pZ]="Index argument was not valid";Kr[mZ]="Base cell number was outside of acceptable range";Kr[gZ]="Child indexing digits invalid";Kr[vZ]="Child indexing digits refer to a deleted subsequence";var _Z=1e3,xP=1001,bP=1002,Ry={};Ry[_Z]="Unknown unit";Ry[xP]="Array length out of bounds";Ry[bP]="Got unexpected null value for H3 index";var yZ="Unknown error";function SP(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||yZ)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function TP(i,e){var t=arguments.length===2?{value:e}:{};return SP(Kr,i,t)}function wP(i,e){var t=arguments.length===2?{value:e}:{};return SP(Ry,i,t)}function vg(i){if(i!==0)throw TP(i)}var eo={};JK.forEach(function(e){eo[e[0]]=Ti.cwrap.apply(Ti,e)});var Xd=16,_g=4,U0=8,xZ=8,j_=eo.sizeOfH3Index(),MM=eo.sizeOfLatLng(),bZ=eo.sizeOfCellBoundary(),SZ=eo.sizeOfGeoPolygon(),Lm=eo.sizeOfGeoLoop();eo.sizeOfLinkedGeoPolygon();eo.sizeOfCoordIJ();function TZ(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw TP(yP,i);return i}function wZ(i){if(!i)throw wP(bP);return i}var MZ=Math.pow(2,32)-1;function EZ(i){if(i>MZ)throw wP(xP,i);return i}var CZ=/[^0-9a-fA-F]/;function MP(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||CZ.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),Xd),t=parseInt(i.substring(i.length-8),Xd);return[t,e]}function E6(i){if(i>=0)return i.toString(Xd);i=i&2147483647;var e=EP(8,i.toString(Xd)),t=(parseInt(e[0],Xd)+8).toString(Xd);return e=t+e.substring(1),e}function RZ(i,e){return E6(e)+EP(8,E6(i))}function EP(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}function C6(i,e,t){for(var n=i.length,r=Ti._calloc(n,MM),s=t?1:0,a=t?0:1,l=0;l<n*2;l+=2)Ti.HEAPF64.set([i[l/2][s],i[l/2][a]].map(DP),r/U0+l);return Ti.HEAPU32.set([n,r],e/_g),e}function NZ(i,e){var t=i.length-1,n=Ti._calloc(SZ),r=0,s=r+Lm,a=s+_g;C6(i[0],n+r,e);var l;if(t>0){l=Ti._calloc(t,Lm);for(var u=0;u<t;u++)C6(i[u+1],l+Lm*u,e)}return Ti.setValue(n+s,t,"i32"),Ti.setValue(n+a,l,"i32"),n}function DZ(i){var e=0,t=e+Lm,n=t+_g,r=_g;Ti._free(Ti.getValue(i+e+r,"i8*"));var s=Ti.getValue(i+t,"i32");if(s>0){for(var a=Ti.getValue(i+n,"i32"),l=0;l<s;l++)Ti._free(Ti.getValue(a+Lm*l+r,"i8*"));Ti._free(a)}Ti._free(i)}function CP(i,e){e===void 0&&(e=0);var t=Ti.getValue(i+j_*e,"i32"),n=Ti.getValue(i+j_*e+_g,"i32");return n?RZ(t,n):null}function PZ(i){return eo.readInt64AsDoubleFromPointer(i)}function LZ(i,e){for(var t=[],n=0;n<e;n++){var r=CP(i,n);r!==null&&t.push(r)}return t}function W_(i){return FZ(Ti.getValue(i,"double"))}function UZ(i){return[W_(i),W_(i+U0)]}function BZ(i){return[W_(i+U0),W_(i)]}function OZ(i,e,t){for(var n=Ti.getValue(i,"i32"),r=i+U0,s=[],a=BZ,l=0;l<n*2;l+=2)s.push(a(r+U0*l));return s.push(s[0]),s}function IZ(i,e,t){var n=Ti._malloc(MM);Ti.HEAPF64.set([i,e].map(DP),n/U0);var r=Ti._malloc(j_);try{return vg(eo.latLngToCell(n,t,r)),wZ(CP(r))}finally{Ti._free(r),Ti._free(n)}}function RP(i){var e=Ti._malloc(MM),t=MP(i),n=t[0],r=t[1];try{return vg(eo.cellToLatLng(n,r,e)),UZ(e)}finally{Ti._free(e)}}function NP(i,e){var t=Ti._malloc(bZ),n=MP(i),r=n[0],s=n[1];try{return vg(eo.cellToBoundary(r,s,t)),OZ(t,e,e)}finally{Ti._free(t)}}function R6(i,e,t){if(TZ(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=NZ(n,t),s=Ti._malloc(xZ);try{vg(eo.maxPolygonToCellsSize(r,e,0,s));var a=EZ(PZ(s)),l=Ti._calloc(a,j_);try{return vg(eo.polygonToCells(r,e,0,l)),LZ(l,a)}finally{Ti._free(l)}}finally{Ti._free(s),DZ(r)}}function DP(i){return i*Math.PI/180}function FZ(i){return i*180/Math.PI}function kZ(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const zZ=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"];class GZ{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=zZ,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){const{geometry:n,material:r,object:s}=e;if(t={material:this.getMaterialData(r),geometry:{attributes:this.getAttributesData(n.attributes),indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:s.matrixWorld.clone()},s.center&&(t.center=s.center.clone()),s.morphTargetInfluences&&(t.morphTargetInfluences=s.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}this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const n in e){const r=e[n];t[n]={version:r.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.nodes.modelViewMatrix!==null||e.renderer.nodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:r.version}:t[n]=r.clone():t[n]=r)}return t}equals(e){const{object:t,material:n,geometry:r}=e,s=this.getRenderObjectData(e);if(s.worldMatrix.equals(t.matrixWorld)!==!0)return s.worldMatrix.copy(t.matrixWorld),!1;const a=s.material;for(const R in a){const C=a[R],E=n[R];if(C.equals!==void 0){if(C.equals(E)===!1)return C.copy(E),!1}else if(E.isTexture===!0){if(C.id!==E.id||C.version!==E.version)return C.id=E.id,C.version=E.version,!1}else if(C!==E)return a[R]=E,!1}if(a.transmission>0){const{width:R,height:C}=e.context;if(s.bufferWidth!==R||s.bufferHeight!==C)return s.bufferWidth=R,s.bufferHeight=C,!1}const l=s.geometry,u=r.attributes,h=l.attributes,m=Object.keys(h),v=Object.keys(u);if(m.length!==v.length)return s.geometry.attributes=this.getAttributesData(u),!1;for(const R of m){const C=h[R],E=u[R];if(E===void 0)return delete h[R],!1;if(C.version!==E.version)return C.version=E.version,!1}const x=r.index,S=l.indexVersion,w=x?x.version:null;if(S!==w)return l.indexVersion=w,!1;if(l.drawRange.start!==r.drawRange.start||l.drawRange.count!==r.drawRange.count)return l.drawRange.start=r.drawRange.start,l.drawRange.count=r.drawRange.count,!1;if(s.morphTargetInfluences){let R=!1;for(let C=0;C<s.morphTargetInfluences.length;C++)s.morphTargetInfluences[C]!==t.morphTargetInfluences[C]&&(R=!0);if(R)return!0}return s.center&&s.center.equals(t.center)===!1?(s.center.copy(t.center),!0):(e.bundle!==null&&(s.version=e.bundle.version),!0)}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e))return!0;const{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;const r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;return r||s?!1:this.equals(e)!==!0}}function yg(i,e=0){let t=3735928559^e,n=1103547991^e;if(i instanceof Array)for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,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 PP=i=>yg(i),Ny=i=>yg(i),EM=(...i)=>yg(i);function LP(i,e=!1){const t=[];i.isNode===!0&&(t.push(i.id),i=i.getSelf());for(const{property:n,childNode:r}of $_(i))t.push(t,yg(n.slice(0,-4)),r.getCacheKey(e));return yg(t)}function*$_(i,e=!1){for(const t in i){if(t.startsWith("_")===!0)continue;const n=i[t];if(Array.isArray(n)===!0)for(let r=0;r<n.length;r++){const s=n[r];s&&(s.isNode===!0||e&&typeof s.toJSON=="function")&&(yield{property:t,index:r,childNode:s})}else if(n&&n.isNode===!0)yield{property:t,childNode:n};else if(typeof n=="object")for(const r in n){const s=n[r];s&&(s.isNode===!0||e&&typeof s.toJSON=="function")&&(yield{property:t,index:r,childNode:s})}}}const qZ=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),N6=new WeakMap;function UP(i){return qZ.get(i)}function BP(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function OP(i){if(/float|int|uint/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;console.error("THREE.TSL: Unsupported type:",i)}function Uh(i){if(i==null)return null;const e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function IP(i,...e){const t=i?i.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]])),i==="color"?new an(...e):t==="vec2"?new gt(...e):t==="vec3"?new he(...e):t==="vec4"?new Ln(...e):t==="mat3"?new Vn(...e):t==="mat4"?new kn(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?zP(e[0]):null}function FP(i){let e=N6.get(i);return e===void 0&&(e={},N6.set(i,e)),e}function kP(i){let e="";const t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function zP(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}const IT={VERTEX:"vertex",FRAGMENT:"fragment"},jn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},VZ={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},sa={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},GP=["fragment","vertex"],FT=["setup","analyze","generate"],kT=[...GP,"compute"],gA=["x","y","z","w"];let HZ=0;class Mn extends zc{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=jn.NONE,this.updateBeforeType=jn.NONE,this.updateAfterType=jn.NONE,this.uuid=M0.generateUUID(),this.version=0,this.global=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:HZ++})}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.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,jn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,jn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,jn.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of $_(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=EM(LP(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)}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}setup(e){const t=e.getNodeProperties(this);let n=0;for(const r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e){if(e.increaseUsage(this)===1){const n=e.getNodeProperties(this);for(const r of Object.values(n))r&&r.isNode===!0&&r.build(e)}}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);e.addNode(this),e.addChain(this);let r=null;const s=e.getBuildStage();if(s==="setup"){this.updateReference(e);const a=e.getNodeProperties(this);if(a.initialized!==!0){a.initialized=!0;const l=this.setup(e),u=l&&l.isNode===!0;for(const h of Object.values(a))h&&h.isNode===!0&&h.build(e);u&&l.build(e),a.outputNode=l}}else if(s==="analyze")this.analyze(e);else if(s==="generate")if(this.generate.length===1){const l=this.getNodeType(e),u=e.getDataFromNode(this);r=u.snippet,r===void 0?(r=this.generate(e)||"",u.snippet=r):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),r=e.format(r,l,t)}else r=this.generate(e,t)||"";return e.removeChain(this),e.addSequentialNode(this),r}getSerializeChildren(){return $_(this)}serialize(e){const t=this.getSerializeChildren(),n={};for(const{property:r,index:s,childNode:a}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=a.toJSON(e.meta).uuid):n[r]=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 r=[];for(const s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){const r={};for(const s in e.inputNodes[n]){const a=e.inputNodes[n][s];r[s]=t[a]}this[n]=r}else{const r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){const{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function a(l){const u=[];for(const h in l){const m=l[h];delete m.metadata,u.push(m)}return u}if(r){const l=a(e.textures),u=a(e.images),h=a(e.nodes);l.length>0&&(s.textures=l),u.length>0&&(s.images=u),h.length>0&&(s.nodes=h)}return s}}class vA extends Mn{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.node.build(e),n=this.indexNode.build(e,"uint");return`${t}[ ${n} ]`}}class qP extends Mn{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 r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);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,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}}class Zr extends Mn{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 r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){const a=super.build(e,r),l=e.getVarFromNode(this,null,r),u=e.getPropertyName(l);return e.addLineFlowCode(`${u} = ${a}`,this),s.snippet=a,s.propertyName=u,e.format(s.propertyName,r,t)}}return super.build(e,t)}}class jZ extends Zr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(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),r=this.nodes,s=e.getComponentType(n),a=[];for(const u of r){let h=u.build(e);const m=e.getComponentType(u.getNodeType(e));m!==s&&(h=e.format(h,m,s)),a.push(h)}const l=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(l,n,t)}}const WZ=gA.join("");class zT extends Mn{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(gA.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))}generate(e,t){const n=this.node,r=e.getTypeLength(n.getNodeType(e));let s=null;if(r>1){let a=null;this.getVectorLength()>=r&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const u=n.build(e,a);this.components.length===r&&this.components===WZ.slice(0,this.components.length)?s=e.format(u,a,t):s=e.format(`${u}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class $Z extends Zr{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:r}=this,s=this.getNodeType(e),a=e.getComponentType(r.getNodeType(e)),l=e.getTypeFromLength(n.length,a),u=r.build(e,l),h=t.build(e,s),m=e.getTypeLength(s),v=[];for(let x=0;x<m;x++){const S=gA[x];S===n[0]?(v.push(u),x+=n.length-1):v.push(h+"."+S)}return`${e.getType(s)}( ${v.join(", ")} )`}}class XZ extends Zr{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,r=this.getNodeType(e),s=n.build(e),a=e.getVarFromNode(this),l=e.getPropertyName(a);e.addLineFlowCode(l+" = "+s,this);const u=e.getTypeLength(r),h=[];let m=0;for(let v=0;v<u;v++){const x=gA[v];x===t[m]?(h.push("1.0 - "+(l+"."+x)),m++):h.push(l+"."+x)}return`${e.getType(r)}( ${h.join(", ")} )`}}class CM extends Mn{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?Uh(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=Uh(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=kP(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?IP(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.")}}class Ll extends CM{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 e.format(this.generateConst(e),n,t)}}let B0=null;const Yd=new Map;function ut(i,e){if(Yd.has(i)){console.warn(`Redefinition of method chaining ${i}`);return}if(typeof e!="function")throw new Error(`Node element ${i} is not a function`);Yd.set(i,e)}const VP=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),D6=i=>VP(i).split("").sort().join(""),HP={setup(i,e){const t=e.shift();return i(Vg(t),...e)},get(i,e,t){if(typeof e=="string"&&i[e]===void 0){if(i.isStackNode!==!0&&e==="assign")return(...n)=>(B0.assign(t,...n),t);if(Yd.has(e)){const n=Yd.get(e);return i.isStackNode?(...r)=>t.add(n(...r)):(...r)=>n(t,...r)}else{if(e==="self")return i;if(e.endsWith("Assign")&&Yd.has(e.slice(0,e.length-6))){const n=Yd.get(e.slice(0,e.length-6));return i.isStackNode?(...r)=>t.assign(r[0],n(...r)):(...r)=>t.assign(n(t,...r))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=VP(e),_t(new zT(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=D6(e.slice(3).toLowerCase()),n=>_t(new $Z(i,e,n));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=D6(e.slice(4).toLowerCase()),()=>_t(new XZ(_t(i),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),_t(new zT(i,e));if(/^\d+$/.test(e)===!0)return _t(new vA(t,new Ll(Number(e),"uint")))}}}return Reflect.get(i,e,t)},set(i,e,t,n){return typeof e=="string"&&i[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(n[e].assign(t),!0):Reflect.set(i,e,t,n)}},W3=new WeakMap,P6=new WeakMap,YZ=function(i,e=null){const t=Uh(i);if(t==="node"){let n=W3.get(i);return n===void 0&&(n=new Proxy(i,HP),W3.set(i,n),W3.set(n,n)),n}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return _t(GT(i,e));if(t==="shader")return je(i)}return i},QZ=function(i,e=null){for(const t in i)i[t]=_t(i[t],e);return i},KZ=function(i,e=null){const t=i.length;for(let n=0;n<t;n++)i[n]=_t(i[n],e);return i},ZZ=function(i,e=null,t=null,n=null){const r=s=>_t(n!==null?Object.assign(s,n):s);return e===null?(...s)=>r(new i(...tA(s))):t!==null?(t=_t(t),(...s)=>r(new i(e,...tA(s),t))):(...s)=>r(new i(e,...tA(s)))},JZ=function(i,...e){return _t(new i(...tA(e)))};class eJ extends Mn{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}call(e){const{shaderNode:t,inputNodes:n}=this,r=e.getNodeProperties(t);if(r.onceOutput)return r.onceOutput;let s=null;if(t.layout){let a=P6.get(e.constructor);a===void 0&&(a=new WeakMap,P6.set(e.constructor,a));let l=a.get(t);l===void 0&&(l=_t(e.buildFunctionNode(t)),a.set(t,l)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(l),s=_t(l.call(n))}else{const a=t.jsFunc,l=n!==null?a(n,e):a(e);s=_t(l)}return t.once&&(r.onceOutput=s),s}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class tJ extends Mn{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 Vg(e),_t(new eJ(this,e))}setup(){return this.call()}}const nJ=[!1,!0],iJ=[0,1,2,3],rJ=[-1,-2],jP=[.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],RM=new Map;for(const i of nJ)RM.set(i,new Ll(i));const NM=new Map;for(const i of iJ)NM.set(i,new Ll(i,"uint"));const DM=new Map([...NM].map(i=>new Ll(i.value,"int")));for(const i of rJ)DM.set(i,new Ll(i,"int"));const Dy=new Map([...DM].map(i=>new Ll(i.value)));for(const i of jP)Dy.set(i,new Ll(i));for(const i of jP)Dy.set(-i,new Ll(-i));const Py={bool:RM,uint:NM,ints:DM,float:Dy},L6=new Map([...RM,...Dy]),GT=(i,e)=>L6.has(i)?L6.get(i):i.isNode===!0?i:new Ll(i,e),sJ=i=>{try{return i.getNodeType()}catch{return}},ls=function(i,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>typeof r!="object"))&&(t=[IP(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return _t(e.get(t[0]));if(t.length===1){const r=GT(t[0],i);return sJ(r)===i?_t(r):_t(new qP(r,i))}const n=t.map(r=>GT(r));return _t(new jZ(n,i))}},xg=i=>typeof i=="object"&&i!==null?i.value:i,WP=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function Um(i,e){return new Proxy(new tJ(i,e),HP)}const _t=(i,e=null)=>YZ(i,e),Vg=(i,e=null)=>new QZ(i,e),tA=(i,e=null)=>new KZ(i,e),ct=(...i)=>new ZZ(...i),Wt=(...i)=>new JZ(...i),je=(i,e)=>{const t=new Um(i,e),n=(...r)=>{let s;return Vg(r),r[0]&&r[0].isNode?s=[...r]:s=r[0],t.call(s)};return n.shaderNode=t,n.setLayout=r=>(t.setLayout(r),n),n.once=()=>(t.once=!0,n),n},aJ=(...i)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),je(...i));ut("toGlobal",i=>(i.global=!0,i));const bg=i=>{B0=i},PM=()=>B0,ti=(...i)=>B0.If(...i);function $P(i){return B0&&B0.add(i),i}ut("append",$P);const XP=new ls("color"),_e=new ls("float",Py.float),Ee=new ls("int",Py.ints),Zt=new ls("uint",Py.uint),Ic=new ls("bool",Py.bool),Ct=new ls("vec2"),ms=new ls("ivec2"),YP=new ls("uvec2"),QP=new ls("bvec2"),Be=new ls("vec3"),KP=new ls("ivec3"),Y0=new ls("uvec3"),LM=new ls("bvec3"),dn=new ls("vec4"),ZP=new ls("ivec4"),JP=new ls("uvec4"),eL=new ls("bvec4"),Ly=new ls("mat2"),ha=new ls("mat3"),nA=new ls("mat4"),oJ=(i="")=>_t(new Ll(i,"string")),lJ=i=>_t(new Ll(i,"ArrayBuffer"));ut("toColor",XP);ut("toFloat",_e);ut("toInt",Ee);ut("toUint",Zt);ut("toBool",Ic);ut("toVec2",Ct);ut("toIVec2",ms);ut("toUVec2",YP);ut("toBVec2",QP);ut("toVec3",Be);ut("toIVec3",KP);ut("toUVec3",Y0);ut("toBVec3",LM);ut("toVec4",dn);ut("toIVec4",ZP);ut("toUVec4",JP);ut("toBVec4",eL);ut("toMat2",Ly);ut("toMat3",ha);ut("toMat4",nA);const tL=ct(vA),nL=(i,e)=>_t(new qP(_t(i),e)),uJ=(i,e)=>_t(new zT(_t(i),e));ut("element",tL);ut("convert",nL);class iL extends Mn{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 rL=i=>new iL(i),UM=(i,e=0)=>new iL(i,!0,e),sL=UM("frame"),Rn=UM("render"),BM=rL("object");class Hg extends CM{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=BM}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const n=this.getSelf();return e=e.bind(n),super.onUpdate(r=>{const s=e(r,n);s!==void 0&&(this.value=s)},t)}generate(e,t){const n=this.getNodeType(e),r=this.getUniformHash(e);let s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);const a=s.getInputType(e),l=e.getUniformFromNode(s,a,e.shaderStage,this.name||e.context.label),u=e.getPropertyName(l);return e.context.label!==void 0&&delete e.context.label,e.format(u,n,t)}}const gn=(i,e)=>{const t=WP(e||i),n=i&&i.isNode===!0?i.node&&i.node.value||i.value:i;return _t(new Hg(n,t))};class Gi extends Mn{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}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 aL=(i,e)=>_t(new Gi(i,e)),Sg=(i,e)=>_t(new Gi(i,e,!0)),Ui=Wt(Gi,"vec4","DiffuseColor"),qT=Wt(Gi,"vec3","EmissiveColor"),Zl=Wt(Gi,"float","Roughness"),Tg=Wt(Gi,"float","Metalness"),X_=Wt(Gi,"float","Clearcoat"),wg=Wt(Gi,"float","ClearcoatRoughness"),Xf=Wt(Gi,"vec3","Sheen"),Uy=Wt(Gi,"float","SheenRoughness"),By=Wt(Gi,"float","Iridescence"),OM=Wt(Gi,"float","IridescenceIOR"),IM=Wt(Gi,"float","IridescenceThickness"),Y_=Wt(Gi,"float","AlphaT"),Rh=Wt(Gi,"float","Anisotropy"),Bm=Wt(Gi,"vec3","AnisotropyT"),iA=Wt(Gi,"vec3","AnisotropyB"),ka=Wt(Gi,"color","SpecularColor"),Mg=Wt(Gi,"float","SpecularF90"),Q_=Wt(Gi,"float","Shininess"),Eg=Wt(Gi,"vec4","Output"),Qv=Wt(Gi,"float","dashSize"),VT=Wt(Gi,"float","gapSize"),cJ=Wt(Gi,"float","pointWidth"),Om=Wt(Gi,"float","IOR"),K_=Wt(Gi,"float","Transmission"),FM=Wt(Gi,"float","Thickness"),kM=Wt(Gi,"float","AttenuationDistance"),zM=Wt(Gi,"color","AttenuationColor"),GM=Wt(Gi,"float","Dispersion");class hJ extends Zr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}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 gA.join("").slice(0,n)!==t.components}return!1}generate(e,t){const{targetNode:n,sourceNode:r}=this,s=this.needsSplitAssign(e),a=n.getNodeType(e),l=n.context({assign:!0}).build(e),u=r.build(e,a),h=r.getNodeType(e),m=e.getDataFromNode(this);let v;if(m.initialized===!0)t!=="void"&&(v=l);else if(s){const x=e.getVarFromNode(this,null,a),S=e.getPropertyName(x);e.addLineFlowCode(`${S} = ${u}`,this);const w=n.node.context({assign:!0}).build(e);for(let R=0;R<n.components.length;R++){const C=n.components[R];e.addLineFlowCode(`${w}.${C} = ${S}[ ${R} ]`,this)}t!=="void"&&(v=l)}else v=`${l} = ${u}`,(t==="void"||h==="void")&&(e.addLineFlowCode(v,this),t!=="void"&&(v=l));return m.initialized=!0,e.format(v,a,t)}}const oL=ct(hJ);ut("assign",oL);class fJ extends Zr{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)}generate(e){const t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,a=(u,h)=>{const m=h.type,v=m==="pointer";let x;return v?x="&"+u.build(e):x=u.build(e,m),x};if(Array.isArray(s))for(let u=0;u<s.length;u++)t.push(a(s[u],r[u]));else for(const u of r){const h=s[u.name];if(h!==void 0)t.push(a(h,u));else throw new Error(`FunctionCallNode: Input '${u.name}' not found in FunctionNode.`)}return`${n.build(e,"property")}( ${t.join(", ")} )`}}const lL=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?tA(e):Vg(e[0]),_t(new fJ(_t(i),e)));ut("call",lL);class Mr extends Zr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new Mr(e,t,n);for(let a=0;a<r.length-1;a++)s=new Mr(e,s,r[a]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n}getNodeType(e,t){const n=this.op,r=this.aNode,s=this.bNode,a=r.getNodeType(e),l=typeof s<"u"?s.getNodeType(e):null;if(a==="void"||l==="void")return"void";if(n==="%")return a;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(a);if(n==="!"||n==="=="||n==="&&"||n==="||"||n==="^^")return"bool";if(n==="<"||n===">"||n==="<="||n===">="){const u=t?e.getTypeLength(t):Math.max(e.getTypeLength(a),e.getTypeLength(l));return u>1?`bvec${u}`:"bool"}else return a==="float"&&e.isMatrix(l)?l:e.isMatrix(a)&&e.isVector(l)?e.getVectorFromMatrix(a):e.isVector(a)&&e.isMatrix(l)?e.getVectorFromMatrix(l):e.getTypeLength(l)>e.getTypeLength(a)?l:a}generate(e,t){const n=this.op,r=this.aNode,s=this.bNode,a=this.getNodeType(e,t);let l=null,u=null;a!=="void"?(l=r.getNodeType(e),u=typeof s<"u"?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="?e.isVector(l)?u=l:l!==u&&(l=u="float"):n===">>"||n==="<<"?(l=a,u=e.changeComponentType(u,"uint")):e.isMatrix(l)&&e.isVector(u)?u=e.getVectorFromMatrix(l):e.isVector(l)&&e.isMatrix(u)?l=e.getVectorFromMatrix(u):l=u=a):l=u=a;const h=r.build(e,l),m=typeof s<"u"?s.build(e,u):null,v=e.getTypeLength(t),x=e.getFunctionOperator(n);if(t!=="void")return n==="<"&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThan",t)}( ${h}, ${m} )`,a,t):e.format(`( ${h} < ${m} )`,a,t):n==="<="&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("lessThanEqual",t)}( ${h}, ${m} )`,a,t):e.format(`( ${h} <= ${m} )`,a,t):n===">"&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThan",t)}( ${h}, ${m} )`,a,t):e.format(`( ${h} > ${m} )`,a,t):n===">="&&v>1?e.useComparisonMethod?e.format(`${e.getMethod("greaterThanEqual",t)}( ${h}, ${m} )`,a,t):e.format(`( ${h} >= ${m} )`,a,t):n==="!"||n==="~"?e.format(`(${n}${h})`,l,t):x?e.format(`${x}( ${h}, ${m} )`,a,t):e.format(`( ${h} ${n} ${m} )`,a,t);if(l!=="void")return x?e.format(`${x}( ${h}, ${m} )`,a,t):e.format(`${h} ${n} ${m}`,a,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const Qr=ct(Mr,"+"),wi=ct(Mr,"-"),Wn=ct(Mr,"*"),Dl=ct(Mr,"/"),qM=ct(Mr,"%"),uL=ct(Mr,"=="),cL=ct(Mr,"!="),hL=ct(Mr,"<"),VM=ct(Mr,">"),fL=ct(Mr,"<="),AL=ct(Mr,">="),dL=ct(Mr,"&&"),pL=ct(Mr,"||"),mL=ct(Mr,"!"),gL=ct(Mr,"^^"),vL=ct(Mr,"&"),_L=ct(Mr,"~"),yL=ct(Mr,"|"),xL=ct(Mr,"^"),bL=ct(Mr,"<<"),SL=ct(Mr,">>");ut("add",Qr);ut("sub",wi);ut("mul",Wn);ut("div",Dl);ut("modInt",qM);ut("equal",uL);ut("notEqual",cL);ut("lessThan",hL);ut("greaterThan",VM);ut("lessThanEqual",fL);ut("greaterThanEqual",AL);ut("and",dL);ut("or",pL);ut("not",mL);ut("xor",gL);ut("bitAnd",vL);ut("bitNot",_L);ut("bitOr",yL);ut("bitXor",xL);ut("shiftLeft",bL);ut("shiftRight",SL);const TL=(...i)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),qM(...i));ut("remainder",TL);class He extends Zr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){super(),this.method=e,this.aNode=t,this.bNode=n,this.cNode=r}getInputType(e){const t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(n)?0:e.getTypeLength(n),l=e.isMatrix(r)?0:e.getTypeLength(r);return s>a&&s>l?t:a>l?n:l>s?r:t}getNodeType(e){const t=this.method;return t===He.LENGTH||t===He.DISTANCE||t===He.DOT?"float":t===He.CROSS?"vec3":t===He.ALL?"bool":t===He.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===He.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){let n=this.method;const r=this.getNodeType(e),s=this.getInputType(e),a=this.aNode,l=this.bNode,u=this.cNode,h=e.renderer.coordinateSystem;if(n===He.TRANSFORM_DIRECTION){let m=a,v=l;e.isMatrix(m.getNodeType(e))?v=dn(Be(v),0):m=dn(Be(m),0);const x=Wn(m,v).xyz;return Fc(x).build(e,t)}else{if(n===He.NEGATE)return e.format("( - "+a.build(e,s)+" )",r,t);if(n===He.ONE_MINUS)return wi(1,a).build(e,t);if(n===He.RECIPROCAL)return Dl(1,a).build(e,t);if(n===He.DIFFERENCE)return ur(wi(a,l)).build(e,t);{const m=[];return n===He.CROSS||n===He.MOD?m.push(a.build(e,r),l.build(e,r)):h===Ha&&n===He.STEP?m.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":s),l.build(e,s)):h===Ha&&(n===He.MIN||n===He.MAX)||n===He.MOD?m.push(a.build(e,s),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":s)):n===He.REFRACT?m.push(a.build(e,s),l.build(e,s),u.build(e,"float")):n===He.MIX?m.push(a.build(e,s),l.build(e,s),u.build(e,e.getTypeLength(u.getNodeType(e))===1?"float":s)):(h===pu&&n===He.ATAN&&l!==null&&(n="atan2"),m.push(a.build(e,s)),l!==null&&m.push(l.build(e,s)),u!==null&&m.push(u.build(e,s))),e.format(`${e.getMethod(n,r)}( ${m.join(", ")} )`,r,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}He.ALL="all";He.ANY="any";He.RADIANS="radians";He.DEGREES="degrees";He.EXP="exp";He.EXP2="exp2";He.LOG="log";He.LOG2="log2";He.SQRT="sqrt";He.INVERSE_SQRT="inversesqrt";He.FLOOR="floor";He.CEIL="ceil";He.NORMALIZE="normalize";He.FRACT="fract";He.SIN="sin";He.COS="cos";He.TAN="tan";He.ASIN="asin";He.ACOS="acos";He.ATAN="atan";He.ABS="abs";He.SIGN="sign";He.LENGTH="length";He.NEGATE="negate";He.ONE_MINUS="oneMinus";He.DFDX="dFdx";He.DFDY="dFdy";He.ROUND="round";He.RECIPROCAL="reciprocal";He.TRUNC="trunc";He.FWIDTH="fwidth";He.TRANSPOSE="transpose";He.BITCAST="bitcast";He.EQUALS="equals";He.MIN="min";He.MAX="max";He.MOD="mod";He.STEP="step";He.REFLECT="reflect";He.DISTANCE="distance";He.DIFFERENCE="difference";He.DOT="dot";He.CROSS="cross";He.POW="pow";He.TRANSFORM_DIRECTION="transformDirection";He.MIX="mix";He.CLAMP="clamp";He.REFRACT="refract";He.SMOOTHSTEP="smoothstep";He.FACEFORWARD="faceforward";const wL=_e(1e-6),AJ=_e(1e6),Z_=_e(Math.PI),dJ=_e(Math.PI*2),HM=ct(He,He.ALL),ML=ct(He,He.ANY),EL=ct(He,He.RADIANS),CL=ct(He,He.DEGREES),jM=ct(He,He.EXP),O0=ct(He,He.EXP2),Oy=ct(He,He.LOG),cu=ct(He,He.LOG2),Cu=ct(He,He.SQRT),WM=ct(He,He.INVERSE_SQRT),hu=ct(He,He.FLOOR),Iy=ct(He,He.CEIL),Fc=ct(He,He.NORMALIZE),Hc=ct(He,He.FRACT),Mo=ct(He,He.SIN),yc=ct(He,He.COS),RL=ct(He,He.TAN),NL=ct(He,He.ASIN),DL=ct(He,He.ACOS),$M=ct(He,He.ATAN),ur=ct(He,He.ABS),Cg=ct(He,He.SIGN),Rc=ct(He,He.LENGTH),PL=ct(He,He.NEGATE),LL=ct(He,He.ONE_MINUS),XM=ct(He,He.DFDX),YM=ct(He,He.DFDY),UL=ct(He,He.ROUND),BL=ct(He,He.RECIPROCAL),QM=ct(He,He.TRUNC),OL=ct(He,He.FWIDTH),IL=ct(He,He.TRANSPOSE),pJ=ct(He,He.BITCAST),FL=ct(He,He.EQUALS),to=ct(He,He.MIN),qr=ct(He,He.MAX),KM=ct(He,He.MOD),Fy=ct(He,He.STEP),kL=ct(He,He.REFLECT),zL=ct(He,He.DISTANCE),GL=ct(He,He.DIFFERENCE),Xh=ct(He,He.DOT),ky=ct(He,He.CROSS),Cl=ct(He,He.POW),ZM=ct(He,He.POW,2),qL=ct(He,He.POW,3),VL=ct(He,He.POW,4),HL=ct(He,He.TRANSFORM_DIRECTION),jL=i=>Wn(Cg(i),Cl(ur(i),1/3)),WL=i=>Xh(i,i),Fi=ct(He,He.MIX),vu=(i,e=0,t=1)=>_t(new He(He.CLAMP,_t(i),_t(e),_t(t))),$L=i=>vu(i),JM=ct(He,He.REFRACT),kc=ct(He,He.SMOOTHSTEP),eE=ct(He,He.FACEFORWARD),XL=je(([i])=>{const n=43758.5453,r=Xh(i.xy,Ct(12.9898,78.233)),s=KM(r,Z_);return Hc(Mo(s).mul(n))}),YL=(i,e,t)=>Fi(e,t,i),QL=(i,e,t)=>kc(e,t,i),KL=(i,e)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),$M(i,e)),mJ=eE,gJ=WM;ut("all",HM);ut("any",ML);ut("equals",FL);ut("radians",EL);ut("degrees",CL);ut("exp",jM);ut("exp2",O0);ut("log",Oy);ut("log2",cu);ut("sqrt",Cu);ut("inverseSqrt",WM);ut("floor",hu);ut("ceil",Iy);ut("normalize",Fc);ut("fract",Hc);ut("sin",Mo);ut("cos",yc);ut("tan",RL);ut("asin",NL);ut("acos",DL);ut("atan",$M);ut("abs",ur);ut("sign",Cg);ut("length",Rc);ut("lengthSq",WL);ut("negate",PL);ut("oneMinus",LL);ut("dFdx",XM);ut("dFdy",YM);ut("round",UL);ut("reciprocal",BL);ut("trunc",QM);ut("fwidth",OL);ut("atan2",KL);ut("min",to);ut("max",qr);ut("mod",KM);ut("step",Fy);ut("reflect",kL);ut("distance",zL);ut("dot",Xh);ut("cross",ky);ut("pow",Cl);ut("pow2",ZM);ut("pow3",qL);ut("pow4",VL);ut("transformDirection",HL);ut("mix",YL);ut("clamp",vu);ut("refract",JM);ut("smoothstep",QL);ut("faceForward",eE);ut("difference",GL);ut("saturate",$L);ut("cbrt",jL);ut("transpose",IL);ut("rand",XL);class vJ extends Mn{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 this.setup(e),this.getNodeType(e);const r=t.getNodeType(e);if(n!==null){const s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){const t=this.condNode.cache(),n=this.ifNode.cache(),r=this.elseNode?this.elseNode.cache():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);const a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n.context({nodeBlock:n}),a.elseNode=r?r.context({nodeBlock:r}):null}generate(e,t){const n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;const{condNode:s,ifNode:a,elseNode:l}=e.getNodeProperties(this),u=t!=="void",h=u?aL(n).build(e):"";r.nodeProperty=h;const m=s.build(e,"bool");e.addFlowCode(`
${e.tab}if ( ${m} ) {

`).addFlowTab();let v=a.build(e,n);if(v&&(u?v=h+" = "+v+";":v="return "+v+";"),e.removeFlowTab().addFlowCode(e.tab+"	"+v+`

`+e.tab+"}"),l!==null){e.addFlowCode(` else {

`).addFlowTab();let x=l.build(e,n);x&&(u?x=h+" = "+x+";":x="return "+x+";"),e.removeFlowTab().addFlowCode(e.tab+"	"+x+`

`+e.tab+`}

`)}else e.addFlowCode(`

`);return e.format(h,n,t)}}const zs=ct(vJ);ut("select",zs);const ZL=(...i)=>(console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),zs(...i));ut("cond",ZL);class JL extends Mn{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)}analyze(e){this.node.build(e)}setup(e){const t=e.getContext();e.setContext({...e.context,...this.value});const n=this.node.build(e);return e.setContext(t),n}generate(e,t){const n=e.getContext();e.setContext({...e.context,...this.value});const r=this.node.build(e,t);return e.setContext(n),r}}const zy=ct(JL),e9=(i,e)=>zy(i,{label:e});ut("context",zy);ut("label",e9);class Kv extends Mn{static get type(){return"VarNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}generate(e){const{node:t,name:n}=this,r=e.getVarFromNode(this,n,e.getVectorType(this.getNodeType(e))),s=e.getPropertyName(r),a=t.build(e,r.type);return e.addLineFlowCode(`${s} = ${a}`,this),s}}const t9=ct(Kv);ut("toVar",(...i)=>t9(...i).append());const n9=i=>(console.warn('TSL: "temp" is deprecated. Use ".toVar()" instead.'),t9(i));ut("temp",n9);class _J extends Mn{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0}isGlobal(){return!0}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 r=this.name,s=this.getNodeType(e);t.varying=n=e.getVaryingFromNode(this,r,s),t.node=this.node}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e)}analyze(e){return this.setupVarying(e),this.node.analyze(e)}generate(e){const t=e.getNodeProperties(this),n=this.setupVarying(e),r=e.shaderStage==="fragment"&&t.reassignPosition===!0&&e.context.needsPositionReassign;if(t.propertyName===void 0||r){const s=this.getNodeType(e),a=e.getPropertyName(n,IT.VERTEX);e.flowNodeFromShaderStage(IT.VERTEX,this.node,s,a),t.propertyName=a,r?t.reassignPosition=!1:t.reassignPosition===void 0&&e.context.isPositionNodeInput&&(t.reassignPosition=!0)}return e.getPropertyName(n)}}const ro=ct(_J),i9=i=>ro(i);ut("varying",ro);ut("vertexStage",i9);const r9=je(([i])=>{const e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Fi(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),s9=je(([i])=>{const e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Fi(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),jg="WorkingColorSpace",tE="OutputColorSpace";class Wg extends Zr{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===jg?ai.workingColorSpace:t===tE?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target);let s=t;return ai.enabled===!1||n===r||!n||!r||(ai.getTransfer(n)===Vi&&(s=dn(r9(s.rgb),s.a)),ai.getPrimaries(n)!==ai.getPrimaries(r)&&(s=dn(ha(ai._getMatrix(new Vn,n,r)).mul(s.rgb),s.a)),ai.getTransfer(r)===Vi&&(s=dn(s9(s.rgb),s.a))),s}}const a9=i=>_t(new Wg(_t(i),jg,tE)),o9=i=>_t(new Wg(_t(i),tE,jg)),l9=(i,e)=>_t(new Wg(_t(i),jg,e)),nE=(i,e)=>_t(new Wg(_t(i),e,jg)),yJ=(i,e,t)=>_t(new Wg(_t(i),e,t));ut("toOutputColorSpace",a9);ut("toWorkingColorSpace",o9);ut("workingToColorSpace",l9);ut("colorSpaceToWorking",nE);let xJ=class extends vA{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(),r=this.getNodeType();return e.format(t,n,r)}};class u9 extends Mn{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=jn.OBJECT}setGroup(e){return this.group=e,this}element(e){return _t(new xJ(this,_t(e)))}setNodeType(e){const t=gn(null,e).getSelf();this.group!==null&&t.setGroup(this.group),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];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 bJ=(i,e,t)=>_t(new u9(i,e,t));class SJ extends u9{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Rn)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}}const c9=(i,e,t=null)=>_t(new SJ(i,e,t));class TJ extends Zr{static get type(){return"ToneMappingNode"}constructor(e,t=f9,n=null){super("vec3"),this.toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return EM(this.toneMapping)}setup(e){const t=this.colorNode||e.context.color,n=this.toneMapping;if(n===Za)return t;let r=null;const s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=dn(s(t.rgb,this.exposureNode),t.a):(console.error("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}}const h9=(i,e,t)=>_t(new TJ(i,_t(e),_t(t))),f9=c9("toneMappingExposure","float");ut("toneMapping",(i,e,t)=>h9(e,t,i));class wJ extends CM{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=o_,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,r=e.getTypeLength(t),s=this.bufferStride||r,a=this.bufferOffset,l=n.isInterleavedBuffer===!0?n:new Qw(n,s),u=new nu(l,r,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),r=e.getPropertyName(n);let s=null;return e.shaderStage==="vertex"||e.shaderStage==="compute"?(this.name=r,s=r):s=ro(this).build(e,t),s}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 $g=(i,e=null,t=0,n=0)=>_t(new wJ(i,e,t,n)),A9=(i,e=null,t=0,n=0)=>$g(i,e,t,n).setUsage(qd),J_=(i,e=null,t=0,n=0)=>$g(i,e,t,n).setInstanced(!0),HT=(i,e=null,t=0,n=0)=>A9(i,e,t,n).setInstanced(!0);ut("toAttribute",i=>$g(i.value));class MJ extends Mn{static get type(){return"ComputeNode"}constructor(e,t,n=[64]){super("void"),this.isComputeNode=!0,this.computeNode=e,this.count=t,this.workgroupSize=n,this.dispatchCount=0,this.version=1,this.name="",this.updateBeforeType=jn.OBJECT,this.onInitFunction=null,this.updateDispatchCount()}dispose(){this.dispatchEvent({type:"dispose"})}label(e){return this.name=e,this}updateDispatchCount(){const{count:e,workgroupSize:t}=this;let n=t[0];for(let r=1;r<t.length;r++)n*=t[r];this.dispatchCount=Math.ceil(e/n)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}generate(e){const{shaderStage:t}=e;if(t==="compute"){const n=this.computeNode.build(e,"void");n!==""&&e.addLineFlowCode(n,this)}}}const d9=(i,e,t)=>_t(new MJ(_t(i),e,t));ut("compute",d9);class EJ extends Mn{static get type(){return"CacheNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isCacheNode=!0}getNodeType(e){const t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);const r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){const n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const s=this.node.build(e,...t);return e.setCache(n),s}}const Im=(i,e)=>_t(new EJ(_t(i),e));ut("cache",Im);class CJ extends Mn{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 p9=ct(CJ);ut("bypass",p9);class m9 extends Mn{static get type(){return"RemapNode"}constructor(e,t,n,r=_e(0),s=_e(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=r,this.outHighNode=s,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:n,outLowNode:r,outHighNode:s,doClamp:a}=this;let l=e.sub(t).div(n.sub(t));return a===!0&&(l=l.clamp()),l.mul(s.sub(r)).add(r)}}const g9=ct(m9,null,null,{doClamp:!1}),v9=ct(m9);ut("remap",g9);ut("remapClamp",v9);class Zv extends Mn{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(`( ${r} )`,n,t)}}const Hh=ct(Zv),_9=i=>(i?zs(i,Hh("discard")):Hh("discard")).append(),RJ=()=>Hh("return").append();ut("discard",_9);class NJ extends Zr{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)||Za,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||Co;return n!==Za&&(t=t.toneMapping(n)),r!==Co&&r!==ai.workingColorSpace&&(t=t.workingToColorSpace(r)),t}}const y9=(i,e=null,t=null)=>_t(new NJ(_t(i),e,t));ut("renderOutput",y9);function DJ(i){console.warn("THREE.TSLBase: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}class x9 extends Mn{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 r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}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 s=e.geometry.getAttribute(t),a=e.getTypeFromAttribute(s),l=e.getAttribute(t,a);return e.shaderStage==="vertex"?e.format(l.name,a,n):ro(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 _u=(i,e)=>_t(new x9(i,e)),Er=(i=0)=>_u("uv"+(i>0?i:""),"vec2");class PJ extends Mn{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"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}}const Fh=ct(PJ);class LJ extends Hg{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=jn.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:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}}const b9=ct(LJ);class yu extends Hg{static get type(){return"TextureNode"}constructor(e,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=jn.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===Rr?"uvec4":this.value.type===Ns?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Er(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=gn(this.value.matrix)),this._matrixUniform.mul(Be(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this.updateType=e?jn.RENDER:jn.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(Ee(Fh(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 r=this.uvNode;(r===null||e.context.forceUVContext===!0)&&e.context.getUV&&(r=e.context.getUV(this)),r||(r=this.getDefaultUV()),this.updateMatrix===!0&&(r=this.getTransformedUV(r)),r=this.setupUV(e,r);let s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this)),t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateSnippet(e,t,n,r,s,a,l,u){const h=this.value;let m;return r?m=e.generateTextureLevel(h,t,n,r,a):s?m=e.generateTextureBias(h,t,n,s,a):u?m=e.generateTextureGrad(h,t,n,u,a):l?m=e.generateTextureCompare(h,t,n,l,a):this.sampler===!1?m=e.generateTextureLoad(h,t,n,a):m=e.generateTexture(h,t,n,a),m}generate(e,t){const n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(t==="sampler")return s+"_sampler";if(e.isReference(t))return s;{const a=e.getDataFromNode(this);let l=a.propertyName;if(l===void 0){const{uvNode:m,levelNode:v,biasNode:x,compareNode:S,depthNode:w,gradNode:R}=r,C=this.generateUV(e,m),E=v?v.build(e,"float"):null,B=x?x.build(e,"float"):null,L=w?w.build(e,"int"):null,O=S?S.build(e,"float"):null,G=R?[R[0].build(e,"vec2"),R[1].build(e,"vec2")]:null,q=e.getVarFromNode(this);l=e.getPropertyName(q);const z=this.generateSnippet(e,s,C,E,B,L,O,G);e.addLineFlowCode(`${l} = ${z}`,this),a.snippet=z,a.propertyName=l}let u=l;const h=this.getNodeType(e);return e.needsToWorkingColorSpace(n)&&(u=nE(Hh(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=_t(e),t.referenceNode=this.getSelf(),_t(t)}blur(e){const t=this.clone();return t.biasNode=_t(e).mul(b9(t)),t.referenceNode=this.getSelf(),_t(t)}level(e){const t=this.clone();return t.levelNode=_t(e),t.referenceNode=this.getSelf(),_t(t)}size(e){return Fh(this,e)}bias(e){const t=this.clone();return t.biasNode=_t(e),t.referenceNode=this.getSelf(),_t(t)}compare(e){const t=this.clone();return t.compareNode=_t(e),t.referenceNode=this.getSelf(),_t(t)}grad(e,t){const n=this.clone();return n.gradNode=[_t(e),_t(t)],n.referenceNode=this.getSelf(),_t(n)}depth(e){const t=this.clone();return t.depthNode=_t(e),t.referenceNode=this.getSelf(),_t(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}}const Ai=ct(yu),Fr=(...i)=>Ai(...i).setSampler(!1),UJ=i=>(i.isNode===!0?i:Ai(i)).convert("sampler"),Dh=gn("float").label("cameraNear").setGroup(Rn).onRenderUpdate(({camera:i})=>i.near),Ph=gn("float").label("cameraFar").setGroup(Rn).onRenderUpdate(({camera:i})=>i.far),_A=gn("mat4").label("cameraProjectionMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.projectionMatrix),BJ=gn("mat4").label("cameraProjectionMatrixInverse").setGroup(Rn).onRenderUpdate(({camera:i})=>i.projectionMatrixInverse),so=gn("mat4").label("cameraViewMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.matrixWorldInverse),OJ=gn("mat4").label("cameraWorldMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.matrixWorld),IJ=gn("mat3").label("cameraNormalMatrix").setGroup(Rn).onRenderUpdate(({camera:i})=>i.normalMatrix),S9=gn(new he).label("cameraPosition").setGroup(Rn).onRenderUpdate(({camera:i},e)=>e.value.setFromMatrixPosition(i.matrixWorld));class Li extends Mn{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=jn.OBJECT,this._uniformNode=new Hg(null)}getNodeType(){const e=this.scope;if(e===Li.WORLD_MATRIX)return"mat4";if(e===Li.POSITION||e===Li.VIEW_POSITION||e===Li.DIRECTION||e===Li.SCALE)return"vec3"}update(e){const t=this.object3d,n=this._uniformNode,r=this.scope;if(r===Li.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===Li.POSITION)n.value=n.value||new he,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===Li.SCALE)n.value=n.value||new he,n.value.setFromMatrixScale(t.matrixWorld);else if(r===Li.DIRECTION)n.value=n.value||new he,t.getWorldDirection(n.value);else if(r===Li.VIEW_POSITION){const s=e.camera;n.value=n.value||new he,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}}generate(e){const t=this.scope;return t===Li.WORLD_MATRIX?this._uniformNode.nodeType="mat4":(t===Li.POSITION||t===Li.VIEW_POSITION||t===Li.DIRECTION||t===Li.SCALE)&&(this._uniformNode.nodeType="vec3"),this._uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}Li.WORLD_MATRIX="worldMatrix";Li.POSITION="position";Li.SCALE="scale";Li.VIEW_POSITION="viewPosition";Li.DIRECTION="direction";const FJ=ct(Li,Li.DIRECTION),kJ=ct(Li,Li.WORLD_MATRIX),T9=ct(Li,Li.POSITION),zJ=ct(Li,Li.SCALE),GJ=ct(Li,Li.VIEW_POSITION);class xu extends Li{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const qJ=Wt(xu,xu.DIRECTION),$o=Wt(xu,xu.WORLD_MATRIX),VJ=Wt(xu,xu.POSITION),HJ=Wt(xu,xu.SCALE),jJ=Wt(xu,xu.VIEW_POSITION),w9=gn(new Vn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),WJ=gn(new kn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Q0=je(i=>i.renderer.nodes.modelViewMatrix||M9).once()().toVar("modelViewMatrix"),M9=so.mul($o),$J=je(i=>(i.context.isHighPrecisionModelViewMatrix=!0,gn("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),XJ=je(i=>{const e=i.context.isHighPrecisionModelViewMatrix;return gn("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),Gy=_u("position","vec3"),Gr=Gy.varying("positionLocal"),ey=Gy.varying("positionPrevious"),Nc=$o.mul(Gr).xyz.varying("v_positionWorld").context({needsPositionReassign:!0}),iE=Gr.transformDirection($o).varying("v_positionWorldDirection").normalize().toVar("positionWorldDirection").context({needsPositionReassign:!0}),Xr=je(i=>i.context.setupPositionView(),"vec3").once()().varying("v_positionView").context({needsPositionReassign:!0}),dr=Xr.negate().varying("v_positionViewDirection").normalize().toVar("positionViewDirection");class YJ extends Mn{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){const{renderer:t,material:n}=e;return t.coordinateSystem===Ha&&n.side===hr?"false":e.getFrontFacing()}}const E9=Wt(YJ),Xg=_e(E9).mul(2).sub(1),qy=_u("normal","vec3"),no=je(i=>i.geometry.hasAttribute("normal")===!1?(console.warn('TSL.NormalNode: Vertex attribute "normal" not found on geometry.'),Be(0,1,0)):qy,"vec3").once()().toVar("normalLocal"),C9=Xr.dFdx().cross(Xr.dFdy()).normalize().toVar("normalFlat"),Jo=je(i=>{let e;return i.material.flatShading===!0?e=C9:e=ro(rE(no),"v_normalView").normalize(),e},"vec3").once()().toVar("normalView"),Vy=ro(Jo.transformDirection(so),"v_normalWorld").normalize().toVar("normalWorld"),zr=je(i=>i.context.setupNormal(),"vec3").once()().mul(Xg).toVar("transformedNormalView"),Hy=zr.transformDirection(so).toVar("transformedNormalWorld"),Qd=je(i=>i.context.setupClearcoatNormal(),"vec3").once()().mul(Xg).toVar("transformedClearcoatNormalView"),R9=je(([i,e=$o])=>{const t=ha(e),n=i.div(Be(t[0].dot(t[0]),t[1].dot(t[1]),t[2].dot(t[2])));return t.mul(n).xyz}),rE=je(([i],e)=>{const t=e.renderer.nodes.modelNormalViewMatrix;if(t!==null)return t.transformDirection(i);const n=w9.mul(i);return so.transformDirection(n)}),N9=gn(0).onReference(({material:i})=>i).onRenderUpdate(({material:i})=>i.refractionRatio),D9=dr.negate().reflect(zr),P9=dr.negate().refract(zr,N9),L9=D9.transformDirection(so).toVar("reflectVector"),U9=P9.transformDirection(so).toVar("reflectVector");class QJ extends yu{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===Qo?L9:e.mapping===Ko?U9:(console.error('THREE.CubeTextureNode: Mapping "%s" not supported.',e.mapping),Be(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return e.renderer.coordinateSystem===pu||!n.isRenderTargetTexture?Be(t.x.negate(),t.yz):t}generateUV(e,t){return t.build(e,"vec3")}}const I0=ct(QJ);class sE extends Hg{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 Yg=(i,e,t)=>_t(new sE(i,e,t));class KJ extends vA{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),n=this.getNodeType(),r=this.node.getPaddedType();return e.format(t,r,n)}}class B9 extends sE{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Uh(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=jn.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 r=0;r<e.length;r++){const s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){const s=r*4,a=e[r];t[s]=a.r,t[s+1]=a.g,t[s+2]=a.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){const s=r*4,a=e[r];t[s]=a.elements[0],t[s+1]=a.elements[1],t[s+2]=a.elements[2],t[s+3]=a.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){const s=r*16,a=e[r];t[s]=a.elements[0],t[s+1]=a.elements[1],t[s+2]=a.elements[2],t[s+4]=a.elements[3],t[s+5]=a.elements[4],t[s+6]=a.elements[5],t[s+8]=a.elements[6],t[s+9]=a.elements[7],t[s+10]=a.elements[8],t[s+15]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){const s=r*16,a=e[r];for(let l=0;l<a.elements.length;l++)t[s+l]=a.elements[l]}else for(let r=0;r<e.length;r++){const s=r*4,a=e[r];t[s]=a.x,t[s+1]=a.y,t[s+2]=a.z||0,t[s+3]=a.w||0}}setup(e){const t=this.array.length,n=this.elementType;let r=Float32Array;const s=this.paddedType,a=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*a),this.bufferCount=t,this.bufferType=s,super.setup(e)}element(e){return _t(new KJ(this,_t(e)))}}const Sc=(i,e)=>_t(new B9(i,e)),ZJ=(i,e)=>(console.warn("TSL.UniformArrayNode: uniforms() has been renamed to uniformArray()."),_t(new B9(i,e)));class JJ extends vA{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(),r=this.getNodeType();return e.format(t,n,r)}}class jy extends Mn{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=jn.OBJECT}element(e){return _t(new JJ(this,_t(e)))}setGroup(e){return this.group=e,this}label(e){return this.name=e,this}setNodeType(e){let t=null;this.count!==null?t=Yg(null,e,this.count):Array.isArray(this.getValueFromReference())?t=Sc(null,e):e==="texture"?t=Ai(null):e==="cubeTexture"?t=I0(null):t=gn(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.label(this.name),this.node=t.getSelf()}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];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 ji=(i,e,t)=>_t(new jy(i,e,t)),jT=(i,e,t,n)=>_t(new jy(i,e,n,t));class eee extends jy{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 Tc=(i,e,t=null)=>_t(new eee(i,e,t)),Wy=je(i=>(i.geometry.hasAttribute("tangent")===!1&&i.geometry.computeTangents(),_u("tangent","vec4")))(),Qg=Wy.xyz.toVar("tangentLocal"),Kg=Q0.mul(dn(Qg,0)).xyz.varying("v_tangentView").normalize().toVar("tangentView"),O9=Kg.transformDirection(so).varying("v_tangentWorld").normalize().toVar("tangentWorld"),aE=Kg.toVar("transformedTangentView"),tee=aE.transformDirection(so).normalize().toVar("transformedTangentWorld"),Zg=i=>i.mul(Wy.w).xyz,nee=ro(Zg(qy.cross(Wy)),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),iee=ro(Zg(no.cross(Qg)),"v_bitangentLocal").normalize().toVar("bitangentLocal"),I9=ro(Zg(Jo.cross(Kg)),"v_bitangentView").normalize().toVar("bitangentView"),ree=ro(Zg(Vy.cross(O9)),"v_bitangentWorld").normalize().toVar("bitangentWorld"),F9=Zg(zr.cross(aE)).normalize().toVar("transformedBitangentView"),see=F9.transformDirection(so).normalize().toVar("transformedBitangentWorld"),Yf=ha(Kg,I9,Jo),k9=dr.mul(Yf),aee=(i,e)=>i.sub(k9.mul(e)),z9=(()=>{let i=iA.cross(dr);return i=i.cross(iA).normalize(),i=Fi(i,zr,Rh.mul(Zl.oneMinus()).oneMinus().pow2().pow2()).normalize(),i})(),oee=je(i=>{const{eye_pos:e,surf_norm:t,mapN:n,uv:r}=i,s=e.dFdx(),a=e.dFdy(),l=r.dFdx(),u=r.dFdy(),h=t,m=a.cross(h),v=h.cross(s),x=m.mul(l.x).add(v.mul(u.x)),S=m.mul(l.y).add(v.mul(u.y)),w=x.dot(x).max(S.dot(S)),R=Xg.mul(w.inverseSqrt());return Qr(x.mul(n.x,R),S.mul(n.y,R),h.mul(n.z)).normalize()});class lee extends Zr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=Dc}setup(e){const{normalMapType:t,scaleNode:n}=this;let r=this.node.mul(2).sub(1);n!==null&&(r=Be(r.xy.mul(n),r.z));let s=null;return t===O7?s=rE(r):t===Dc&&(e.hasGeometryAttribute("tangent")===!0?s=Yf.mul(r).normalize():s=oee({eye_pos:Xr,surf_norm:Jo,mapN:r,uv:Er()})),s}}const WT=ct(lee),uee=je(({textureNode:i,bumpScale:e})=>{const t=r=>i.cache().context({getUV:s=>r(s.uvNode||Er()),forceUVContext:!0}),n=_e(t(r=>r));return Ct(_e(t(r=>r.add(r.dFdx()))).sub(n),_e(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),cee=je(i=>{const{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),a=t,l=s.cross(a),u=a.cross(r),h=r.dot(l).mul(Xg),m=h.sign().mul(n.x.mul(l).add(n.y.mul(u)));return h.abs().mul(t).sub(m).normalize()});class hee extends Zr{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=uee({textureNode:this.textureNode,bumpScale:e});return cee({surf_pos:Xr,surf_norm:Jo,dHdxy:t})}}const G9=ct(hee),U6=new Map;class st extends Mn{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=U6.get(e);return n===void 0&&(n=Tc(e,t),U6.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 r=null;if(n===st.COLOR){const s=t.color!==void 0?this.getColor(n):Be();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===st.OPACITY){const s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===st.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=_e(1);else if(n===st.SPECULAR_INTENSITY){const s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===st.SPECULAR_COLOR){const s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===st.ROUGHNESS){const s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===st.METALNESS){const s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===st.EMISSIVE){const s=this.getFloat("emissiveIntensity"),a=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=a.mul(this.getTexture(n)):r=a}else if(n===st.NORMAL)t.normalMap?(r=WT(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType):t.bumpMap?r=G9(this.getTexture("bump").r,this.getFloat("bumpScale")):r=Jo;else if(n===st.CLEARCOAT){const s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===st.CLEARCOAT_ROUGHNESS){const s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===st.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=WT(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=Jo;else if(n===st.SHEEN){const s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===st.SHEEN_ROUGHNESS){const s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(.07,1)}else if(n===st.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const s=this.getTexture(n);r=Ly(kd.x,kd.y,kd.y.negate(),kd.x).mul(s.rg.mul(2).sub(Ct(1)).normalize().mul(s.b))}else r=kd;else if(n===st.IRIDESCENCE_THICKNESS){const s=ji("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const a=ji("0","float",t.iridescenceThicknessRange);r=s.sub(a).mul(this.getTexture(n).g).add(a)}else r=s}else if(n===st.TRANSMISSION){const s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===st.THICKNESS){const s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===st.IOR)r=this.getFloat(n);else if(n===st.LIGHT_MAP)r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity"));else if(n===st.AO)r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else{const s=this.getNodeType(e);r=this.getCache(n,s)}return r}}st.ALPHA_TEST="alphaTest";st.COLOR="color";st.OPACITY="opacity";st.SHININESS="shininess";st.SPECULAR="specular";st.SPECULAR_STRENGTH="specularStrength";st.SPECULAR_INTENSITY="specularIntensity";st.SPECULAR_COLOR="specularColor";st.REFLECTIVITY="reflectivity";st.ROUGHNESS="roughness";st.METALNESS="metalness";st.NORMAL="normal";st.CLEARCOAT="clearcoat";st.CLEARCOAT_ROUGHNESS="clearcoatRoughness";st.CLEARCOAT_NORMAL="clearcoatNormal";st.EMISSIVE="emissive";st.ROTATION="rotation";st.SHEEN="sheen";st.SHEEN_ROUGHNESS="sheenRoughness";st.ANISOTROPY="anisotropy";st.IRIDESCENCE="iridescence";st.IRIDESCENCE_IOR="iridescenceIOR";st.IRIDESCENCE_THICKNESS="iridescenceThickness";st.IOR="ior";st.TRANSMISSION="transmission";st.THICKNESS="thickness";st.ATTENUATION_DISTANCE="attenuationDistance";st.ATTENUATION_COLOR="attenuationColor";st.LINE_SCALE="scale";st.LINE_DASH_SIZE="dashSize";st.LINE_GAP_SIZE="gapSize";st.LINE_WIDTH="linewidth";st.LINE_DASH_OFFSET="dashOffset";st.POINT_WIDTH="pointWidth";st.DISPERSION="dispersion";st.LIGHT_MAP="light";st.AO="ao";const q9=Wt(st,st.ALPHA_TEST),V9=Wt(st,st.COLOR),H9=Wt(st,st.SHININESS),j9=Wt(st,st.EMISSIVE),oE=Wt(st,st.OPACITY),W9=Wt(st,st.SPECULAR),$T=Wt(st,st.SPECULAR_INTENSITY),$9=Wt(st,st.SPECULAR_COLOR),Fm=Wt(st,st.SPECULAR_STRENGTH),Jv=Wt(st,st.REFLECTIVITY),X9=Wt(st,st.ROUGHNESS),Y9=Wt(st,st.METALNESS),Q9=Wt(st,st.NORMAL).context({getUV:null}),K9=Wt(st,st.CLEARCOAT),Z9=Wt(st,st.CLEARCOAT_ROUGHNESS),J9=Wt(st,st.CLEARCOAT_NORMAL).context({getUV:null}),eU=Wt(st,st.ROTATION),tU=Wt(st,st.SHEEN),nU=Wt(st,st.SHEEN_ROUGHNESS),iU=Wt(st,st.ANISOTROPY),rU=Wt(st,st.IRIDESCENCE),sU=Wt(st,st.IRIDESCENCE_IOR),aU=Wt(st,st.IRIDESCENCE_THICKNESS),oU=Wt(st,st.TRANSMISSION),lU=Wt(st,st.THICKNESS),uU=Wt(st,st.IOR),cU=Wt(st,st.ATTENUATION_DISTANCE),hU=Wt(st,st.ATTENUATION_COLOR),fU=Wt(st,st.LINE_SCALE),AU=Wt(st,st.LINE_DASH_SIZE),dU=Wt(st,st.LINE_GAP_SIZE),fee=Wt(st,st.LINE_WIDTH),pU=Wt(st,st.LINE_DASH_OFFSET),Aee=Wt(st,st.POINT_WIDTH),mU=Wt(st,st.DISPERSION),lE=Wt(st,st.LIGHT_MAP),gU=Wt(st,st.AO),kd=gn(new gt).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),uE=je(i=>i.context.setupModelViewProjection(),"vec4").once()().varying("v_modelViewProjection");class pr extends Mn{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 r;if(n===pr.VERTEX)r=e.getVertexIndex();else if(n===pr.INSTANCE)r=e.getInstanceIndex();else if(n===pr.DRAW)r=e.getDrawIndex();else if(n===pr.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===pr.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===pr.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=ro(this).build(e,t),s}}pr.VERTEX="vertex";pr.INSTANCE="instance";pr.SUBGROUP="subgroup";pr.INVOCATION_LOCAL="invocationLocal";pr.INVOCATION_SUBGROUP="invocationSubgroup";pr.DRAW="draw";const vU=Wt(pr,pr.VERTEX),Jg=Wt(pr,pr.INSTANCE),dee=Wt(pr,pr.SUBGROUP),pee=Wt(pr,pr.INVOCATION_SUBGROUP),mee=Wt(pr,pr.INVOCATION_LOCAL),_U=Wt(pr,pr.DRAW);class yU extends Mn{static get type(){return"InstanceNode"}constructor(e,t,n){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=n,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=jn.FRAME,this.buffer=null,this.bufferColor=null}setup(e){const{count:t,instanceMatrix:n,instanceColor:r}=this;let{instanceMatrixNode:s,instanceColorNode:a}=this;if(s===null){if(t<=1e3)s=Yg(n.array,"mat4",Math.max(t,1)).element(Jg);else{const u=new h_(n.array,16,1);this.buffer=u;const h=n.usage===qd?HT:J_,m=[h(u,"vec4",16,0),h(u,"vec4",16,4),h(u,"vec4",16,8),h(u,"vec4",16,12)];s=nA(...m)}this.instanceMatrixNode=s}if(r&&a===null){const u=new Ig(r.array,3),h=r.usage===qd?HT:J_;this.bufferColor=u,a=Be(h(u,"vec3",3,0)),this.instanceColorNode=a}const l=s.mul(Gr).xyz;if(Gr.assign(l),e.hasGeometryAttribute("normal")){const u=R9(no,s);no.assign(u)}this.instanceColorNode!==null&&Sg("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){this.instanceMatrix.usage!==qd&&this.buffer!==null&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version),this.instanceColor&&this.instanceColor.usage!==qd&&this.bufferColor!==null&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)}}const gee=ct(yU);class vee extends yU{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:n,instanceColor:r}=e;super(t,n,r),this.instancedMesh=e}}const xU=ct(vee);class _ee extends Mn{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=Jg:this.batchingIdNode=_U);const n=je(([w])=>{const R=Fh(Fr(this.batchMesh._indirectTexture),0),C=Ee(w).modInt(Ee(R)),E=Ee(w).div(Ee(R));return Fr(this.batchMesh._indirectTexture,ms(C,E)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(Ee(this.batchingIdNode)),r=this.batchMesh._matricesTexture,s=Fh(Fr(r),0),a=_e(n).mul(4).toInt().toVar(),l=a.modInt(s),u=a.div(Ee(s)),h=nA(Fr(r,ms(l,u)),Fr(r,ms(l.add(1),u)),Fr(r,ms(l.add(2),u)),Fr(r,ms(l.add(3),u))),m=this.batchMesh._colorsTexture;if(m!==null){const R=je(([C])=>{const E=Fh(Fr(m),0).x,B=C,L=B.modInt(E),O=B.div(E);return Fr(m,ms(L,O)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(n);Sg("vec3","vBatchColor").assign(R)}const v=ha(h);Gr.assign(h.mul(Gr));const x=no.div(Be(v[0].dot(v[0]),v[1].dot(v[1]),v[2].dot(v[2]))),S=v.mul(x).xyz;no.assign(S),e.hasGeometryAttribute("tangent")&&Qg.mulAssign(v)}}const bU=ct(_ee),B6=new WeakMap;class SU extends Mn{static get type(){return"SkinningNode"}constructor(e,t=!1){super("void"),this.skinnedMesh=e,this.useReference=t,this.updateType=jn.OBJECT,this.skinIndexNode=_u("skinIndex","uvec4"),this.skinWeightNode=_u("skinWeight","vec4");let n,r,s;t?(n=ji("bindMatrix","mat4"),r=ji("bindMatrixInverse","mat4"),s=jT("skeleton.boneMatrices","mat4",e.skeleton.bones.length)):(n=gn(e.bindMatrix,"mat4"),r=gn(e.bindMatrixInverse,"mat4"),s=Yg(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length)),this.bindMatrixNode=n,this.bindMatrixInverseNode=r,this.boneMatricesNode=s,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=Gr){const{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:s,bindMatrixInverseNode:a}=this,l=e.element(n.x),u=e.element(n.y),h=e.element(n.z),m=e.element(n.w),v=s.mul(t),x=Qr(l.mul(r.x).mul(v),u.mul(r.y).mul(v),h.mul(r.z).mul(v),m.mul(r.w).mul(v));return a.mul(x).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=no){const{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:s,bindMatrixInverseNode:a}=this,l=e.element(n.x),u=e.element(n.y),h=e.element(n.z),m=e.element(n.w);let v=Qr(r.x.mul(l),r.y.mul(u),r.z.mul(h),r.w.mul(m));return v=a.mul(v).mul(s),v.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return this.previousBoneMatricesNode===null&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=jT("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,ey)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")||FP(e.object).useVelocity===!0}setup(e){this.needsPreviousBoneMatrices(e)&&ey.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(Gr.assign(t),e.hasGeometryAttribute("normal")){const n=this.getSkinnedNormal();no.assign(n),e.hasGeometryAttribute("tangent")&&Qg.assign(n)}}generate(e,t){if(t!=="void")return Gr.build(e,t)}update(e){const n=(this.useReference?e.object:this.skinnedMesh).skeleton;B6.get(n)!==e.frameId&&(B6.set(n,e.frameId),this.previousBoneMatricesNode!==null&&n.previousBoneMatrices.set(n.boneMatrices),n.update())}}const yee=i=>_t(new SU(i)),TU=i=>_t(new SU(i,!0));class xee extends Mn{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 s=0,a=this.params.length-1;s<a;s++){const l=this.params[s],u=l.isNode!==!0&&l.name||this.getVarName(s),h=l.isNode!==!0&&l.type||"int";n[u]=Hh(u,h)}const r=e.addStack();return t.returnsNode=this.params[this.params.length-1](n,r,e),t.stackNode=r,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,r=t.stackNode;for(let l=0,u=n.length-1;l<u;l++){const h=n[l];let m=null,v=null,x=null,S=null,w=null,R=null;h.isNode?(S="int",x=this.getVarName(l),m="0",v=h.build(e,S),w="<"):(S=h.type||"int",x=h.name||this.getVarName(l),m=h.start,v=h.end,w=h.condition,R=h.update,typeof m=="number"?m=e.generateConst(S,m):m&&m.isNode&&(m=m.build(e,S)),typeof v=="number"?v=e.generateConst(S,v):v&&v.isNode&&(v=v.build(e,S)),m!==void 0&&v===void 0?(m=m+" - 1",v="0",w=">="):v!==void 0&&m===void 0&&(m="0",w="<"),w===void 0&&(Number(m)>Number(v)?w=">=":w="<"));const C={start:m,end:v},E=C.start,B=C.end;let L="",O="",G="";R||(S==="int"||S==="uint"?w.includes("<")?R="++":R="--":w.includes("<")?R="+= 1.":R="-= 1."),L+=e.getVar(S,x)+" = "+E,O+=x+" "+w+" "+B,G+=x+" "+R;const q=`for ( ${L}; ${O}; ${G} )`;e.addFlowCode((l===0?`
`:"")+e.tab+q+` {

`).addFlowTab()}const s=r.build(e,"void"),a=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode(`
`+e.tab+s);for(let l=0,u=this.params.length-1;l<u;l++)e.addFlowCode((l===0?"":e.tab)+`}

`).removeFlowTab();return e.addFlowTab(),a}}const ki=(...i)=>_t(new xee(tA(i,"int"))).append(),bee=()=>Hh("continue").append(),wU=()=>Hh("break").append(),See=(...i)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),ki(...i)),$3=new WeakMap,vo=new Ln,O6=je(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{const a=Ee(vU).mul(t).add(s),l=a.div(n),u=a.sub(l.mul(n));return Fr(i,ms(u,l)).depth(r).mul(e)});function Tee(i){const e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0;let a=$3.get(i);if(a===void 0||a.count!==s){let B=function(){C.dispose(),$3.delete(i),i.removeEventListener("dispose",B)};var l=B;a!==void 0&&a.texture.dispose();const u=i.morphAttributes.position||[],h=i.morphAttributes.normal||[],m=i.morphAttributes.color||[];let v=0;e===!0&&(v=1),t===!0&&(v=2),n===!0&&(v=3);let x=i.attributes.position.count*v,S=1;const w=4096;x>w&&(S=Math.ceil(x/w),x=w);const R=new Float32Array(x*S*4*s),C=new jw(R,x,S,s);C.type=$r,C.needsUpdate=!0;const E=v*4;for(let L=0;L<s;L++){const O=u[L],G=h[L],q=m[L],z=x*S*4*L;for(let j=0;j<O.count;j++){const F=j*E;e===!0&&(vo.fromBufferAttribute(O,j),R[z+F+0]=vo.x,R[z+F+1]=vo.y,R[z+F+2]=vo.z,R[z+F+3]=0),t===!0&&(vo.fromBufferAttribute(G,j),R[z+F+4]=vo.x,R[z+F+5]=vo.y,R[z+F+6]=vo.z,R[z+F+7]=0),n===!0&&(vo.fromBufferAttribute(q,j),R[z+F+8]=vo.x,R[z+F+9]=vo.y,R[z+F+10]=vo.z,R[z+F+11]=q.itemSize===4?vo.w:1)}}a={count:s,texture:C,stride:v,size:new gt(x,S)},$3.set(i,a),i.addEventListener("dispose",B)}return a}class wee extends Mn{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=gn(1),this.updateType=jn.OBJECT}setup(e){const{geometry:t}=e,n=t.morphAttributes.position!==void 0,r=t.hasAttribute("normal")&&t.morphAttributes.normal!==void 0,s=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,a=s!==void 0?s.length:0,{texture:l,stride:u,size:h}=Tee(t);n===!0&&Gr.mulAssign(this.morphBaseInfluence),r===!0&&no.mulAssign(this.morphBaseInfluence);const m=Ee(h.width);ki(a,({i:v})=>{const x=_e(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?x.assign(Fr(this.mesh.morphTexture,ms(Ee(v).add(1),Ee(Jg))).r):x.assign(ji("morphTargetInfluences","float").element(v).toVar()),n===!0&&Gr.addAssign(O6({bufferMap:l,influence:x,stride:u,width:m,depth:v,offset:Ee(0)})),r===!0&&no.addAssign(O6({bufferMap:l,influence:x,stride:u,width:m,depth:v,offset:Ee(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 MU=ct(wee);class K0 extends Mn{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class Mee extends K0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class Eee extends JL{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,r=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=r,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n=Be().toVar("directDiffuse"),r=Be().toVar("directSpecular"),s=Be().toVar("indirectDiffuse"),a=Be().toVar("indirectSpecular"),l={directDiffuse:n,directSpecular:r,indirectDiffuse:s,indirectSpecular:a};return{radiance:Be().toVar("radiance"),irradiance:Be().toVar("irradiance"),iblIrradiance:Be().toVar("iblIrradiance"),ambientOcclusion:_e(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 EU=ct(Eee);class Cee extends K0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let am,om;class ss extends Mn{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this.isViewportNode=!0}getNodeType(){return this.scope===ss.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=jn.NONE;return(this.scope===ss.SIZE||this.scope===ss.VIEWPORT)&&(e=jn.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===ss.VIEWPORT?t!==null?om.copy(t.viewport):(e.getViewport(om),om.multiplyScalar(e.getPixelRatio())):t!==null?(am.width=t.width,am.height=t.height):e.getDrawingBufferSize(am)}setup(){const e=this.scope;let t=null;return e===ss.SIZE?t=gn(am||(am=new gt)):e===ss.VIEWPORT?t=gn(om||(om=new Ln)):t=Ct(e1.div(Rg)),t}generate(e){if(this.scope===ss.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(Rg).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}ss.COORDINATE="coordinate";ss.VIEWPORT="viewport";ss.SIZE="size";ss.UV="uv";const bu=Wt(ss,ss.UV),Rg=Wt(ss,ss.SIZE),e1=Wt(ss,ss.COORDINATE),cE=Wt(ss,ss.VIEWPORT),CU=cE.zw,RU=e1.sub(cE.xy),Ree=RU.div(CU),Nee=je(()=>(console.warn('TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.'),Rg),"vec2").once()(),Dee=je(()=>(console.warn('TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.'),bu),"vec2").once()(),Pee=je(()=>(console.warn('TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.'),bu.flipY()),"vec2").once()(),lm=new gt;class $y extends yu{static get type(){return"ViewportTextureNode"}constructor(e=bu,t=null,n=null){n===null&&(n=new W7,n.minFilter=Va),super(n,e,t),this.generateMipmaps=!1,this.isOutputTextureNode=!0,this.updateBeforeType=jn.FRAME}updateBefore(e){const t=e.renderer;t.getDrawingBufferSize(lm);const n=this.value;(n.image.width!==lm.width||n.image.height!==lm.height)&&(n.image.width=lm.width,n.image.height=lm.height,n.needsUpdate=!0);const r=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=r}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const Lee=ct($y),hE=ct($y,null,null,{generateMipmaps:!0});let X3=null;class Uee extends $y{static get type(){return"ViewportDepthTextureNode"}constructor(e=bu,t=null){X3===null&&(X3=new qc),super(e,t,X3)}}const fE=ct(Uee);class Xa extends Mn{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===Xa.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let r=null;if(t===Xa.DEPTH_BASE)n!==null&&(r=DU().assign(n));else if(t===Xa.DEPTH)e.isPerspectiveCamera?r=NU(Xr.z,Dh,Ph):r=s0(Xr.z,Dh,Ph);else if(t===Xa.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){const s=AE(n,Dh,Ph);r=s0(s,Dh,Ph)}else r=n;else r=s0(Xr.z,Dh,Ph);return r}}Xa.DEPTH_BASE="depthBase";Xa.DEPTH="depth";Xa.LINEAR_DEPTH="linearDepth";const s0=(i,e,t)=>i.add(e).div(e.sub(t)),Bee=(i,e,t)=>e.sub(t).mul(i).sub(e),NU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),AE=(i,e,t)=>e.mul(t).div(t.sub(e).mul(i).sub(t)),dE=(i,e,t)=>{e=e.max(1e-6).toVar();const n=cu(i.negate().div(e)),r=cu(t.div(e));return n.div(r)},Oee=(i,e,t)=>{const n=i.mul(Oy(t.div(e)));return _e(Math.E).pow(n).mul(e).negate()},DU=ct(Xa,Xa.DEPTH_BASE),pE=Wt(Xa,Xa.DEPTH),ty=ct(Xa,Xa.LINEAR_DEPTH),Iee=ty(fE());pE.assign=i=>DU(i);class Fee extends Mn{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const kee=ct(Fee);class Yo extends Mn{static get type(){return"ClippingNode"}constructor(e=Yo.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===Yo.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===Yo.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return je(()=>{const n=_e().toVar("distanceToPlane"),r=_e().toVar("distanceToGradient"),s=_e(1).toVar("clipOpacity"),a=t.length;if(this.hardwareClipping===!1&&a>0){const u=Sc(t);ki(a,({i:h})=>{const m=u.element(h);n.assign(Xr.dot(m.xyz).negate().add(m.w)),r.assign(n.fwidth().div(2)),s.mulAssign(kc(r.negate(),r,n))})}const l=e.length;if(l>0){const u=Sc(e),h=_e(1).toVar("intersectionClipOpacity");ki(l,({i:m})=>{const v=u.element(m);n.assign(Xr.dot(v.xyz).negate().add(v.w)),r.assign(n.fwidth().div(2)),h.mulAssign(kc(r.negate(),r,n).oneMinus())}),s.mulAssign(h.oneMinus())}Ui.a.mulAssign(s),Ui.a.equal(0).discard()})()}setupDefault(e,t){return je(()=>{const n=t.length;if(this.hardwareClipping===!1&&n>0){const s=Sc(t);ki(n,({i:a})=>{const l=s.element(a);Xr.dot(l.xyz).greaterThan(l.w).discard()})}const r=e.length;if(r>0){const s=Sc(e),a=Ic(!0).toVar("clipped");ki(r,({i:l})=>{const u=s.element(l);a.assign(Xr.dot(u.xyz).greaterThan(u.w).and(a))}),a.discard()}})()}setupHardwareClipping(e,t){const n=e.length;return t.enableHardwareClipping(n),je(()=>{const r=Sc(e),s=kee(t.getClipDistance());ki(n,({i:a})=>{const l=r.element(a),u=Xr.dot(l.xyz).sub(l.w).negate();s.element(a).assign(u)})})()}}Yo.ALPHA_TO_COVERAGE="alphaToCoverage";Yo.DEFAULT="default";Yo.HARDWARE="hardware";const zee=()=>_t(new Yo),Gee=()=>_t(new Yo(Yo.ALPHA_TO_COVERAGE)),qee=()=>_t(new Yo(Yo.HARDWARE)),Vee=.05,I6=je(([i])=>Hc(Wn(1e4,Mo(Wn(17,i.x).add(Wn(.1,i.y)))).mul(Qr(.1,ur(Mo(Wn(13,i.y).add(i.x))))))),F6=je(([i])=>I6(Ct(I6(i.xy),i.z))),Hee=je(([i])=>{const e=qr(Rc(XM(i.xyz)),Rc(YM(i.xyz))),t=_e(1).div(_e(Vee).mul(e)).toVar("pixScale"),n=Ct(O0(hu(cu(t))),O0(Iy(cu(t)))),r=Ct(F6(hu(n.x.mul(i.xyz))),F6(hu(n.y.mul(i.xyz)))),s=Hc(cu(t)),a=Qr(Wn(s.oneMinus(),r.x),Wn(s,r.y)),l=to(s,s.oneMinus()),u=Be(a.mul(a).div(Wn(2,l).mul(wi(1,l))),a.sub(Wn(.5,l)).div(wi(1,l)),wi(1,wi(1,a).mul(wi(1,a)).div(Wn(2,l).mul(wi(1,l))))),h=a.lessThan(l.oneMinus()).select(a.lessThan(l).select(u.x,u.y),u.z);return vu(h,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class Vr extends ua{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.positionNode=null,this.geometryNode=null,this.depthNode=null,this.shadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null}customProgramCacheKey(){return this.type+LP(this)}build(e){this.setup(e)}setupObserver(e){return new GZ(e)}setup(e){e.context.setupNormal=()=>this.setupNormal(e),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,n=t.getRenderTarget();e.addStack();const r=this.vertexNode||this.setupVertex(e);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 s;const a=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 l=this.setupLighting(e);a!==null&&e.stack.add(a);const u=dn(l,Ui.a).max(0);if(s=this.setupOutput(e,u),Eg.assign(s),this.outputNode!==null&&(s=this.outputNode),n!==null){const h=t.getMRT(),m=this.mrtNode;h!==null?(s=h,m!==null&&(s=h.merge(m))):m!==null&&(s=m)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=dn(l)),s=this.setupOutput(e,l)}e.stack.outputNode=s,e.addFlow("fragment",e.removeStack()),e.monitor=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{unionPlanes:t,intersectionPlanes:n}=e.clippingContext;let r=null;if(t.length>0||n.length>0){const s=e.renderer.samples;this.alphaToCoverage&&s>1?r=Gee():e.stack.add(zee())}return r}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(qee()),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:n}=e;let r=this.depthNode;if(r===null){const s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=dE(Xr.z,Dh,Ph):r=s0(Xr.z,Dh,Ph))}r!==null&&pE.assign(r).append()}setupPositionView(){return Q0.mul(Gr).xyz}setupModelViewProjection(){return _A.mul(Xr)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),uE}setupPosition(e){const{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&MU(t).append(),t.isSkinnedMesh===!0&&TU(t).append(),this.displacementMap){const r=Tc("displacementMap","texture"),s=Tc("displacementScale","float"),a=Tc("displacementBias","float");Gr.addAssign(no.normalize().mul(r.x.mul(s).add(a)))}return t.isBatchedMesh&&bU(t).append(),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&xU(t).append(),this.positionNode!==null&&Gr.assign(this.positionNode.context({isPositionNodeInput:!0})),Gr}setupDiffuseColor({object:e,geometry:t}){let n=this.colorNode?dn(this.colorNode):V9;this.vertexColors===!0&&t.hasAttribute("color")&&(n=dn(n.xyz.mul(_u("color","vec3")),n.a)),e.instanceColor&&(n=Sg("vec3","vInstanceColor").mul(n)),e.isBatchedMesh&&e._colorsTexture&&(n=Sg("vec3","vBatchColor").mul(n)),Ui.assign(n);const r=this.opacityNode?_e(this.opacityNode):oE;if(Ui.a.assign(Ui.a.mul(r)),this.alphaTestNode!==null||this.alphaTest>0){const s=this.alphaTestNode!==null?_e(this.alphaTestNode):q9;Ui.a.lessThanEqual(s).discard()}this.alphaHash===!0&&Ui.a.lessThan(Hee(Gr)).discard(),this.transparent===!1&&this.blending===Ka&&this.alphaToCoverage===!1&&Ui.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?Be(0):Ui.rgb}setupNormal(){return this.normalNode?Be(this.normalNode):Q9}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Tc("envMap","cubeTexture"):Tc("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new Cee(lE)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const r=this.setupLightMap(e);if(r&&r.isLightingNode&&t.push(r),this.aoNode!==null||e.material.aoMap){const a=this.aoNode!==null?this.aoNode:gU;t.push(new Mee(a))}let s=this.lightsNode||e.lightsNode;return t.length>0&&(s=e.renderer.lighting.createNode([...s.getLights(),...t])),s}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=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);u=EU(l,h,n,r)}else n!==null&&(u=Be(r!==null?Fi(u,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(qT.assign(Be(s||j9)),u=u.add(qT)),u}setupOutput(e,t){if(this.fog===!0){const n=e.fogNode;n&&(Eg.assign(t),t=dn(n))}return t}setDefaultValues(e){for(const n in e){const r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.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=ua.prototype.toJSON.call(this,e),r=$_(this);n.inputNodes={};for(const{property:a,childNode:l}of r)n.inputNodes[a]=l.toJSON(e).uuid;function s(a){const l=[];for(const u in a){const h=a[u];delete h.metadata,l.push(h)}return l}if(t){const a=s(e.textures),l=s(e.images),u=s(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.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.shadowPositionNode=e.shadowPositionNode,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 jee=new $0;class Wee extends Vr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(jee),this.setValues(e)}}const $ee=new Bz;class Xee extends Vr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues($ee),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?_e(this.offsetNode):pU,t=this.dashScaleNode?_e(this.dashScaleNode):fU,n=this.dashSizeNode?_e(this.dashSizeNode):AU,r=this.gapSizeNode?_e(this.gapSizeNode):dU;Qv.assign(n),VT.assign(r);const s=ro(_u("lineDistance").mul(t));(e?s.add(e):s).mod(Qv.add(VT)).greaterThan(Qv).discard()}}let Y3=null;class Yee extends $y{static get type(){return"ViewportSharedTextureNode"}constructor(e=bu,t=null){Y3===null&&(Y3=new W7),super(e,t,Y3)}updateReference(){return this}}const Qee=ct(Yee),PU=i=>_t(i).mul(.5).add(.5),Kee=i=>_t(i).mul(2).sub(1),Zee=new Dz;class Jee extends Vr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Zee),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?_e(this.opacityNode):oE;Ui.assign(dn(PU(zr),e))}}class ete extends Zr{static get type(){return"EquirectUVNode"}constructor(e=iE){super("vec2"),this.dirNode=e}setup(){const e=this.dirNode,t=e.z.atan(e.x).mul(1/(Math.PI*2)).add(.5),n=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return Ct(t,n)}}const mE=ct(ete);class LU extends H7{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,r=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 s=new $h(5,5,5),a=mE(iE),l=new Vr;l.colorNode=Ai(t,a,0),l.side=hr,l.blending=Qa;const u=new zi(s,l),h=new Yw;h.add(u),t.minFilter===Va&&(t.minFilter=gs);const m=new V7(1,10,this),v=e.getMRT();return e.setMRT(null),m.update(e,h),e.setMRT(v),t.minFilter=n,t.currentGenerateMipmaps=r,u.geometry.dispose(),u.material.dispose(),this}}const km=new WeakMap;class tte extends Zr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=I0();const t=new yy;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=jn.RENDER}updateBefore(e){const{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){const s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){const a=s.mapping;if(a===zh||a===Gh){if(km.has(s)){const l=km.get(s);k6(l,s.mapping),this._cubeTexture=l}else{const l=s.image;if(nte(l)){const u=new LU(l.height);u.fromEquirectangularTexture(t,s),k6(u.texture,s.mapping),this._cubeTexture=u.texture,km.set(s,u.texture),s.addEventListener("dispose",UU)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function nte(i){return i==null?!1:i.height>0}function UU(i){const e=i.target;e.removeEventListener("dispose",UU);const t=km.get(e);t!==void 0&&(km.delete(e),t.dispose())}function k6(i,e){e===zh?i.mapping=Qo:e===Gh&&(i.mapping=Ko)}const BU=ct(tte);class gE extends K0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=BU(this.envNode)}}class ite extends K0{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=_e(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class Xy{start(){}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class OU extends Xy{constructor(){super()}indirect(e,t,n){const r=e.ambientOcclusion,s=e.reflectedLight,a=n.context.irradianceLightMap;s.indirectDiffuse.assign(dn(0)),a?s.indirectDiffuse.addAssign(a):s.indirectDiffuse.addAssign(dn(1,1,1,0)),s.indirectDiffuse.mulAssign(r),s.indirectDiffuse.mulAssign(Ui.rgb)}finish(e,t,n){const r=n.material,s=e.outgoingLight,a=n.context.environment;if(a)switch(r.combine){case Lg:s.rgb.assign(Fi(s.rgb,s.rgb.mul(a.rgb),Fm.mul(Jv)));break;case C7:s.rgb.assign(Fi(s.rgb,a.rgb,Fm.mul(Jv)));break;case R7:s.rgb.addAssign(a.rgb.mul(Fm.mul(Jv)));break;default:console.warn("THREE.BasicLightingModel: Unsupported .combine value:",r.combine);break}}}const rte=new pA;class ste extends Vr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(rte),this.setValues(e)}setupNormal(){return Jo}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new gE(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new ite(lE)),t}setupOutgoingLight(){return Ui.rgb}setupLightingModel(){return new OU}}const F0=je(({f0:i,f90:e,dotVH:t})=>{const n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),AA=je(i=>i.diffuseColor.mul(1/Math.PI)),ate=()=>_e(.25),ote=je(({dotNH:i})=>Q_.mul(_e(.5)).add(1).mul(_e(1/Math.PI)).mul(i.pow(Q_))),lte=je(({lightDirection:i})=>{const e=i.add(dr).normalize(),t=zr.dot(e).clamp(),n=dr.dot(e).clamp(),r=F0({f0:ka,f90:1,dotVH:n}),s=ate(),a=ote({dotNH:t});return r.mul(s).mul(a)});class IU extends OU{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const s=zr.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(AA({diffuseColor:Ui.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(lte({lightDirection:e})).mul(Fm))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(AA({diffuseColor:Ui}))),n.indirectDiffuse.mulAssign(e)}}const ute=new Vc;class cte extends Vr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(ute),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new gE(t):null}setupLightingModel(){return new IU(!1)}}const hte=new iD;class fte extends Vr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(hte),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new gE(t):null}setupLightingModel(){return new IU}setupVariants(){const e=(this.shininessNode?_e(this.shininessNode):H9).max(1e-4);Q_.assign(e);const t=this.specularNode||W9;ka.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const FU=je(i=>{if(i.geometry.hasAttribute("normal")===!1)return _e(0);const e=Jo.dFdx().abs().max(Jo.dFdy().abs());return e.x.max(e.y).max(e.z)}),vE=je(i=>{const{roughness:e}=i,t=FU();let n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),kU=je(({alpha:i,dotNL:e,dotNV:t})=>{const n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return Dl(.5,r.add(s).max(wL))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),Ate=je(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:a,dotNL:l})=>{const u=l.mul(Be(i.mul(t),e.mul(n),a).length()),h=a.mul(Be(i.mul(r),e.mul(s),l).length());return Dl(.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"}]}),zU=je(({alpha:i,dotNH:e})=>{const t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),dte=_e(1/Math.PI),pte=je(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{const s=i.mul(e),a=Be(e.mul(n),i.mul(r),s.mul(t)),l=a.dot(a),u=s.div(l);return dte.mul(s.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"}]}),XT=je(i=>{const{lightDirection:e,f0:t,f90:n,roughness:r,f:s,USE_IRIDESCENCE:a,USE_ANISOTROPY:l}=i,u=i.normalView||zr,h=r.pow2(),m=e.add(dr).normalize(),v=u.dot(e).clamp(),x=u.dot(dr).clamp(),S=u.dot(m).clamp(),w=dr.dot(m).clamp();let R=F0({f0:t,f90:n,dotVH:w}),C,E;if(xg(a)&&(R=By.mix(R,s)),xg(l)){const B=Bm.dot(e),L=Bm.dot(dr),O=Bm.dot(m),G=iA.dot(e),q=iA.dot(dr),z=iA.dot(m);C=Ate({alphaT:Y_,alphaB:h,dotTV:L,dotBV:q,dotTL:B,dotBL:G,dotNV:x,dotNL:v}),E=pte({alphaT:Y_,alphaB:h,dotNH:S,dotTH:O,dotBH:z})}else C=kU({alpha:h,dotNL:v,dotNV:x}),E=zU({alpha:h,dotNH:S});return R.mul(C).mul(E)}),_E=je(({roughness:i,dotNV:e})=>{const t=dn(-1,-.0275,-.572,.022),n=dn(1,.0425,1.04,-.04),r=i.mul(t).add(n),s=r.x.mul(r.x).min(e.mul(-9.28).exp2()).mul(r.x).add(r.y);return Ct(-1.04,1.04).mul(s).add(r.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),GU=je(i=>{const{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=_E({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),qU=je(({f:i,f90:e,dotVH:t})=>{const n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(Be(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),mte=je(({roughness:i,dotNH:e})=>{const t=i.pow2(),n=_e(1).div(t),s=e.pow2().oneMinus().max(.0078125);return _e(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),gte=je(({dotNV:i,dotNL:e})=>_e(1).div(_e(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),vte=je(({lightDirection:i})=>{const e=i.add(dr).normalize(),t=zr.dot(i).clamp(),n=zr.dot(dr).clamp(),r=zr.dot(e).clamp(),s=mte({roughness:Uy,dotNH:r}),a=gte({dotNV:n,dotNL:t});return Xf.mul(s).mul(a)}),_te=je(({N:i,V:e,roughness:t})=>{const s=.0078125,a=i.dot(e).saturate(),l=Ct(t,a.oneMinus().sqrt());return l.assign(l.mul(.984375).add(s)),l}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),yte=je(({f:i})=>{const e=i.length();return qr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),lv=je(({v1:i,v2:e})=>{const t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),a=r.div(s),l=t.greaterThan(0).select(a,qr(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return i.cross(e).mul(l)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),z6=je(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:a,p3:l})=>{const u=s.sub(r).toVar(),h=l.sub(r).toVar(),m=u.cross(h),v=Be().toVar();return ti(m.dot(t.sub(r)).greaterThanEqual(0),()=>{const x=e.sub(i.mul(e.dot(i))).normalize(),S=i.cross(x).negate(),w=n.mul(ha(x,S,i).transpose()).toVar(),R=w.mul(r.sub(t)).normalize().toVar(),C=w.mul(s.sub(t)).normalize().toVar(),E=w.mul(a.sub(t)).normalize().toVar(),B=w.mul(l.sub(t)).normalize().toVar(),L=Be(0).toVar();L.addAssign(lv({v1:R,v2:C})),L.addAssign(lv({v1:C,v2:E})),L.addAssign(lv({v1:E,v2:B})),L.addAssign(lv({v1:B,v2:R})),v.assign(Be(yte({f:L})))}),v}).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"}]}),Yy=1/6,VU=i=>Wn(Yy,Wn(i,Wn(i,i.negate().add(3)).sub(3)).add(1)),YT=i=>Wn(Yy,Wn(i,Wn(i,Wn(3,i).sub(6))).add(4)),HU=i=>Wn(Yy,Wn(i,Wn(i,Wn(-3,i).add(3)).add(3)).add(1)),QT=i=>Wn(Yy,Cl(i,3)),G6=i=>VU(i).add(YT(i)),q6=i=>HU(i).add(QT(i)),V6=i=>Qr(-1,YT(i).div(VU(i).add(YT(i)))),H6=i=>Qr(1,QT(i).div(HU(i).add(QT(i)))),j6=(i,e,t)=>{const n=i.uvNode,r=Wn(n,e.zw).add(.5),s=hu(r),a=Hc(r),l=G6(a.x),u=q6(a.x),h=V6(a.x),m=H6(a.x),v=V6(a.y),x=H6(a.y),S=Ct(s.x.add(h),s.y.add(v)).sub(.5).mul(e.xy),w=Ct(s.x.add(m),s.y.add(v)).sub(.5).mul(e.xy),R=Ct(s.x.add(h),s.y.add(x)).sub(.5).mul(e.xy),C=Ct(s.x.add(m),s.y.add(x)).sub(.5).mul(e.xy),E=G6(a.y).mul(Qr(l.mul(i.sample(S).level(t)),u.mul(i.sample(w).level(t)))),B=q6(a.y).mul(Qr(l.mul(i.sample(R).level(t)),u.mul(i.sample(C).level(t))));return E.add(B)},jU=je(([i,e=_e(3)])=>{const t=Ct(i.size(Ee(e))),n=Ct(i.size(Ee(e.add(1)))),r=Dl(1,t),s=Dl(1,n),a=j6(i,dn(r,t),hu(e)),l=j6(i,dn(s,n),Iy(e));return Hc(e).mix(a,l)}),W6=je(([i,e,t,n,r])=>{const s=Be(JM(e.negate(),Fc(i),Dl(1,n))),a=Be(Rc(r[0].xyz),Rc(r[1].xyz),Rc(r[2].xyz));return Fc(s).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"}]}),xte=je(([i,e])=>i.mul(vu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),bte=hE(),Ste=hE(),$6=je(([i,e,t],{material:n})=>{const s=(n.side===hr?bte:Ste).sample(i),a=cu(Rg.x).mul(xte(e,t));return jU(s,a)}),X6=je(([i,e,t])=>(ti(t.notEqual(0),()=>{const n=Oy(e).negate().div(t);return jM(n.negate().mul(i))}),Be(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Tte=je(([i,e,t,n,r,s,a,l,u,h,m,v,x,S,w])=>{let R,C;if(w){R=dn().toVar(),C=Be().toVar();const G=m.sub(1).mul(w.mul(.025)),q=Be(m.sub(G),m,m.add(G));ki({start:0,end:3},({i:z})=>{const j=q.element(z),F=W6(i,e,v,j,l),V=a.add(F),Y=h.mul(u.mul(dn(V,1))),ee=Ct(Y.xy.div(Y.w)).toVar();ee.addAssign(1),ee.divAssign(2),ee.assign(Ct(ee.x,ee.y.oneMinus()));const te=$6(ee,t,j);R.element(z).assign(te.element(z)),R.a.addAssign(te.a),C.element(z).assign(n.element(z).mul(X6(Rc(F),x,S).element(z)))}),R.a.divAssign(3)}else{const G=W6(i,e,v,m,l),q=a.add(G),z=h.mul(u.mul(dn(q,1))),j=Ct(z.xy.div(z.w)).toVar();j.addAssign(1),j.divAssign(2),j.assign(Ct(j.x,j.y.oneMinus())),R=$6(j,t,m),C=n.mul(X6(Rc(G),x,S))}const E=C.rgb.mul(R.rgb),B=i.dot(e).clamp(),L=Be(GU({dotNV:B,specularColor:r,specularF90:s,roughness:t})),O=C.r.add(C.g,C.b).div(3);return dn(L.oneMinus().mul(E),R.a.oneMinus().mul(O).oneMinus())}),wte=ha(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Mte=i=>{const e=i.sqrt();return Be(1).add(e).div(Be(1).sub(e))},Y6=(i,e)=>i.sub(e).div(i.add(e)).pow2(),Ete=(i,e)=>{const t=i.mul(2*Math.PI*1e-9),n=Be(54856e-17,44201e-17,52481e-17),r=Be(1681e3,1795300,2208400),s=Be(43278e5,93046e5,66121e5),a=_e(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(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return l=Be(l.x.add(a),l.y,l.z).div(10685e-11),wte.mul(l)},Cte=je(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{const s=Fi(i,e,kc(0,.03,n)),l=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();ti(l.lessThan(0),()=>Be(1));const u=l.sqrt(),h=Y6(s,i),m=F0({f0:h,f90:1,dotVH:t}),v=m.oneMinus(),x=s.lessThan(i).select(Math.PI,0),S=_e(Math.PI).sub(x),w=Mte(r.clamp(0,.9999)),R=Y6(w,s.toVec3()),C=F0({f0:R,f90:1,dotVH:u}),E=Be(w.x.lessThan(s).select(Math.PI,0),w.y.lessThan(s).select(Math.PI,0),w.z.lessThan(s).select(Math.PI,0)),B=s.mul(n,u,2),L=Be(S).add(E),O=m.mul(C).clamp(1e-5,.9999),G=O.sqrt(),q=v.pow2().mul(C).div(Be(1).sub(O)),j=m.add(q).toVar(),F=q.sub(v).toVar();return ki({start:1,end:2,condition:"<=",name:"m"},({m:V})=>{F.mulAssign(G);const Y=Ete(_e(V).mul(B),_e(V).mul(L)).mul(2);j.addAssign(F.mul(Y))}),j.max(Be(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"}]}),Rte=je(({normal:i,viewDir:e,roughness:t})=>{const n=i.dot(e).saturate(),r=t.pow2(),s=zs(t.lessThan(.25),_e(-339.2).mul(r).add(_e(161.4).mul(t)).sub(25.9),_e(-8.48).mul(r).add(_e(14.3).mul(t)).sub(9.95)),a=zs(t.lessThan(.25),_e(44).mul(r).sub(_e(23.7).mul(t)).add(3.26),_e(1.97).mul(r).sub(_e(3.27).mul(t)).add(.72));return zs(t.lessThan(.25),0,_e(.1).mul(t).sub(.025)).add(s.mul(n).add(a).exp()).mul(1/Math.PI).saturate()}),Q3=Be(.04),K3=_e(1);class WU extends Xy{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,a=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,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=Be().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=Be().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=Be().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=Be().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=Be().toVar("sheenSpecularIndirect")),this.iridescence===!0){const t=zr.dot(dr).clamp();this.iridescenceFresnel=Cte({outsideIOR:_e(1),eta2:OM,cosTheta1:t,thinFilmThickness:IM,baseF0:ka}),this.iridescenceF0=qU({f:this.iridescenceFresnel,f90:1,dotVH:t})}if(this.transmission===!0){const t=Nc,n=S9.sub(Nc).normalize(),r=Hy;e.backdrop=Tte(r,n,Zl,Ui,ka,Mg,t,$o,so,_A,Om,FM,zM,kM,this.dispersion?GM:null),e.backdropAlpha=K_,Ui.a.mulAssign(Fi(1,e.backdrop.a,K_))}}computeMultiscattering(e,t,n){const r=zr.dot(dr).clamp(),s=_E({roughness:Zl,dotNV:r}),l=(this.iridescenceF0?By.mix(ka,this.iridescenceF0):ka).mul(s.x).add(n.mul(s.y)),h=s.x.add(s.y).oneMinus(),m=ka.add(ka.oneMinus().mul(.047619)),v=l.mul(m).div(h.mul(m).oneMinus());e.addAssign(l),t.addAssign(v.mul(h))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const s=zr.dot(e).clamp().mul(t);if(this.sheen===!0&&this.sheenSpecularDirect.addAssign(s.mul(vte({lightDirection:e}))),this.clearcoat===!0){const l=Qd.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(l.mul(XT({lightDirection:e,f0:Q3,f90:K3,roughness:wg,normalView:Qd})))}n.directDiffuse.addAssign(s.mul(AA({diffuseColor:Ui.rgb}))),n.directSpecular.addAssign(s.mul(XT({lightDirection:e,f0:ka,f90:1,roughness:Zl,iridescence:this.iridescence,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:a,ltc_2:l}){const u=t.add(n).sub(r),h=t.sub(n).sub(r),m=t.sub(n).add(r),v=t.add(n).add(r),x=zr,S=dr,w=Xr.toVar(),R=_te({N:x,V:S,roughness:Zl}),C=a.sample(R).toVar(),E=l.sample(R).toVar(),B=ha(Be(C.x,0,C.y),Be(0,1,0),Be(C.z,0,C.w)).toVar(),L=ka.mul(E.x).add(ka.oneMinus().mul(E.y)).toVar();s.directSpecular.addAssign(e.mul(L).mul(z6({N:x,V:S,P:w,mInv:B,p0:u,p1:h,p2:m,p3:v}))),s.directDiffuse.addAssign(e.mul(Ui).mul(z6({N:x,V:S,P:w,mInv:ha(1,0,0,0,1,0,0,0,1),p0:u,p1:h,p2:m,p3:v})))}indirect(e,t,n){this.indirectDiffuse(e,t,n),this.indirectSpecular(e,t,n),this.ambientOcclusion(e,t,n)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.addAssign(e.mul(AA({diffuseColor:Ui})))}indirectSpecular({radiance:e,iblIrradiance:t,reflectedLight:n}){if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(t.mul(Xf,Rte({normal:zr,viewDir:dr,roughness:Uy}))),this.clearcoat===!0){const h=Qd.dot(dr).clamp(),m=GU({dotNV:h,specularColor:Q3,specularF90:K3,roughness:wg});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(m))}const r=Be().toVar("singleScattering"),s=Be().toVar("multiScattering"),a=t.mul(1/Math.PI);this.computeMultiscattering(r,s,Mg);const l=r.add(s),u=Ui.mul(l.r.max(l.g).max(l.b).oneMinus());n.indirectSpecular.addAssign(e.mul(r)),n.indirectSpecular.addAssign(s.mul(a)),n.indirectDiffuse.addAssign(u.mul(a))}ambientOcclusion({ambientOcclusion:e,reflectedLight:t}){const r=zr.dot(dr).clamp().add(e),s=Zl.mul(-16).oneMinus().negate().exp2(),a=e.sub(r.pow(s).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(e),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(e),t.indirectDiffuse.mulAssign(e),t.indirectSpecular.mulAssign(a)}finish(e){const{outgoingLight:t}=e;if(this.clearcoat===!0){const n=Qd.dot(dr).clamp(),r=F0({dotVH:n,f0:Q3,f90:K3}),s=t.mul(X_.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(X_));t.assign(s)}if(this.sheen===!0){const n=Xf.r.max(Xf.g).max(Xf.b).mul(.157).oneMinus(),r=t.mul(n).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(r)}}}const Q6=_e(1),KT=_e(-2),uv=_e(.8),Z3=_e(-1),cv=_e(.4),J3=_e(2),hv=_e(.305),eS=_e(3),K6=_e(.21),Nte=_e(4),Z6=_e(4),Dte=_e(16),Pte=je(([i])=>{const e=Be(ur(i)).toVar(),t=_e(-1).toVar();return ti(e.x.greaterThan(e.z),()=>{ti(e.x.greaterThan(e.y),()=>{t.assign(zs(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(zs(i.y.greaterThan(0),1,4))})}).Else(()=>{ti(e.z.greaterThan(e.y),()=>{t.assign(zs(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(zs(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),Lte=je(([i,e])=>{const t=Ct().toVar();return ti(e.equal(0),()=>{t.assign(Ct(i.z,i.y).div(ur(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(Ct(i.x.negate(),i.z.negate()).div(ur(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(Ct(i.x.negate(),i.y).div(ur(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(Ct(i.z.negate(),i.y).div(ur(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(Ct(i.x.negate(),i.z).div(ur(i.y)))}).Else(()=>{t.assign(Ct(i.x,i.y).div(ur(i.z)))}),Wn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),Ute=je(([i])=>{const e=_e(0).toVar();return ti(i.greaterThanEqual(uv),()=>{e.assign(Q6.sub(i).mul(Z3.sub(KT)).div(Q6.sub(uv)).add(KT))}).ElseIf(i.greaterThanEqual(cv),()=>{e.assign(uv.sub(i).mul(J3.sub(Z3)).div(uv.sub(cv)).add(Z3))}).ElseIf(i.greaterThanEqual(hv),()=>{e.assign(cv.sub(i).mul(eS.sub(J3)).div(cv.sub(hv)).add(J3))}).ElseIf(i.greaterThanEqual(K6),()=>{e.assign(hv.sub(i).mul(Nte.sub(eS)).div(hv.sub(K6)).add(eS))}).Else(()=>{e.assign(_e(-2).mul(cu(Wn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),$U=je(([i,e])=>{const t=i.toVar();t.assign(Wn(2,t).sub(1));const n=Be(t,1).toVar();return ti(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)}).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"}]}),XU=je(([i,e,t,n,r,s])=>{const a=_e(t),l=Be(e),u=vu(Ute(a),KT,s),h=Hc(u),m=hu(u),v=Be(ZT(i,l,m,n,r,s)).toVar();return ti(h.notEqual(0),()=>{const x=Be(ZT(i,l,m.add(1),n,r,s)).toVar();v.assign(Fi(v,x,h))}),v}),ZT=je(([i,e,t,n,r,s])=>{const a=_e(t).toVar(),l=Be(e),u=_e(Pte(l)).toVar(),h=_e(qr(Z6.sub(a),0)).toVar();a.assign(qr(a,Z6));const m=_e(O0(a)).toVar(),v=Ct(Lte(l,u).mul(m.sub(2)).add(1)).toVar();return ti(u.greaterThan(2),()=>{v.y.addAssign(m),u.subAssign(3)}),v.x.addAssign(u.mul(m)),v.x.addAssign(h.mul(Wn(3,Dte))),v.y.addAssign(Wn(4,O0(s).sub(m))),v.x.mulAssign(n),v.y.mulAssign(r),i.sample(v).grad(Ct(),Ct())}),tS=je(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l})=>{const u=yc(n),h=t.mul(u).add(r.cross(t).mul(Mo(n))).add(r.mul(r.dot(t).mul(u.oneMinus())));return ZT(i,h,e,s,a,l)}),YU=je(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:a,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:m,CUBEUV_MAX_MIP:v})=>{const x=Be(zs(e,t,ky(t,n))).toVar();ti(HM(x.equals(Be(0))),()=>{x.assign(Be(n.z,0,n.x.negate()))}),x.assign(Fc(x));const S=Be().toVar();return S.addAssign(r.element(Ee(0)).mul(tS({theta:0,axis:x,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:m,CUBEUV_MAX_MIP:v}))),ki({start:Ee(1),end:i},({i:w})=>{ti(w.greaterThanEqual(s),()=>{wU()});const R=_e(a.mul(_e(w))).toVar();S.addAssign(r.element(w).mul(tS({theta:R.mul(-1),axis:x,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:m,CUBEUV_MAX_MIP:v}))),S.addAssign(r.element(w).mul(tS({theta:R,axis:x,outputDirection:n,mipInt:l,envMap:u,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:m,CUBEUV_MAX_MIP:v})))}),dn(S,1)});let ny=null;const J6=new WeakMap;function Bte(i){const e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function Ote(i){let e=J6.get(i);if((e!==void 0?e.pmremVersion:-1)!==i.pmremVersion){const n=i.image;if(i.isCubeTexture)if(Fte(n))e=ny.fromCubemap(i,e);else return null;else if(kte(n))e=ny.fromEquirectangular(i,e);else return null;e.pmremVersion=i.pmremVersion,J6.set(i,e)}return e.texture}class Ite extends Zr{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 r=new vs;r.isRenderTargetTexture=!0,this._texture=Ai(r),this._width=gn(0),this._height=gn(0),this._maxMip=gn(0),this.updateBeforeType=jn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=Bte(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(){let e=this._pmrem;const t=e?e.pmremVersion:-1,n=this._value;t!==n.pmremVersion&&(n.isPMREMTexture===!0?e=n:e=Ote(n),e!==null&&(this._pmrem=e,this.updateFromTexture(e)))}setup(e){ny===null&&(ny=e.createPMREMGenerator()),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this));const n=this.value;e.renderer.coordinateSystem===Ha&&n.isPMREMTexture!==!0&&n.isRenderTargetTexture===!0&&(t=Be(t.x.negate(),t.yz)),t=Be(t.x,t.y.negate(),t.z);let r=this.levelNode;return r===null&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),XU(this._texture,t,r,this._width,this._height,this._maxMip)}}function Fte(i){if(i==null)return!1;let e=0;const t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function kte(i){return i==null?!1:i.height>0}const yE=ct(Ite),eN=new WeakMap;class zte extends K0{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 S=n.isTextureNode?n.value:t[n.property];let w=eN.get(S);w===void 0&&(w=yE(S),eN.set(S,w)),n=w}const s=t.envMap?ji("envMapIntensity","float",e.material):ji("environmentIntensity","float",e.scene),l=t.useAnisotropy===!0||t.anisotropy>0?z9:zr,u=n.context(tN(Zl,l)).mul(s),h=n.context(Gte(Hy)).mul(Math.PI).mul(s),m=Im(u),v=Im(h);e.context.radiance.addAssign(m),e.context.iblIrradiance.addAssign(v);const x=e.context.lightingModel.clearcoatRadiance;if(x){const S=n.context(tN(wg,Qd)).mul(s),w=Im(S);x.addAssign(w)}}}const tN=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=dr.negate().reflect(e),t=i.mul(i).mix(t,e).normalize(),t=t.transformDirection(so)),t),getTextureLevel:()=>i}},Gte=i=>({getUV:()=>i,getTextureLevel:()=>_e(1)}),qte=new nD;class QU extends Vr{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(qte),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new zte(t):null}setupLightingModel(){return new WU}setupSpecular(){const e=Fi(Be(.04),Ui.rgb,Tg);ka.assign(e),Mg.assign(1)}setupVariants(){const e=this.metalnessNode?_e(this.metalnessNode):Y9;Tg.assign(e);let t=this.roughnessNode?_e(this.roughnessNode):X9;t=vE({roughness:t}),Zl.assign(t),this.setupSpecular(),Ui.assign(dn(Ui.rgb.mul(e.oneMinus()),Ui.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const Vte=new Rz;class Hte extends QU{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(Vte),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?_e(this.iorNode):uU;Om.assign(e),ka.assign(Fi(to(ZM(Om.sub(1).div(Om.add(1))).mul($9),Be(1)).mul($T),Ui.rgb,Tg)),Mg.assign(Fi($T,1,Tg))}setupLightingModel(){return new WU(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const t=this.clearcoatNode?_e(this.clearcoatNode):K9,n=this.clearcoatRoughnessNode?_e(this.clearcoatRoughnessNode):Z9;X_.assign(t),wg.assign(vE({roughness:n}))}if(this.useSheen){const t=this.sheenNode?Be(this.sheenNode):tU,n=this.sheenRoughnessNode?_e(this.sheenRoughnessNode):nU;Xf.assign(t),Uy.assign(n)}if(this.useIridescence){const t=this.iridescenceNode?_e(this.iridescenceNode):rU,n=this.iridescenceIORNode?_e(this.iridescenceIORNode):sU,r=this.iridescenceThicknessNode?_e(this.iridescenceThicknessNode):aU;By.assign(t),OM.assign(n),IM.assign(r)}if(this.useAnisotropy){const t=(this.anisotropyNode?Ct(this.anisotropyNode):iU).toVar();Rh.assign(t.length()),ti(Rh.equal(0),()=>{t.assign(Ct(1,0))}).Else(()=>{t.divAssign(Ct(Rh)),Rh.assign(Rh.saturate())}),Y_.assign(Rh.pow2().mix(Zl.pow2(),1)),Bm.assign(Yf[0].mul(t.x).add(Yf[1].mul(t.y))),iA.assign(Yf[1].mul(t.x).sub(Yf[0].mul(t.y)))}if(this.useTransmission){const t=this.transmissionNode?_e(this.transmissionNode):oU,n=this.thicknessNode?_e(this.thicknessNode):lU,r=this.attenuationDistanceNode?_e(this.attenuationDistanceNode):cU,s=this.attenuationColorNode?Be(this.attenuationColorNode):hU;if(K_.assign(t),FM.assign(n),kM.assign(r),zM.assign(s),this.useDispersion){const a=this.dispersionNode?_e(this.dispersionNode):mU;GM.assign(a)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?Be(this.clearcoatNormalNode):J9}setup(e){e.context.setupClearcoatNormal=()=>this.setupClearcoatNormal(e),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.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}const jte=je(({normal:i,lightDirection:e,builder:t})=>{const n=i.dot(e),r=Ct(n.mul(.5).add(.5),0);if(t.material.gradientMap){const s=Tc("gradientMap","texture").context({getUV:()=>r});return Be(s.r)}else{const s=r.fwidth().mul(.5);return Fi(Be(.7),Be(1),kc(_e(.7).sub(s.x),_e(.7).add(s.x),r.x))}});class Wte extends Xy{direct({lightDirection:e,lightColor:t,reflectedLight:n},r,s){const a=jte({normal:qy,lightDirection:e,builder:s}).mul(t);n.directDiffuse.addAssign(a.mul(AA({diffuseColor:Ui.rgb})))}indirect({ambientOcclusion:e,irradiance:t,reflectedLight:n}){n.indirectDiffuse.addAssign(t.mul(AA({diffuseColor:Ui}))),n.indirectDiffuse.mulAssign(e)}}const $te=new Nz;class Xte extends Vr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues($te),this.setValues(e)}setupLightingModel(){return new Wte}}class Yte extends Zr{static get type(){return"MatcapUVNode"}constructor(){super("vec2")}setup(){const e=Be(dr.z,0,dr.x.negate()).normalize(),t=dr.cross(e);return Ct(e.dot(zr),t.dot(zr)).mul(.495).add(.5)}}const KU=Wt(Yte),Qte=new Uz;class Kte extends Vr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(Qte),this.setValues(e)}setupVariants(e){const t=KU;let n;e.material.matcap?n=Tc("matcap","texture").context({getUV:()=>t}):n=Be(Fi(.2,.8,t.y)),Ui.rgb.mulAssign(n.rgb)}}const Zte=new Kw;class Jte extends Vr{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.isPointsNodeMaterial=!0,this.setDefaultValues(Zte),this.setValues(e)}}class ene extends Zr{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 s=t.cos(),a=t.sin();return Ly(s,a,a.negate(),s).mul(n)}else{const s=t,a=nA(dn(1,0,0,0),dn(0,yc(s.x),Mo(s.x).negate(),0),dn(0,Mo(s.x),yc(s.x),0),dn(0,0,0,1)),l=nA(dn(yc(s.y),0,Mo(s.y),0),dn(0,1,0,0),dn(Mo(s.y).negate(),0,yc(s.y),0),dn(0,0,0,1)),u=nA(dn(yc(s.z),Mo(s.z).negate(),0,0),dn(Mo(s.z),yc(s.z),0,0),dn(0,0,1,0),dn(0,0,0,1));return a.mul(l).mul(u).mul(dn(n,1)).xyz}}}const xE=ct(ene),tne=new Wk;class nne extends Vr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.setDefaultValues(tne),this.setValues(e)}setupPositionView(e){const{object:t,camera:n}=e,r=this.sizeAttenuation,{positionNode:s,rotationNode:a,scaleNode:l}=this,u=Q0.mul(Be(s||0));let h=Ct($o[0].xyz.length(),$o[1].xyz.length());if(l!==null&&(h=h.mul(l)),r===!1)if(n.isPerspectiveCamera)h=h.mul(u.z.negate());else{const S=_e(2).div(_A.element(1).element(1));h=h.mul(S.mul(2))}let m=Gy.xy;if(t.center&&t.center.isVector2===!0){const S=bJ("center","vec2",t);m=m.sub(S.sub(.5))}m=m.mul(h);const v=_e(a||eU),x=xE(m,v);return dn(u.xy.add(x),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)}}class ine extends Xy{constructor(){super(),this.shadowNode=_e(1).toVar("shadowMask")}direct({shadowMask:e}){this.shadowNode.mulAssign(e)}finish(e){Ui.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Ui.rgb)}}const rne=new Cz;class sne extends Vr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.setDefaultValues(rne),this.setValues(e)}setupLightingModel(){return new ine}}const ane=je(({texture:i,uv:e})=>{const n=Be().toVar();return ti(e.x.lessThan(1e-4),()=>{n.assign(Be(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(Be(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(Be(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(Be(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(Be(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(Be(0,0,-1))}).Else(()=>{const s=i.sample(e.add(Be(-.01,0,0))).r.sub(i.sample(e.add(Be(.01,0,0))).r),a=i.sample(e.add(Be(0,-.01,0))).r.sub(i.sample(e.add(Be(0,.01,0))).r),l=i.sample(e.add(Be(0,0,-.01))).r.sub(i.sample(e.add(Be(0,0,.01))).r);n.assign(Be(s,a,l))}),n.normalize()});class one extends yu{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return Be(.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(Ee(Fh(this,this.levelNode).y).sub(t.y).sub(1))),t}generateUV(e,t){return t.build(e,"vec3")}normal(e){return ane({texture:this,uv:e})}}const lne=ct(one);class une{constructor(e,t){this.nodes=e,this.info=t,this._context=self,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(),this.info.frame=this.nodes.nodeFrame.frameId,this._animationLoop!==null&&this._animationLoop(t,n)};e()}stop(){this._context.cancelAnimationFrame(this._requestId),this._requestId=null}setAnimationLoop(e){this._animationLoop=e}setContext(e){this._context=e}dispose(){this.stop()}}class Su{constructor(){this.weakMap=new WeakMap}get(e){let t=this.weakMap;for(let n=0;n<e.length;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 r=0;r<e.length;r++){const s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this.weakMap;for(let n=0;n<e.length;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}}let cne=0;function hne(i){const e=Object.keys(i);let t=Object.getPrototypeOf(i);for(;t;){const n=Object.getOwnPropertyDescriptors(t);for(const r in n)if(n[r]!==void 0){const s=n[r];s&&typeof s.get=="function"&&e.push(r)}t=Object.getPrototypeOf(t)}return e}class fne{constructor(e,t,n,r,s,a,l,u,h,m){this.id=cne++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=a,this.camera=l,this.lightsNode=u,this.context=h,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.pipeline=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=m,this.clippingContextCacheKey=m!==null?m.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.material.addEventListener("dispose",this.onMaterialDispose)}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().monitor)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}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}getAttributes(){if(this.attributes!==null)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set;for(const s of e){const a=s.node&&s.node.attribute?s.node.attribute:t.getAttribute(s.name);if(a===void 0)continue;n.push(a);const l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:n,group:r,drawRange:s}=this,a=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),l=this.getIndex(),u=l!==null,h=n.isInstancedBufferGeometry?n.instanceCount:e.count>1?e.count:1;if(h===0)return null;if(a.instanceCount=h,e.isBatchedMesh===!0)return a;let m=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(m=2);let v=s.start*m,x=(s.start+s.count)*m;r!==null&&(v=Math.max(v,r.start*m),x=Math.min(x,(r.start+r.count)*m));const S=n.attributes.position;let w=1/0;u?w=l.count:S!=null&&(w=S.count),v=Math.max(v,0),x=Math.min(x,w);const R=x-v;return R<0||R===1/0?null:(a.vertexCount=R,a.firstVertex=v,a)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const n of Object.keys(e.attributes).sort()){const r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}return e.index&&(t+="index,"),t}getMaterialCacheKey(){const{object:e,material:t}=this;let n=t.customProgramCacheKey();for(const r of hne(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(r))continue;const s=t[r];let a;if(s!==null){const l=typeof s;l==="number"?a=s!==0?"1":"0":l==="object"?(a="{",s.isTexture&&(a+=s.mapping),a+="}"):a=String(s)}else a=String(s);n+=a+","}return n+=this.clippingContextCacheKey+",",e.geometry&&(n+=this.getGeometryCacheKey()),e.skeleton&&(n+=e.skeleton.bones.length+","),e.morphTargetInfluences&&(n+=e.morphTargetInfluences.length+","),e.isBatchedMesh&&(n+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(n+=e._colorsTexture.uuid+",")),e.count>1&&(n+=e.uuid+","),n+=e.receiveShadow+",",PP(n)}get needsGeometryUpdate(){return this.geometry.id!==this.object.geometry.id}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=this._nodes.getCacheKey(this.scene,this.lightsNode);return this.object.receiveShadow&&(e+=1),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}}const Ed=[];class Ane{constructor(e,t,n,r,s,a){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=a,this.chainMaps={}}get(e,t,n,r,s,a,l,u){const h=this.getChainMap(u);Ed[0]=e,Ed[1]=t,Ed[2]=a,Ed[3]=s;let m=h.get(Ed);return m===void 0?(m=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,a,l,u),h.set(Ed,m)):(m.updateClipping(l),m.needsGeometryUpdate&&m.setGeometry(e.geometry),(m.version!==t.version||m.needsUpdate)&&(m.initialCacheKey!==m.getCacheKey()?(m.dispose(),m=this.get(e,t,n,r,s,a,l,u)):m.version=t.version)),m}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Su)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,a,l,u,h,m,v){const x=this.getChainMap(v),S=new fne(e,t,n,r,s,a,l,u,h,m);return S.onDispose=()=>{this.pipelines.delete(S),this.bindings.delete(S),this.nodes.delete(S),x.delete(S.getChainArray())},S}}class Yh{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 iu={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},Lh=16,dne=211,pne=212;class mne extends Yh{constructor(e){super(),this.backend=e}delete(e){const t=super.delete(e);return t!==void 0&&this.backend.destroyAttribute(e),t}update(e,t){const n=this.get(e);if(n.version===void 0)t===iu.VERTEX?this.backend.createAttribute(e):t===iu.INDEX?this.backend.createIndexAttribute(e):t===iu.STORAGE?this.backend.createStorageAttribute(e):t===iu.INDIRECT&&this.backend.createIndirectStorageAttribute(e),n.version=this._getBufferAttribute(e).version;else{const r=this._getBufferAttribute(e);(n.version<r.version||r.usage===qd)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}function gne(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function ZU(i){return i.index!==null?i.index.version:i.attributes.position.version}function nN(i){const e=[],t=i.index,n=i.attributes.position;if(t!==null){const s=t.array;for(let a=0,l=s.length;a<l;a+=3){const u=s[a+0],h=s[a+1],m=s[a+2];e.push(u,h,h,m,m,u)}}else{const s=n.array;for(let a=0,l=s.length/3-1;a<l;a+=3){const u=a+0,h=a+1,m=a+2;e.push(u,h,h,m,m,u)}}const r=new(gne(e)?Xw:$w)(e,1);return r.version=ZU(i),r}class vne extends Yh{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 r=()=>{this.info.memory.geometries--;const s=t.index,a=e.getAttributes();s!==null&&this.attributes.delete(s);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",r)};t.addEventListener("dispose",r)}updateAttributes(e){const t=e.getAttributes();for(const s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,iu.STORAGE):this.updateAttribute(s,iu.VERTEX);const n=this.getIndex(e);n!==null&&this.updateAttribute(n,iu.INDEX);const r=e.geometry.indirect;r!==null&&this.updateAttribute(r,iu.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 r=t.index;if(n.wireframe===!0){const s=this.wireframes;let a=s.get(t);a===void 0?(a=nN(t),s.set(t,a)):a.version!==ZU(t)&&(this.attributes.delete(a),a=nN(t),s.set(t,a)),r=a}return r}}class _ne{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,previousFrameCalls:0,timestampCalls:0},this.compute={calls:0,frameCalls:0,timestamp:0,previousFrameCalls:0,timestampCalls: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.")}updateTimestamp(e,t){this[e].timestampCalls===0&&(this[e].timestamp=0),this[e].timestamp+=t,this[e].timestampCalls++,this[e].timestampCalls>=this[e].previousFrameCalls&&(this[e].timestampCalls=0)}reset(){const e=this.render.frameCalls;this.render.previousFrameCalls=e;const t=this.compute.frameCalls;this.compute.previousFrameCalls=t,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 JU{constructor(e){this.cacheKey=e,this.usedTimes=0}}class yne extends JU{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}}class xne extends JU{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let bne=0;class nS{constructor(e,t,n,r=null,s=null){this.id=bne++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}}class Sne extends Yh{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,r=this.get(e);if(this._needsComputeUpdate(e)){const s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);const a=this.nodes.getForCompute(e);let l=this.programs.compute.get(a.computeShader);l===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),l=new nS(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&&(s&&s.usedTimes===0&&this._releasePipeline(s),h=this._getComputePipeline(e,l,u,t)),h.usedTimes++,l.usedTimes++,r.version=e.version,r.pipeline=h}return r.pipeline}getForRender(e,t=null){const{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){const s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);const a=e.getNodeBuilderState(),l=e.material?e.material.name:"";let u=this.programs.vertex.get(a.vertexShader);u===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),u=new nS(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&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),h=new nS(a.fragmentShader,"fragment",l),this.programs.fragment.set(a.fragmentShader,h),n.createProgram(h));const m=this._getRenderCacheKey(e,u,h);let v=this.caches.get(m);v===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),v=this._getRenderPipeline(e,u,h,m,t)):e.pipeline=v,v.usedTimes++,u.usedTimes++,h.usedTimes++,r.pipeline=v}return r.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,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new xne(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let a=this.caches.get(r);return a===void 0&&(a=new yne(r,t,n),this.caches.set(r,a),e.pipeline=a,this.backend.createRenderPipeline(e,s)),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 Tne extends Yh{constructor(e,t,n,r,s,a){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=a,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const n of t){const r=this.get(n);r.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),r.bindGroup=n)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const n of t){const r=this.get(n);r.bindGroup===void 0&&(this._init(n),this.backend.createBindings(n,t,0),r.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,r=n.isIndirectStorageBufferAttribute?iu.INDIRECT:iu.STORAGE;this.attributes.update(n,r)}}_update(e,t){const{backend:n}=this;let r=!1,s=!0,a=0,l=0;for(const u of e.bindings)if(!(u.isNodeUniformsGroup&&this.nodes.updateGroup(u)===!1)){if(u.isUniformBuffer)u.update()&&n.updateBinding(u);else if(u.isSampler)u.update();else if(u.isSampledTexture){const h=this.textures.get(u.texture);u.needsBindingsUpdate(h.generation)&&(r=!0);const m=u.update(),v=u.texture;m&&this.textures.updateTexture(v);const x=n.get(v);if(x.externalTexture!==void 0||h.isDefaultTexture?s=!1:(a=a*10+v.id,l+=v.version),n.isWebGPUBackend===!0&&x.texture===void 0&&x.externalTexture===void 0&&(console.error("Bindings._update: binding should be available:",u,m,v,u.textureNode.value,r),this.textures.updateTexture(v),r=!0),v.isStorageTexture===!0){const S=this.get(v);u.store===!0?S.needsMipmap=!0:this.textures.needsMipmaps(v)&&S.needsMipmap===!0&&(this.backend.generateMipmaps(v),S.needsMipmap=!1)}}}r===!0&&this.backend.updateBindings(e,t,s?a:0,l)}}function wne(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function iN(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function rN(i){return(i.transmission>0||i.transmissionNode)&&i.side===as&&i.forceSinglePass===!1}class Mne{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,r,s,a,l){let u=this.renderItems[this.renderItemsIndex];return u===void 0?(u={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:a,clippingContext:l},this.renderItems[this.renderItemsIndex]=u):(u.id=e.id,u.object=e,u.geometry=t,u.material=n,u.groupOrder=r,u.renderOrder=e.renderOrder,u.z=s,u.group=a,u.clippingContext=l),this.renderItemsIndex++,u}push(e,t,n,r,s,a,l){const u=this.getNextRenderItem(e,t,n,r,s,a,l);e.occlusionTest===!0&&this.occlusionQueryCount++,n.transparent===!0||n.transmission>0?(rN(n)&&this.transparentDoublePass.push(u),this.transparent.push(u)):this.opaque.push(u)}unshift(e,t,n,r,s,a,l){const u=this.getNextRenderItem(e,t,n,r,s,a,l);n.transparent===!0||n.transmission>0?(rN(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||wne),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||iN),this.transparent.length>1&&this.transparent.sort(t||iN)}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}}}class Ene{constructor(e){this.lighting=e,this.lists=new Su}get(e,t){const n=this.lists,r=[e,t];let s=n.get(r);return s===void 0&&(s=new Mne(this.lighting,e,t),n.set(r,s)),s}dispose(){this.lists=new Su}}let Cne=0;class Rne{constructor(){this.id=Cne++,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 Ln,this.scissor=!1,this.scissorValue=new Ln,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.sampleCount=1,this.width=0,this.height=0,this.isRenderContext=!0}getCacheKey(){return eB(this)}}function eB(i){const{textures:e,activeCubeFace:t}=i,n=[t];for(const r of e)n.push(r.id);return Ny(n)}class Nne{constructor(){this.chainMaps={}}get(e=null,t=null,n=null){const r=[];e!==null&&r.push(e),t!==null&&r.push(t),r.length===0&&r.push({id:"default"});let s;if(n===null)s="default";else{const u=n.texture.format;s=`${n.textures.length}:${u}:${n.samples}:${n.depthBuffer}:${n.stencilBuffer}`}const a=this.getChainMap(s);let l=a.get(r);return l===void 0&&(l=new Rne,a.set(r,l)),n!==null&&(l.sampleCount=n.samples===0?1:n.samples),l}getChainMap(e){return this.chainMaps[e]||(this.chainMaps[e]=new Su)}dispose(){this.chainMaps={}}}const Dne=new he;class Pne extends Yh{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n}updateRenderTarget(e,t=0){const n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),a=e.textures,l=this.getSize(a[0]),u=l.width>>t,h=l.height>>t;let m=e.depthTexture||s[t];const v=e.depthBuffer===!0||e.stencilBuffer===!0;let x=!1;m===void 0&&v&&(m=new qc,m.format=e.stencilBuffer?du:au,m.type=e.stencilBuffer?Au:Rr,m.image.width=u,m.image.height=h,s[t]=m),(n.width!==l.width||l.height!==n.height)&&(x=!0,m&&(m.needsUpdate=!0,m.image.width=u,m.image.height=h)),n.width=l.width,n.height=l.height,n.textures=a,n.depthTexture=m||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(x=!0,m&&(m.needsUpdate=!0),n.sampleCount=r);const S={sampleCount:r};for(let w=0;w<a.length;w++){const R=a[w];x&&(R.needsUpdate=!0),this.updateTexture(R,S)}if(m&&this.updateTexture(m,S),n.initialized!==!0){n.initialized=!0;const w=()=>{e.removeEventListener("dispose",w);for(let R=0;R<a.length;R++)this._destroyTexture(a[R]);m&&this._destroyTexture(m),this.delete(e)};e.addEventListener("dispose",w)}}updateTexture(e,t={}){const n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;const r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&(s.destroySampler(e),s.destroyTexture(e)),e.isFramebufferTexture){const h=this.renderer.getRenderTarget();h?e.type=h.texture.type:e.type=aa}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,r||e.isStorageTexture===!0)s.createSampler(e),s.createTexture(e,t),n.generation=e.version;else if(n.initialized!==!0&&s.createSampler(e),e.version>0){const m=e.image;if(m===void 0)console.warn("THREE.Renderer: Texture marked for update but image is undefined.");else if(m.complete===!1)console.warn("THREE.Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const v=[];for(const x of e.images)v.push(x);t.images=v}else t.image=m;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t),t.needsMipmaps&&e.mipmaps.length===0&&s.generateMipmaps(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;if(n.initialized!==!0){n.initialized=!0,n.generation=e.version,this.info.memory.textures++;const h=()=>{e.removeEventListener("dispose",h),this._destroyTexture(e),this.info.memory.textures--};e.addEventListener("dispose",h)}n.version=e.version}getSize(e,t=Dne){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),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 r;return e.isCompressedTexture?e.mipmaps?r=e.mipmaps.length:r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return this.isEnvironmentTexture(e)||e.isCompressedTexture===!0||e.generateMipmaps}isEnvironmentTexture(e){const t=e.mapping;return t===zh||t===Gh||t===Qo||t===Ko}_destroyTexture(e){this.backend.destroySampler(e),this.backend.destroyTexture(e),this.delete(e)}}class bE extends an{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,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 tB extends Gi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}const Lne=(i,e)=>_t(new tB(i,e));class Une extends Mn{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this.isStackNode=!0}getNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}add(e){return this.nodes.push(e),this}If(e,t){const n=new Um(t);return this._currentCond=zs(e,n),this.add(this._currentCond)}ElseIf(e,t){const n=new Um(t),r=zs(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new Um(e),this}build(e,...t){const n=PM();bg(this);for(const r of this.nodes)r.build(e,"void");return bg(n),this.outputNode?this.outputNode.build(e,...t):super.build(e,...t)}else(...e){return console.warn("TSL.StackNode: .else() has been renamed to .Else()."),this.Else(...e)}elseif(...e){return console.warn("TSL.StackNode: .elseif() has been renamed to .ElseIf()."),this.ElseIf(...e)}}const e_=ct(Une);class nB extends Mn{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}setup(e){super.setup(e);const t=this.members,n=[];for(let r=0;r<t.length;r++)n.push(t[r].getNodeType(e));this.nodeType=e.getStructTypeFromNode(this,n).name}generate(e,t){const n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let a=0;a<r.length;a++){const l=r[a].build(e,t);e.addLineFlowCode(`${s}m${a} = ${l}`,this)}return n}}const Bne=ct(nB);function iB(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}class One extends nB{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 rB(t)}setup(e){const t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(const a in t){const l=iB(s,a);r[l]=dn(t[a])}return this.members=r,super.setup(e)}}const rB=ct(One),Ine=je(([i])=>{const e=i.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)}),JT=(i,e)=>Cl(Wn(4,i.mul(wi(1,i))),e),Fne=(i,e)=>i.lessThan(.5)?JT(i.mul(2),e).div(2):wi(1,JT(Wn(wi(1,i),2),e).div(2)),kne=(i,e,t)=>Cl(Dl(Cl(i,e),Qr(Cl(i,e),Cl(wi(1,i),t))),1/e),zne=(i,e)=>Mo(Z_.mul(e.mul(i).sub(1))).div(Z_.mul(e.mul(i).sub(1))),xc=je(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),Gne=je(([i])=>Be(xc(i.z.add(xc(i.y.mul(1)))),xc(i.z.add(xc(i.x.mul(1)))),xc(i.y.add(xc(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),qne=je(([i,e,t])=>{const n=Be(i).toVar(),r=_e(1.4).toVar(),s=_e(0).toVar(),a=Be(n).toVar();return ki({start:_e(0),end:_e(3),type:"float",condition:"<="},()=>{const l=Be(Gne(a.mul(2))).toVar();n.addAssign(l.add(t.mul(_e(.1).mul(e)))),a.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);const u=_e(xc(n.z.add(xc(n.x.add(xc(n.y)))))).toVar();s.addAssign(u.div(r)),a.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class Vne extends Mn{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 r=null,s=-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 m=0;for(let v=0;v<t.length;v++){const x=t[v],S=h[v];x.getNodeType(e)===S.type?m++:m=0}m>s&&(r=a,s=m)}}this._candidateFnCall=n=r(...t)}return n}}const Hne=ct(Vne),Vs=i=>(...e)=>Hne(i,...e),yA=gn(0).setGroup(Rn).onRenderUpdate(i=>i.time),sB=gn(0).setGroup(Rn).onRenderUpdate(i=>i.deltaTime),jne=gn(0,"uint").setGroup(Rn).onRenderUpdate(i=>i.frameId),Wne=(i=1)=>(console.warn('TSL: timerLocal() is deprecated. Use "time" instead.'),yA.mul(i)),$ne=(i=1)=>(console.warn('TSL: timerGlobal() is deprecated. Use "time" instead.'),yA.mul(i)),Xne=(i=1)=>(console.warn('TSL: timerDelta() is deprecated. Use "deltaTime" instead.'),sB.mul(i)),Yne=(i=yA)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),Qne=(i=yA)=>i.fract().round(),Kne=(i=yA)=>i.add(.5).fract().mul(2).sub(1).abs(),Zne=(i=yA)=>i.fract(),Jne=je(([i,e,t=Ct(.5)])=>xE(i.sub(t),e).add(t)),eie=je(([i,e,t=Ct(.5)])=>{const n=i.sub(t),r=n.dot(n),a=r.mul(r).mul(e);return i.add(n.mul(a))}),tie=je(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=$o.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=$o;const r=so.mul(n);return xg(e)&&(r[0][0]=$o[0].length(),r[0][1]=0,r[0][2]=0),xg(t)&&(r[1][0]=0,r[1][1]=$o[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,_A.mul(r).mul(Gr)}),nie=je(([i=null])=>{const e=ty();return ty(fE(i)).sub(e).lessThan(0).select(bu,i)});class iie extends Mn{static get type(){return"SpriteSheetUVNode"}constructor(e,t=Er(),n=_e(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:r,height:s}=n,a=e.mod(r.mul(s)).floor(),l=a.mod(r),u=s.sub(a.add(1).div(r).ceil()),h=n.reciprocal(),m=Ct(l,u);return t.add(m).mul(h)}}const rie=ct(iie);class sie extends Mn{static get type(){return"TriplanarTexturesNode"}constructor(e,t=null,n=null,r=_e(1),s=Gr,a=no){super("vec4"),this.textureXNode=e,this.textureYNode=t,this.textureZNode=n,this.scaleNode=r,this.positionNode=s,this.normalNode=a}setup(){const{textureXNode:e,textureYNode:t,textureZNode:n,scaleNode:r,positionNode:s,normalNode:a}=this;let l=a.abs().normalize();l=l.div(l.dot(Be(1)));const u=s.yz.mul(r),h=s.zx.mul(r),m=s.xy.mul(r),v=e.value,x=t!==null?t.value:v,S=n!==null?n.value:v,w=Ai(v,u).mul(l.x),R=Ai(x,h).mul(l.y),C=Ai(S,m).mul(l.z);return Qr(w,R,C)}}const aB=ct(sie),aie=(...i)=>aB(...i),Cd=new Yl,Cf=new he,Rd=new he,iS=new he,um=new kn,fv=new he(0,0,-1),Hl=new Ln,cm=new he,Av=new he,hm=new Ln,dv=new gt,iy=new Wh,oie=bu.flipX();iy.depthTexture=new qc(1,1);let rS=!1;class SE extends yu{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||iy.texture,oie),this._reflectorBaseNode=e.reflector||new lie(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 can only be requested when the reflector is created with { depth: true }. ");this._depthNode=_t(new SE({defaultTexture:iy.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._reflectorBaseNode=this._reflectorBaseNode,e}}class lie extends Mn{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:n=new vr,resolution:r=1,generateMipmaps:s=!1,bounces:a=!0,depth:l=!1}=t;this.textureNode=e,this.target=n,this.resolution=r,this.generateMipmaps=s,this.bounces=a,this.depth=l,this.updateBeforeType=a?jn.RENDER:jn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new WeakMap}_updateResolution(e,t){const n=this.resolution;t.getDrawingBufferSize(dv),e.setSize(Math.round(dv.width*n),Math.round(dv.height*n))}setup(e){return this._updateResolution(iy,e.renderer),super.setup(e)}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 Wh(0,0,{type:Gs}),this.generateMipmaps===!0&&(t.texture.minFilter=qF,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new qc),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&rS)return!1;rS=!0;const{scene:t,camera:n,renderer:r,material:s}=e,{target:a}=this,l=this.getVirtualCamera(n),u=this.getRenderTarget(l);if(r.getDrawingBufferSize(dv),this._updateResolution(u,r),Rd.setFromMatrixPosition(a.matrixWorld),iS.setFromMatrixPosition(n.matrixWorld),um.extractRotation(a.matrixWorld),Cf.set(0,0,1),Cf.applyMatrix4(um),cm.subVectors(Rd,iS),cm.dot(Cf)>0)return;cm.reflect(Cf).negate(),cm.add(Rd),um.extractRotation(n.matrixWorld),fv.set(0,0,-1),fv.applyMatrix4(um),fv.add(iS),Av.subVectors(Rd,fv),Av.reflect(Cf).negate(),Av.add(Rd),l.coordinateSystem=n.coordinateSystem,l.position.copy(cm),l.up.set(0,1,0),l.up.applyMatrix4(um),l.up.reflect(Cf),l.lookAt(Av),l.near=n.near,l.far=n.far,l.updateMatrixWorld(),l.projectionMatrix.copy(n.projectionMatrix),Cd.setFromNormalAndCoplanarPoint(Cf,Rd),Cd.applyMatrix4(l.matrixWorldInverse),Hl.set(Cd.normal.x,Cd.normal.y,Cd.normal.z,Cd.constant);const h=l.projectionMatrix;hm.x=(Math.sign(Hl.x)+h.elements[8])/h.elements[0],hm.y=(Math.sign(Hl.y)+h.elements[9])/h.elements[5],hm.z=-1,hm.w=(1+h.elements[10])/h.elements[14],Hl.multiplyScalar(1/Hl.dot(hm));const m=0;h.elements[2]=Hl.x,h.elements[6]=Hl.y,h.elements[10]=r.coordinateSystem===pu?Hl.z-m:Hl.z+1-m,h.elements[14]=Hl.w,this.textureNode.value=u.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=u.depthTexture),s.visible=!1;const v=r.getRenderTarget(),x=r.getMRT(),S=r.autoClear;r.setMRT(null),r.setRenderTarget(u),r.autoClear=!0,r.render(t,l),r.setMRT(x),r.setRenderTarget(v),r.autoClear=S,s.visible=!0,rS=!1}}const uie=i=>_t(new SE(i)),sS=new kg(-1,1,1,-1,0,1);class cie extends Ki{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Mi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Mi(t,2))}}const hie=new cie;class TE extends zi{constructor(e=null){super(hie,e),this.camera=sS,this.isQuadMesh=!0}async renderAsync(e){return e.renderAsync(this,sS)}render(e){e.render(this,sS)}}const fie=new gt;class Aie extends yu{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Gs}){const s=new Wh(t,n,r);super(s.texture,Er()),this.node=e,this.width=t,this.height=n,this.pixelRatio=1,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new TE(new Vr),this.updateBeforeType=jn.RENDER}get autoSize(){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,r=t*this.pixelRatio;this.renderTarget.setSize(n,r),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.autoSize===!0){this.pixelRatio=e.getPixelRatio();const n=e.getSize(fie);this.setSize(n.width,n.height)}this._quadMesh.material.fragmentNode=this._rttNode;const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new yu(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const oB=(i,...e)=>_t(new Aie(_t(i),...e)),die=(i,...e)=>i.isTextureNode?i:i.isPassNode?i.getTextureNode():oB(i,...e),zd=je(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===pu?(i=Ct(i.x,i.y.oneMinus()).mul(2).sub(1),r=dn(Be(i,e),1)):r=dn(Be(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);const s=dn(t.mul(r));return s.xyz.div(s.w)}),pie=je(([i,e])=>{const t=e.mul(dn(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return Ct(n.x,n.y.oneMinus())}),mie=je(([i,e,t])=>{const n=Fh(Fr(e)),r=ms(i.mul(n)).toVar(),s=Fr(e,r).toVar(),a=Fr(e,r.sub(ms(2,0))).toVar(),l=Fr(e,r.sub(ms(1,0))).toVar(),u=Fr(e,r.add(ms(1,0))).toVar(),h=Fr(e,r.add(ms(2,0))).toVar(),m=Fr(e,r.add(ms(0,2))).toVar(),v=Fr(e,r.add(ms(0,1))).toVar(),x=Fr(e,r.sub(ms(0,1))).toVar(),S=Fr(e,r.sub(ms(0,2))).toVar(),w=ur(wi(_e(2).mul(l).sub(a),s)).toVar(),R=ur(wi(_e(2).mul(u).sub(h),s)).toVar(),C=ur(wi(_e(2).mul(v).sub(m),s)).toVar(),E=ur(wi(_e(2).mul(x).sub(S),s)).toVar(),B=zd(i,s,t).toVar(),L=w.lessThan(R).select(B.sub(zd(i.sub(Ct(_e(1).div(n.x),0)),l,t)),B.negate().add(zd(i.add(Ct(_e(1).div(n.x),0)),u,t))),O=C.lessThan(E).select(B.sub(zd(i.add(Ct(0,_e(1).div(n.y))),v,t)),B.negate().add(zd(i.sub(Ct(0,_e(1).div(n.y))),x,t)));return Fc(ky(L,O))});class t_ extends Ig{constructor(e,t,n=Float32Array){const r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}}class gie extends wr{constructor(e,t,n=Float32Array){const r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}}class vie extends vA{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}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const r=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){const s=this.getNodeType(e);n=e.format(n,s,t)}return n}}const _ie=ct(vie);class yie extends sE{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t=UP(e.itemSize),n=e.count),super(e,t,n),this.isStorageBufferNode=!0,this.access=sa.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 _ie(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(sa.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=$g(this.value),this._varying=ro(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}generate(e){if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}}const Qy=(i,e=null,t=0)=>_t(new yie(i,e,t)),xie=(i,e,t)=>(console.warn('THREE.TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.'),Qy(i,e,t).setPBO(!0)),bie=(i,e="float")=>{const t=OP(e),n=BP(e),r=new gie(i,t,n);return Qy(r,e,i)},Sie=(i,e="float")=>{const t=OP(e),n=BP(e),r=new t_(i,t,n);return Qy(r,e,i)};class Tie extends x9{static get type(){return"VertexColorNode"}constructor(e=0){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 r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new Ln(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const wie=i=>_t(new Tie(i));class Mie extends Mn{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const Eie=Wt(Mie),fm=new la,aS=new kn;class Ya extends Mn{static get type(){return"SceneNode"}constructor(e=Ya.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 r;return t===Ya.BACKGROUND_BLURRINESS?r=ji("backgroundBlurriness","float",n):t===Ya.BACKGROUND_INTENSITY?r=ji("backgroundIntensity","float",n):t===Ya.BACKGROUND_ROTATION?r=gn("mat4").label("backgroundRotation").setGroup(Rn).onRenderUpdate(()=>{const s=n.background;return s!==null&&s.isTexture&&s.mapping!==Lw?(fm.copy(n.backgroundRotation),fm.x*=-1,fm.y*=-1,fm.z*=-1,aS.makeRotationFromEuler(fm)):aS.identity(),aS}):console.error("THREE.SceneNode: Unknown scope:",t),r}}Ya.BACKGROUND_BLURRINESS="backgroundBlurriness";Ya.BACKGROUND_INTENSITY="backgroundIntensity";Ya.BACKGROUND_ROTATION="backgroundRotation";const lB=Wt(Ya,Ya.BACKGROUND_BLURRINESS),ew=Wt(Ya,Ya.BACKGROUND_INTENSITY),uB=Wt(Ya,Ya.BACKGROUND_ROTATION);class Cie extends yu{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.isStorageTextureNode=!0,this.access=sa.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);t.storeNode=this.storeNode}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(sa.READ_WRITE)}toReadOnly(){return this.setAccess(sa.READ_ONLY)}toWriteOnly(){return this.setAccess(sa.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:r}=t,s=super.generate(e,"property"),a=n.build(e,"uvec2"),l=r.build(e,"vec4"),u=e.generateTextureStore(e,s,a,l);e.addLineFlowCode(u,this)}}const cB=ct(Cie),Rie=(i,e,t)=>{const n=cB(i,e,t);return t!==null&&n.append(),n};class Nie extends jy{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 Die=(i,e,t)=>_t(new Nie(i,e,t)),sN=new WeakMap;class Pie extends Zr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=jn.OBJECT,this.updateAfterType=jn.OBJECT,this.previousModelWorldMatrix=gn(new kn),this.previousProjectionMatrix=gn(new kn).setGroup(Rn),this.previousCameraViewMatrix=gn(new kn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){const r=aN(n);this.previousModelWorldMatrix.value.copy(r);const s=hB(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new kn,s.previousCameraViewMatrix=new kn,s.currentProjectionMatrix=new kn,s.currentCameraViewMatrix=new kn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){aN(e).copy(e.matrixWorld)}setup(){const e=this.projectionMatrix===null?_A:gn(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Q0).mul(Gr),r=this.previousProjectionMatrix.mul(t).mul(ey),s=n.xy.div(n.w),a=r.xy.div(r.w);return wi(s,a)}}function hB(i){let e=sN.get(i);return e===void 0&&(e={},sN.set(i,e)),e}function aN(i,e=0){const t=hB(i);let n=t[e];return n===void 0&&(t[e]=n=new kn),n}const Lie=Wt(Pie),fB=je(([i,e])=>to(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),AB=je(([i,e])=>to(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),dB=je(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),pB=je(([i,e])=>Fi(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Fy(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Uie=je(([i,e])=>{const t=e.a.add(i.a.mul(e.a.oneMinus()));return dn(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),Bie=(...i)=>(console.warn('THREE.TSL: "burn" has been renamed. Use "blendBurn" instead.'),fB(i)),Oie=(...i)=>(console.warn('THREE.TSL: "dodge" has been renamed. Use "blendDodge" instead.'),AB(i)),Iie=(...i)=>(console.warn('THREE.TSL: "screen" has been renamed. Use "blendScreen" instead.'),dB(i)),Fie=(...i)=>(console.warn('THREE.TSL: "overlay" has been renamed. Use "blendOverlay" instead.'),pB(i)),kie=je(([i])=>wE(i.rgb)),zie=je(([i,e=_e(1)])=>e.mix(wE(i.rgb),i.rgb)),Gie=je(([i,e=_e(1)])=>{const t=Qr(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Fi(i.rgb,n,r)}),qie=je(([i,e=_e(1)])=>{const t=Be(.57735,.57735,.57735),n=e.cos();return Be(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(Xh(t,i.rgb).mul(n.oneMinus())))))}),wE=(i,e=Be(ai.getLuminanceCoefficients(new he)))=>Xh(i,e),Vie=je(([i,e=Be(1),t=Be(0),n=Be(1),r=_e(1),s=Be(ai.getLuminanceCoefficients(new he,Ro))])=>{const a=i.rgb.dot(Be(s)),l=qr(i.rgb.mul(e).add(t),0).toVar(),u=l.pow(n).toVar();return ti(l.r.greaterThan(0),()=>{l.r.assign(u.r)}),ti(l.g.greaterThan(0),()=>{l.g.assign(u.g)}),ti(l.b.greaterThan(0),()=>{l.b.assign(u.b)}),l.assign(a.add(l.sub(a).mul(r))),dn(l.rgb,i.a)});class Hie extends Zr{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 jie=ct(Hie),Wie=new gt;class mB extends yu{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return e.object.isQuadMesh&&this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class oN extends mB{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(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}class Tu extends Zr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._pixelRatio=1,this._width=1,this._height=1;const s=new qc;s.isRenderTargetTexture=!0,s.name="depth";const a=new Wh(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Gs,...r});a.texture.name="output",a.depthTexture=s,this.renderTarget=a,this._textures={output:a.texture,depth:s},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=gn(0),this._cameraFar=gn(0),this._mrt=null,this.isPassNode=!0,this.updateBeforeType=jn.FRAME}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}isGlobal(){return!0}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],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=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=_t(new oN(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=_t(new oN(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,r=this._cameraFar;this._viewZNodes[e]=t=AE(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=s0(s,n,r)}return t}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,e.backend.isWebGLBackend===!0&&(this.renderTarget.samples=0),this.scope===Tu.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n,camera:r}=this;this._pixelRatio=t.getPixelRatio();const s=t.getSize(Wie);this.setSize(s.width,s.height);const a=t.getRenderTarget(),l=t.getMRT();this._cameraNear.value=r.near,this._cameraFar.value=r.far;for(const u in this._previousTextures)this.toggleTexture(u);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(n,r),t.setRenderTarget(a),t.setMRT(l)}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget.setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}Tu.COLOR="color";Tu.DEPTH="depth";const $ie=(i,e,t)=>_t(new Tu(Tu.COLOR,i,e,t)),Xie=(i,e)=>_t(new mB(i,e)),Yie=(i,e,t)=>_t(new Tu(Tu.DEPTH,i,e,t));class Qie extends Tu{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Tu.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,a,l,u,h,m,v)=>{if((u.isMeshToonMaterial||u.isMeshToonNodeMaterial)&&u.wireframe===!1){const x=this._getOutlineMaterial(u);t.renderObject(r,s,a,l,x,h,m,v)}t.renderObject(r,s,a,l,u,h,m,v)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new Vr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=hr;const t=no.negate(),n=_A.mul(Q0),r=_e(1),s=n.mul(dn(Gr,1)),a=n.mul(dn(Gr.add(t),1)),l=Fc(s.sub(a));return e.vertexNode=s.add(l.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=dn(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 Kie=(i,e,t=new an(0,0,0),n=.003,r=1)=>_t(new Qie(i,e,_t(t),_t(n),_t(r))),gB=je(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),vB=je(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),_B=je(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);const t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.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"}]}),Zie=je(([i])=>{const e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),yB=je(([i,e])=>{const t=ha(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=ha(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=Zie(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Jie=ha(Be(1.6605,-.1246,-.0182),Be(-.5876,1.1329,-.1006),Be(-.0728,-.0083,1.1187)),ere=ha(Be(.6274,.0691,.0164),Be(.3293,.9195,.088),Be(.0433,.0113,.8956)),tre=je(([i])=>{const e=Be(i).toVar(),t=Be(e.mul(e)).toVar(),n=Be(t.mul(t)).toVar();return _e(15.5).mul(n.mul(t)).sub(Wn(40.14,n.mul(e))).add(Wn(31.96,n).sub(Wn(6.868,t.mul(e))).add(Wn(.4298,t).add(Wn(.1191,e).sub(.00232))))}),xB=je(([i,e])=>{const t=Be(i).toVar(),n=ha(Be(.856627153315983,.137318972929847,.11189821299995),Be(.0951212405381588,.761241990602591,.0767994186031903),Be(.0482516061458583,.101439036467562,.811302368396859)),r=ha(Be(1.1271005818144368,-.1413297634984383,-.14132976349843826),Be(-.11060664309660323,1.157823702216272,-.11060664309660294),Be(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=_e(-12.47393),a=_e(4.026069);return t.mulAssign(e),t.assign(ere.mul(t)),t.assign(n.mul(t)),t.assign(qr(t,1e-10)),t.assign(cu(t)),t.assign(t.sub(s).div(a.sub(s))),t.assign(vu(t,0,1)),t.assign(tre(t)),t.assign(r.mul(t)),t.assign(Cl(qr(Be(0),t),Be(2.2))),t.assign(Jie.mul(t)),t.assign(vu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),bB=je(([i,e])=>{const t=_e(.76),n=_e(.15);i=i.mul(e);const r=to(i.r,to(i.g,i.b)),s=zs(r.lessThan(.08),r.sub(Wn(6.25,r.mul(r))),.04);i.subAssign(s);const a=qr(i.r,qr(i.g,i.b));ti(a.lessThan(t),()=>i);const l=wi(1,t),u=wi(1,l.mul(l).div(a.add(l.sub(t))));i.mulAssign(u.div(a));const h=wi(1,Dl(1,n.mul(a.sub(u)).add(1)));return Fi(i,Be(u),h)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class rs extends Mn{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.code=e,this.includes=t,this.language=n}isGlobal(){return!0}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.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 Ky=ct(rs),nre=(i,e)=>Ky(i,e,"js"),ire=(i,e)=>Ky(i,e,"wgsl"),rre=(i,e)=>Ky(i,e,"glsl");class SB extends rs{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}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),r=n.name,s=n.type,a=e.getCodeFromNode(this,s);r!==""&&(a.name=r);const l=e.getPropertyName(a),u=this.getNodeFunction(e).getCode(l);return a.code=u+`
`,t==="property"?l:e.format(`${l}()`,s,t)}}const TB=(i,e=[],t="")=>{for(let s=0;s<e.length;s++){const a=e[s];typeof a=="function"&&(e[s]=a.functionNode)}const n=_t(new SB(i,e,t)),r=(...s)=>n.call(...s);return r.functionNode=n,r},sre=(i,e)=>TB(i,e,"glsl"),are=(i,e)=>TB(i,e,"wgsl");class ore extends Mn{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new zc,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:_e()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=kP(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=zP(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 n_=ct(ore);class wB extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(t!==null){const r=t(...n);return this.set(e,r),r}}}class lre{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 i_=new wB;class ure extends Mn{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new wB,this._output=n_(),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]=n_(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]=n_(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 r=this.getObject()[e];if(typeof r=="function")return r(...t)}async callAsync(e,...t){const r=this.getObject()[e];if(typeof r=="function")return r.constructor.name==="AsyncFunction"?await r(...t):r(...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,m)=>this.setOutput(h,m),n=new lre(this),r=i_.get("THREE"),s=i_.get("TSL"),a=this.getMethod(),l=[n,this._local,i_,e,t,r,s];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 m=h.id||h.name;h.inputType&&(this.getParameter(m)===void 0&&this.setParameter(m,null),this.getParameter(m).inputType=h.inputType),h.outputType&&(this.getOutput(m)===void 0&&this.setOutput(m,null),this.getOutput(m).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:_e()}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(", "),r="var "+n+`; var output = {};
`,s=`
return { ...output, `+n+" };",a=r+this.codeNode.code+s;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=[PP(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return Ny(t)}set needsUpdate(e){e===!0&&this.dispose()}get needsUpdate(){return this.source!==this._source}_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 cre=ct(ure);function MB(i){let e;const t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Xr.z).negate()}const ME=je(([i,e],t)=>{const n=MB(t);return kc(i,e,n)}),EE=je(([i],e)=>{const t=MB(e);return i.mul(i,t,t).negate().exp().oneMinus()}),Ng=je(([i,e])=>dn(e.toFloat().mix(Eg.rgb,i.toVec3()),Eg.a));function hre(i,e,t){return console.warn('THREE.TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),Ng(i,ME(e,t))}function fre(i,e){return console.warn('THREE.TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),Ng(i,EE(e))}let Rf=null,Nf=null;class Are extends Mn{static get type(){return"RangeNode"}constructor(e=_e(),t=_e()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Uh(this.minNode.value)),n=e.getTypeLength(Uh(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 r=this.minNode.value,s=this.maxNode.value,a=e.getTypeLength(Uh(r)),l=e.getTypeLength(Uh(s));Rf=Rf||new Ln,Nf=Nf||new Ln,Rf.setScalar(0),Nf.setScalar(0),a===1?Rf.setScalar(r):r.isColor?Rf.set(r.r,r.g,r.b,1):Rf.set(r.x,r.y,r.z||0,r.w||0),l===1?Nf.setScalar(s):s.isColor?Nf.set(s.r,s.g,s.b,1):Nf.set(s.x,s.y,s.z||0,s.w||0);const u=4,h=u*t.count,m=new Float32Array(h);for(let x=0;x<h;x++){const S=x%u,w=Rf.getComponent(S),R=Nf.getComponent(S);m[x]=M0.lerp(w,R,Math.random())}const v=this.getNodeType(e);if(t.count<=4096)n=Yg(m,"vec4",t.count).element(Jg).convert(v);else{const x=new Ig(m,4);e.geometry.setAttribute("__range"+this.id,x),n=J_(x).convert(v)}}else n=_e(0);return n}}const dre=ct(Are);class pre extends Mn{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){e.hasBuiltin(this._builtinName)}generate(e,t){const n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(console.warn(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}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 Zy=(i,e)=>_t(new pre(i,e)),mre=Zy("numWorkgroups","uvec3"),gre=Zy("workgroupId","uvec3"),vre=Zy("localId","uvec3"),_re=Zy("subgroupSize","uint");class yre extends Mn{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(`	// ${t}Barrier 
`):e.addLineFlowCode(`${t}Barrier()`,this)}}const CE=ct(yre),xre=()=>CE("workgroup").append(),bre=()=>CE("storage").append(),Sre=()=>CE("texture").append();class Tre extends vA{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const r=e.context.assign;if(n=super.generate(e),r!==!0){const s=this.getNodeType(e);n=e.format(n,s,t)}return n}}class wre extends Mn{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e}label(e){return this.name=e,this}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return _t(new Tre(this,e))}generate(e){return e.getScopedArray(this.name||`${this.scope}Array_${this.id}`,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const Mre=(i,e)=>_t(new wre("Workgroup",i,e));class Ds extends Zr{static get type(){return"AtomicFunctionNode"}constructor(e,t,n,r=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.storeNode=r}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,n=this.getNodeType(e),r=this.getInputType(e),s=this.pointerNode,a=this.valueNode,l=[];l.push(`&${s.build(e,r)}`),l.push(a.build(e,r));const u=`${e.getMethod(t,n)}( ${l.join(", ")} )`;if(this.storeNode!==null){const h=this.storeNode.build(e,r);e.addLineFlowCode(`${h} = ${u}`,this)}else e.addLineFlowCode(u,this)}}Ds.ATOMIC_LOAD="atomicLoad";Ds.ATOMIC_STORE="atomicStore";Ds.ATOMIC_ADD="atomicAdd";Ds.ATOMIC_SUB="atomicSub";Ds.ATOMIC_MAX="atomicMax";Ds.ATOMIC_MIN="atomicMin";Ds.ATOMIC_AND="atomicAnd";Ds.ATOMIC_OR="atomicOr";Ds.ATOMIC_XOR="atomicXor";const Ere=ct(Ds),jc=(i,e,t,n=null)=>{const r=Ere(i,e,t,n);return r.append(),r},Cre=(i,e,t=null)=>jc(Ds.ATOMIC_STORE,i,e,t),Rre=(i,e,t=null)=>jc(Ds.ATOMIC_ADD,i,e,t),Nre=(i,e,t=null)=>jc(Ds.ATOMIC_SUB,i,e,t),Dre=(i,e,t=null)=>jc(Ds.ATOMIC_MAX,i,e,t),Pre=(i,e,t=null)=>jc(Ds.ATOMIC_MIN,i,e,t),Lre=(i,e,t=null)=>jc(Ds.ATOMIC_AND,i,e,t),Ure=(i,e,t=null)=>jc(Ds.ATOMIC_OR,i,e,t),Bre=(i,e,t=null)=>jc(Ds.ATOMIC_XOR,i,e,t);let pv;function t1(i){pv=pv||new WeakMap;let e=pv.get(i);return e===void 0&&pv.set(i,e={}),e}function RE(i){const e=t1(i);return e.shadowMatrix||(e.shadowMatrix=gn("mat4").setGroup(Rn).onRenderUpdate(()=>(i.castShadow!==!0&&i.shadow.updateMatrices(i),i.shadow.matrix)))}function EB(i){const e=t1(i);if(e.projectionUV===void 0){const t=RE(i).mul(Nc);e.projectionUV=t.xyz.div(t.w)}return e.projectionUV}function NE(i){const e=t1(i);return e.position||(e.position=gn(new he).setGroup(Rn).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function CB(i){const e=t1(i);return e.targetPosition||(e.targetPosition=gn(new he).setGroup(Rn).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function Jy(i){const e=t1(i);return e.viewPosition||(e.viewPosition=gn(new he).setGroup(Rn).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new he,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const DE=i=>so.transformDirection(NE(i).sub(CB(i))),Ore=i=>i.sort((e,t)=>e.id-t.id),Ire=(i,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},oS=new WeakMap;class PE extends Mn{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Be().toVar("totalDiffuse"),this.totalSpecularNode=Be().toVar("totalSpecular"),this.outgoingLightNode=Be().toVar("outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=[],t=this._lights;for(let n=0;n<t.length;n++)e.push(t[n].id);return Ny(e)}getHash(e){if(this._lightNodesHash===null){this._lightNodes===null&&this.setupLightsNode(e);const t=[];for(const n of this._lightNodes)t.push(n.getSelf().getHash());this._lightNodesHash="lights-"+t.join(",")}return this._lightNodesHash}analyze(e){const t=e.getDataFromNode(this);for(const n of t.nodes)n.build(e)}setupLightsNode(e){const t=[],n=this._lightNodes,r=Ore(this._lights),s=e.renderer.library;for(const a of r)if(a.isNode)t.push(_t(a));else{let l=null;if(n!==null&&(l=Ire(a.id,n)),l===null){const u=s.getLightNodeClass(a.constructor);if(u===null){console.warn(`LightsNode.setupNodeLights: Light node not found for ${a.constructor.name}`);continue}let h=null;oS.has(a)?h=oS.get(a):(h=_t(new u(a)),oS.set(a,h)),t.push(h)}}this._lightNodes=t}setupLights(e,t){for(const n of t)n.build(e)}setup(e){this._lightNodes===null&&this.setupLightsNode(e);const t=e.context,n=t.lightingModel;let r=this.outgoingLightNode;if(n){const{_lightNodes:s,totalDiffuseNode:a,totalSpecularNode:l}=this;t.outgoingLight=r;const u=e.addStack(),h=e.getDataFromNode(this);h.nodes=u.nodes,n.start(t,u,e),this.setupLights(e,s),n.indirect(t,u,e);const{backdrop:m,backdropAlpha:v}=t,{directDiffuse:x,directSpecular:S,indirectDiffuse:w,indirectSpecular:R}=t.reflectedLight;let C=x.add(w);m!==null&&(v!==null?C=Be(v.mix(C,m)):C=Be(m),t.material.transparent=!0),a.assign(C),l.assign(S.add(R)),r.assign(a.add(l)),n.finish(t,u,e),r=r.bypass(e.removeStack())}return r}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 Fre=(i=[])=>_t(new PE).setLights(i);class kre extends Mn{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=jn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({material:e}){LE.assign(e.shadowPositionNode||Nc)}dispose(){this.updateBeforeType=jn.NONE}}const LE=Be().toVar("shadowPositionWorld");function zre(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new an),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function Gre(i,e){return e=zre(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function qre(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function Vre(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function Hre(i,e){return e=Vre(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function jre(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function Wre(i,e,t){return t=Gre(i,t),t=Hre(e,t),t}function $re(i,e,t){qre(i,t),jre(e,t)}const lN=new WeakMap,Xre=je(([i,e,t])=>{let n=Nc.sub(i).length();return n=n.sub(e).div(t.sub(e)),n=n.saturate(),n}),Yre=i=>{const e=i.shadow.camera,t=ji("near","float",e).setGroup(Rn),n=ji("far","float",e).setGroup(Rn),r=T9(i);return Xre(r,t,n)},Qre=i=>{let e=lN.get(i);if(e===void 0){const t=i.isPointLight?Yre(i):null;e=new Vr,e.colorNode=dn(0,0,0,1),e.depthNode=t,e.isShadowNodeMaterial=!0,e.name="ShadowMaterial",e.fog=!1,lN.set(i,e)}return e},RB=je(({depthTexture:i,shadowCoord:e})=>Ai(i,e.xy).compare(e.z)),NB=je(({depthTexture:i,shadowCoord:e,shadow:t})=>{const n=(R,C)=>Ai(i,R).compare(C),r=ji("mapSize","vec2",t).setGroup(Rn),s=ji("radius","float",t).setGroup(Rn),a=Ct(1).div(r),l=a.x.negate().mul(s),u=a.y.negate().mul(s),h=a.x.mul(s),m=a.y.mul(s),v=l.div(2),x=u.div(2),S=h.div(2),w=m.div(2);return Qr(n(e.xy.add(Ct(l,u)),e.z),n(e.xy.add(Ct(0,u)),e.z),n(e.xy.add(Ct(h,u)),e.z),n(e.xy.add(Ct(v,x)),e.z),n(e.xy.add(Ct(0,x)),e.z),n(e.xy.add(Ct(S,x)),e.z),n(e.xy.add(Ct(l,0)),e.z),n(e.xy.add(Ct(v,0)),e.z),n(e.xy,e.z),n(e.xy.add(Ct(S,0)),e.z),n(e.xy.add(Ct(h,0)),e.z),n(e.xy.add(Ct(v,w)),e.z),n(e.xy.add(Ct(0,w)),e.z),n(e.xy.add(Ct(S,w)),e.z),n(e.xy.add(Ct(l,m)),e.z),n(e.xy.add(Ct(0,m)),e.z),n(e.xy.add(Ct(h,m)),e.z)).mul(1/17)}),DB=je(({depthTexture:i,shadowCoord:e,shadow:t})=>{const n=(m,v)=>Ai(i,m).compare(v),r=ji("mapSize","vec2",t).setGroup(Rn),s=Ct(1).div(r),a=s.x,l=s.y,u=e.xy,h=Hc(u.mul(r).add(.5));return u.subAssign(h.mul(s)),Qr(n(u,e.z),n(u.add(Ct(a,0)),e.z),n(u.add(Ct(0,l)),e.z),n(u.add(s),e.z),Fi(n(u.add(Ct(a.negate(),0)),e.z),n(u.add(Ct(a.mul(2),0)),e.z),h.x),Fi(n(u.add(Ct(a.negate(),l)),e.z),n(u.add(Ct(a.mul(2),l)),e.z),h.x),Fi(n(u.add(Ct(0,l.negate())),e.z),n(u.add(Ct(0,l.mul(2))),e.z),h.y),Fi(n(u.add(Ct(a,l.negate())),e.z),n(u.add(Ct(a,l.mul(2))),e.z),h.y),Fi(Fi(n(u.add(Ct(a.negate(),l.negate())),e.z),n(u.add(Ct(a.mul(2),l.negate())),e.z),h.x),Fi(n(u.add(Ct(a.negate(),l.mul(2))),e.z),n(u.add(Ct(a.mul(2),l.mul(2))),e.z),h.x),h.y)).mul(1/9)}),PB=je(({depthTexture:i,shadowCoord:e})=>{const t=_e(1).toVar(),n=Ai(i).sample(e.xy).rg,r=Fy(e.z,n.x);return ti(r.notEqual(_e(1)),()=>{const s=e.z.sub(n.x),a=qr(0,n.y.mul(n.y));let l=a.div(a.add(s.mul(s)));l=vu(wi(l,.3).div(.95-.3)),t.assign(vu(qr(r,l)))}),t}),Kre=je(({samples:i,radius:e,size:t,shadowPass:n})=>{const r=_e(0).toVar(),s=_e(0).toVar(),a=i.lessThanEqual(_e(1)).select(_e(0),_e(2).div(i.sub(1))),l=i.lessThanEqual(_e(1)).select(_e(0),_e(-1));ki({start:Ee(0),end:Ee(i),type:"int",condition:"<"},({i:h})=>{const m=l.add(_e(h).mul(a)),v=n.sample(Qr(e1.xy,Ct(0,m).mul(e)).div(t)).x;r.addAssign(v),s.addAssign(v.mul(v))}),r.divAssign(i),s.divAssign(i);const u=Cu(s.sub(r.mul(r)));return Ct(r,u)}),Zre=je(({samples:i,radius:e,size:t,shadowPass:n})=>{const r=_e(0).toVar(),s=_e(0).toVar(),a=i.lessThanEqual(_e(1)).select(_e(0),_e(2).div(i.sub(1))),l=i.lessThanEqual(_e(1)).select(_e(0),_e(-1));ki({start:Ee(0),end:Ee(i),type:"int",condition:"<"},({i:h})=>{const m=l.add(_e(h).mul(a)),v=n.sample(Qr(e1.xy,Ct(m,0).mul(e)).div(t));r.addAssign(v.x),s.addAssign(Qr(v.y.mul(v.y),v.x.mul(v.x)))}),r.divAssign(i),s.divAssign(i);const u=Cu(s.sub(r.mul(r)));return Ct(r,u)}),Jre=[RB,NB,DB,PB];let lS;const mv=new TE;class LB extends kre{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.isShadowNode=!0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){const a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s});return a.select(l,_e(1))}setupShadowCoord(e,t){const{shadow:n}=this,{renderer:r}=e,s=ji("bias","float",n).setGroup(Rn);let a=t,l;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)a=a.xyz.div(a.w),l=a.z,r.coordinateSystem===pu&&(l=l.mul(2).sub(1));else{const u=a.w;a=a.xy.div(u);const h=ji("near","float",n.camera).setGroup(Rn),m=ji("far","float",n.camera).setGroup(Rn);l=dE(u.negate(),h,m)}return a=Be(a.x,a.y.oneMinus(),l.add(s)),a}getShadowFilterFn(e){return Jre[e]}setupShadow(e){const{renderer:t}=e,{light:n,shadow:r}=this,s=t.shadowMap.type,a=new qc(r.mapSize.width,r.mapSize.height);a.compareFunction=my;const l=e.createRenderTarget(r.mapSize.width,r.mapSize.height);if(l.depthTexture=a,r.camera.updateProjectionMatrix(),s===xo){a.compareFunction=null,this.vsmShadowMapVertical=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:lA,type:Gs}),this.vsmShadowMapHorizontal=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:lA,type:Gs});const E=Ai(a),B=Ai(this.vsmShadowMapVertical.texture),L=ji("blurSamples","float",r).setGroup(Rn),O=ji("radius","float",r).setGroup(Rn),G=ji("mapSize","vec2",r).setGroup(Rn);let q=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Vr);q.fragmentNode=Kre({samples:L,radius:O,size:G,shadowPass:E}).context(e.getSharedContext()),q.name="VSMVertical",q=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Vr),q.fragmentNode=Zre({samples:L,radius:O,size:G,shadowPass:B}).context(e.getSharedContext()),q.name="VSMHorizontal"}const u=ji("intensity","float",r).setGroup(Rn),h=ji("normalBias","float",r).setGroup(Rn),m=RE(n).mul(LE.add(Hy.mul(h))),v=this.setupShadowCoord(e,m),x=r.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(x===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const S=s===xo?this.vsmShadowMapHorizontal.texture:a,w=this.setupShadowFilter(e,{filterFn:x,shadowTexture:l.texture,depthTexture:S,shadowCoord:v,shadow:r}),R=Ai(l.texture,v),C=Fi(1,w.rgb.mix(R,1),u.mul(R.a)).toVar();return this.shadowMap=l,this.shadow.map=l,C}setup(e){if(e.renderer.shadowMap.enabled!==!1)return je(()=>{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:r}=this,{renderer:s,scene:a}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height),s.render(a,t.camera)}updateShadow(e){const{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:a,camera:l}=e,u=s.shadowMap.type,h=t.depthTexture.version;this._depthVersionCached=h,r.camera.layers.mask=l.layers.mask;const m=s.getRenderObjectFunction(),v=s.getMRT(),x=v?v.has("velocity"):!1;lS=Wre(s,a,lS),a.overrideMaterial=Qre(n),s.setRenderObjectFunction((S,w,R,C,E,B,...L)=>{(S.castShadow===!0||S.receiveShadow&&u===xo)&&(x&&(FP(S).useVelocity=!0),S.onBeforeShadow(s,S,l,r.camera,C,w.overrideMaterial,B),s.renderObject(S,w,R,C,E,B,...L),S.onAfterShadow(s,S,l,r.camera,C,w.overrideMaterial,B))}),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(m),n.isPointLight!==!0&&u===xo&&this.vsmPass(s),$re(s,a,lS)}vsmPass(e){const{shadow:t}=this;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height),e.setRenderTarget(this.vsmShadowMapVertical),mv.material=this.vsmMaterialVertical,mv.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),mv.material=this.vsmMaterialHorizontal,mv.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;(t.needsUpdate||t.autoUpdate)&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const UB=(i,e)=>_t(new LB(i,e));class xA extends K0{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new an,this.colorNode=e&&e.colorNode||gn(this.color).setGroup(Rn),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=jn.FRAME}customCacheKey(){return EM(this.light.id,this.light.castShadow?1:0)}getHash(){return this.light.uuid}setupShadowNode(){return UB(this.light)}setupShadow(e){const{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){const r=this.light.shadow.shadowNode;let s;r!==void 0?s=_t(r):s=this.setupShadowNode(e),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),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)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const UE=je(i=>{const{lightDistance:e,cutoffDistance:t,decayExponent:n}=i,r=e.pow(n).max(.01).reciprocal();return t.greaterThan(0).select(r.mul(e.div(t).pow4().oneMinus().clamp().pow2()),r)}),ese=new an,Xl=je(([i,e])=>{const t=i.toVar(),n=ur(t),r=Dl(1,qr(n.x,qr(n.y,n.z)));n.mulAssign(r),t.mulAssign(r.mul(e.mul(2).oneMinus()));const s=Ct(t.xy).toVar(),l=e.mul(1.5).oneMinus();return ti(n.z.greaterThanEqual(l),()=>{ti(t.z.greaterThan(0),()=>{s.x.assign(wi(4,t.x))})}).ElseIf(n.x.greaterThanEqual(l),()=>{const u=Cg(t.x);s.x.assign(t.z.mul(u).add(u.mul(2)))}).ElseIf(n.y.greaterThanEqual(l),()=>{const u=Cg(t.y);s.x.assign(t.x.add(u.mul(2)).add(2)),s.y.assign(t.z.mul(u).sub(2))}),Ct(.125,.25).mul(s).add(Ct(.375,.75)).flipY()}).setLayout({name:"cubeToUV",type:"vec2",inputs:[{name:"pos",type:"vec3"},{name:"texelSizeY",type:"float"}]}),tse=je(({depthTexture:i,bd3D:e,dp:t,texelSize:n})=>Ai(i,Xl(e,n.y)).compare(t)),nse=je(({depthTexture:i,bd3D:e,dp:t,texelSize:n,shadow:r})=>{const s=ji("radius","float",r).setGroup(Rn),a=Ct(-1,1).mul(s).mul(n.y);return Ai(i,Xl(e.add(a.xyy),n.y)).compare(t).add(Ai(i,Xl(e.add(a.yyy),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.xyx),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.yyx),n.y)).compare(t)).add(Ai(i,Xl(e,n.y)).compare(t)).add(Ai(i,Xl(e.add(a.xxy),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.yxy),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.xxx),n.y)).compare(t)).add(Ai(i,Xl(e.add(a.yxx),n.y)).compare(t)).mul(1/9)}),ise=je(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n})=>{const r=t.xyz.toVar(),s=r.length(),a=gn("float").setGroup(Rn).onRenderUpdate(()=>n.camera.near),l=gn("float").setGroup(Rn).onRenderUpdate(()=>n.camera.far),u=ji("bias","float",n).setGroup(Rn),h=gn(n.mapSize).setGroup(Rn),m=_e(1).toVar();return ti(s.sub(l).lessThanEqual(0).and(s.sub(a).greaterThanEqual(0)),()=>{const v=s.sub(a).div(l.sub(a)).toVar();v.addAssign(u);const x=r.normalize(),S=Ct(1).div(h.mul(Ct(4,2)));m.assign(i({depthTexture:e,bd3D:x,dp:v,texelSize:S,shadow:n}))}),m}),uN=new Ln,Nd=new gt,Am=new gt;class rse extends LB{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===BF?tse:nse}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,shadowTexture:n,depthTexture:r,shadowCoord:s,shadow:a}){return ise({filterFn:t,shadowTexture:n,depthTexture:r,shadowCoord:s,shadow:a})}renderShadow(e){const{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:a}=e,l=t.getFrameExtents();Am.copy(t.mapSize),Am.multiply(l),n.setSize(Am.width,Am.height),Nd.copy(t.mapSize);const u=s.autoClear,h=s.getClearColor(ese),m=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha),s.clear();const v=t.getViewportCount();for(let x=0;x<v;x++){const S=t.getViewport(x),w=Nd.x*S.x,R=Am.y-Nd.y-Nd.y*S.y;uN.set(w,R,Nd.x*S.z,Nd.y*S.w),n.viewport.copy(uN),t.updateMatrices(r,x),s.render(a,t.camera)}s.autoClear=u,s.setClearColor(h,m)}}const sse=(i,e)=>_t(new rse(i,e)),BB=je(({color:i,lightViewPosition:e,cutoffDistance:t,decayExponent:n},r)=>{const s=r.context.lightingModel,a=e.sub(Xr),l=a.normalize(),u=a.length(),h=UE({lightDistance:u,cutoffDistance:t,decayExponent:n}),m=i.mul(h),v=r.context.reflectedLight;s.direct({lightDirection:l,lightColor:m,reflectedLight:v},r.stack,r)});class ase extends xA{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=gn(0).setGroup(Rn),this.decayExponentNode=gn(2).setGroup(Rn)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return sse(this.light)}setup(e){super.setup(e),BB({color:this.colorNode,lightViewPosition:Jy(this.light),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode}).append()}}const ose=je(([i=Er()])=>{const e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),zm=je(([i,e,t])=>{const n=_e(t).toVar(),r=_e(e).toVar(),s=Ic(i).toVar();return zs(s,r,n)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),ry=je(([i,e])=>{const t=Ic(e).toVar(),n=_e(i).toVar();return zs(t,n.negate(),n)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Yr=je(([i])=>{const e=_e(i).toVar();return Ee(hu(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),_r=je(([i,e])=>{const t=_e(i).toVar();return e.assign(Yr(t)),t.sub(_e(e))}),lse=je(([i,e,t,n,r,s])=>{const a=_e(s).toVar(),l=_e(r).toVar(),u=_e(n).toVar(),h=_e(t).toVar(),m=_e(e).toVar(),v=_e(i).toVar(),x=_e(wi(1,l)).toVar();return wi(1,a).mul(v.mul(x).add(m.mul(l))).add(a.mul(h.mul(x).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"}]}),use=je(([i,e,t,n,r,s])=>{const a=_e(s).toVar(),l=_e(r).toVar(),u=Be(n).toVar(),h=Be(t).toVar(),m=Be(e).toVar(),v=Be(i).toVar(),x=_e(wi(1,l)).toVar();return wi(1,a).mul(v.mul(x).add(m.mul(l))).add(a.mul(h.mul(x).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"}]}),OB=Vs([lse,use]),cse=je(([i,e,t,n,r,s,a,l,u,h,m])=>{const v=_e(m).toVar(),x=_e(h).toVar(),S=_e(u).toVar(),w=_e(l).toVar(),R=_e(a).toVar(),C=_e(s).toVar(),E=_e(r).toVar(),B=_e(n).toVar(),L=_e(t).toVar(),O=_e(e).toVar(),G=_e(i).toVar(),q=_e(wi(1,S)).toVar(),z=_e(wi(1,x)).toVar();return _e(wi(1,v)).toVar().mul(z.mul(G.mul(q).add(O.mul(S))).add(x.mul(L.mul(q).add(B.mul(S))))).add(v.mul(z.mul(E.mul(q).add(C.mul(S))).add(x.mul(R.mul(q).add(w.mul(S))))))}).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"}]}),hse=je(([i,e,t,n,r,s,a,l,u,h,m])=>{const v=_e(m).toVar(),x=_e(h).toVar(),S=_e(u).toVar(),w=Be(l).toVar(),R=Be(a).toVar(),C=Be(s).toVar(),E=Be(r).toVar(),B=Be(n).toVar(),L=Be(t).toVar(),O=Be(e).toVar(),G=Be(i).toVar(),q=_e(wi(1,S)).toVar(),z=_e(wi(1,x)).toVar();return _e(wi(1,v)).toVar().mul(z.mul(G.mul(q).add(O.mul(S))).add(x.mul(L.mul(q).add(B.mul(S))))).add(v.mul(z.mul(E.mul(q).add(C.mul(S))).add(x.mul(R.mul(q).add(w.mul(S))))))}).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"}]}),IB=Vs([cse,hse]),fse=je(([i,e,t])=>{const n=_e(t).toVar(),r=_e(e).toVar(),s=Zt(i).toVar(),a=Zt(s.bitAnd(Zt(7))).toVar(),l=_e(zm(a.lessThan(Zt(4)),r,n)).toVar(),u=_e(Wn(2,zm(a.lessThan(Zt(4)),n,r))).toVar();return ry(l,Ic(a.bitAnd(Zt(1)))).add(ry(u,Ic(a.bitAnd(Zt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Ase=je(([i,e,t,n])=>{const r=_e(n).toVar(),s=_e(t).toVar(),a=_e(e).toVar(),l=Zt(i).toVar(),u=Zt(l.bitAnd(Zt(15))).toVar(),h=_e(zm(u.lessThan(Zt(8)),a,s)).toVar(),m=_e(zm(u.lessThan(Zt(4)),s,zm(u.equal(Zt(12)).or(u.equal(Zt(14))),a,r))).toVar();return ry(h,Ic(u.bitAnd(Zt(1)))).add(ry(m,Ic(u.bitAnd(Zt(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"}]}),Rs=Vs([fse,Ase]),dse=je(([i,e,t])=>{const n=_e(t).toVar(),r=_e(e).toVar(),s=Y0(i).toVar();return Be(Rs(s.x,r,n),Rs(s.y,r,n),Rs(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),pse=je(([i,e,t,n])=>{const r=_e(n).toVar(),s=_e(t).toVar(),a=_e(e).toVar(),l=Y0(i).toVar();return Be(Rs(l.x,a,s,r),Rs(l.y,a,s,r),Rs(l.z,a,s,r))}).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"}]}),Ho=Vs([dse,pse]),mse=je(([i])=>{const e=_e(i).toVar();return Wn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),gse=je(([i])=>{const e=_e(i).toVar();return Wn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),vse=je(([i])=>{const e=Be(i).toVar();return Wn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),FB=Vs([mse,vse]),_se=je(([i])=>{const e=Be(i).toVar();return Wn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),kB=Vs([gse,_se]),To=je(([i,e])=>{const t=Ee(e).toVar(),n=Zt(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(Ee(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),zB=je(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(To(t,Ee(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(To(i,Ee(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(To(e,Ee(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(To(t,Ee(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(To(i,Ee(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(To(e,Ee(4))),e.addAssign(i)}),n1=je(([i,e,t])=>{const n=Zt(t).toVar(),r=Zt(e).toVar(),s=Zt(i).toVar();return n.bitXorAssign(r),n.subAssign(To(r,Ee(14))),s.bitXorAssign(n),s.subAssign(To(n,Ee(11))),r.bitXorAssign(s),r.subAssign(To(s,Ee(25))),n.bitXorAssign(r),n.subAssign(To(r,Ee(16))),s.bitXorAssign(n),s.subAssign(To(n,Ee(4))),r.bitXorAssign(s),r.subAssign(To(s,Ee(14))),n.bitXorAssign(r),n.subAssign(To(r,Ee(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),oa=je(([i])=>{const e=Zt(i).toVar();return _e(e).div(_e(Zt(Ee(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),fu=je(([i])=>{const e=_e(i).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"}]}),yse=je(([i])=>{const e=Ee(i).toVar(),t=Zt(Zt(1)).toVar(),n=Zt(Zt(Ee(3735928559)).add(t.shiftLeft(Zt(2))).add(Zt(13))).toVar();return n1(n.add(Zt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),xse=je(([i,e])=>{const t=Ee(e).toVar(),n=Ee(i).toVar(),r=Zt(Zt(2)).toVar(),s=Zt().toVar(),a=Zt().toVar(),l=Zt().toVar();return s.assign(a.assign(l.assign(Zt(Ee(3735928559)).add(r.shiftLeft(Zt(2))).add(Zt(13))))),s.addAssign(Zt(n)),a.addAssign(Zt(t)),n1(s,a,l)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),bse=je(([i,e,t])=>{const n=Ee(t).toVar(),r=Ee(e).toVar(),s=Ee(i).toVar(),a=Zt(Zt(3)).toVar(),l=Zt().toVar(),u=Zt().toVar(),h=Zt().toVar();return l.assign(u.assign(h.assign(Zt(Ee(3735928559)).add(a.shiftLeft(Zt(2))).add(Zt(13))))),l.addAssign(Zt(s)),u.addAssign(Zt(r)),h.addAssign(Zt(n)),n1(l,u,h)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Sse=je(([i,e,t,n])=>{const r=Ee(n).toVar(),s=Ee(t).toVar(),a=Ee(e).toVar(),l=Ee(i).toVar(),u=Zt(Zt(4)).toVar(),h=Zt().toVar(),m=Zt().toVar(),v=Zt().toVar();return h.assign(m.assign(v.assign(Zt(Ee(3735928559)).add(u.shiftLeft(Zt(2))).add(Zt(13))))),h.addAssign(Zt(l)),m.addAssign(Zt(a)),v.addAssign(Zt(s)),zB(h,m,v),h.addAssign(Zt(r)),n1(h,m,v)}).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"}]}),Tse=je(([i,e,t,n,r])=>{const s=Ee(r).toVar(),a=Ee(n).toVar(),l=Ee(t).toVar(),u=Ee(e).toVar(),h=Ee(i).toVar(),m=Zt(Zt(5)).toVar(),v=Zt().toVar(),x=Zt().toVar(),S=Zt().toVar();return v.assign(x.assign(S.assign(Zt(Ee(3735928559)).add(m.shiftLeft(Zt(2))).add(Zt(13))))),v.addAssign(Zt(h)),x.addAssign(Zt(u)),S.addAssign(Zt(l)),zB(v,x,S),v.addAssign(Zt(a)),x.addAssign(Zt(s)),n1(v,x,S)}).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"}]}),Wi=Vs([yse,xse,bse,Sse,Tse]),wse=je(([i,e])=>{const t=Ee(e).toVar(),n=Ee(i).toVar(),r=Zt(Wi(n,t)).toVar(),s=Y0().toVar();return s.x.assign(r.bitAnd(Ee(255))),s.y.assign(r.shiftRight(Ee(8)).bitAnd(Ee(255))),s.z.assign(r.shiftRight(Ee(16)).bitAnd(Ee(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Mse=je(([i,e,t])=>{const n=Ee(t).toVar(),r=Ee(e).toVar(),s=Ee(i).toVar(),a=Zt(Wi(s,r,n)).toVar(),l=Y0().toVar();return l.x.assign(a.bitAnd(Ee(255))),l.y.assign(a.shiftRight(Ee(8)).bitAnd(Ee(255))),l.z.assign(a.shiftRight(Ee(16)).bitAnd(Ee(255))),l}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),jo=Vs([wse,Mse]),Ese=je(([i])=>{const e=Ct(i).toVar(),t=Ee().toVar(),n=Ee().toVar(),r=_e(_r(e.x,t)).toVar(),s=_e(_r(e.y,n)).toVar(),a=_e(fu(r)).toVar(),l=_e(fu(s)).toVar(),u=_e(OB(Rs(Wi(t,n),r,s),Rs(Wi(t.add(Ee(1)),n),r.sub(1),s),Rs(Wi(t,n.add(Ee(1))),r,s.sub(1)),Rs(Wi(t.add(Ee(1)),n.add(Ee(1))),r.sub(1),s.sub(1)),a,l)).toVar();return FB(u)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),Cse=je(([i])=>{const e=Be(i).toVar(),t=Ee().toVar(),n=Ee().toVar(),r=Ee().toVar(),s=_e(_r(e.x,t)).toVar(),a=_e(_r(e.y,n)).toVar(),l=_e(_r(e.z,r)).toVar(),u=_e(fu(s)).toVar(),h=_e(fu(a)).toVar(),m=_e(fu(l)).toVar(),v=_e(IB(Rs(Wi(t,n,r),s,a,l),Rs(Wi(t.add(Ee(1)),n,r),s.sub(1),a,l),Rs(Wi(t,n.add(Ee(1)),r),s,a.sub(1),l),Rs(Wi(t.add(Ee(1)),n.add(Ee(1)),r),s.sub(1),a.sub(1),l),Rs(Wi(t,n,r.add(Ee(1))),s,a,l.sub(1)),Rs(Wi(t.add(Ee(1)),n,r.add(Ee(1))),s.sub(1),a,l.sub(1)),Rs(Wi(t,n.add(Ee(1)),r.add(Ee(1))),s,a.sub(1),l.sub(1)),Rs(Wi(t.add(Ee(1)),n.add(Ee(1)),r.add(Ee(1))),s.sub(1),a.sub(1),l.sub(1)),u,h,m)).toVar();return kB(v)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),BE=Vs([Ese,Cse]),Rse=je(([i])=>{const e=Ct(i).toVar(),t=Ee().toVar(),n=Ee().toVar(),r=_e(_r(e.x,t)).toVar(),s=_e(_r(e.y,n)).toVar(),a=_e(fu(r)).toVar(),l=_e(fu(s)).toVar(),u=Be(OB(Ho(jo(t,n),r,s),Ho(jo(t.add(Ee(1)),n),r.sub(1),s),Ho(jo(t,n.add(Ee(1))),r,s.sub(1)),Ho(jo(t.add(Ee(1)),n.add(Ee(1))),r.sub(1),s.sub(1)),a,l)).toVar();return FB(u)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Nse=je(([i])=>{const e=Be(i).toVar(),t=Ee().toVar(),n=Ee().toVar(),r=Ee().toVar(),s=_e(_r(e.x,t)).toVar(),a=_e(_r(e.y,n)).toVar(),l=_e(_r(e.z,r)).toVar(),u=_e(fu(s)).toVar(),h=_e(fu(a)).toVar(),m=_e(fu(l)).toVar(),v=Be(IB(Ho(jo(t,n,r),s,a,l),Ho(jo(t.add(Ee(1)),n,r),s.sub(1),a,l),Ho(jo(t,n.add(Ee(1)),r),s,a.sub(1),l),Ho(jo(t.add(Ee(1)),n.add(Ee(1)),r),s.sub(1),a.sub(1),l),Ho(jo(t,n,r.add(Ee(1))),s,a,l.sub(1)),Ho(jo(t.add(Ee(1)),n,r.add(Ee(1))),s.sub(1),a,l.sub(1)),Ho(jo(t,n.add(Ee(1)),r.add(Ee(1))),s,a.sub(1),l.sub(1)),Ho(jo(t.add(Ee(1)),n.add(Ee(1)),r.add(Ee(1))),s.sub(1),a.sub(1),l.sub(1)),u,h,m)).toVar();return kB(v)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),OE=Vs([Rse,Nse]),Dse=je(([i])=>{const e=_e(i).toVar(),t=Ee(Yr(e)).toVar();return oa(Wi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Pse=je(([i])=>{const e=Ct(i).toVar(),t=Ee(Yr(e.x)).toVar(),n=Ee(Yr(e.y)).toVar();return oa(Wi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Lse=je(([i])=>{const e=Be(i).toVar(),t=Ee(Yr(e.x)).toVar(),n=Ee(Yr(e.y)).toVar(),r=Ee(Yr(e.z)).toVar();return oa(Wi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Use=je(([i])=>{const e=dn(i).toVar(),t=Ee(Yr(e.x)).toVar(),n=Ee(Yr(e.y)).toVar(),r=Ee(Yr(e.z)).toVar(),s=Ee(Yr(e.w)).toVar();return oa(Wi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),Bse=Vs([Dse,Pse,Lse,Use]),Ose=je(([i])=>{const e=_e(i).toVar(),t=Ee(Yr(e)).toVar();return Be(oa(Wi(t,Ee(0))),oa(Wi(t,Ee(1))),oa(Wi(t,Ee(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),Ise=je(([i])=>{const e=Ct(i).toVar(),t=Ee(Yr(e.x)).toVar(),n=Ee(Yr(e.y)).toVar();return Be(oa(Wi(t,n,Ee(0))),oa(Wi(t,n,Ee(1))),oa(Wi(t,n,Ee(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Fse=je(([i])=>{const e=Be(i).toVar(),t=Ee(Yr(e.x)).toVar(),n=Ee(Yr(e.y)).toVar(),r=Ee(Yr(e.z)).toVar();return Be(oa(Wi(t,n,r,Ee(0))),oa(Wi(t,n,r,Ee(1))),oa(Wi(t,n,r,Ee(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),kse=je(([i])=>{const e=dn(i).toVar(),t=Ee(Yr(e.x)).toVar(),n=Ee(Yr(e.y)).toVar(),r=Ee(Yr(e.z)).toVar(),s=Ee(Yr(e.w)).toVar();return Be(oa(Wi(t,n,r,s,Ee(0))),oa(Wi(t,n,r,s,Ee(1))),oa(Wi(t,n,r,s,Ee(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),GB=Vs([Ose,Ise,Fse,kse]),sy=je(([i,e,t,n])=>{const r=_e(n).toVar(),s=_e(t).toVar(),a=Ee(e).toVar(),l=Be(i).toVar(),u=_e(0).toVar(),h=_e(1).toVar();return ki(a,()=>{u.addAssign(h.mul(BE(l))),h.mulAssign(r),l.mulAssign(s)}),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"}]}),qB=je(([i,e,t,n])=>{const r=_e(n).toVar(),s=_e(t).toVar(),a=Ee(e).toVar(),l=Be(i).toVar(),u=Be(0).toVar(),h=_e(1).toVar();return ki(a,()=>{u.addAssign(h.mul(OE(l))),h.mulAssign(r),l.mulAssign(s)}),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"}]}),zse=je(([i,e,t,n])=>{const r=_e(n).toVar(),s=_e(t).toVar(),a=Ee(e).toVar(),l=Be(i).toVar();return Ct(sy(l,a,s,r),sy(l.add(Be(Ee(19),Ee(193),Ee(17))),a,s,r))}).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"}]}),Gse=je(([i,e,t,n])=>{const r=_e(n).toVar(),s=_e(t).toVar(),a=Ee(e).toVar(),l=Be(i).toVar(),u=Be(qB(l,a,s,r)).toVar(),h=_e(sy(l.add(Be(Ee(19),Ee(193),Ee(17))),a,s,r)).toVar();return dn(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"}]}),qse=je(([i,e,t,n,r,s,a])=>{const l=Ee(a).toVar(),u=_e(s).toVar(),h=Ee(r).toVar(),m=Ee(n).toVar(),v=Ee(t).toVar(),x=Ee(e).toVar(),S=Ct(i).toVar(),w=Be(GB(Ct(x.add(m),v.add(h)))).toVar(),R=Ct(w.x,w.y).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);const C=Ct(Ct(_e(x),_e(v)).add(R)).toVar(),E=Ct(C.sub(S)).toVar();return ti(l.equal(Ee(2)),()=>ur(E.x).add(ur(E.y))),ti(l.equal(Ee(3)),()=>qr(ur(E.x),ur(E.y))),Xh(E,E)}).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"}]}),Vse=je(([i,e,t,n,r,s,a,l,u])=>{const h=Ee(u).toVar(),m=_e(l).toVar(),v=Ee(a).toVar(),x=Ee(s).toVar(),S=Ee(r).toVar(),w=Ee(n).toVar(),R=Ee(t).toVar(),C=Ee(e).toVar(),E=Be(i).toVar(),B=Be(GB(Be(C.add(S),R.add(x),w.add(v)))).toVar();B.subAssign(.5),B.mulAssign(m),B.addAssign(.5);const L=Be(Be(_e(C),_e(R),_e(w)).add(B)).toVar(),O=Be(L.sub(E)).toVar();return ti(h.equal(Ee(2)),()=>ur(O.x).add(ur(O.y)).add(ur(O.z))),ti(h.equal(Ee(3)),()=>qr(qr(ur(O.x),ur(O.y)),ur(O.z))),Xh(O,O)}).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"}]}),Z0=Vs([qse,Vse]),Hse=je(([i,e,t])=>{const n=Ee(t).toVar(),r=_e(e).toVar(),s=Ct(i).toVar(),a=Ee().toVar(),l=Ee().toVar(),u=Ct(_r(s.x,a),_r(s.y,l)).toVar(),h=_e(1e6).toVar();return ki({start:-1,end:Ee(1),name:"x",condition:"<="},({x:m})=>{ki({start:-1,end:Ee(1),name:"y",condition:"<="},({y:v})=>{const x=_e(Z0(u,m,v,a,l,r,n)).toVar();h.assign(to(h,x))})}),ti(n.equal(Ee(0)),()=>{h.assign(Cu(h))}),h}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),jse=je(([i,e,t])=>{const n=Ee(t).toVar(),r=_e(e).toVar(),s=Ct(i).toVar(),a=Ee().toVar(),l=Ee().toVar(),u=Ct(_r(s.x,a),_r(s.y,l)).toVar(),h=Ct(1e6,1e6).toVar();return ki({start:-1,end:Ee(1),name:"x",condition:"<="},({x:m})=>{ki({start:-1,end:Ee(1),name:"y",condition:"<="},({y:v})=>{const x=_e(Z0(u,m,v,a,l,r,n)).toVar();ti(x.lessThan(h.x),()=>{h.y.assign(h.x),h.x.assign(x)}).ElseIf(x.lessThan(h.y),()=>{h.y.assign(x)})})}),ti(n.equal(Ee(0)),()=>{h.assign(Cu(h))}),h}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Wse=je(([i,e,t])=>{const n=Ee(t).toVar(),r=_e(e).toVar(),s=Ct(i).toVar(),a=Ee().toVar(),l=Ee().toVar(),u=Ct(_r(s.x,a),_r(s.y,l)).toVar(),h=Be(1e6,1e6,1e6).toVar();return ki({start:-1,end:Ee(1),name:"x",condition:"<="},({x:m})=>{ki({start:-1,end:Ee(1),name:"y",condition:"<="},({y:v})=>{const x=_e(Z0(u,m,v,a,l,r,n)).toVar();ti(x.lessThan(h.x),()=>{h.z.assign(h.y),h.y.assign(h.x),h.x.assign(x)}).ElseIf(x.lessThan(h.y),()=>{h.z.assign(h.y),h.y.assign(x)}).ElseIf(x.lessThan(h.z),()=>{h.z.assign(x)})})}),ti(n.equal(Ee(0)),()=>{h.assign(Cu(h))}),h}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),$se=je(([i,e,t])=>{const n=Ee(t).toVar(),r=_e(e).toVar(),s=Be(i).toVar(),a=Ee().toVar(),l=Ee().toVar(),u=Ee().toVar(),h=Be(_r(s.x,a),_r(s.y,l),_r(s.z,u)).toVar(),m=_e(1e6).toVar();return ki({start:-1,end:Ee(1),name:"x",condition:"<="},({x:v})=>{ki({start:-1,end:Ee(1),name:"y",condition:"<="},({y:x})=>{ki({start:-1,end:Ee(1),name:"z",condition:"<="},({z:S})=>{const w=_e(Z0(h,v,x,S,a,l,u,r,n)).toVar();m.assign(to(m,w))})})}),ti(n.equal(Ee(0)),()=>{m.assign(Cu(m))}),m}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Xse=Vs([Hse,$se]),Yse=je(([i,e,t])=>{const n=Ee(t).toVar(),r=_e(e).toVar(),s=Be(i).toVar(),a=Ee().toVar(),l=Ee().toVar(),u=Ee().toVar(),h=Be(_r(s.x,a),_r(s.y,l),_r(s.z,u)).toVar(),m=Ct(1e6,1e6).toVar();return ki({start:-1,end:Ee(1),name:"x",condition:"<="},({x:v})=>{ki({start:-1,end:Ee(1),name:"y",condition:"<="},({y:x})=>{ki({start:-1,end:Ee(1),name:"z",condition:"<="},({z:S})=>{const w=_e(Z0(h,v,x,S,a,l,u,r,n)).toVar();ti(w.lessThan(m.x),()=>{m.y.assign(m.x),m.x.assign(w)}).ElseIf(w.lessThan(m.y),()=>{m.y.assign(w)})})})}),ti(n.equal(Ee(0)),()=>{m.assign(Cu(m))}),m}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Qse=Vs([jse,Yse]),Kse=je(([i,e,t])=>{const n=Ee(t).toVar(),r=_e(e).toVar(),s=Be(i).toVar(),a=Ee().toVar(),l=Ee().toVar(),u=Ee().toVar(),h=Be(_r(s.x,a),_r(s.y,l),_r(s.z,u)).toVar(),m=Be(1e6,1e6,1e6).toVar();return ki({start:-1,end:Ee(1),name:"x",condition:"<="},({x:v})=>{ki({start:-1,end:Ee(1),name:"y",condition:"<="},({y:x})=>{ki({start:-1,end:Ee(1),name:"z",condition:"<="},({z:S})=>{const w=_e(Z0(h,v,x,S,a,l,u,r,n)).toVar();ti(w.lessThan(m.x),()=>{m.z.assign(m.y),m.y.assign(m.x),m.x.assign(w)}).ElseIf(w.lessThan(m.y),()=>{m.z.assign(m.y),m.y.assign(w)}).ElseIf(w.lessThan(m.z),()=>{m.z.assign(w)})})})}),ti(n.equal(Ee(0)),()=>{m.assign(Cu(m))}),m}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Zse=Vs([Wse,Kse]),Jse=je(([i])=>{const e=i.y,t=i.z,n=Be().toVar();return ti(e.lessThan(1e-4),()=>{n.assign(Be(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(hu(r)).mul(6).toVar();const s=Ee(QM(r)),a=r.sub(_e(s)),l=t.mul(e.oneMinus()),u=t.mul(e.mul(a).oneMinus()),h=t.mul(e.mul(a.oneMinus()).oneMinus());ti(s.equal(Ee(0)),()=>{n.assign(Be(t,h,l))}).ElseIf(s.equal(Ee(1)),()=>{n.assign(Be(u,t,l))}).ElseIf(s.equal(Ee(2)),()=>{n.assign(Be(l,t,h))}).ElseIf(s.equal(Ee(3)),()=>{n.assign(Be(l,u,t))}).ElseIf(s.equal(Ee(4)),()=>{n.assign(Be(h,l,t))}).Else(()=>{n.assign(Be(t,l,u))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),eae=je(([i])=>{const e=Be(i).toVar(),t=_e(e.x).toVar(),n=_e(e.y).toVar(),r=_e(e.z).toVar(),s=_e(to(t,to(n,r))).toVar(),a=_e(qr(t,qr(n,r))).toVar(),l=_e(a.sub(s)).toVar(),u=_e().toVar(),h=_e().toVar(),m=_e().toVar();return m.assign(a),ti(a.greaterThan(0),()=>{h.assign(l.div(a))}).Else(()=>{h.assign(0)}),ti(h.lessThanEqual(0),()=>{u.assign(0)}).Else(()=>{ti(t.greaterThanEqual(a),()=>{u.assign(n.sub(r).div(l))}).ElseIf(n.greaterThanEqual(a),()=>{u.assign(Qr(2,r.sub(t).div(l)))}).Else(()=>{u.assign(Qr(4,t.sub(n).div(l)))}),u.mulAssign(1/6),ti(u.lessThan(0),()=>{u.addAssign(1)})}),Be(u,h,m)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),tae=je(([i])=>{const e=Be(i).toVar(),t=LM(VM(e,Be(.04045))).toVar(),n=Be(e.div(12.92)).toVar(),r=Be(Cl(qr(e.add(Be(.055)),Be(0)).div(1.055),Be(2.4))).toVar();return Fi(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),VB=(i,e)=>{i=_e(i),e=_e(e);const t=Ct(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return kc(i.sub(t),i.add(t),e)},HB=(i,e,t,n)=>Fi(i,e,t[n].clamp()),nae=(i,e,t=Er())=>HB(i,e,t,"x"),iae=(i,e,t=Er())=>HB(i,e,t,"y"),jB=(i,e,t,n,r)=>Fi(i,e,VB(t,n[r])),rae=(i,e,t,n=Er())=>jB(i,e,t,n,"x"),sae=(i,e,t,n=Er())=>jB(i,e,t,n,"y"),aae=(i=1,e=0,t=Er())=>t.mul(i).add(e),oae=(i,e=1)=>(i=_e(i),i.abs().pow(e).mul(i.sign())),lae=(i,e=1,t=.5)=>_e(i).sub(t).mul(e).add(t),uae=(i=Er(),e=1,t=0)=>BE(i.convert("vec2|vec3")).mul(e).add(t),cae=(i=Er(),e=1,t=0)=>OE(i.convert("vec2|vec3")).mul(e).add(t),hae=(i=Er(),e=1,t=0)=>(i=i.convert("vec2|vec3"),dn(OE(i),BE(i.add(Ct(19,73)))).mul(e).add(t)),fae=(i=Er(),e=1)=>Xse(i.convert("vec2|vec3"),e,Ee(1)),Aae=(i=Er(),e=1)=>Qse(i.convert("vec2|vec3"),e,Ee(1)),dae=(i=Er(),e=1)=>Zse(i.convert("vec2|vec3"),e,Ee(1)),pae=(i=Er())=>Bse(i.convert("vec2|vec3")),mae=(i=Er(),e=3,t=2,n=.5,r=1)=>sy(i,Ee(e),t,n).mul(r),gae=(i=Er(),e=3,t=2,n=.5,r=1)=>zse(i,Ee(e),t,n).mul(r),vae=(i=Er(),e=3,t=2,n=.5,r=1)=>qB(i,Ee(e),t,n).mul(r),_ae=(i=Er(),e=3,t=2,n=.5,r=1)=>Gse(i,Ee(e),t,n).mul(r),yae=je(([i,e,t])=>{const n=Fc(i).toVar("nDir"),r=wi(_e(.5).mul(e.sub(t)),Nc).div(n).toVar("rbmax"),s=wi(_e(-.5).mul(e.sub(t)),Nc).div(n).toVar("rbmin"),a=Be().toVar("rbminmax");a.x=n.x.greaterThan(_e(0)).select(r.x,s.x),a.y=n.y.greaterThan(_e(0)).select(r.y,s.y),a.z=n.z.greaterThan(_e(0)).select(r.z,s.z);const l=to(to(a.x,a.y),a.z).toVar("correction");return Nc.add(n.mul(l)).toVar("boxIntersection").sub(t)}),WB=je(([i,e])=>{const t=i.x,n=i.y,r=i.z;let s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(Wn(t,t).sub(Wn(n,n)))),s});var W=Object.freeze({__proto__:null,BRDF_GGX:XT,BRDF_Lambert:AA,BasicShadowFilter:RB,Break:wU,Continue:bee,DFGApprox:_E,D_GGX:zU,Discard:_9,EPSILON:wL,F_Schlick:F0,Fn:je,INFINITY:AJ,If:ti,Loop:ki,NodeAccess:sa,NodeShaderStage:IT,NodeType:VZ,NodeUpdateType:jn,PCFShadowFilter:NB,PCFSoftShadowFilter:DB,PI:Z_,PI2:dJ,Return:RJ,Schlick_to_F0:qU,ScriptableNodeResources:i_,ShaderNode:Um,TBNViewMatrix:Yf,VSMShadowFilter:PB,V_GGX_SmithCorrelated:kU,abs:ur,acesFilmicToneMapping:yB,acos:DL,add:Qr,addMethodChaining:ut,addNodeElement:DJ,agxToneMapping:xB,all:HM,alphaT:Y_,and:dL,anisotropy:Rh,anisotropyB:iA,anisotropyT:Bm,any:ML,append:$P,arrayBuffer:lJ,asin:NL,assign:oL,atan:$M,atan2:KL,atomicAdd:Rre,atomicAnd:Lre,atomicFunc:jc,atomicMax:Dre,atomicMin:Pre,atomicOr:Ure,atomicStore:Cre,atomicSub:Nre,atomicXor:Bre,attenuationColor:zM,attenuationDistance:kM,attribute:_u,attributeArray:bie,backgroundBlurriness:lB,backgroundIntensity:ew,backgroundRotation:uB,batch:bU,billboarding:tie,bitAnd:vL,bitNot:_L,bitOr:yL,bitXor:xL,bitangentGeometry:nee,bitangentLocal:iee,bitangentView:I9,bitangentWorld:ree,bitcast:pJ,blendBurn:fB,blendColor:Uie,blendDodge:AB,blendOverlay:pB,blendScreen:dB,blur:YU,bool:Ic,buffer:Yg,bufferAttribute:$g,bumpMap:G9,burn:Bie,bvec2:QP,bvec3:LM,bvec4:eL,bypass:p9,cache:Im,call:lL,cameraFar:Ph,cameraNear:Dh,cameraNormalMatrix:IJ,cameraPosition:S9,cameraProjectionMatrix:_A,cameraProjectionMatrixInverse:BJ,cameraViewMatrix:so,cameraWorldMatrix:OJ,cbrt:jL,cdl:Vie,ceil:Iy,checker:ose,cineonToneMapping:_B,clamp:vu,clearcoat:X_,clearcoatRoughness:wg,code:Ky,color:XP,colorSpaceToWorking:nE,colorToDirection:Kee,compute:d9,cond:ZL,context:zy,convert:nL,convertColorSpace:yJ,convertToTexture:die,cos:yc,cross:ky,cubeTexture:I0,dFdx:XM,dFdy:YM,dashSize:Qv,defaultBuildStages:FT,defaultShaderStages:GP,defined:xg,degrees:CL,deltaTime:sB,densityFog:fre,densityFogFactor:EE,depth:pE,depthPass:Yie,difference:GL,diffuseColor:Ui,directPointLight:BB,directionToColor:PU,dispersion:GM,distance:zL,div:Dl,dodge:Oie,dot:Xh,drawIndex:_U,dynamicBufferAttribute:A9,element:tL,emissive:qT,equal:uL,equals:FL,equirectUV:mE,exp:jM,exp2:O0,expression:Hh,faceDirection:Xg,faceForward:eE,faceforward:mJ,float:_e,floor:hu,fog:Ng,fract:Hc,frameGroup:sL,frameId:jne,frontFacing:E9,fwidth:OL,gain:Fne,gapSize:VT,getConstNodeType:WP,getCurrentStack:PM,getDirection:$U,getDistanceAttenuation:UE,getGeometryRoughness:FU,getNormalFromDepth:mie,getParallaxCorrectNormal:yae,getRoughness:vE,getScreenPosition:pie,getShIrradianceAt:WB,getTextureIndex:iB,getViewPosition:zd,glsl:rre,glslFn:sre,grayscale:kie,greaterThan:VM,greaterThanEqual:AL,hash:Ine,highpModelNormalViewMatrix:XJ,highpModelViewMatrix:$J,hue:qie,instance:gee,instanceIndex:Jg,instancedArray:Sie,instancedBufferAttribute:J_,instancedDynamicBufferAttribute:HT,instancedMesh:xU,int:Ee,inverseSqrt:WM,inversesqrt:gJ,invocationLocalIndex:mee,invocationSubgroupIndex:pee,ior:Om,iridescence:By,iridescenceIOR:OM,iridescenceThickness:IM,ivec2:ms,ivec3:KP,ivec4:ZP,js:nre,label:e9,length:Rc,lengthSq:WL,lessThan:hL,lessThanEqual:fL,lightPosition:NE,lightProjectionUV:EB,lightShadowMatrix:RE,lightTargetDirection:DE,lightTargetPosition:CB,lightViewPosition:Jy,lightingContext:EU,lights:Fre,linearDepth:ty,linearToneMapping:gB,localId:vre,log:Oy,log2:cu,logarithmicDepthToViewZ:Oee,loop:See,luminance:wE,mat2:Ly,mat3:ha,mat4:nA,matcapUV:KU,materialAO:gU,materialAlphaTest:q9,materialAnisotropy:iU,materialAnisotropyVector:kd,materialAttenuationColor:hU,materialAttenuationDistance:cU,materialClearcoat:K9,materialClearcoatNormal:J9,materialClearcoatRoughness:Z9,materialColor:V9,materialDispersion:mU,materialEmissive:j9,materialIOR:uU,materialIridescence:rU,materialIridescenceIOR:sU,materialIridescenceThickness:aU,materialLightMap:lE,materialLineDashOffset:pU,materialLineDashSize:AU,materialLineGapSize:dU,materialLineScale:fU,materialLineWidth:fee,materialMetalness:Y9,materialNormal:Q9,materialOpacity:oE,materialPointWidth:Aee,materialReference:Tc,materialReflectivity:Jv,materialRefractionRatio:N9,materialRotation:eU,materialRoughness:X9,materialSheen:tU,materialSheenRoughness:nU,materialShininess:H9,materialSpecular:W9,materialSpecularColor:$9,materialSpecularIntensity:$T,materialSpecularStrength:Fm,materialThickness:lU,materialTransmission:oU,max:qr,maxMipLevel:b9,mediumpModelViewMatrix:M9,metalness:Tg,min:to,mix:Fi,mixElement:YL,mod:KM,modInt:qM,modelDirection:qJ,modelNormalMatrix:w9,modelPosition:VJ,modelScale:HJ,modelViewMatrix:Q0,modelViewPosition:jJ,modelViewProjection:uE,modelWorldMatrix:$o,modelWorldMatrixInverse:WJ,morphReference:MU,mrt:rB,mul:Wn,mx_aastep:VB,mx_cell_noise_float:pae,mx_contrast:lae,mx_fractal_noise_float:mae,mx_fractal_noise_vec2:gae,mx_fractal_noise_vec3:vae,mx_fractal_noise_vec4:_ae,mx_hsvtorgb:Jse,mx_noise_float:uae,mx_noise_vec3:cae,mx_noise_vec4:hae,mx_ramplr:nae,mx_ramptb:iae,mx_rgbtohsv:eae,mx_safepower:oae,mx_splitlr:rae,mx_splittb:sae,mx_srgb_texture_to_lin_rec709:tae,mx_transform_uv:aae,mx_worley_noise_float:fae,mx_worley_noise_vec2:Aae,mx_worley_noise_vec3:dae,negate:PL,neutralToneMapping:bB,nodeArray:tA,nodeImmutable:Wt,nodeObject:_t,nodeObjects:Vg,nodeProxy:ct,normalFlat:C9,normalGeometry:qy,normalLocal:no,normalMap:WT,normalView:Jo,normalWorld:Vy,normalize:Fc,not:mL,notEqual:cL,numWorkgroups:mre,objectDirection:FJ,objectGroup:BM,objectPosition:T9,objectScale:zJ,objectViewPosition:GJ,objectWorldMatrix:kJ,oneMinus:LL,or:pL,orthographicDepthToViewZ:Bee,oscSawtooth:Zne,oscSine:Yne,oscSquare:Qne,oscTriangle:Kne,output:Eg,outputStruct:Bne,overlay:Fie,overloadingFn:Vs,parabola:JT,parallaxDirection:k9,parallaxUV:aee,parameter:Lne,pass:$ie,passTexture:Xie,pcurve:kne,perspectiveDepthToViewZ:AE,pmremTexture:yE,pointUV:Eie,pointWidth:cJ,positionGeometry:Gy,positionLocal:Gr,positionPrevious:ey,positionView:Xr,positionViewDirection:dr,positionWorld:Nc,positionWorldDirection:iE,posterize:jie,pow:Cl,pow2:ZM,pow3:qL,pow4:VL,property:aL,radians:EL,rand:XL,range:dre,rangeFog:hre,rangeFogFactor:ME,reciprocal:BL,reference:ji,referenceBuffer:jT,reflect:kL,reflectVector:L9,reflectView:D9,reflector:uie,refract:JM,refractVector:U9,refractView:P9,reinhardToneMapping:vB,remainder:TL,remap:g9,remapClamp:v9,renderGroup:Rn,renderOutput:y9,rendererReference:c9,rotate:xE,rotateUV:Jne,roughness:Zl,round:UL,rtt:oB,sRGBTransferEOTF:r9,sRGBTransferOETF:s9,sampler:UJ,saturate:$L,saturation:zie,screen:Iie,screenCoordinate:e1,screenSize:Rg,screenUV:bu,scriptable:cre,scriptableValue:n_,select:zs,setCurrentStack:bg,shaderStages:kT,shadow:UB,shadowPositionWorld:LE,sharedUniformGroup:UM,sheen:Xf,sheenRoughness:Uy,shiftLeft:bL,shiftRight:SL,shininess:Q_,sign:Cg,sin:Mo,sinc:zne,skinning:yee,skinningReference:TU,smoothstep:kc,smoothstepElement:QL,specularColor:ka,specularF90:Mg,spherizeUV:eie,split:uJ,spritesheetUV:rie,sqrt:Cu,stack:e_,step:Fy,storage:Qy,storageBarrier:bre,storageObject:xie,storageTexture:cB,string:oJ,sub:wi,subgroupIndex:dee,subgroupSize:_re,tan:RL,tangentGeometry:Wy,tangentLocal:Qg,tangentView:Kg,tangentWorld:O9,temp:n9,texture:Ai,texture3D:lne,textureBarrier:Sre,textureBicubic:jU,textureCubeUV:XU,textureLoad:Fr,textureSize:Fh,textureStore:Rie,thickness:FM,time:yA,timerDelta:Xne,timerGlobal:$ne,timerLocal:Wne,toOutputColorSpace:a9,toWorkingColorSpace:o9,toneMapping:h9,toneMappingExposure:f9,toonOutlinePass:Kie,transformDirection:HL,transformNormal:R9,transformNormalToView:rE,transformedBentNormalView:z9,transformedBitangentView:F9,transformedBitangentWorld:see,transformedClearcoatNormalView:Qd,transformedNormalView:zr,transformedNormalWorld:Hy,transformedTangentView:aE,transformedTangentWorld:tee,transmission:K_,transpose:IL,triNoise3D:qne,triplanarTexture:aie,triplanarTextures:aB,trunc:QM,tslFn:aJ,uint:Zt,uniform:gn,uniformArray:Sc,uniformGroup:rL,uniforms:ZJ,userData:Die,uv:Er,uvec2:YP,uvec3:Y0,uvec4:JP,varying:ro,varyingProperty:Sg,vec2:Ct,vec3:Be,vec4:dn,vectorComponents:gA,velocity:Lie,vertexColor:wie,vertexIndex:vU,vertexStage:i9,vibrance:Gie,viewZToLogarithmicDepth:dE,viewZToOrthographicDepth:s0,viewZToPerspectiveDepth:NU,viewport:cE,viewportBottomLeft:Pee,viewportCoordinate:RU,viewportDepthTexture:fE,viewportLinearDepth:Iee,viewportMipTexture:hE,viewportResolution:Nee,viewportSafeUV:nie,viewportSharedTexture:Qee,viewportSize:CU,viewportTexture:Lee,viewportTopLeft:Dee,viewportUV:Ree,wgsl:ire,wgslFn:are,workgroupArray:Mre,workgroupBarrier:xre,workgroupId:gre,workingToColorSpace:l9,xor:gL});const vc=new bE;class xae extends Yh{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){const r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background;let a=!1;if(s===null)r._clearColor.getRGB(vc,Ro),vc.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(vc,Ro),vc.a=1,a=!0;else if(s.isNode===!0){const l=this.get(e),u=s;vc.copy(r._clearColor);let h=l.backgroundMesh;if(h===void 0){const v=zy(dn(u).mul(ew),{getUV:()=>uB.mul(Vy),getTextureLevel:()=>lB});let x=uE;x=x.setZ(x.w);const S=new Vr;S.name="Background.material",S.side=hr,S.depthTest=!1,S.depthWrite=!1,S.fog=!1,S.lights=!1,S.vertexNode=x,S.colorNode=v,l.backgroundMeshNode=v,l.backgroundMesh=h=new zi(new Eu(1,32,32),S),h.frustumCulled=!1,h.name="Background.mesh",h.onBeforeRender=function(w,R,C){this.matrixWorld.copyPosition(C.matrixWorld)}}const m=u.getCacheKey();l.backgroundCacheKey!==m&&(l.backgroundMeshNode.node=dn(u).mul(ew),l.backgroundMeshNode.needsUpdate=!0,h.material.needsUpdate=!0,l.backgroundCacheKey=m),t.unshift(h,h.geometry,h.material,0,0,null,null)}else console.error("THREE.Renderer: Unsupported background configuration.",s);if(r.autoClear===!0||a===!0){const l=n.clearColorValue;l.r=vc.r,l.g=vc.g,l.b=vc.b,l.a=vc.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r._clearDepth,n.stencilClearValue=r._clearStencil,n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}}let bae=0;class tw{constructor(e="",t=[],n=0,r=[]){this.name=e,this.bindings=t,this.index=n,this.bindingsReference=r,this.id=bae++}}class Sae{constructor(e,t,n,r,s,a,l,u,h,m=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=m,this.nodeAttributes=r,this.bindings=s,this.updateNodes=a,this.updateBeforeNodes=l,this.updateAfterNodes=u,this.monitor=h,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){const r=new tw(t.name,[],t.index,t);e.push(r);for(const s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}}class cN{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class Tae{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n.getSelf()}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 $B{constructor(e,t){this.isNodeVar=!0,this.name=e,this.type=t}}class wae extends $B{constructor(e,t){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0}}class Mae{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let Eae=0;class uS{constructor(e=null){this.id=Eae++,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 Cae extends Mn{static get type(){return"StructTypeNode"}constructor(e,t){super(),this.name=e,this.types=t,this.isStructTypeNode=!0}getMemberTypes(){return this.types}}class bA{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 Rae extends bA{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class Nae extends bA{constructor(e,t=new gt){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class Dae extends bA{constructor(e,t=new he){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class Pae extends bA{constructor(e,t=new Ln){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class Lae extends bA{constructor(e,t=new an){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class Uae extends bA{constructor(e,t=new Vn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class Bae extends bA{constructor(e,t=new kn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class Oae extends Rae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Iae extends Nae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Fae extends Dae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class kae extends Pae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class zae extends Lae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Gae extends Uae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class qae extends Bae{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}const Kd=4,hN=[.125,.215,.35,.446,.526,.582],Gf=20,cS=new kg(-1,1,1,-1,0,1),Vae=new ya(90,1),fN=new an;let hS=null,fS=0,AS=0;const If=(1+Math.sqrt(5))/2,Dd=1/If,AN=[new he(-If,Dd,0),new he(If,Dd,0),new he(-Dd,0,If),new he(Dd,0,If),new he(0,If,-Dd),new he(0,If,Dd),new he(-1,1,-1),new he(1,1,-1),new he(-1,1,1),new he(1,1,1)],Hae=[3,1,5,0,4,2],dS=$U(Er(),_u("faceIndex")).normalize(),IE=Be(dS.x,dS.y,dS.z);class jae{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,r=100,s=null){if(this._setSize(256),this._hasInitialized===!1){console.warn("THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Try using .fromSceneAsync() instead.");const l=s||this._allocateTargets();return this.fromSceneAsync(e,t,n,r,l),l}hS=this._renderer.getRenderTarget(),fS=this._renderer.getActiveCubeFace(),AS=this._renderer.getActiveMipmapLevel();const a=s||this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,n,r,a),t>0&&this._blur(a,0,0,t),this._applyPMREM(a),this._cleanup(a),a}async fromSceneAsync(e,t=0,n=.1,r=100,s=null){return this._hasInitialized===!1&&await this._renderer.init(),this.fromScene(e,t,n,r,s)}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._allocateTargets();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._allocateTargets();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=pN(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=mN(),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===Qo||e.mapping===Ko?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(hS,fS,AS),e.scissorTest=!1,gv(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),hS=this._renderer.getRenderTarget(),fS=this._renderer.getActiveCubeFace(),AS=this._renderer.getActiveMipmapLevel();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:gs,minFilter:gs,generateMipmaps:!1,type:Gs,format:ks,colorSpace:Ro},r=dN(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=dN(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas,lodMeshes:this._lodMeshes}=Wae(s)),this._blurMaterial=$ae(s,e,t)}return r}async _compileMaterial(e){const t=new zi(this._lodPlanes[0],e);await this._renderer.compile(t,cS)}_sceneToCubeUV(e,t,n,r){const s=Vae;s.near=t,s.far=n;const a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],u=this._renderer,h=u.autoClear;u.getClearColor(fN),u.autoClear=!1;let m=this._backgroundBox;if(m===null){const S=new pA({name:"PMREM.Background",side:hr,depthWrite:!1,depthTest:!1});m=new zi(new $h,S)}let v=!1;const x=e.background;x?x.isColor&&(m.material.color.copy(x),e.background=null,v=!0):(m.material.color.copy(fN),v=!0),u.setRenderTarget(r),u.clear(),v&&u.render(m,s);for(let S=0;S<6;S++){const w=S%3;w===0?(s.up.set(0,a[S],0),s.lookAt(l[S],0,0)):w===1?(s.up.set(0,0,a[S]),s.lookAt(0,l[S],0)):(s.up.set(0,a[S],0),s.lookAt(0,0,l[S]));const R=this._cubeSize;gv(r,w*R,S>2?R:0,R,R),u.render(e,s)}u.autoClear=h,e.background=x}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Qo||e.mapping===Ko;r?this._cubemapMaterial===null&&(this._cubemapMaterial=pN(e)):this._equirectMaterial===null&&(this._equirectMaterial=mN(e));const s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;const a=this._lodMeshes[0];a.material=s;const l=this._cubeSize;gv(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,cS)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),l=AN[(r-s-1)%AN.length];this._blur(e,s-1,s,a,l)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,l){const u=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const m=3,v=this._lodMeshes[r];v.material=h;const x=h.uniforms,S=this._sizeLods[n]-1,w=isFinite(s)?Math.PI/(2*S):2*Math.PI/(2*Gf-1),R=s/w,C=isFinite(s)?1+Math.floor(m*R):Gf;C>Gf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${Gf}`);const E=[];let B=0;for(let z=0;z<Gf;++z){const j=z/R,F=Math.exp(-j*j/2);E.push(F),z===0?B+=F:z<C&&(B+=2*F)}for(let z=0;z<E.length;z++)E[z]=E[z]/B;e.texture.frame=(e.texture.frame||0)+1,x.envMap.value=e.texture,x.samples.value=C,x.weights.array=E,x.latitudinal.value=a==="latitudinal"?1:0,l&&(x.poleAxis.value=l);const{_lodMax:L}=this;x.dTheta.value=w,x.mipInt.value=L-n;const O=this._sizeLods[r],G=3*O*(r>L-Kd?r-L+Kd:0),q=4*(this._cubeSize-O);gv(t,G,q,3*O,2*O),u.setRenderTarget(t),u.render(v,cS)}}function Wae(i){const e=[],t=[],n=[],r=[];let s=i;const a=i-Kd+1+hN.length;for(let l=0;l<a;l++){const u=Math.pow(2,s);t.push(u);let h=1/u;l>i-Kd?h=hN[l-i+Kd-1]:l===0&&(h=0),n.push(h);const m=1/(u-2),v=-m,x=1+m,S=[v,v,x,v,x,x,v,v,x,x,v,x],w=6,R=6,C=3,E=2,B=1,L=new Float32Array(C*R*w),O=new Float32Array(E*R*w),G=new Float32Array(B*R*w);for(let z=0;z<w;z++){const j=z%3*2/3-1,F=z>2?0:-1,V=[j,F,0,j+2/3,F,0,j+2/3,F+1,0,j,F,0,j+2/3,F+1,0,j,F+1,0],Y=Hae[z];L.set(V,C*R*Y),O.set(S,E*R*Y);const ee=[Y,Y,Y,Y,Y,Y];G.set(ee,B*R*Y)}const q=new Ki;q.setAttribute("position",new wr(L,C)),q.setAttribute("uv",new wr(O,E)),q.setAttribute("faceIndex",new wr(G,B)),e.push(q),r.push(new zi(q,null)),s>Kd&&s--}return{lodPlanes:e,sizeLods:t,sigmas:n,lodMeshes:r}}function dN(i,e,t){const n=new Wh(i,e,t);return n.texture.mapping=sA,n.texture.name="PMREM.cubeUv",n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function gv(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function FE(i){const e=new Vr;return e.depthTest=!1,e.depthWrite=!1,e.blending=Qa,e.name=`PMREM_${i}`,e}function $ae(i,e,t){const n=Sc(new Array(Gf).fill(0)),r=gn(new he(0,1,0)),s=gn(0),a=_e(Gf),l=gn(0),u=gn(1),h=Ai(null),m=gn(0),v=_e(1/e),x=_e(1/t),S=_e(i),w={n:a,latitudinal:l,weights:n,poleAxis:r,outputDirection:IE,dTheta:s,samples:u,envMap:h,mipInt:m,CUBEUV_TEXEL_WIDTH:v,CUBEUV_TEXEL_HEIGHT:x,CUBEUV_MAX_MIP:S},R=FE("blur");return R.uniforms=w,R.fragmentNode=YU({...w,latitudinal:l.equal(1)}),R}function pN(i){const e=FE("cubemap");return e.fragmentNode=I0(i,IE),e}function mN(i){const e=FE("equirect");return e.fragmentNode=Ai(i,mE(IE),0),e}const gN=new WeakMap,Xae=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),vv=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0"));class XB{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.monitor=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.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.flow={code:""},this.chaining=[],this.stack=e_(),this.stacks=[],this.tab="	",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new uS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.useComparisonMethod=!1}getBindGroupsCache(){let e=gN.get(this.renderer);return e===void 0&&(e=new Su,gN.set(this.renderer,e)),e}createRenderTarget(e,t,n){return new Wh(e,t,n)}createCubeRenderTarget(e,t){return new LU(e,t)}createPMREMGenerator(){return new jae(this.renderer)}includes(e){return this.nodes.includes(e)}_getBindGroup(e,t){const n=this.getBindGroupsCache(),r=[];let s=!0;for(const l of t)r.push(l),s=s&&l.groupNode.shared!==!0;let a;return s?(a=n.get(r),a===void 0&&(a=new tw(e,r,this.bindingsIndexes[e].group,r),n.set(r,a))):a=new tw(e,r,this.bindingsIndexes[e].group,r),a}getBindGroupArray(e,t){const n=this.bindings[t];let r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){const t={},n=this.bindings;for(const r of kT)for(const s in n[r]){const a=n[r][s];(t[s]||(t[s]=[])).push(...a)}e=[];for(const r in t){const s=t[r],a=this._getBindGroup(r,s);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()!==jn.NONE&&this.updateNodes.push(e.getSelf());for(const e of this.sequentialNodes){const t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==jn.NONE&&this.updateBeforeNodes.push(e.getSelf()),n!==jn.NONE&&this.updateAfterNodes.push(e.getSelf())}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===gs||e.magFilter===Jd||e.magFilter===tu||e.magFilter===Va||e.minFilter===gs||e.minFilter===Jd||e.minFilter===tu||e.minFilter===Va}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("NodeBuilder: Invalid node chaining!")}getMethod(e){return e}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 uS(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.")}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new an:e==="vec2"?t=new gt:e==="vec3"?t=new he:e==="vec4"&&(t=new Ln)),e==="float")return vv(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")}( ${vv(t.r)}, ${vv(t.g)}, ${vv(t.b)} )`;const n=this.getTypeLength(e),r=this.getComponentType(e),s=a=>this.generateConst(r,a);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>4&&t&&(t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).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 s of n)if(s.name===e)return s;const r=new cN(e,t);return n.push(r),r}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==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===Ns)return"int";if(t===Rr)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;const n=UP(e);return(t==="float"?"":t[0])+n}getTypeFromArray(e){return Xae.get(e.constructor)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const n=t.array,r=e.itemSize,s=e.normalized;let a;return!(e instanceof G7)&&s!==!0&&(a=this.getTypeFromArray(n)),this.getTypeFromLength(r,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(){return this.stack=e_(this.stack),this.stacks.push(PM()||this.stack),bg(this.stack),this.stack}removeStack(){const e=this.stack;return this.stack=e.parent,bg(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);return r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={}),r[t]}getNodeProperties(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 r=n.bufferAttribute;if(r===void 0){const s=this.uniforms.index++;r=new cN("nodeAttribute"+s,t,e),this.bufferAttributes.push(r),n.bufferAttribute=r}return r}getStructTypeFromNode(e,t,n=this.shaderStage){const r=this.getDataFromNode(e,n);let s=r.structType;if(s===void 0){const a=this.structs.index++;s=new Cae("StructType"+a,t),this.structs[n].push(s),r.structType=s}return s}getUniformFromNode(e,t,n=this.shaderStage,r=null){const s=this.getDataFromNode(e,n,this.globalCache);let a=s.uniform;if(a===void 0){const l=this.uniforms.index++;a=new Tae(r||"nodeUniform"+l,t,e),this.uniforms[n].push(a),s.uniform=a}return a}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage){const s=this.getDataFromNode(e,r);let a=s.variable;if(a===void 0){const l=this.vars[r]||(this.vars[r]=[]);t===null&&(t="nodeVar"+l.length),a=new $B(t,n),l.push(a),s.variable=a}return a}getVaryingFromNode(e,t=null,n=e.getNodeType(this)){const r=this.getDataFromNode(e,"any");let s=r.varying;if(s===void 0){const a=this.varyings,l=a.length;t===null&&(t="nodeVarying"+l),s=new wae(t,n),a.push(s),r.varying=s}return s}getCodeFromNode(e,t,n=this.shaderStage){const r=this.getDataFromNode(e);let s=r.code;if(s===void 0){const a=this.codes[n]||(this.codes[n]=[]),l=a.length;s=new Mae("nodeCode"+l,t),a.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e);let s=!0,a=t;for(;a;){if(r.get(a)===!0){s=!1;break}a=this.getDataFromNode(a).parentNodeBlock}if(s)for(const l of n)this.addLineFlowCode(l)}addLineFlowCodeBlock(e,t,n){const r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),a=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.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+`;
`),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}buildFunctionNode(e){const t=new SB,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})}}};for(const a of t.inputs)n[a.name]=new tB(a.type,a.name);e.layout=null;const r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowStagesNode(e,t=null){const n=this.flow,r=this.vars,s=this.cache,a=this.buildStage,l=this.stack,u={code:""};this.flow=u,this.vars={},this.cache=new uS,this.stack=e_();for(const h of FT)this.setBuildStage(h),u.result=e.build(this,t);return u.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.cache=s,this.stack=l,this.setBuildStage(a),u}getFunctionOperator(){return null}flowChildNode(e,t=null){const n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){const s=this.shaderStage;this.setShaderStage(e);const a=this.flowChildNode(t,n);return r!==null&&(a.code+=`${this.tab+r} = ${a.result};
`),this.flowCode[e]=this.flowCode[e]+a.code,this.setShaderStage(s),a}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){console.warn("Abstract function.")}getVaryings(){console.warn("Abstract function.")}getVar(e,t){return`${this.getType(e)} ${t}`}getVars(e){let t="";const n=this.vars[e];if(n!==void 0)for(const r of n)t+=`${this.getVar(r.type,r.name)}; `;return t}getUniforms(){console.warn("Abstract function.")}getCodes(e){const t=this.codes[e];let n="";if(t!==void 0)for(const r of t)n+=r.code+`
`;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.")}build(){const{object:e,material:t,renderer:n}=this;if(t!==null){let r=n.library.fromMaterial(t);r===null&&(console.error(`NodeMaterial: Material "${t.type}" is not compatible.`),r=new Vr),r.build(this)}else this.addFlow("compute",e);for(const r of FT){this.setBuildStage(r),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const s of kT){this.setShaderStage(s);const a=this.flowNodes[s];for(const l of a)r==="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 Oae(e);if(t==="vec2"||t==="ivec2"||t==="uvec2")return new Iae(e);if(t==="vec3"||t==="ivec3"||t==="uvec3")return new Fae(e);if(t==="vec4"||t==="ivec4"||t==="uvec4")return new kae(e);if(t==="color")return new zae(e);if(t==="mat3")return new Gae(e);if(t==="mat4")return new qae(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 r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}(${e}[0].xyz, ${e}[1].xyz, ${e}[2].xyz)`:r===9&&s===4?`${this.getType(n)}(${e}[0].xy, ${e}[1].xy)`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?this.format(`${e}.${"xyz".slice(0,s)}`,this.getTypeFromLength(s,this.getComponentType(t)),n):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${V0} - Node System
`}createNodeMaterial(e="NodeMaterial"){throw new Error(`THREE.NodeBuilder: createNodeMaterial() was deprecated. Use new ${e}() instead.`)}}class vN{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===jn.FRAME){const{frameMap:r}=this._getMaps(this.updateBeforeMap,n);r.get(n)!==this.frameId&&e.updateBefore(this)!==!1&&r.set(n,this.frameId)}else if(t===jn.RENDER){const{renderMap:r}=this._getMaps(this.updateBeforeMap,n);r.get(n)!==this.renderId&&e.updateBefore(this)!==!1&&r.set(n,this.renderId)}else t===jn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===jn.FRAME){const{frameMap:r}=this._getMaps(this.updateAfterMap,n);r.get(n)!==this.frameId&&e.updateAfter(this)!==!1&&r.set(n,this.frameId)}else if(t===jn.RENDER){const{renderMap:r}=this._getMaps(this.updateAfterMap,n);r.get(n)!==this.renderId&&e.updateAfter(this)!==!1&&r.set(n,this.renderId)}else t===jn.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===jn.FRAME){const{frameMap:r}=this._getMaps(this.updateMap,n);r.get(n)!==this.frameId&&e.update(this)!==!1&&r.set(n,this.frameId)}else if(t===jn.RENDER){const{renderMap:r}=this._getMaps(this.updateMap,n);r.get(n)!==this.renderId&&e.update(this)!==!1&&r.set(n,this.renderId)}else t===jn.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 kE{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}}kE.isNodeFunctionInput=!0;class Yae extends xA{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setup(e){super.setup(e);const t=e.context.lightingModel,n=this.colorNode,r=DE(this.light),s=e.context.reflectedLight;t.direct({lightDirection:r,lightColor:n,reflectedLight:s},e.stack,e)}}const pS=new kn,_v=new kn;let dm=null;class Qae extends xA{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=gn(new he).setGroup(Rn),this.halfWidth=gn(new he).setGroup(Rn),this.updateType=jn.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;_v.identity(),pS.copy(t.matrixWorld),pS.premultiply(n),_v.extractRotation(pS),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(_v),this.halfHeight.value.applyMatrix4(_v)}setup(e){super.setup(e);let t,n;e.isAvailable("float32Filterable")?(t=Ai(dm.LTC_FLOAT_1),n=Ai(dm.LTC_FLOAT_2)):(t=Ai(dm.LTC_HALF_1),n=Ai(dm.LTC_HALF_2));const{colorNode:r,light:s}=this,a=e.context.lightingModel,l=Jy(s),u=e.context.reflectedLight;a.directRectArea({lightColor:r,lightPosition:l,halfWidth:this.halfWidth,halfHeight:this.halfHeight,reflectedLight:u,ltc_1:t,ltc_2:n},e.stack,e)}static setLTC(e){dm=e}}class YB extends xA{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=gn(0).setGroup(Rn),this.penumbraCosNode=gn(0).setGroup(Rn),this.cutoffDistanceNode=gn(0).setGroup(Rn),this.decayExponentNode=gn(0).setGroup(Rn)}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){const{coneCosNode:t,penumbraCosNode:n}=this;return kc(t,n,e)}setup(e){super.setup(e);const t=e.context.lightingModel,{colorNode:n,cutoffDistanceNode:r,decayExponentNode:s,light:a}=this,l=Jy(a).sub(Xr),u=l.normalize(),h=u.dot(DE(a)),m=this.getSpotAttenuation(h),v=l.length(),x=UE({lightDistance:v,cutoffDistance:r,decayExponent:s});let S=n.mul(m).mul(x);if(a.map){const R=EB(a),C=Ai(a.map,R.xy).onRenderUpdate(()=>a.map);S=R.mul(2).sub(1).abs().lessThan(1).all().select(S.mul(C),S)}const w=e.context.reflectedLight;t.direct({lightDirection:u,lightColor:S,reflectedLight:w},e.stack,e)}}class Kae extends YB{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e){const t=this.light.iesMap;let n=null;if(t&&t.isTexture===!0){const r=e.acos().mul(1/Math.PI);n=Ai(t,Ct(r,0),0).r}else n=super.getSpotAttenuation(e);return n}}class Zae extends xA{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class Jae extends xA{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=NE(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=gn(new an).setGroup(Rn)}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:r}=this,a=Jo.dot(r).mul(.5).add(.5),l=Fi(n,t,a);e.context.irradiance.addAssign(l)}}class eoe extends xA{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let n=0;n<9;n++)t.push(new he);this.lightProbe=Sc(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=WB(Vy,this.lightProbe);e.context.irradiance.addAssign(t)}}class QB{parseFunction(){console.warn("Abstract function.")}}class zE{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){console.warn("Abstract function.")}}zE.isNodeFunction=!0;const toe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,noe=/[a-z_0-9]+/ig,_N="#pragma main",ioe=i=>{i=i.trim();const e=i.indexOf(_N),t=e!==-1?i.slice(e+_N.length):i,n=t.match(toe);if(n!==null&&n.length===5){const r=n[4],s=[];let a=null;for(;(a=noe.exec(r))!==null;)s.push(a);const l=[];let u=0;for(;u<s.length;){const w=s[u][0]==="const";w===!0&&u++;let R=s[u][0];R==="in"||R==="out"||R==="inout"?u++:R="";const C=s[u++][0];let E=Number.parseInt(s[u][0]);Number.isNaN(E)===!1?u++:E=null;const B=s[u++][0];l.push(new kE(C,B,E,R,w))}const h=t.substring(n[0].length),m=n[3]!==void 0?n[3]:"",v=n[2],x=n[1]!==void 0?n[1]:"",S=e!==-1?i.slice(0,e):"";return{type:v,inputs:l,name:m,precision:x,inputsCode:r,blockCode:h,headerCode:S}}else throw new Error("FunctionNode: Function is not a GLSL code.")};class roe extends zE{constructor(e){const{type:t,inputs:n,name:r,precision:s,inputsCode:a,blockCode:l,headerCode:u}=ioe(e);super(t,n,r,s),this.inputsCode=a,this.blockCode=l,this.headerCode=u}getCode(e=this.name){let t;const n=this.blockCode;if(n!==""){const{type:r,inputsCode:s,headerCode:a,precision:l}=this;let u=`${r} ${e} ( ${s.trim()} )`;l!==""&&(u=`${l} ${u}`),t=a+u+n}else t="";return t}}class soe extends QB{parseFunction(e){return new roe(e)}}const yN=new WeakMap;class aoe extends Yh{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new vN,this.nodeBuilderCache=new Map,this.callHashCache=new Su,this.groupsData=new Su,this.cacheLib={}}updateGroup(e){const t=e.groupNode,n=t.name;if(n===BM.name)return!0;if(n===Rn.name){const a=this.get(e),l=this.nodeFrame.renderId;return a.renderId!==l?(a.renderId=l,!0):!1}if(n===sL.name){const a=this.get(e),l=this.nodeFrame.frameId;return a.frameId!==l?(a.frameId=l,!0):!1}const r=[t,e];let s=this.groupsData.get(r);return s===void 0&&this.groupsData.set(r,s={}),s.version!==t.version?(s.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:r}=this,s=this.getForRenderCacheKey(e);if(n=r.get(s),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,a.build(),n=this._createNodeBuilderState(a),r.set(s,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 r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n}return n}_createNodeBuilderState(e){return new Sae(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.monitor,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){const n=[e,t],r=this.renderer.info.calls;let s=this.callHashCache.get(n);if(s===void 0||s.callId!==r){const a=this.getEnvironmentNode(e),l=this.getFogNode(e),u=[];t&&u.push(t.getCacheKey(!0)),a&&u.push(a.getCacheKey()),l&&u.push(l.getCacheKey()),u.push(this.renderer.shadowMap.enabled?1:0),s={callId:r,cacheKey:Ny(u)},this.callHashCache.set(n,s)}return s.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),n=e.background;if(n){const r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){const s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===zh||n.mapping===Gh||n.mapping===sA){if(e.backgroundBlurriness>0||n.mapping===sA)return yE(n);{let a;return n.isCubeTexture===!0?a=I0(n):a=Ai(n),BU(a)}}else{if(n.isTexture===!0)return Ai(n,bu.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&console.error("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){const s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let a=s.get(t);return(a===void 0||r)&&(a=n(),s.set(t,a)),a}updateFog(e){const t=this.get(e),n=e.fog;if(n){if(t.fog!==n){const r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){const s=ji("color","color",n).setGroup(Rn),a=ji("density","float",n).setGroup(Rn);return Ng(s,EE(a))}else if(n.isFog){const s=ji("color","color",n).setGroup(Rn),a=ji("near","float",n).setGroup(Rn),l=ji("far","float",n).setGroup(Rn);return Ng(s,ME(a,l))}else console.error("THREE.Renderer: Unsupported fog configuration.",n)});t.fogNode=r,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 r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return I0(n);if(n.isTexture===!0)return Ai(n);console.error("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){const a=this.nodeFrame;return a.renderer=e,a.scene=t,a.object=n,a.camera=r,a.material=s,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}hasOutputChange(e){return yN.get(e)!==this.getOutputCacheKey()}getOutputNode(e){const t=this.renderer,n=this.getOutputCacheKey(),r=Ai(e,bu).renderOutput(t.toneMapping,t.currentColorSpace);return yN.set(e,n),r}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 r of n.updateNodes)t.updateNode(r)}updateForRender(e){const t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(const r of n.updateNodes)t.updateNode(r)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new vN,this.nodeBuilderCache=new Map,this.cacheLib={}}}const mS=new Yl;class ay{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new Vn,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 r=e.length;for(let s=0;s<r;s++){mS.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);const a=t[n+s],l=mS.normal;a.x=-l.x,a.y=-l.y,a.z=-l.z,a.w=mS.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowNodeMaterial,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 r=t.clippingPlanes,s=r.length;let a,l;if(this.clipIntersection?(a=this.intersectionPlanes,l=e.intersectionPlanes.length):(a=this.unionPlanes,l=e.unionPlanes.length),a.length!==l+s){a.length=l+s;for(let u=0;u<s;u++)a[l+u]=new Ln;n=!0}this.projectPlanes(r,a,l),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new ay(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}}class ooe{constructor(e,t){this.bundleGroup=e,this.camera=t}}class loe{constructor(){this.bundles=new Su}get(e,t){const n=this.bundles,r=[e,t];let s=n.get(r);return s===void 0&&(s=new ooe(e,t),n.set(r,s)),s}dispose(){this.bundles=new Su}}class KB{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 r in e)t[r]=e[r]}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 uoe=new PE;class coe extends Su{constructor(){super()}createNode(e=[]){return new PE().setLights(e)}getNode(e,t){if(e.isQuadMesh)return uoe;const n=[e,t];let r=this.get(n);return r===void 0&&(r=this.createNode(),this.set(n,r)),r}}const xN=new Yw,yv=new gt,gS=new Ln,vS=new Fg,xv=new kn,Sh=new Ln;class hoe{constructor(e,t={}){this.isRenderer=!0;const{logarithmicDepthBuffer:n=!1,alpha:r=!0,depth:s=!0,stencil:a=!1,antialias:l=!1,samples:u=0,getFallback:h=null}=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=r,this.logarithmicDepthBuffer=n,this.outputColorSpace=_n,this.toneMapping=Za,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=s,this.stencil=a,this.info=new _ne,this.nodes={modelViewMatrix:null,modelNormalViewMatrix:null},this.library=new KB,this.lighting=new coe,this._getFallback=h,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new Ln(0,0,this._width,this._height),this._scissor=new Ln(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 TE(new Vr),this._quad.material.name="Renderer_output",this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTarget=null;const m=this.alpha===!0?0:1;this._clearColor=new bE(0,0,0,m),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this._initialized=!1,this._initPromise=null,this._compilationPromises=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,type:yw},this.xr={enabled:!1},this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(v,x,S)=>{await this.compileAsync(v,x);const w=this._renderLists.get(v,x),R=this._renderContexts.get(v,x,this._renderTarget),C=v.overrideMaterial||S.material,E=this._objects.get(S,C,v,x,w.lightsNode,R,R.clippingContext),{fragmentShader:B,vertexShader:L}=E.getNodeBuilderState();return{fragmentShader:B,vertexShader:L}}}}async 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(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new aoe(this,n),this._animation=new une(this._nodes,this.info),this._attributes=new mne(n),this._background=new xae(this,this._nodes),this._geometries=new vne(this._attributes,this.info),this._textures=new Pne(this,n,this.info),this._pipelines=new Sne(n,this._nodes),this._bindings=new Tne(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new Ane(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new Ene(this.lighting),this._bundles=new loe,this._renderContexts=new Nne,this._animation.start(),this._initialized=!0,e()}),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 r=this._nodes.nodeFrame,s=r.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,u=this._compilationPromises,h=e.isScene===!0?e:xN;n===null&&(n=e);const m=this._renderTarget,v=this._renderContexts.get(n,t,m),x=this._activeMipmapLevel,S=[];this._currentRenderContext=v,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=S,r.renderId++,r.update(),v.depth=this.depth,v.stencil=this.stencil,v.clippingContext||(v.clippingContext=new ay),v.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,m);const w=this._renderLists.get(e,t);if(w.begin(),this._projectObject(e,t,0,w,v.clippingContext),n!==e&&n.traverseVisible(function(L){L.isLight&&L.layers.test(t.layers)&&w.pushLight(L)}),w.finish(),m!==null){this._textures.updateRenderTarget(m,x);const L=this._textures.get(m);v.textures=L.textures,v.depthTexture=L.depthTexture}else v.textures=null,v.depthTexture=null;this._background.update(h,w,v);const R=w.opaque,C=w.transparent,E=w.transparentDoublePass,B=w.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,h,B),this.transparent===!0&&C.length>0&&this._renderTransparents(C,E,t,h,B),r.renderId=s,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._compilationPromises=u,this._handleObjectFunction=this._renderObjectDirect,await Promise.all(S)}async renderAsync(e,t){this._initialized===!1&&await this.init();const n=this._renderScene(e,t);await this.backend.resolveTimestampAsync(n,"render")}async waitForGPU(){await this.backend.waitForGPU()}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:

Message: ${e.message}`;e.reason&&(t+=`
Reason: ${e.reason}`),console.error(t),this._isDeviceLost=!0}_renderBundle(e,t,n){const{bundleGroup:r,camera:s,renderList:a}=e,l=this._currentRenderContext,u=this._bundles.get(r,s),h=this.backend.get(u);h.renderContexts===void 0&&(h.renderContexts=new Set);const m=r.version!==h.version,v=h.renderContexts.has(l)===!1||m;if(h.renderContexts.add(l),v){this.backend.beginBundle(l),(h.renderObjects===void 0||m)&&(h.renderObjects=[]),this._currentRenderBundle=u;const x=a.opaque;this.opaque===!0&&x.length>0&&this._renderObjects(x,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(l,u),h.version=r.version}else{const{renderObjects:x}=h;for(let S=0,w=x.length;S<w;S++){const R=x[S];this._nodes.needsRefresh(R)&&(this._nodes.updateBefore(R),this._nodes.updateForRender(R),this._bindings.updateForRender(R),this._nodes.updateAfter(R))}}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;if(e!==Za===!1&&t!==Ro===!1)return null;const{width:s,height:a}=this.getDrawingBufferSize(yv),{depth:l,stencil:u}=this;let h=this._frameBufferTarget;return h===null&&(h=new Wh(s,a,{depthBuffer:l,stencilBuffer:u,type:Gs,format:ks,colorSpace:Ro,generateMipmaps:!1,minFilter:gs,magFilter:gs,samples:this.samples}),h.isPostProcessingRenderTarget=!0,this._frameBufferTarget=h),h.depthBuffer=l,h.stencilBuffer=u,h.setSize(s,a),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}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;const r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,a=s.renderId,l=this._currentRenderContext,u=this._currentRenderObjectFunction,h=e.isScene===!0?e:xN,m=this._renderTarget,v=this._activeCubeFace,x=this._activeMipmapLevel;let S;r!==null?(S=r,this.setRenderTarget(S)):S=m;const w=this._renderContexts.get(e,t,S);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls;const R=this.coordinateSystem;t.coordinateSystem!==R&&(t.coordinateSystem=R,t.updateProjectionMatrix()),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld();let C=this._viewport,E=this._scissor,B=this._pixelRatio;S!==null&&(C=S.viewport,E=S.scissor,B=1),this.getDrawingBufferSize(yv),gS.set(0,0,yv.width,yv.height);const L=C.minDepth===void 0?0:C.minDepth,O=C.maxDepth===void 0?1:C.maxDepth;w.viewportValue.copy(C).multiplyScalar(B).floor(),w.viewportValue.width>>=x,w.viewportValue.height>>=x,w.viewportValue.minDepth=L,w.viewportValue.maxDepth=O,w.viewport=w.viewportValue.equals(gS)===!1,w.scissorValue.copy(E).multiplyScalar(B).floor(),w.scissor=this._scissorTest&&w.scissorValue.equals(gS)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new ay),w.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,S),xv.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),vS.setFromProjectionMatrix(xv,R);const G=this._renderLists.get(e,t);if(G.begin(),this._projectObject(e,t,0,G,w.clippingContext),G.finish(),this.sortObjects===!0&&G.sort(this._opaqueSort,this._transparentSort),S!==null){this._textures.updateRenderTarget(S,x);const Y=this._textures.get(S);w.textures=Y.textures,w.depthTexture=Y.depthTexture,w.width=Y.width,w.height=Y.height,w.renderTarget=S,w.depth=S.depthBuffer,w.stencil=S.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=this.domElement.width,w.height=this.domElement.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=x,w.height>>=x,w.activeCubeFace=v,w.activeMipmapLevel=x,w.occlusionQueryCount=G.occlusionQueryCount,this._background.update(h,G,w),this.backend.beginRender(w);const{bundles:q,lightsNode:z,transparentDoublePass:j,transparent:F,opaque:V}=G;if(q.length>0&&this._renderBundles(q,h,z),this.opaque===!0&&V.length>0&&this._renderObjects(V,t,h,z),this.transparent===!0&&F.length>0&&this._renderTransparents(F,j,t,h,z),this.backend.finishRender(w),s.renderId=a,this._currentRenderContext=l,this._currentRenderObjectFunction=u,r!==null){this.setRenderTarget(m,v,x);const Y=this._quad;this._nodes.hasOutputChange(S.texture)&&(Y.material.fragmentNode=this._nodes.getOutputNode(S.texture),Y.material.needsUpdate=!0),this._renderScene(Y,Y.camera,!1)}return h.onAfterRender(this,e,t,S),w}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._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._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,r){const s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e,this.backend.setScissorTest(e)}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,a=1){const l=this._viewport;e.isVector4?l.copy(e):l.set(e,t,n,r),l.minDepth=s,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 r=this._renderTarget||this._getFrameBufferTarget();let s=null;if(r!==null){this._textures.updateRenderTarget(r);const a=this._textures.get(r);s=this._renderContexts.get(null,null,r),s.textures=a.textures,s.depthTexture=a.depthTexture,s.width=a.width,s.height=a.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer}if(this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null){const a=this._quad;this._nodes.hasOutputChange(r.texture)&&(a.material.fragmentNode=this._nodes.getOutputNode(r.texture),a.material.needsUpdate=!0),this._renderScene(a,a.camera,!1)}}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._renderTarget!==null?Za:this.toneMapping}get currentColorSpace(){return this._renderTarget!==null?Ro:this.outputColorSpace}dispose(){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.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e){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 t=this._nodes.nodeFrame,n=t.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,t.renderId=this.info.calls;const r=this.backend,s=this._pipelines,a=this._bindings,l=this._nodes,u=Array.isArray(e)?e:[e];if(u[0]===void 0||u[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");r.beginCompute(e);for(const h of u){if(s.has(h)===!1){const x=()=>{h.removeEventListener("dispose",x),s.delete(h),a.delete(h),l.delete(h)};h.addEventListener("dispose",x);const S=h.onInitFunction;S!==null&&S.call(h,{renderer:this})}l.updateForCompute(h),a.updateForCompute(h);const m=a.getForCompute(h),v=s.getForCompute(h,m);r.compute(e,h,m,v)}r.finishCompute(e),t.renderId=n}async computeAsync(e){this._initialized===!1&&await this.init(),this.compute(e),await this.backend.resolveTimestampAsync(e,"compute")}async hasFeatureAsync(e){return this._initialized===!1&&await this.init(),this.backend.hasFeature(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)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=Sh.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Sh.copy(t).floor();else{console.error("THREE.Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Sh.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t)}copyTextureToTexture(e,t,n=null,r=null,s=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s)}async readRenderTargetPixelsAsync(e,t,n,r,s,a=0,l=0){return this.backend.copyTextureToBuffer(e.textures[a],t,n,r,s,l)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){if(!e.frustumCulled||vS.intersectsSprite(e)){this.sortObjects===!0&&Sh.setFromMatrixPosition(e.matrixWorld).applyMatrix4(xv);const{geometry:u,material:h}=e;h.visible&&r.push(e,u,h,n,Sh.z,null,s)}}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)&&(!e.frustumCulled||vS.intersectsObject(e))){const{geometry:u,material:h}=e;if(this.sortObjects===!0&&(u.boundingSphere===null&&u.computeBoundingSphere(),Sh.copy(u.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(xv)),Array.isArray(h)){const m=u.groups;for(let v=0,x=m.length;v<x;v++){const S=m[v],w=h[S.materialIndex];w&&w.visible&&r.push(e,u,w,n,Sh.z,S,s)}}else h.visible&&r.push(e,u,h,n,Sh.z,null,s)}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){const u=r;r=this._renderLists.get(e,t),r.begin(),u.pushBundle({bundleGroup:e,camera:t,renderList:r}),r.finish()}const l=e.children;for(let u=0,h=l.length;u<h;u++)this._projectObject(l[u],t,n,r,s)}_renderBundles(e,t,n){for(const r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(const{material:a}of t)a.side=hr;this._renderObjects(t,n,r,s,"backSide");for(const{material:a}of t)a.side=Nl;this._renderObjects(e,n,r,s);for(const{material:a}of t)a.side=as}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let a=0,l=e.length;a<l;a++){const u=e[a],{object:h,geometry:m,material:v,group:x,clippingContext:S}=u;if(t.isArrayCamera){const w=t.cameras;for(let R=0,C=w.length;R<C;R++){const E=w[R];if(h.layers.test(E.layers)){const B=E.viewport,L=B.minDepth===void 0?0:B.minDepth,O=B.maxDepth===void 0?1:B.maxDepth,G=this._currentRenderContext.viewportValue;G.copy(B).multiplyScalar(this._pixelRatio).floor(),G.minDepth=L,G.maxDepth=O,this.backend.updateViewport(this._currentRenderContext),this._currentRenderObjectFunction(h,n,E,m,v,x,r,S,s)}}}else this._currentRenderObjectFunction(h,n,t,m,v,x,r,S,s)}}renderObject(e,t,n,r,s,a,l,u=null,h=null){let m,v,x;if(e.onBeforeRender(this,t,n,r,s,a),t.overrideMaterial!==null){const S=t.overrideMaterial;s.positionNode&&s.positionNode.isNode&&(m=S.positionNode,S.positionNode=s.positionNode),S.alphaTest=s.alphaTest,S.alphaMap=s.alphaMap,S.transparent=s.transparent||s.transmission>0,S.isShadowNodeMaterial&&(S.side=s.shadowSide===null?s.side:s.shadowSide,s.depthNode&&s.depthNode.isNode&&(x=S.depthNode,S.depthNode=s.depthNode),s.castShadowNode&&s.castShadowNode.isNode&&(v=S.colorNode,S.colorNode=s.castShadowNode)),s=S}s.transparent===!0&&s.side===as&&s.forceSinglePass===!1?(s.side=hr,this._handleObjectFunction(e,s,t,n,l,a,u,"backSide"),s.side=Nl,this._handleObjectFunction(e,s,t,n,l,a,u,h),s.side=as):this._handleObjectFunction(e,s,t,n,l,a,u,h),m!==void 0&&(t.overrideMaterial.positionNode=m),x!==void 0&&(t.overrideMaterial.depthNode=x),v!==void 0&&(t.overrideMaterial.colorNode=v),e.onAfterRender(this,t,n,r,s,a)}_renderObjectDirect(e,t,n,r,s,a,l,u){const h=this._objects.get(e,t,n,r,s,this._currentRenderContext,l,u);h.drawRange=e.geometry.drawRange,h.group=a;const m=this._nodes.needsRefresh(h);m&&(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),m&&this._nodes.updateAfter(h)}_createObjectPipeline(e,t,n,r,s,a,l,u){const h=this._objects.get(e,t,n,r,s,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 GE{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}clone(){return Object.assign(new this.constructor,this)}}function foe(i){return i+(Lh-i%Lh)%Lh}class ZB extends GE{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t}get byteLength(){return foe(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}}class JB extends ZB{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let Aoe=0;class eO extends JB{constructor(e,t){super("UniformBuffer_"+Aoe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class doe extends JB{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(){let e=0;for(let t=0,n=this.uniforms.length;t<n;t++){const r=this.uniforms[t],{boundary:s,itemSize:a}=r,l=e%Lh,u=Lh-l;l!==0&&u-s<0?e+=Lh-l:l%s!==0&&(e+=l%s),r.offset=e/this.bytesPerElement,e+=a*this.bytesPerElement}return Math.ceil(e/Lh)*Lh}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,r=e.getValue(),s=e.offset,a=e.getType();if(n[s]!==r){const l=this._getBufferForType(a);l[s]=n[s]=r,t=!0}return t}updateVector2(e){let t=!1;const n=this.values,r=e.getValue(),s=e.offset,a=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){const l=this._getBufferForType(a);l[s+0]=n[s+0]=r.x,l[s+1]=n[s+1]=r.y,t=!0}return t}updateVector3(e){let t=!1;const n=this.values,r=e.getValue(),s=e.offset,a=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){const l=this._getBufferForType(a);l[s+0]=n[s+0]=r.x,l[s+1]=n[s+1]=r.y,l[s+2]=n[s+2]=r.z,t=!0}return t}updateVector4(e){let t=!1;const n=this.values,r=e.getValue(),s=e.offset,a=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+4]!==r.w){const l=this._getBufferForType(a);l[s+0]=n[s+0]=r.x,l[s+1]=n[s+1]=r.y,l[s+2]=n[s+2]=r.z,l[s+3]=n[s+3]=r.w,t=!0}return t}updateColor(e){let t=!1;const n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){const a=this.buffer;a[s+0]=n[s+0]=r.r,a[s+1]=n[s+1]=r.g,a[s+2]=n[s+2]=r.b,t=!0}return t}updateMatrix3(e){let t=!1;const n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){const a=this.buffer;a[s+0]=n[s+0]=r[0],a[s+1]=n[s+1]=r[1],a[s+2]=n[s+2]=r[2],a[s+4]=n[s+4]=r[3],a[s+5]=n[s+5]=r[4],a[s+6]=n[s+6]=r[5],a[s+8]=n[s+8]=r[6],a[s+9]=n[s+9]=r[7],a[s+10]=n[s+10]=r[8],t=!0}return t}updateMatrix4(e){let t=!1;const n=this.values,r=e.getValue().elements,s=e.offset;return moe(n,r,s)===!1&&(this.buffer.set(r,s),poe(n,r,s),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 poe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function moe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}let goe=0;class tO extends doe{constructor(e,t){super(e),this.id=goe++,this.groupNode=t,this.isNodeUniformsGroup=!0}}let voe=0;class _oe extends GE{constructor(e,t){super(e),this.id=voe++,this.texture=t,this.version=t?t.version:0,this.store=!1,this.generation=null,this.isSampledTexture=!0}needsBindingsUpdate(e){const{texture:t}=this;return e!==this.generation?(this.generation=e,!0):t.isVideoTexture}update(){const{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}}class ex extends _oe{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}needsBindingsUpdate(e){return this.textureNode.value!==this.texture||super.needsBindingsUpdate(e)}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class nO extends ex{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}}class iO extends ex{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}}const yoe={textureDimensions:"textureSize",equals:"equal"},xoe={low:"lowp",medium:"mediump",high:"highp"},bN={swizzleAssign:!0,storageBuffer:!1},SN=`
precision highp float;
precision highp int;
precision highp sampler2D;
precision highp sampler3D;
precision highp samplerCube;
precision highp sampler2DArray;

precision highp usampler2D;
precision highp usampler3D;
precision highp usamplerCube;
precision highp usampler2DArray;

precision highp isampler2D;
precision highp isampler3D;
precision highp isamplerCube;
precision highp isampler2DArray;

precision lowp sampler2DShadow;
`;class boe extends XB{constructor(e,t){super(e,t,new soe),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]},this.useComparisonMethod=!0}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==Co}getMethod(e){return yoe[e]||e}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),r=[];for(const a of t.inputs)r.push(this.getType(a.type)+" "+a.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {

	${n.vars}

${n.code}
	return ${n.result};

}`}setupPBO(e){const t=e.value;if(t.pbo===void 0){const n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,a=t.array.constructor.name.toLowerCase().includes("int");let l=a?H0:Bg;s===2?l=a?j0:lA:s===3?l=a?VF:Ug:s===4&&(l=a?W0:ks);const u={Float32Array:$r,Uint8Array:aa,Uint16Array:wl,Uint32Array:Rr,Int8Array:Qf,Int16Array:Kf,Int32Array:Ns,Uint8ClampedArray:aa},h=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s))));let m=Math.ceil(r/s/h);h*m*s<r&&m++;const v=h*m*s,x=new n.constructor(v);x.set(n,0),t.array=x;const S=new $k(t.array,h,m,l,u[t.array.constructor.name]||$r);S.needsUpdate=!0,S.isPBOTexture=!0;const w=new yu(S,null,null);w.setPrecision("high"),t.pboNode=w,t.pbo=w.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.label)}}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,r=t.value;if(this.renderer.backend.has(r)){const m=this.renderer.backend.get(r);m.pbo=r.pbo}const s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.label),a=this.getPropertyName(s);this.increaseUsage(n);const l=n.build(this,"uint"),u=this.getDataFromNode(e);let h=u.propertyName;if(h===void 0){const m=this.getVarFromNode(e);h=this.getPropertyName(m);const v=this.getDataFromNode(t);let x=v.propertySizeName;x===void 0&&(x=h+"Size",this.getVarFromNode(t,x,"uint"),this.addLineFlowCode(`${x} = uint( textureSize( ${a}, 0 ).x )`,e),v.propertySizeName=x);const{itemSize:S}=r,w="."+gA.join("").slice(0,S),R=`ivec2(${l} % ${x}, ${l} / ${x})`,C=this.generateTextureLoad(null,a,R,null,"0");let E="vec4";r.pbo.type===Rr?E="uvec4":r.pbo.type===Ns&&(E="ivec4"),this.addLineFlowCode(`${h} = ${E}(${C})${w}`,e),u.propertyName=h}return h}generateTextureLoad(e,t,n,r,s="0"){return r?`texelFetch( ${t}, ivec3( ${n}, ${r} ), ${s} )`:`texelFetch( ${t}, ${n}, ${s} )`}generateTexture(e,t,n,r){return e.isDepthTexture?`texture( ${t}, ${n} ).x`:(r&&(n=`vec3( ${n}, ${r} )`),`texture( ${t}, ${n} )`)}generateTextureLevel(e,t,n,r){return`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r){return`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r){return`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,a=this.shaderStage){if(a==="fragment")return`texture( ${t}, vec3( ${n}, ${r} ) )`;console.error(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const r of n)t.push(`${this.getVar(r.type,r.name)};`);return t.join(`
	`)}getUniforms(e){const t=this.uniforms[e],n=[],r={};for(const a of t){let l=null,u=!1;if(a.type==="texture"){const m=a.node.value;let v="";m.isDataTexture===!0&&(m.type===Rr?v="u":m.type===Ns&&(v="i")),m.compareFunction?l=`sampler2DShadow ${a.name};`:m.isDataArrayTexture===!0||m.isCompressedArrayTexture===!0?l=`${v}sampler2DArray ${a.name};`:l=`${v}sampler2D ${a.name};`}else if(a.type==="cubeTexture")l=`samplerCube ${a.name};`;else if(a.type==="texture3D")l=`sampler3D ${a.name};`;else if(a.type==="buffer"){const m=a.node,v=this.getType(m.bufferType),x=m.bufferCount,S=x>0?x:"";l=`${m.name} {
	${v} ${a.name}[${S}];
};
`}else l=`${this.getVectorType(a.type)} ${this.getPropertyName(a,e)};`,u=!0;const h=a.node.precision;if(h!==null&&(l=xoe[h]+" "+l),u){l="	"+l;const m=a.groupNode.name;(r[m]||(r[m]=[])).push(l)}else l="uniform "+l,n.push(l)}let s="";for(const a in r){const l=r[a];s+=this._getGLSLUniformStruct(e+"_"+a,l.join(`
`))+`
`}return s+=n.join(`
`),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Ns){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);const r=n.array;r instanceof Uint32Array||r instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){const n=this.getAttributesArray();let r=0;for(const s of n)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};
`}return t}getStructMembers(e){const t=[],n=e.getMemberTypes();for(let r=0;r<n.length;r++){const s=n[r];t.push(`layout( location = ${r} ) out ${s} m${r};`)}return t.join(`
`)}getStructs(e){const t=[],n=this.structs[e];if(n.length===0)return`layout( location = 0 ) out vec4 fragColor;
`;for(let r=0,s=n.length;r<s;r++){const a=n[r];let l=`
`;l+=this.getStructMembers(a),l+=`
`,t.push(l)}return t.join(`

`)}getVaryings(e){let t="";const n=this.varyings;if(e==="vertex"||e==="compute")for(const r of n){e==="compute"&&(r.needsInterpolation=!0);const s=this.getType(r.type),a=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${a}${r.needsInterpolation?"out":"/*out*/"} ${s} ${r.name};
`}else if(e==="fragment"){for(const r of n)if(r.needsInterpolation){const s=this.getType(r.type),a=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${a}in ${s} ${r.name};
`}}for(const r of this.builtins[e])t+=`${r};
`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((n,r)=>n*r,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 r=this.extensions[n]||(this.extensions[n]=new Map);r.has(e)===!1&&r.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if(e==="vertex"){const r=this.renderer.backend.extensions;this.object.isBatchedMesh&&r.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const n=this.extensions[e];if(n!==void 0)for(const{name:r,behavior:s}of n.values())t.push(`#extension ${r} : ${s}`);return t.join(`
`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=bN[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 r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}bN[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} ]`)}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 r=e[n],s=this.getPropertyName(r.attributeNode);t+=`${r.varyingName} = ${s};
	`}return t}_getGLSLUniformStruct(e,t){return`
layout( std140 ) uniform ${e} {
${t}
};`}_getGLSLVertexCode(e){return`#version 300 es

${this.getSignature()}

// extensions 
${e.extensions}

// precision
${SN}

// uniforms
${e.uniforms}

// varyings
${e.varyings}

// attributes
${e.attributes}

// codes
${e.codes}

void main() {

	// vars
	${e.vars}

	// transforms
	${e.transforms}

	// flow
	${e.flow}

	gl_PointSize = 1.0;

}
`}_getGLSLFragmentCode(e){return`#version 300 es

${this.getSignature()}

// precision
${SN}

// uniforms
${e.uniforms}

// varyings
${e.varyings}

// codes
${e.codes}

${e.structs}

void main() {

	// vars
	${e.vars}

	// flow
	${e.flow}

}
`}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){let n=`// code

`;n+=this.flowCode[t];const r=this.flowNodes[t],s=r[r.length-1];for(const l of r){const u=this.getFlowData(l),h=l.name;h&&(n.length>0&&(n+=`
`),n+=`	// flow -> ${h}
	`),n+=`${u.code}
	`,l===s&&t!=="compute"&&(n+=`// result
	`,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,r=null){const s=super.getUniformFromNode(e,t,n,r),a=this.getDataFromNode(e,n,this.globalCache);let l=a.uniformGPU;if(l===void 0){const u=e.groupNode,h=u.name,m=this.getBindGroupArray(h,n);if(t==="texture")l=new ex(s.name,s.node,u),m.push(l);else if(t==="cubeTexture")l=new nO(s.name,s.node,u),m.push(l);else if(t==="texture3D")l=new iO(s.name,s.node,u),m.push(l);else if(t==="buffer"){e.name=`NodeBuffer_${e.id}`,s.name=`buffer${e.id}`;const v=new eO(e,u);v.name=e.name,m.push(v),l=v}else{const v=this.uniformGroups[n]||(this.uniformGroups[n]={});let x=v[h];x===void 0&&(x=new tO(n+"_"+h,u),v[h]=x,m.push(x)),l=this.getNodeUniform(s,t),x.addUniform(l)}a.uniformGPU=l}return s}}let _S=null,Pd=null;class rO{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null}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(){}copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}isOccluded(){}async resolveTimestampAsync(){}async waitForGPU(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return _S=_S||new gt,this.renderer.getDrawingBufferSize(_S)}setScissorTest(){}getClearColor(){const e=this.renderer;return Pd=Pd||new bE,e.getClearColor(Pd),Pd.getRGB(Pd,this.renderer.currentColorSpace),Pd}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:F7(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${V0} 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 Soe=0;class Toe{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 woe{constructor(e){this.backend=e}createAttribute(e,t){const n=this.backend,{gl:r}=n,s=e.array,a=e.usage||r.STATIC_DRAW,l=e.isInterleavedBufferAttribute?e.data:e,u=n.get(l);let h=u.bufferGPU;h===void 0&&(h=this._createBuffer(r,t,s,a),u.bufferGPU=h,u.bufferType=t,u.version=l.version);let m;if(s instanceof Float32Array)m=r.FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?m=r.HALF_FLOAT:m=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)m=r.SHORT;else if(s instanceof Uint32Array)m=r.UNSIGNED_INT;else if(s instanceof Int32Array)m=r.INT;else if(s instanceof Int8Array)m=r.BYTE;else if(s instanceof Uint8Array)m=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)m=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let v={bufferGPU:h,bufferType:t,type:m,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:m===r.INT||m===r.UNSIGNED_INT||e.gpuType===Ns,id:Soe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const x=this._createBuffer(r,t,s,a);v=new Toe(v,x)}n.set(e,v)}updateAttribute(e){const t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,a=t.get(s),l=a.bufferType,u=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(l,a.bufferGPU),u.length===0)n.bufferSubData(l,0,r);else{for(let h=0,m=u.length;h<m;h++){const v=u[h];n.bufferSubData(l,v.start*r.BYTES_PER_ELEMENT,r,v.start,v.count)}s.clearUpdateRanges()}n.bindBuffer(l,null),a.version=s.version}destroyAttribute(e){const t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);const r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e){const t=this.backend,{gl:n}=t,r=e.isInterleavedBufferAttribute?e.data:e,{bufferGPU:s}=t.get(r),a=e.array,l=a.byteLength;n.bindBuffer(n.COPY_READ_BUFFER,s);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,r){const s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}}let TN=!1,yS,pm;class Moe{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.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},TN===!1&&(this._init(this.gl),TN=!0)}_init(e){yS={[Eo]:e.FUNC_ADD,[bw]:e.FUNC_SUBTRACT,[Sw]:e.FUNC_REVERSE_SUBTRACT},pm={[Tw]:e.ZERO,[ww]:e.ONE,[Mw]:e.SRC_COLOR,[qm]:e.SRC_ALPHA,[Pw]:e.SRC_ALPHA_SATURATE,[Nw]:e.DST_COLOR,[Cw]:e.DST_ALPHA,[Ew]:e.ONE_MINUS_SRC_COLOR,[Vm]:e.ONE_MINUS_SRC_ALPHA,[Dw]:e.ONE_MINUS_DST_COLOR,[Rw]:e.ONE_MINUS_DST_ALPHA}}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!==T7?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===VS?t.cullFace(t.BACK):e===w7?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,r,s,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!==xw){if(e!==this.currentBlending||u!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==Eo||this.currentBlendEquationAlpha!==Eo)&&(h.blendEquation(h.FUNC_ADD),this.currentBlendEquation=Eo,this.currentBlendEquationAlpha=Eo),u)switch(e){case Ka:h.blendFuncSeparate(h.ONE,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA);break;case a0:h.blendFunc(h.ONE,h.ONE);break;case o0:h.blendFuncSeparate(h.ZERO,h.ONE_MINUS_SRC_COLOR,h.ZERO,h.ONE);break;case l0:h.blendFuncSeparate(h.ZERO,h.SRC_COLOR,h.ZERO,h.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e);break}else switch(e){case Ka:h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA);break;case a0:h.blendFunc(h.SRC_ALPHA,h.ONE);break;case o0:h.blendFuncSeparate(h.ZERO,h.ONE_MINUS_SRC_COLOR,h.ZERO,h.ONE);break;case l0:h.blendFunc(h.ZERO,h.SRC_COLOR);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}s=s||t,a=a||n,l=l||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(h.blendEquationSeparate(yS[t],yS[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||a!==this.currentBlendSrcAlpha||l!==this.currentBlendDstAlpha)&&(h.blendFuncSeparate(pm[n],pm[r],pm[a],pm[l]),this.currentBlendSrc=n,this.currentBlendDst=r,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 Hm:t.depthFunc(t.NEVER);break;case jm:t.depthFunc(t.ALWAYS);break;case Wm:t.depthFunc(t.LESS);break;case kh:t.depthFunc(t.LEQUAL);break;case $m:t.depthFunc(t.EQUAL);break;case Xm:t.depthFunc(t.GEQUAL);break;case Ym:t.depthFunc(t.GREATER);break;case Qm:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}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:r}=this;e.side===as?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===hr;t&&(s=!s),this.setFlipSided(s),e.blending===Ka&&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(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.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:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}bindFramebuffer(e,t){const{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){const{gl:n}=this;let r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));const a=e.textures;if(r.length!==a.length||r[0]!==n.COLOR_ATTACHMENT0){for(let l=0,u=a.length;l<u;l++)r[l]=n.COLOR_ATTACHMENT0+l;r.length=a.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){const{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){const{gl:r,currentTextureSlot:s,currentBoundTextures:a,maxTextures:l}=this;n===void 0&&(s===null?n=r.TEXTURE0+l-1:n=s);let u=a[n];u===void 0&&(u={type:void 0,texture:void 0},a[n]=u),(u.type!==e||u.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),u.type=e,u.texture=t)}bindBufferBase(e,t,n){const{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){const{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}}class Eoe{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=Co){const{gl:n,extensions:r}=this;let s;if(e===aa)return n.UNSIGNED_BYTE;if(e===Ay)return n.UNSIGNED_SHORT_4_4_4_4;if(e===dy)return n.UNSIGNED_SHORT_5_5_5_1;if(e===py)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===Qf)return n.BYTE;if(e===Kf)return n.SHORT;if(e===wl)return n.UNSIGNED_SHORT;if(e===Ns)return n.INT;if(e===Rr)return n.UNSIGNED_INT;if(e===$r)return n.FLOAT;if(e===Gs)return n.HALF_FLOAT;if(e===Uw)return n.ALPHA;if(e===Ug)return n.RGB;if(e===ks)return n.RGBA;if(e===Bw)return n.LUMINANCE;if(e===Ow)return n.LUMINANCE_ALPHA;if(e===au)return n.DEPTH_COMPONENT;if(e===du)return n.DEPTH_STENCIL;if(e===Bg)return n.RED;if(e===H0)return n.RED_INTEGER;if(e===lA)return n.RG;if(e===j0)return n.RG_INTEGER;if(e===W0)return n.RGBA_INTEGER;if(e===Zf||e===Bh||e===Oh||e===Ih)if(t===_n)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Zf)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Bh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Oh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Ih)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Zf)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Bh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Oh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Ih)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===Km||e===Zm||e===Jm||e===eg)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===Km)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===Zm)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===Jm)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===eg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===tg||e===u0||e===c0)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===tg||e===u0)return t===_n?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===c0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(e===h0||e===f0||e===A0||e===d0||e===p0||e===m0||e===g0||e===v0||e===_0||e===y0||e===x0||e===b0||e===S0||e===T0)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===h0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===f0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===A0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===d0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===p0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===m0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===g0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===v0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===_0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===y0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===x0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===b0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===S0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===T0)return t===_n?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Jf)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===Jf)return t===_n?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(e===Iw||e===ng||e===ig||e===rg)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===Jf)return s.COMPRESSED_RED_RGTC1_EXT;if(e===ng)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===ig)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===rg)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===Au?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,r)=>{function s(){const a=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(a===e.WAIT_FAILED){e.deleteSync(t),r();return}if(a===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}}let wN=!1,bv,xS,MN;class Coe{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},wN===!1&&(this._init(this.gl),wN=!0)}_init(e){bv={[aA]:e.REPEAT,[eu]:e.CLAMP_TO_EDGE,[oA]:e.MIRRORED_REPEAT},xS={[mr]:e.NEAREST,[s_]:e.NEAREST_MIPMAP_NEAREST,[tu]:e.NEAREST_MIPMAP_LINEAR,[gs]:e.LINEAR,[Jd]:e.LINEAR_MIPMAP_NEAREST,[Va]:e.LINEAR_MIPMAP_LINEAR},MN={[Fw]:e.NEVER,[Vw]:e.ALWAYS,[my]:e.LESS,[gy]:e.LEQUAL,[kw]:e.EQUAL,[qw]:e.GEQUAL,[zw]:e.GREATER,[Gw]:e.NOTEQUAL}}filterFallback(e){const{gl:t}=this;return e===mr||e===s_||e===tu?t.NEAREST:t.LINEAR}getGLTextureType(e){const{gl:t}=this;let n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP: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,r,s=!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;return 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&&(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=r===_n&&s===!1?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)),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&&(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=r===_n&&s===!1?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)),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_INT&&(u=a.DEPTH24_STENCIL8),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:r,backend:s}=this;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,n.NONE),n.texParameteri(e,n.TEXTURE_WRAP_S,bv[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,bv[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&n.texParameteri(e,n.TEXTURE_WRAP_R,bv[t.wrapR]),n.texParameteri(e,n.TEXTURE_MAG_FILTER,xS[t.magFilter]);const a=t.mipmaps!==void 0&&t.mipmaps.length>0,l=t.minFilter===gs&&a?Va:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,xS[l]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,MN[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===mr||t.minFilter!==tu&&t.minFilter!==Va||t.type===$r&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){const u=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e);let a=r[s];a===void 0&&(a=t.createTexture(),n.state.bindTexture(s,a),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=a),n.set(e,{textureGPU:a,glTextureType:s,isDefault:!0})}createTexture(e,t){const{gl:n,backend:r}=this,{levels:s,width:a,height:l,depth:u}=t,h=r.utils.convert(e.format,e.colorSpace),m=r.utils.convert(e.type),v=this.getInternalFormat(e.internalFormat,h,m,e.colorSpace,e.isVideoTexture),x=n.createTexture(),S=this.getGLTextureType(e);r.state.bindTexture(S,x),this.setTextureParameters(S,e),e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,s,v,a,l,u):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,s,v,a,l,u):e.isVideoTexture||n.texStorage2D(S,s,v,a,l),r.set(e,{textureGPU:x,glTextureType:S,glFormat:h,glType:m,glInternalFormat:v})}copyBufferToTexture(e,t){const{gl:n,backend:r}=this,{textureGPU:s,glTextureType:a,glFormat:l,glType:u}=r.get(t),{width:h,height:m}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,s),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,h,m,l,u,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){const{gl:n}=this,{width:r,height:s}=t,{textureGPU:a,glTextureType:l,glFormat:u,glType:h,glInternalFormat:m}=this.backend.get(e);if(e.isRenderTargetTexture||a===void 0)return;const v=x=>x.isDataTexture?x.image.data:typeof HTMLImageElement<"u"&&x instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&x instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&x instanceof ImageBitmap||x instanceof OffscreenCanvas?x:x.data;if(this.backend.state.bindTexture(l,a),this.setTextureParameters(l,e),e.isCompressedTexture){const x=e.mipmaps,S=t.image;for(let w=0;w<x.length;w++){const R=x[w];e.isCompressedArrayTexture?e.format!==n.RGBA?u!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,w,0,0,0,R.width,R.height,S.depth,u,R.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,w,0,0,0,R.width,R.height,S.depth,u,h,R.data):u!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,w,0,0,R.width,R.height,u,R.data):console.warn("Unsupported compressed texture format")}}else if(e.isCubeTexture){const x=t.images;for(let S=0;S<6;S++){const w=v(x[S]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,0,0,r,s,u,h,w)}}else if(e.isDataArrayTexture){const x=t.image;n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,x.width,x.height,x.depth,u,h,x.data)}else if(e.isData3DTexture){const x=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,x.width,x.height,x.depth,u,h,x.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(l,0,m,u,h,t.image);else{const x=v(t.image);n.texSubImage2D(l,0,0,0,r,s,u,h,x)}}generateMipmaps(e){const{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){const{gl:t,backend:n}=this;if(e){const r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(const s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e){const{gl:t,backend:n}=this,{textureGPU:r,renderTarget:s}=n.get(e);this.deallocateRenderBuffers(s),t.deleteTexture(r),n.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0){const{gl:a,backend:l}=this,{state:u}=this.backend,{textureGPU:h,glTextureType:m,glType:v,glFormat:x}=l.get(t);let S,w,R,C,E,B;n!==null?(S=n.max.x-n.min.x,w=n.max.y-n.min.y,R=n.min.x,C=n.min.y):(S=e.image.width,w=e.image.height,R=0,C=0),r!==null?(E=r.x,B=r.y):(E=0,B=0),u.bindTexture(m,h),a.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),a.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);const L=a.getParameter(a.UNPACK_ROW_LENGTH),O=a.getParameter(a.UNPACK_IMAGE_HEIGHT),G=a.getParameter(a.UNPACK_SKIP_PIXELS),q=a.getParameter(a.UNPACK_SKIP_ROWS),z=a.getParameter(a.UNPACK_SKIP_IMAGES),j=e.isCompressedTexture?e.mipmaps[s]:e.image;if(a.pixelStorei(a.UNPACK_ROW_LENGTH,j.width),a.pixelStorei(a.UNPACK_IMAGE_HEIGHT,j.height),a.pixelStorei(a.UNPACK_SKIP_PIXELS,R),a.pixelStorei(a.UNPACK_SKIP_ROWS,C),e.isRenderTargetTexture||e.isDepthTexture){const F=l.get(e),V=l.get(t),Y=l.get(F.renderTarget),ee=l.get(V.renderTarget),te=Y.framebuffers[F.cacheKey],re=ee.framebuffers[V.cacheKey];u.bindFramebuffer(a.READ_FRAMEBUFFER,te),u.bindFramebuffer(a.DRAW_FRAMEBUFFER,re);let ne=a.COLOR_BUFFER_BIT;e.isDepthTexture&&(ne=a.DEPTH_BUFFER_BIT),a.blitFramebuffer(R,C,S,w,E,B,S,w,ne,a.NEAREST),u.bindFramebuffer(a.READ_FRAMEBUFFER,null),u.bindFramebuffer(a.DRAW_FRAMEBUFFER,null)}else e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,s,E,B,S,w,x,v,j.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,s,E,B,j.width,j.height,x,j.data):a.texSubImage2D(a.TEXTURE_2D,s,E,B,S,w,x,v,j);a.pixelStorei(a.UNPACK_ROW_LENGTH,L),a.pixelStorei(a.UNPACK_IMAGE_HEIGHT,O),a.pixelStorei(a.UNPACK_SKIP_PIXELS,G),a.pixelStorei(a.UNPACK_SKIP_ROWS,q),a.pixelStorei(a.UNPACK_SKIP_IMAGES,z),s===0&&t.generateMipmaps&&a.generateMipmap(a.TEXTURE_2D),u.unbindTexture()}copyFramebufferToTexture(e,t,n){const{gl:r}=this,{state:s}=this.backend,{textureGPU:a}=this.backend.get(e),{x:l,y:u,z:h,w:m}=n,v=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,x=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(v){const S=l!==0||u!==0;let w,R;if(e.isDepthTexture===!0?(w=r.DEPTH_BUFFER_BIT,R=r.DEPTH_ATTACHMENT,t.stencil&&(w|=r.STENCIL_BUFFER_BIT)):(w=r.COLOR_BUFFER_BIT,R=r.COLOR_ATTACHMENT0),S){const C=this.backend.get(t.renderTarget),E=C.framebuffers[t.getCacheKey()],B=C.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,E),s.bindFramebuffer(r.READ_FRAMEBUFFER,B);const L=x-u-m;r.blitFramebuffer(l,L,l+h,L+m,l,L,l+h,L+m,w,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,E),s.bindTexture(r.TEXTURE_2D,a),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,l,L,h,m),s.unbindTexture()}else{const C=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,C),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,R,r.TEXTURE_2D,a,0),r.blitFramebuffer(0,0,h,m,0,0,h,m,w,r.NEAREST),r.deleteFramebuffer(C)}}else s.bindTexture(r.TEXTURE_2D,a),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,l,x-m-u,h,m),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t){const{gl:n}=this,r=t.renderTarget,{samples:s,depthTexture:a,depthBuffer:l,stencilBuffer:u,width:h,height:m}=r;if(n.bindRenderbuffer(n.RENDERBUFFER,e),l&&!u){let v=n.DEPTH_COMPONENT24;s>0?(a&&a.isDepthTexture&&a.type===n.FLOAT&&(v=n.DEPTH_COMPONENT32F),n.renderbufferStorageMultisample(n.RENDERBUFFER,s,v,h,m)):n.renderbufferStorage(n.RENDERBUFFER,v,h,m),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e)}else l&&u&&(s>0?n.renderbufferStorageMultisample(n.RENDERBUFFER,s,n.DEPTH24_STENCIL8,h,m):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,h,m),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,e))}async copyTextureToBuffer(e,t,n,r,s,a){const{backend:l,gl:u}=this,{textureGPU:h,glFormat:m,glType:v}=this.backend.get(e),x=u.createFramebuffer();u.bindFramebuffer(u.READ_FRAMEBUFFER,x);const S=e.isCubeTexture?u.TEXTURE_CUBE_MAP_POSITIVE_X+a:u.TEXTURE_2D;u.framebufferTexture2D(u.READ_FRAMEBUFFER,u.COLOR_ATTACHMENT0,S,h,0);const w=this._getTypedArrayType(v),R=this._getBytesPerTexel(v,m),E=r*s*R,B=u.createBuffer();u.bindBuffer(u.PIXEL_PACK_BUFFER,B),u.bufferData(u.PIXEL_PACK_BUFFER,E,u.STREAM_READ),u.readPixels(t,n,r,s,m,v,0),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),await l.utils._clientWaitAsync();const L=new w(E/w.BYTES_PER_ELEMENT);return u.bindBuffer(u.PIXEL_PACK_BUFFER,B),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,L),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),u.deleteFramebuffer(x),L}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(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 r=0;if(e===n.UNSIGNED_BYTE&&(r=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)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}}class Roe{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 Noe{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 EN={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"};class Doe{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:r,object:s,type:a,info:l,index:u}=this;u!==0?n.drawElements(r,t,a,e):n.drawArrays(r,e,t),l.update(s,t,r,1)}renderInstances(e,t,n){const{gl:r,mode:s,type:a,index:l,object:u,info:h}=this;n!==0&&(l!==0?r.drawElementsInstanced(s,t,a,e,n):r.drawArraysInstanced(s,e,t,n),h.update(u,t,s,n))}renderMultiDraw(e,t,n){const{extensions:r,mode:s,object:a,info:l}=this;if(n===0)return;const u=r.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(s,t,0,this.type,e,0,n):u.multiDrawArraysWEBGL(s,e,0,t,0,n);let h=0;for(let m=0;m<n;m++)h+=t[m];l.update(a,h,s,1)}}renderMultiDrawInstances(e,t,n,r){const{extensions:s,mode:a,object:l,info:u}=this;if(n===0)return;const h=s.get("WEBGL_multi_draw");if(h===null)for(let m=0;m<n;m++)this.renderInstances(e[m],t[m],r[m]);else{this.index!==0?h.multiDrawElementsInstancedWEBGL(a,t,0,this.type,e,0,r,0,n):h.multiDrawArraysInstancedWEBGL(a,e,0,t,0,r,0,n);let m=0;for(let v=0;v<n;v++)m+=t[v]*r[v];u.update(l,m,a,1)}}}class CN extends rO{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.trackTimestamp=e.trackTimestamp===!0,this._currentContext=null,this._knownBindings=new WeakSet}init(e){super.init(e);const t=this.parameters,n=t.context!==void 0?t.context:e.domElement.getContext("webgl2");function r(s){s.preventDefault();const a={api:"WebGL",message:s.statusMessage||"Unknown reason",reason:null,originalEvent:s};e.onDeviceLost(a)}this._onContextLost=r,e.domElement.addEventListener("webglcontextlost",r,!1),this.gl=n,this.extensions=new Roe(this),this.capabilities=new Noe(this),this.attributeUtils=new woe(this),this.textureUtils=new Coe(this),this.bufferRenderer=new Doe(this),this.state=new Moe(this),this.utils=new Eoe(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.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile")}get coordinateSystem(){return Ha}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async waitForGPU(){await this.utils._clientWaitAsync()}initTimestampQuery(e){if(!this.disjoint||!this.trackTimestamp)return;const t=this.get(e);if(this.queryRunning){t.queryQueue||(t.queryQueue=[]),t.queryQueue.push(e);return}t.activeQuery&&(this.gl.endQuery(this.disjoint.TIME_ELAPSED_EXT),t.activeQuery=null),t.activeQuery=this.gl.createQuery(),t.activeQuery!==null&&(this.gl.beginQuery(this.disjoint.TIME_ELAPSED_EXT,t.activeQuery),this.queryRunning=!0)}prepareTimestampBuffer(e){if(!this.disjoint||!this.trackTimestamp)return;const t=this.get(e);if(t.activeQuery&&(this.gl.endQuery(this.disjoint.TIME_ELAPSED_EXT),t.gpuQueries||(t.gpuQueries=[]),t.gpuQueries.push({query:t.activeQuery}),t.activeQuery=null,this.queryRunning=!1,t.queryQueue&&t.queryQueue.length>0)){const n=t.queryQueue.shift();this.initTimestampQuery(n)}}async resolveTimestampAsync(e,t="render"){if(!this.disjoint||!this.trackTimestamp)return;const n=this.get(e);n.gpuQueries||(n.gpuQueries=[]);for(let r=0;r<n.gpuQueries.length;r++){const s=n.gpuQueries[r],a=this.gl.getQueryParameter(s.query,this.gl.QUERY_RESULT_AVAILABLE),l=this.gl.getParameter(this.disjoint.GPU_DISJOINT_EXT);if(a&&!l){const u=this.gl.getQueryParameter(s.query,this.gl.QUERY_RESULT),h=Number(u)/1e6;this.gl.deleteQuery(s.query),n.gpuQueries.splice(r,1),r--,this.renderer.info.updateTimestamp(t,h)}}}getContext(){return this.gl}beginRender(e){const{gl:t}=this,n=this.get(e);if(this.initTimestampQuery(e),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1),e.viewport?this.updateViewport(e):t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),e.scissor){const{x:s,y:a,width:l,height:u}=e.scissorValue;t.scissor(s,e.height-u-a,l,u)}const r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:n}=this,r=this.get(e),s=r.previousContext,a=e.occlusionQueryCount;a>0&&(a>r.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=s,e.textures!==null&&e.renderTarget){const u=this.get(e.renderTarget),{samples:h}=e.renderTarget;if(h>0){const m=u.framebuffers[e.getCacheKey()],v=t.COLOR_BUFFER_BIT,x=u.msaaFrameBuffer,S=e.textures;n.bindFramebuffer(t.READ_FRAMEBUFFER,x),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,m);for(let w=0;w<S.length;w++)if(e.scissor){const{x:R,y:C,width:E,height:B}=e.scissorValue,L=e.height-B-C;t.blitFramebuffer(R,L,R+E,L+B,R,L,R+E,L+B,v,t.NEAREST),t.invalidateSubFramebuffer(t.READ_FRAMEBUFFER,u.invalidationArray,R,L,E,B)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,v,t.NEAREST),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,u.invalidationArray)}}s!==null&&(this._setFramebuffer(s),s.viewport?this.updateViewport(s):t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight)),this.prepareTimestampBuffer(e)}resolveOccludedAsync(e){const t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){const s=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 m=n[h];m!==null&&a.getQueryParameter(m,a.QUERY_RESULT_AVAILABLE)&&(a.getQueryParameter(m,a.QUERY_RESULT)>0&&s.add(r[h]),n[h]=null,a.deleteQuery(m),u++)}u<n.length?requestAnimationFrame(l):t.occluded=s};l()}}isOccluded(e,t){const n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){const t=this.gl,{x:n,y:r,width:s,height:a}=e.viewportValue;t.viewport(n,e.height-a-r,s,a)}setScissorTest(e){const t=this.gl;e?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST)}clear(e,t,n,r=null,s=!0){const{gl:a}=this;if(r===null){const u=this.getClearColor();u.r*=u.a,u.g*=u.a,u.b*=u.a,r={textures:null,clearColorValue:u}}let l=0;if(e&&(l|=a.COLOR_BUFFER_BIT),t&&(l|=a.DEPTH_BUFFER_BIT),n&&(l|=a.STENCIL_BUFFER_BIT),l!==0){let u;if(r.clearColorValue?u=r.clearColorValue:(u=this.getClearColor(),u.r*=u.a,u.g*=u.a,u.b*=u.a),t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(u.r,u.g,u.b,u.a),a.clear(l);else{if(s&&this._setFramebuffer(r),e)for(let h=0;h<r.textures.length;h++)a.clearBufferfv(a.COLOR,h,[u.r,u.g,u.b,u.a]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,1,0):t?a.clearBufferfv(a.DEPTH,0,[1]):n&&a.clearBufferiv(a.STENCIL,0,[0])}}}beginCompute(e){const{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(e)}compute(e,t,n,r){const{state:s,gl:a}=this;this.discard===!1&&(a.enable(a.RASTERIZER_DISCARD),this.discard=!0);const{programGPU:l,transformBuffers:u,attributes:h}=this.get(r),m=this._getVaoKey(null,h),v=this.vaoCache[m];v===void 0?this._createVao(null,h):a.bindVertexArray(v),s.useProgram(l),this._bindUniforms(n);const x=this._getTransformFeedback(u);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,x),a.beginTransformFeedback(a.POINTS),h[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,t.count):a.drawArrays(a.POINTS,0,t.count),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let S=0;S<u.length;S++){const w=u[S];w.pbo&&this.textureUtils.copyBufferToTexture(w.transformBuffer,w.pbo),w.switchBuffers()}}finishCompute(e){const t=this.gl;this.discard=!1,t.disable(t.RASTERIZER_DISCARD),this.prepareTimestampBuffer(e),this._currentContext&&this._setFramebuffer(this._currentContext)}draw(e){const{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:a}=e,{programGPU:l}=this.get(n),{gl:u,state:h}=this,m=this.get(s),v=e.getDrawParameters();if(v===null)return;this._bindUniforms(e.getBindings());const x=t.isMesh&&t.matrixWorld.determinant()<0;h.setMaterial(r,x,a),h.useProgram(l);const S=this.get(e);let w=S.staticVao;if(w===void 0||S.geometryId!==e.geometry.id){const G=this._getVaoKey(e.getIndex(),e.getAttributes());if(w=this.vaoCache[G],w===void 0){let q;({vaoGPU:w,staticVao:q}=this._createVao(e.getIndex(),e.getAttributes())),q&&(S.staticVao=w,S.geometryId=e.geometry.id)}}u.bindVertexArray(w);const R=e.getIndex(),C=m.lastOcclusionObject;if(C!==t&&C!==void 0){if(C!==null&&C.occlusionTest===!0&&(u.endQuery(u.ANY_SAMPLES_PASSED),m.occlusionQueryIndex++),t.occlusionTest===!0){const G=u.createQuery();u.beginQuery(u.ANY_SAMPLES_PASSED,G),m.occlusionQueries[m.occlusionQueryIndex]=G,m.occlusionQueryObjects[m.occlusionQueryIndex]=t}m.lastOcclusionObject=t}const E=this.bufferRenderer;t.isPoints?E.mode=u.POINTS:t.isLineSegments?E.mode=u.LINES:t.isLine?E.mode=u.LINE_STRIP:t.isLineLoop?E.mode=u.LINE_LOOP:r.wireframe===!0?(h.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),E.mode=u.LINES):E.mode=u.TRIANGLES;const{vertexCount:B,instanceCount:L}=v;let{firstVertex:O}=v;if(E.object=t,R!==null){O*=R.array.BYTES_PER_ELEMENT;const G=this.get(R);E.index=R.count,E.type=G.type}else E.index=0;t.isBatchedMesh?t._multiDrawInstances!==null?E.renderMultiDrawInstances(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount,t._multiDrawInstances):this.hasFeature("WEBGL_multi_draw")?E.renderMultiDraw(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount):kf("THREE.WebGLRenderer: WEBGL_multi_draw not supported."):L>1?E.renderInstances(O,B,L):E.render(O,B),u.bindVertexArray(null)}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)}copyTextureToBuffer(e,t,n,r,s,a){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,a)}createSampler(){}destroySampler(){}createNodeBuilder(e,t){return new boe(e,t)}createProgram(e){const t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){const n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:a}=r,l=n.createProgram(),u=this.get(s).shaderGPU,h=this.get(a).shaderGPU;if(n.attachShader(l,u),n.attachShader(l,h),n.linkProgram(l),this.set(r,{programGPU:l,fragmentShader:u,vertexShader:h}),t!==null&&this.parallel){const m=new Promise(v=>{const x=this.parallel,S=()=>{n.getProgramParameter(l,x.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),v()):requestAnimationFrame(S)};S()});t.push(m);return}this._completeCompile(e,r)}_handleSource(e,t){const n=e.split(`
`),r=[],s=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let l=s;l<a;l++){const u=l+1;r.push(`${u===t?">":" "} ${u}: ${n[l]}`)}return r.join(`
`)}_getShaderErrors(e,t,n){const r=e.getShaderParameter(t,e.COMPILE_STATUS),s=e.getShaderInfoLog(t).trim();if(r&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const l=parseInt(a[1]);return n.toUpperCase()+`

`+s+`

`+this._handleSource(e.getShaderSource(t),l)}else return s}_logProgramError(e,t,n){if(this.renderer.debug.checkShaderErrors){const r=this.gl,s=r.getProgramInfoLog(e).trim();if(r.getProgramParameter(e,r.LINK_STATUS)===!1)if(typeof this.renderer.debug.onShaderError=="function")this.renderer.debug.onShaderError(r,e,n,t);else{const a=this._getShaderErrors(r,n,"vertex"),l=this._getShaderErrors(r,t,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(e,r.VALIDATE_STATUS)+`

Program Info Log: `+s+`
`+a+`
`+l)}else s!==""&&console.warn("THREE.WebGLProgram: Program Info Log:",s)}}_completeCompile(e,t){const{state:n,gl:r}=this,s=this.get(t),{programGPU:a,fragmentShader:l,vertexShader:u}=s;r.getProgramParameter(a,r.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:r}=this,s={stage:"fragment",code:`#version 300 es
precision highp float;
void main() {}`};this.createProgram(s);const{computeProgram:a}=e,l=r.createProgram(),u=this.get(s).shaderGPU,h=this.get(a).shaderGPU,m=a.transforms,v=[],x=[];for(let C=0;C<m.length;C++){const E=m[C];v.push(E.varyingName),x.push(E.attributeNode)}r.attachShader(l,u),r.attachShader(l,h),r.transformFeedbackVaryings(l,v,r.SEPARATE_ATTRIBS),r.linkProgram(l),r.getProgramParameter(l,r.LINK_STATUS)===!1&&this._logProgramError(l,u,h),n.useProgram(l),this._setupBindings(t,l);const S=a.attributes,w=[],R=[];for(let C=0;C<S.length;C++){const E=S[C].node.attribute;w.push(E),this.has(E)||this.attributeUtils.createAttribute(E,r.ARRAY_BUFFER)}for(let C=0;C<x.length;C++){const E=x[C].attribute;this.has(E)||this.attributeUtils.createAttribute(E,r.ARRAY_BUFFER);const B=this.get(E);R.push(B)}this.set(e,{programGPU:l,transformBuffers:R,attributes:w})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(const s of t){this.set(s,{textures:r,uniformBuffers:n});for(const a of s.bindings)a.isUniformBuffer&&n++,a.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){const{gl:t}=this,n=this.get(e);let r=n.uniformBuffers,s=n.textures;for(const a of e.bindings)if(a.isUniformsGroup||a.isUniformBuffer){const l=a.buffer,u=t.createBuffer();t.bindBuffer(t.UNIFORM_BUFFER,u),t.bufferData(t.UNIFORM_BUFFER,l,t.DYNAMIC_DRAW),this.set(a,{index:r++,bufferGPU:u})}else if(a.isSampledTexture){const{textureGPU:l,glTextureType:u}=this.get(a.texture);this.set(a,{index:s++,textureGPU:l,glTextureType:u})}}updateBinding(e){const t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){const r=this.get(e).bufferGPU,s=e.buffer;t.bindBuffer(t.UNIFORM_BUFFER,r),t.bufferData(t.UNIFORM_BUFFER,s,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(EN).filter(r=>EN[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}getMaxAnisotropy(){return this.capabilities.getMaxAnisotropy()}copyTextureToTexture(e,t,n=null,r=null,s=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}_setFramebuffer(e){const{gl:t,state:n}=this;let r=null;if(e.textures!==null){const s=e.renderTarget,a=this.get(s),{samples:l,depthBuffer:u,stencilBuffer:h}=s,m=s.isWebGLCubeRenderTarget===!0,v=s.isRenderTarget3D===!0,x=s.isRenderTargetArray===!0;let S=a.msaaFrameBuffer,w=a.depthRenderbuffer;const R=eB(e);let C;if(m?(a.cubeFramebuffers||(a.cubeFramebuffers={}),C=a.cubeFramebuffers[R]):(a.framebuffers||(a.framebuffers={}),C=a.framebuffers[R]),C===void 0){C=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,C);const E=e.textures;if(m){a.cubeFramebuffers[R]=C;const{textureGPU:B}=this.get(E[0]),L=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+L,B,0)}else{a.framebuffers[R]=C;for(let B=0;B<E.length;B++){const L=E[B],O=this.get(L);O.renderTarget=e.renderTarget,O.cacheKey=R;const G=t.COLOR_ATTACHMENT0+B;if(v||x){const q=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,G,O.textureGPU,0,q)}else t.framebufferTexture2D(t.FRAMEBUFFER,G,t.TEXTURE_2D,O.textureGPU,0)}n.drawBuffers(e,C)}if(e.depthTexture!==null){const B=this.get(e.depthTexture),L=h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;B.renderTarget=e.renderTarget,B.cacheKey=R,t.framebufferTexture2D(t.FRAMEBUFFER,L,t.TEXTURE_2D,B.textureGPU,0)}}if(l>0){if(S===void 0){const E=[];S=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,S);const B=[],L=e.textures;for(let O=0;O<L.length;O++){if(B[O]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,B[O]),E.push(t.COLOR_ATTACHMENT0+O),u){const z=h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;E.push(z)}const G=e.textures[O],q=this.get(G);t.renderbufferStorageMultisample(t.RENDERBUFFER,l,q.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+O,t.RENDERBUFFER,B[O])}if(a.msaaFrameBuffer=S,a.msaaRenderbuffers=B,w===void 0){w=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(w,e),a.depthRenderbuffer=w;const O=h?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;E.push(O)}a.invalidationArray=E}r=a.msaaFrameBuffer}else r=C}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e,t){let n="";if(e!==null){const r=this.get(e);n+=":"+r.id}for(let r=0;r<t.length;r++){const s=this.get(t[r]);n+=":"+s.id}return n}_createVao(e,t){const{gl:n}=this,r=n.createVertexArray();let s="",a=!0;if(n.bindVertexArray(r),e!==null){const l=this.get(e);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,l.bufferGPU),s+=":"+l.id}for(let l=0;l<t.length;l++){const u=t[l],h=this.get(u);s+=":"+h.id,n.bindBuffer(n.ARRAY_BUFFER,h.bufferGPU),n.enableVertexAttribArray(l),(u.isStorageBufferAttribute||u.isStorageInstancedBufferAttribute)&&(a=!1);let m,v;u.isInterleavedBufferAttribute===!0?(m=u.data.stride*h.bytesPerElement,v=u.offset*h.bytesPerElement):(m=0,v=0),h.isInteger?n.vertexAttribIPointer(l,u.itemSize,h.type,m,v):n.vertexAttribPointer(l,u.itemSize,h.type,u.normalized,m,v),u.isInstancedBufferAttribute&&!u.isInterleavedBufferAttribute?n.vertexAttribDivisor(l,u.meshPerAttribute):u.isInterleavedBufferAttribute&&u.data.isInstancedInterleavedBuffer&&n.vertexAttribDivisor(l,u.data.meshPerAttribute)}return n.bindBuffer(n.ARRAY_BUFFER,null),this.vaoCache[s]=r,{vaoGPU:r,staticVao:a}}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;const{gl:r}=this;n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){const a=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,a.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){const n=this.gl;for(const r of e)for(const s of r.bindings){const l=this.get(s).index;if(s.isUniformsGroup||s.isUniformBuffer){const u=n.getUniformBlockIndex(t,s.name);n.uniformBlockBinding(t,u,l)}else if(s.isSampledTexture){const u=n.getUniformLocation(t,s.name);n.uniform1i(u,l)}}}_bindUniforms(e){const{gl:t,state:n}=this;for(const r of e)for(const s of r.bindings){const a=this.get(s),l=a.index;s.isUniformsGroup||s.isUniformBuffer?n.bindBufferBase(t.UNIFORM_BUFFER,l,a.bufferGPU):s.isSampledTexture&&n.bindTexture(a.glTextureType,a.textureGPU,t.TEXTURE0+l)}}dispose(){this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const Zd={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list",TriangleStrip:"triangle-strip"},Bs={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},ia={Store:"store"},Wr={Load:"load",Clear:"clear"},bS={CCW:"ccw"},SS={None:"none",Front:"front",Back:"back"},k0={Uint16:"uint16",Uint32:"uint32"},Ue={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",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",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-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"},TS={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},qf={Linear:"linear",Nearest:"nearest"},Kn={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDstColor:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},Df={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},RN={None:0,All:15},Th={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},wS={Storage:"storage",ReadOnlyStorage:"read-only-storage"},MS={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},Ld={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},NN={TwoD:"2d",ThreeD:"3d"},za={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},Poe={All:"all"},Sv={Vertex:"vertex",Instance:"instance"},nw={DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups"};class Loe extends GE{constructor(e,t){super(e),this.texture=t,this.version=t?t.version:0,this.isSampler=!0}}class Uoe extends Loe{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){this.texture=this.textureNode.value}}class Boe extends ZB{constructor(e,t){super(e,t?t.array:null),this.attribute=t,this.isStorageBuffer=!0}}let Ooe=0;class Ioe extends Boe{constructor(e,t){super("StorageBuffer_"+Ooe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:sa.READ_WRITE,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class Foe extends Yh{constructor(e){super(),this.device=e;const t=`
struct VarysStruct {
	@builtin( position ) Position: vec4<f32>,
	@location( 0 ) vTex : vec2<f32>
};

@vertex
fn main( @builtin( vertex_index ) vertexIndex : u32 ) -> VarysStruct {

	var Varys : VarysStruct;

	var pos = array< vec2<f32>, 4 >(
		vec2<f32>( -1.0,  1.0 ),
		vec2<f32>(  1.0,  1.0 ),
		vec2<f32>( -1.0, -1.0 ),
		vec2<f32>(  1.0, -1.0 )
	);

	var tex = array< vec2<f32>, 4 >(
		vec2<f32>( 0.0, 0.0 ),
		vec2<f32>( 1.0, 0.0 ),
		vec2<f32>( 0.0, 1.0 ),
		vec2<f32>( 1.0, 1.0 )
	);

	Varys.vTex = tex[ vertexIndex ];
	Varys.Position = vec4<f32>( pos[ vertexIndex ], 0.0, 1.0 );

	return Varys;

}
`,n=`
@group( 0 ) @binding( 0 )
var imgSampler : sampler;

@group( 0 ) @binding( 1 )
var img : texture_2d<f32>;

@fragment
fn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> {

	return textureSample( img, imgSampler, vTex );

}
`,r=`
@group( 0 ) @binding( 0 )
var imgSampler : sampler;

@group( 0 ) @binding( 1 )
var img : texture_2d<f32>;

@fragment
fn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> {

	return textureSample( img, imgSampler, vec2( vTex.x, 1.0 - vTex.y ) );

}
`;this.mipmapSampler=e.createSampler({minFilter:qf.Linear}),this.flipYSampler=e.createSampler({minFilter:qf.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:r})}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:Zd.TriangleStrip,stripIndexFormat:k0.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:Zd.TriangleStrip,stripIndexFormat:k0.Uint32},layout:"auto"}),this.flipYPipelines[e]=t),t}flipY(e,t,n=0){const r=t.format,{width:s,height:a}=t.size,l=this.getTransferPipeline(r),u=this.getFlipYPipeline(r),h=this.device.createTexture({size:{width:s,height:a,depthOrArrayLayers:1},format:r,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),m=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:za.TwoD,baseArrayLayer:n}),v=h.createView({baseMipLevel:0,mipLevelCount:1,dimension:za.TwoD,baseArrayLayer:0}),x=this.device.createCommandEncoder({}),S=(w,R,C)=>{const E=w.getBindGroupLayout(0),B=this.device.createBindGroup({layout:E,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:R}]}),L=x.beginRenderPass({colorAttachments:[{view:C,loadOp:Wr.Clear,storeOp:ia.Store,clearValue:[0,0,0,0]}]});L.setPipeline(w),L.setBindGroup(0,B),L.draw(4,1,0,0),L.end()};S(l,m,v),S(u,v,m),this.device.queue.submit([x.finish()]),h.destroy()}generateMipmaps(e,t,n=0){const r=this.get(e);r.useCount===void 0&&(r.useCount=0,r.layers=[]);const s=r.layers[n]||this._mipmapCreateBundles(e,t,n),a=this.device.createCommandEncoder({});this._mipmapRunBundles(a,s),this.device.queue.submit([a.finish()]),r.useCount!==0&&(r.layers[n]=s),r.useCount++}_mipmapCreateBundles(e,t,n){const r=this.getTransferPipeline(t.format),s=r.getBindGroupLayout(0);let a=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:za.TwoD,baseArrayLayer:n});const l=[];for(let u=1;u<t.mipLevelCount;u++){const h=this.device.createBindGroup({layout:s,entries:[{binding:0,resource:this.mipmapSampler},{binding:1,resource:a}]}),m=e.createView({baseMipLevel:u,mipLevelCount:1,dimension:za.TwoD,baseArrayLayer:n}),v={colorAttachments:[{view:m,loadOp:Wr.Clear,storeOp:ia.Store,clearValue:[0,0,0,0]}]},x=this.device.createRenderBundleEncoder({colorFormats:[t.format]});x.setPipeline(r),x.setBindGroup(0,h),x.draw(4,1,0,0),l.push({renderBundles:[x.finish()],passDescriptor:v}),a=m}return l}_mipmapRunBundles(e,t){const n=t.length;for(let r=0;r<n;r++){const s=t[r],a=e.beginRenderPass(s.passDescriptor);a.executeBundles(s.renderBundles),a.end()}}}const koe={[Fw]:"never",[my]:"less",[kw]:"equal",[gy]:"less-equal",[zw]:"greater",[qw]:"greater-equal",[Vw]:"always",[Gw]:"not-equal"},zoe=[0,1,3,2,4,5];class Goe{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this.colorBuffer=null,this.depthTexture=new qc,this.depthTexture.name="depthBuffer"}createSampler(e){const t=this.backend,n=t.device,r=t.get(e),s={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};s.magFilter===qf.Linear&&s.minFilter===qf.Linear&&s.mipmapFilter===qf.Linear&&(s.maxAnisotropy=e.anisotropy),e.isDepthTexture&&e.compareFunction!==null&&(s.compare=koe[e.compareFunction]),r.sampler=n.createSampler(s)}createDefaultTexture(e){let t;const n=iw(e);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):e.isVideoTexture?this.backend.get(e).externalTexture=this._getDefaultVideoFrame():t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){const n=this.backend,r=n.get(e);if(r.initialized)throw new Error("WebGPUTextureUtils: Texture already initialized.");t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);const{width:s,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),m=e.internalFormat||t.format||iw(e,n.device);r.format=m;const{samples:v,primarySamples:x,isMSAA:S}=n.utils.getTextureSampleData(e);let w=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(w|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&(w|=GPUTextureUsage.RENDER_ATTACHMENT);const R={label:e.name,size:{width:s,height:a,depthOrArrayLayers:l},mipLevelCount:u,sampleCount:x,dimension:h,format:m,usage:w};if(e.isVideoTexture){const C=e.source.data,E=new VideoFrame(C);R.size.width=E.displayWidth,R.size.height=E.displayHeight,E.close(),r.externalTexture=C}else{if(m===void 0)return console.warn("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);r.texture=n.device.createTexture(R)}if(S){const C=Object.assign({},R);C.label=C.label+"-msaa",C.sampleCount=v,r.msaaTexture=n.device.createTexture(C)}r.initialized=!0,r.textureDescriptorGPU=R}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 r=0;r<n;r++)this._generateMipmaps(t.texture,t.textureDescriptorGPU,r)}}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:r,height:s}=n.getDrawingBufferSize(),a=this.depthTexture,l=n.get(a).texture;let u,h;if(t?(u=du,h=Au):e&&(u=au,h=Rr),l!==void 0){if(a.image.width===r&&a.image.height===s&&a.format===u&&a.type===h)return l;this.destroyTexture(a)}return a.name="depthBuffer",a.format=u,a.type=h,a.image.width=r,a.image.height=s,this.createTexture(a,{width:r,height:s}),n.get(a).texture}updateTexture(e,t){const n=this.backend.get(e),{textureDescriptorGPU:r}=n;if(!(e.isRenderTargetTexture||r===void 0)){if(e.isDataTexture)this._copyBufferToTexture(t.image,n.texture,r,0,e.flipY);else if(e.isDataArrayTexture||e.isData3DTexture)for(let s=0;s<t.image.depth;s++)this._copyBufferToTexture(t.image,n.texture,r,s,e.flipY,s);else if(e.isCompressedTexture||e.isCompressedArrayTexture)this._copyCompressedBufferToTexture(e.mipmaps,n.texture,r);else if(e.isCubeTexture)this._copyCubeMapToTexture(t.images,n.texture,r,e.flipY);else if(e.isVideoTexture){const s=e.source.data;n.externalTexture=s}else this._copyImageToTexture(t.image,n.texture,r,0,e.flipY);n.version=e.version,e.onUpdate&&e.onUpdate(e)}}async copyTextureToBuffer(e,t,n,r,s,a){const l=this.backend.device,u=this.backend.get(e),h=u.texture,m=u.textureDescriptorGPU.format,v=this._getBytesPerTexel(m);let x=r*v;x=Math.ceil(x/256)*256;const S=l.createBuffer({size:r*s*v,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),w=l.createCommandEncoder();w.copyTextureToBuffer({texture:h,origin:{x:t,y:n,z:a}},{buffer:S,bytesPerRow:x},{width:r,height:s});const R=this._getTypedArrayType(m);l.queue.submit([w.finish()]),await S.mapAsync(GPUMapMode.READ);const C=S.getMappedRange();return new R(C)}_isEnvironmentTexture(e){const t=e.mapping;return t===zh||t===Gh||t===Qo||t===Ko}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){const n=new vs;n.minFilter=mr,n.magFilter=mr,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 yy;n.minFilter=mr,n.magFilter=mr,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultVideoFrame(){let e=this.defaultVideoFrame;if(e===null){const t={timestamp:0,codedWidth:1,codedHeight:1,format:"RGBA"};this.defaultVideoFrame=e=new VideoFrame(new Uint8Array([0,0,0,255]),t)}return e}_copyCubeMapToTexture(e,t,n,r){for(let s=0;s<6;s++){const a=e[s],l=r===!0?zoe[s]:s;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,r):this._copyImageToTexture(a,t,n,l,r)}}_copyImageToTexture(e,t,n,r,s){this.backend.device.queue.copyExternalImageToTexture({source:e},{texture:t,mipLevel:0,origin:{x:0,y:0,z:r}},{width:e.width,height:e.height,depthOrArrayLayers:1}),s===!0&&this._flipY(t,n,r)}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new Foe(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,r,s,a=0){const l=this.backend.device,u=e.data,h=this._getBytesPerTexel(n.format),m=e.width*h;l.queue.writeTexture({texture:t,mipLevel:0,origin:{x:0,y:0,z:r}},u,{offset:e.width*e.height*h*a,bytesPerRow:m},{width:e.width,height:e.height,depthOrArrayLayers:1}),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n){const r=this.backend.device,s=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1;for(let l=0;l<e.length;l++){const u=e[l],h=u.width,m=u.height,v=a?n.size.depthOrArrayLayers:1,x=Math.ceil(h/s.width)*s.byteLength,S=x*Math.ceil(m/s.height);for(let w=0;w<v;w++)r.queue.writeTexture({texture:t,mipLevel:l,origin:{x:0,y:0,z:w}},u.data,{offset:w*S,bytesPerRow:x,rowsPerImage:Math.ceil(m/s.height)},{width:Math.ceil(h/s.width)*s.width,height:Math.ceil(m/s.height)*s.height,depthOrArrayLayers:1})}}_getBlockData(e){if(e===Ue.BC1RGBAUnorm||e===Ue.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===Ue.BC2RGBAUnorm||e===Ue.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===Ue.BC3RGBAUnorm||e===Ue.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===Ue.BC4RUnorm||e===Ue.BC4RSNorm)return{byteLength:8,width:4,height:4};if(e===Ue.BC5RGUnorm||e===Ue.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===Ue.BC6HRGBUFloat||e===Ue.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===Ue.BC7RGBAUnorm||e===Ue.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===Ue.ETC2RGB8Unorm||e===Ue.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===Ue.ETC2RGB8A1Unorm||e===Ue.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===Ue.ETC2RGBA8Unorm||e===Ue.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===Ue.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===Ue.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===Ue.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===Ue.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===Ue.ASTC4x4Unorm||e===Ue.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===Ue.ASTC5x4Unorm||e===Ue.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===Ue.ASTC5x5Unorm||e===Ue.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===Ue.ASTC6x5Unorm||e===Ue.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===Ue.ASTC6x6Unorm||e===Ue.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===Ue.ASTC8x5Unorm||e===Ue.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===Ue.ASTC8x6Unorm||e===Ue.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===Ue.ASTC8x8Unorm||e===Ue.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===Ue.ASTC10x5Unorm||e===Ue.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===Ue.ASTC10x6Unorm||e===Ue.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===Ue.ASTC10x8Unorm||e===Ue.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===Ue.ASTC10x10Unorm||e===Ue.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===Ue.ASTC12x10Unorm||e===Ue.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===Ue.ASTC12x12Unorm||e===Ue.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=TS.ClampToEdge;return e===aA?t=TS.Repeat:e===oA&&(t=TS.MirrorRepeat),t}_convertFilterMode(e){let t=qf.Linear;return(e===mr||e===s_||e===tu)&&(t=qf.Nearest),t}_getBytesPerTexel(e){if(e===Ue.R8Unorm||e===Ue.R8Snorm||e===Ue.R8Uint||e===Ue.R8Sint)return 1;if(e===Ue.R16Uint||e===Ue.R16Sint||e===Ue.R16Float||e===Ue.RG8Unorm||e===Ue.RG8Snorm||e===Ue.RG8Uint||e===Ue.RG8Sint)return 2;if(e===Ue.R32Uint||e===Ue.R32Sint||e===Ue.R32Float||e===Ue.RG16Uint||e===Ue.RG16Sint||e===Ue.RG16Float||e===Ue.RGBA8Unorm||e===Ue.RGBA8UnormSRGB||e===Ue.RGBA8Snorm||e===Ue.RGBA8Uint||e===Ue.RGBA8Sint||e===Ue.BGRA8Unorm||e===Ue.BGRA8UnormSRGB||e===Ue.RGB9E5UFloat||e===Ue.RGB10A2Unorm||e===Ue.RG11B10UFloat||e===Ue.Depth32Float||e===Ue.Depth24Plus||e===Ue.Depth24PlusStencil8||e===Ue.Depth32FloatStencil8)return 4;if(e===Ue.RG32Uint||e===Ue.RG32Sint||e===Ue.RG32Float||e===Ue.RGBA16Uint||e===Ue.RGBA16Sint||e===Ue.RGBA16Float)return 8;if(e===Ue.RGBA32Uint||e===Ue.RGBA32Sint||e===Ue.RGBA32Float)return 16}_getTypedArrayType(e){if(e===Ue.R8Uint)return Uint8Array;if(e===Ue.R8Sint)return Int8Array;if(e===Ue.R8Unorm)return Uint8Array;if(e===Ue.R8Snorm)return Int8Array;if(e===Ue.RG8Uint)return Uint8Array;if(e===Ue.RG8Sint)return Int8Array;if(e===Ue.RG8Unorm)return Uint8Array;if(e===Ue.RG8Snorm)return Int8Array;if(e===Ue.RGBA8Uint)return Uint8Array;if(e===Ue.RGBA8Sint)return Int8Array;if(e===Ue.RGBA8Unorm)return Uint8Array;if(e===Ue.RGBA8Snorm)return Int8Array;if(e===Ue.R16Uint)return Uint16Array;if(e===Ue.R16Sint)return Int16Array;if(e===Ue.RG16Uint)return Uint16Array;if(e===Ue.RG16Sint)return Int16Array;if(e===Ue.RGBA16Uint)return Uint16Array;if(e===Ue.RGBA16Sint)return Int16Array;if(e===Ue.R16Float||e===Ue.RG16Float||e===Ue.RGBA16Float)return Uint16Array;if(e===Ue.R32Uint)return Uint32Array;if(e===Ue.R32Sint)return Int32Array;if(e===Ue.R32Float)return Float32Array;if(e===Ue.RG32Uint)return Uint32Array;if(e===Ue.RG32Sint)return Int32Array;if(e===Ue.RG32Float)return Float32Array;if(e===Ue.RGBA32Uint)return Uint32Array;if(e===Ue.RGBA32Sint)return Int32Array;if(e===Ue.RGBA32Float)return Float32Array;if(e===Ue.BGRA8Unorm||e===Ue.BGRA8UnormSRGB)return Uint8Array;if(e===Ue.RGB10A2Unorm||e===Ue.RGB9E5UFloat||e===Ue.RG11B10UFloat)return Uint32Array;if(e===Ue.Depth32Float)return Float32Array;if(e===Ue.Depth24Plus||e===Ue.Depth24PlusStencil8)return Uint32Array;if(e===Ue.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.isData3DTexture?t=NN.ThreeD:t=NN.TwoD,t}}function iw(i,e=null){const t=i.format,n=i.type,r=i.colorSpace;let s;if(i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Bh:s=r===_n?Ue.BC1RGBAUnormSRGB:Ue.BC1RGBAUnorm;break;case Oh:s=r===_n?Ue.BC2RGBAUnormSRGB:Ue.BC2RGBAUnorm;break;case Ih:s=r===_n?Ue.BC3RGBAUnormSRGB:Ue.BC3RGBAUnorm;break;case u0:s=r===_n?Ue.ETC2RGB8UnormSRGB:Ue.ETC2RGB8Unorm;break;case c0:s=r===_n?Ue.ETC2RGBA8UnormSRGB:Ue.ETC2RGBA8Unorm;break;case h0:s=r===_n?Ue.ASTC4x4UnormSRGB:Ue.ASTC4x4Unorm;break;case f0:s=r===_n?Ue.ASTC5x4UnormSRGB:Ue.ASTC5x4Unorm;break;case A0:s=r===_n?Ue.ASTC5x5UnormSRGB:Ue.ASTC5x5Unorm;break;case d0:s=r===_n?Ue.ASTC6x5UnormSRGB:Ue.ASTC6x5Unorm;break;case p0:s=r===_n?Ue.ASTC6x6UnormSRGB:Ue.ASTC6x6Unorm;break;case m0:s=r===_n?Ue.ASTC8x5UnormSRGB:Ue.ASTC8x5Unorm;break;case g0:s=r===_n?Ue.ASTC8x6UnormSRGB:Ue.ASTC8x6Unorm;break;case v0:s=r===_n?Ue.ASTC8x8UnormSRGB:Ue.ASTC8x8Unorm;break;case _0:s=r===_n?Ue.ASTC10x5UnormSRGB:Ue.ASTC10x5Unorm;break;case y0:s=r===_n?Ue.ASTC10x6UnormSRGB:Ue.ASTC10x6Unorm;break;case x0:s=r===_n?Ue.ASTC10x8UnormSRGB:Ue.ASTC10x8Unorm;break;case b0:s=r===_n?Ue.ASTC10x10UnormSRGB:Ue.ASTC10x10Unorm;break;case S0:s=r===_n?Ue.ASTC12x10UnormSRGB:Ue.ASTC12x10Unorm;break;case T0:s=r===_n?Ue.ASTC12x12UnormSRGB:Ue.ASTC12x12Unorm;break;case ks:s=r===_n?Ue.RGBA8UnormSRGB:Ue.RGBA8Unorm;break;default:console.error("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case ks:switch(n){case Qf:s=Ue.RGBA8Snorm;break;case Kf:s=Ue.RGBA16Sint;break;case wl:s=Ue.RGBA16Uint;break;case Rr:s=Ue.RGBA32Uint;break;case Ns:s=Ue.RGBA32Sint;break;case aa:s=r===_n?Ue.RGBA8UnormSRGB:Ue.RGBA8Unorm;break;case Gs:s=Ue.RGBA16Float;break;case $r:s=Ue.RGBA32Float;break;default:console.error("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Ug:switch(n){case py:s=Ue.RGB9E5UFloat;break;default:console.error("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Bg:switch(n){case Qf:s=Ue.R8Snorm;break;case Kf:s=Ue.R16Sint;break;case wl:s=Ue.R16Uint;break;case Rr:s=Ue.R32Uint;break;case Ns:s=Ue.R32Sint;break;case aa:s=Ue.R8Unorm;break;case Gs:s=Ue.R16Float;break;case $r:s=Ue.R32Float;break;default:console.error("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case lA:switch(n){case Qf:s=Ue.RG8Snorm;break;case Kf:s=Ue.RG16Sint;break;case wl:s=Ue.RG16Uint;break;case Rr:s=Ue.RG32Uint;break;case Ns:s=Ue.RG32Sint;break;case aa:s=Ue.RG8Unorm;break;case Gs:s=Ue.RG16Float;break;case $r:s=Ue.RG32Float;break;default:console.error("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case au:switch(n){case wl:s=Ue.Depth16Unorm;break;case Rr:s=Ue.Depth24Plus;break;case $r:s=Ue.Depth32Float;break;default:console.error("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case du:switch(n){case Au:s=Ue.Depth24PlusStencil8;break;case $r:e&&e.features.has(nw.Depth32FloatStencil8)===!1&&console.error('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),s=Ue.Depth32FloatStencil8;break;default:console.error("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case H0:switch(n){case Ns:s=Ue.R32Sint;break;case Rr:s=Ue.R32Uint;break;default:console.error("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case j0:switch(n){case Ns:s=Ue.RG32Sint;break;case Rr:s=Ue.RG32Uint;break;default:console.error("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case W0:switch(n){case Ns:s=Ue.RGBA32Sint;break;case Rr:s=Ue.RGBA32Uint;break;default:console.error("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:console.error("WebGPURenderer: Unsupported texture format.",t)}return s}const qoe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,Voe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,DN={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_multisampled_2d:"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"},Hoe=i=>{i=i.trim();const e=i.match(qoe);if(e!==null&&e.length===4){const t=e[2],n=[];let r=null;for(;(r=Voe.exec(t))!==null;)n.push({name:r[1],type:r[2]});const s=[];for(let m=0;m<n.length;m++){const{name:v,type:x}=n[m];let S=x;S.startsWith("ptr")?S="pointer":(S.startsWith("texture")&&(S=x.split("<")[0]),S=DN[S]),s.push(new kE(S,v))}const a=i.substring(e[0].length),l=e[3]||"void",u=e[1]!==void 0?e[1]:"";return{type:DN[l]||l,inputs:s,name:u,inputsCode:t,blockCode:a,outputType:l}}else throw new Error("FunctionNode: Function is not a WGSL code.")};class joe extends zE{constructor(e){const{type:t,inputs:n,name:r,inputsCode:s,blockCode:a,outputType:l}=Hoe(e);super(t,n,r),this.inputsCode=s,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 Woe extends QB{parseFunction(e){return new joe(e)}}const Ud=typeof self<"u"?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},$oe={[sa.READ_ONLY]:"read",[sa.WRITE_ONLY]:"write",[sa.READ_WRITE]:"read_write"},PN={[aA]:"repeat",[eu]:"clamp",[oA]:"mirror"},Tv={vertex:Ud?Ud.VERTEX:1,fragment:Ud?Ud.FRAGMENT:2,compute:Ud?Ud.COMPUTE:4},LN={instance:!0,swizzleAssign:!1,storageBuffer:!0},Xoe={"^^":"tsl_xor"},Yoe={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>"},UN={},Wo={tsl_xor:new rs("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new rs("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new rs("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new rs("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new rs("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new rs("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new rs("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new rs("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 rs("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 rs("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new rs("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 rs("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new rs(`
fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {

	let res = vec2f( iRes );

	let uvScaled = coord * res;
	let uvWrapping = ( ( uvScaled % res ) + res ) % res;

	// https://www.shadertoy.com/view/WtyXRy

	let uv = uvWrapping - 0.5;
	let iuv = floor( uv );
	let f = fract( uv );

	let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );
	let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );
	let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );
	let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );

	return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );

}
`)},Mm={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>"};typeof navigator<"u"&&/Windows/g.test(navigator.userAgent)&&(Wo.pow_float=new rs("fn tsl_pow_float( a : f32, b : f32 ) -> f32 { return select( -pow( -a, b ), pow( a, b ), a > 0.0 ); }"),Wo.pow_vec2=new rs("fn tsl_pow_vec2( a : vec2f, b : vec2f ) -> vec2f { return vec2f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ) ); }",[Wo.pow_float]),Wo.pow_vec3=new rs("fn tsl_pow_vec3( a : vec3f, b : vec3f ) -> vec3f { return vec3f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ) ); }",[Wo.pow_float]),Wo.pow_vec4=new rs("fn tsl_pow_vec4( a : vec4f, b : vec4f ) -> vec4f { return vec4f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ), tsl_pow_float( a.w, b.w ) ); }",[Wo.pow_float]),Mm.pow_float="tsl_pow_float",Mm.pow_vec2="tsl_pow_vec2",Mm.pow_vec3="tsl_pow_vec3",Mm.pow_vec4="tsl_pow_vec4");let sO="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(sO+=`diagnostic( off, derivative_uniformity );
`);class Qoe extends XB{constructor(e,t){super(e,t,new Woe),this.uniformGroups={},this.builtins={},this.directives={},this.scopedArrays=new Map}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==Co}_generateTextureSample(e,t,n,r,s=this.shaderStage){return s==="fragment"?r?`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n):this.generateTextureLod(e,t,n,r,"0")}_generateVideoSample(e,t,n=this.shaderStage){if(n==="fragment")return`textureSampleBaseClampToEdge( ${e}, ${e}_sampler, vec2<f32>( ${t}.x, 1.0 - ${t}.y ) )`;console.error(`WebGPURenderer: THREE.VideoTexture does not support ${n} shader.`)}_generateTextureSampleLevel(e,t,n,r,s,a=this.shaderStage){return(a==="fragment"||a==="compute")&&this.isUnfilterable(e)===!1?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,r):this.generateTextureLod(e,t,n,s,r)}generateWrapFunction(e){const t=`tsl_coord_${PN[e.wrapS]}S_${PN[e.wrapT]}_${e.isData3DTexture?"3d":"2d"}T`;let n=UN[t];if(n===void 0){const r=[],s=e.isData3DTexture?"vec3f":"vec2f";let a=`fn ${t}( coord : ${s} ) -> ${s} {

	return ${s}(
`;const l=(u,h)=>{u===aA?(r.push(Wo.repeatWrapping_float),a+=`		tsl_repeatWrapping_float( coord.${h} )`):u===eu?(r.push(Wo.clampWrapping_float),a+=`		tsl_clampWrapping_float( coord.${h} )`):u===oA?(r.push(Wo.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+=`,
`,l(e.wrapT,"y"),e.isData3DTexture&&(a+=`,
`,l(e.wrapR,"z")),a+=`
	);

}
`,UN[t]=n=new rs(a,r)}return n.build(this),t}generateTextureDimension(e,t,n){const r=this.getDataFromNode(e,this.shaderStage,this.globalCache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.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.isVideoTexture||e.isStorageTexture?a=t:a=`${t}${n?`, u32( ${n} )`:""}`,s=new Kv(new Zv(`textureDimensions( ${a} )`,l)),r.dimensionsSnippet[n]=s,(e.isDataArrayTexture||e.isData3DTexture)&&(r.arrayLayerCount=new Kv(new Zv(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new Kv(new Zv("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r="0u"){this._include("biquadraticTexture");const s=this.generateWrapFunction(e),a=this.generateTextureDimension(e,t,r);return`tsl_biquadraticTexture( ${t}, ${s}( ${n} ), ${a}, u32( ${r} ) )`}generateTextureLod(e,t,n,r,s="0u"){const a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s),u=e.isData3DTexture?"vec3":"vec2",h=`${u}<u32>(${a}(${n}) * ${u}<f32>(${l}))`;return this.generateTextureLoad(e,t,h,r,s)}generateTextureLoad(e,t,n,r,s="0u"){return e.isVideoTexture===!0||e.isStorageTexture===!0?`textureLoad( ${t}, ${n} )`:r?`textureLoad( ${t}, ${n}, ${r}, u32( ${s} ) )`:`textureLoad( ${t}, ${n}, u32( ${s} ) )`}generateTextureStore(e,t,n,r){return`textureStore( ${t}, ${n}, ${r} )`}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.isDataTexture===!0&&e.type===$r||this.isSampleCompare(e)===!1&&e.minFilter===mr&&e.magFilter===mr||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s=this.shaderStage){let a=null;return e.isVideoTexture===!0?a=this._generateVideoSample(t,n,s):this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,"0",s):a=this._generateTextureSample(e,t,n,r,s),a}generateTextureGrad(e,t,n,r,s,a=this.shaderStage){if(a==="fragment")return`textureSampleGrad( ${t}, ${t}_sampler, ${n},  ${r[0]}, ${r[1]} )`;console.error(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,a=this.shaderStage){if(a==="fragment")return`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;console.error(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureLevel(e,t,n,r,s,a=this.shaderStage){let l=null;return e.isVideoTexture===!0?l=this._generateVideoSample(t,n,a):l=this._generateTextureSampleLevel(e,t,n,r,s,a),l}generateTextureBias(e,t,n,r,s,a=this.shaderStage){if(a==="fragment")return`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;console.error(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} 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,r=e.type;return r==="texture"||r==="cubeTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?`NodeBuffer_${e.id}.${n}`:e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}_getUniformGroupCount(e){return Object.keys(this.uniforms[e]).length}getFunctionOperator(e){const t=Xoe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?sa.READ_ONLY:e.access}getStorageAccess(e,t){return $oe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){const s=super.getUniformFromNode(e,t,n,r),a=this.getDataFromNode(e,n,this.globalCache);if(a.uniformGPU===void 0){let l;const u=e.groupNode,h=u.name,m=this.getBindGroupArray(h,n);if(t==="texture"||t==="cubeTexture"||t==="storageTexture"||t==="texture3D"){let v=null;const x=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?v=new ex(s.name,s.node,u,x):t==="cubeTexture"?v=new nO(s.name,s.node,u,x):t==="texture3D"&&(v=new iO(s.name,s.node,u,x)),v.store=e.isStorageTextureNode===!0,v.setVisibility(Tv[n]),(n==="fragment"||n==="compute")&&this.isUnfilterable(e.value)===!1&&v.store===!1){const S=new Uoe(`${s.name}_sampler`,s.node,u);S.setVisibility(Tv[n]),m.push(S,v),l=[S,v]}else m.push(v),l=[v]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){const v=t==="buffer"?eO:Ioe,x=new v(e,u);x.setVisibility(Tv[n]),m.push(x),l=x}else{const v=this.uniformGroups[n]||(this.uniformGroups[n]={});let x=v[h];x===void 0&&(x=new tO(h,u),x.setVisibility(Tv[n]),v[h]=x,m.push(x)),l=this.getNodeUniform(s,t),x.addUniform(l)}a.uniformGPU=l}return s}getBuiltin(e,t,n,r=this.shaderStage){const s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.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),r=[];for(const a of t.inputs)r.push(a.name+" : "+this.getType(a.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {
${n.vars}
${n.code}
`;return n.result&&(s+=`	return ${n.result};
`),s+=`
}
`,s}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 r of n)t.push(`enable ${r};`);return t.join(`
`)}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:r,property:s,type:a}of n.values())t.push(`@builtin( ${r} ) ${s} : ${a}`);return t.join(`,
	`)}getScopedArray(e,t,n,r){return this.scopedArrays.has(e)===!1&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:n,bufferCount:r}),e}getScopedArrays(e){if(e!=="compute")return;const t=[];for(const{name:n,scope:r,bufferType:s,bufferCount:a}of this.scopedArrays.values()){const l=this.getType(s);t.push(`var<${r}> ${n}: array< ${l}, ${a} >;`)}return t.join(`
`)}getAttributes(e){const t=[];if(e==="compute"&&(this.getBuiltin("global_invocation_id","id","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");n&&t.push(n);const r=this.getAttributesArray();for(let s=0,a=r.length;s<a;s++){const l=r[s],u=l.name,h=this.getType(l.type);t.push(`@location( ${s} ) ${u} : ${h}`)}}return t.join(`,
	`)}getStructMembers(e){const t=[],n=e.getMemberTypes();for(let s=0;s<n.length;s++){const a=n[s];t.push(`	@location( ${s} ) m${s} : ${a}<f32>`)}const r=this.getBuiltins("output");return r&&t.push("	"+r),t.join(`,
`)}getStructs(e){const t=[],n=this.structs[e];for(let r=0,s=n.length;r<s;r++){const a=n[r],l=a.name;let u=`struct ${l} {
`;u+=this.getStructMembers(a),u+=`
}`,t.push(u),t.push(`
var<private> output : ${l};

`)}return t.join(`

`)}getVar(e,t){return`var ${t} : ${this.getType(e)}`}getVars(e){const t=[],n=this.vars[e];if(n!==void 0)for(const r of n)t.push(`	${this.getVar(r.type,r.name)};`);return`
${t.join(`
`)}
`}getVaryings(e){const t=[];if(e==="vertex"&&this.getBuiltin("position","Vertex","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){const s=this.varyings,a=this.vars[e];for(let l=0;l<s.length;l++){const u=s[l];if(u.needsInterpolation){let h=`@location( ${l} )`;/^(int|uint|ivec|uvec)/.test(u.type)&&(h+=" @interpolate( 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 r=t.join(`,
	`);return e==="vertex"?this._getWGSLStruct("VaryingsStruct","	"+r):r}getUniforms(e){const t=this.uniforms[e],n=[],r=[],s=[],a={};for(const u of t){const h=u.groupNode.name,m=this.bindingsIndexes[h];if(u.type==="texture"||u.type==="cubeTexture"||u.type==="storageTexture"||u.type==="texture3D"){const v=u.node.value;(e==="fragment"||e==="compute")&&this.isUnfilterable(v)===!1&&u.node.isStorageTextureNode!==!0&&(this.isSampleCompare(v)?n.push(`@binding( ${m.binding++} ) @group( ${m.group} ) var ${u.name}_sampler : sampler_comparison;`):n.push(`@binding( ${m.binding++} ) @group( ${m.group} ) var ${u.name}_sampler : sampler;`));let x,S="";const{primarySamples:w}=this.renderer.backend.utils.getTextureSampleData(v);if(w>1&&(S="_multisampled"),v.isCubeTexture===!0)x="texture_cube<f32>";else if(v.isDataArrayTexture===!0||v.isCompressedArrayTexture===!0)x="texture_2d_array<f32>";else if(v.isDepthTexture===!0)x=`texture_depth${S}_2d`;else if(v.isVideoTexture===!0)x="texture_external";else if(v.isData3DTexture===!0)x="texture_3d<f32>";else if(u.node.isStorageTextureNode===!0){const R=iw(v),C=this.getStorageAccess(u.node,e);x=`texture_storage_2d<${R}, ${C}>`}else{const R=this.getComponentTypeFromTexture(v).charAt(0);x=`texture${S}_2d<${R}32>`}n.push(`@binding( ${m.binding++} ) @group( ${m.group} ) var ${u.name} : ${x};`)}else if(u.type==="buffer"||u.type==="storageBuffer"||u.type==="indirectStorageBuffer"){const v=u.node,x=this.getType(v.bufferType),S=v.bufferCount,w=S>0&&u.type==="buffer"?", "+S:"",R=v.isAtomic?`atomic<${x}>`:`${x}`,C=`	${u.name} : array< ${R}${w} >
`,E=v.isStorageBufferNode?`storage, ${this.getStorageAccess(v,e)}`:"uniform";r.push(this._getWGSLStructBinding("NodeBuffer_"+v.id,C,E,m.binding++,m.group))}else{const v=this.getType(this.getVectorType(u.type)),x=u.groupNode.name;(a[x]||(a[x]={index:m.binding++,id:m.group,snippets:[]})).snippets.push(`	${u.name} : ${v}`)}}for(const u in a){const h=a[u];s.push(this._getWGSLStructBinding(u,h.snippets.join(`,
`),"uniform",h.index,h.id))}let l=n.join(`
`);return l+=r.join(`
`),l+=s.join(`
`),l}buildCode(){const e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){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 r=`// code

`;r+=this.flowCode[t];const s=this.flowNodes[t],a=s[s.length-1],l=a.outputNode,u=l!==void 0&&l.isOutputStructNode===!0;for(const h of s){const m=this.getFlowData(h),v=h.name;if(v&&(r.length>0&&(r+=`
`),r+=`	// flow -> ${v}
	`),r+=`${m.code}
	`,h===a&&t!=="compute"){if(r+=`// result

	`,t==="vertex")r+=`varyings.Vertex = ${m.result};`;else if(t==="fragment")if(u)n.returnType=l.nodeType,r+=`return ${m.result};`;else{let x="	@location(0) color: vec4<f32>";const S=this.getBuiltins("output");S&&(x+=`,
	`+S),n.returnType="OutputStruct",n.structs+=this._getWGSLStruct("OutputStruct",x),n.structs+=`
var<private> output : OutputStruct;

`,r+=`output.color = ${m.result};

	return output;`}}}n.flow=r}this.material!==null?(this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment)):this.computeShader=this._getWGSLComputeCode(e.compute,(this.object.workgroupSize||[64]).join(", "))}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getType(e){return Yoe[e]||e}isAvailable(e){let t=LN[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),LN[e]=t),t}_getWGSLMethod(e){return Wo[e]!==void 0&&this._include(e),Mm[e]}_include(e){const t=Wo[e];return t.build(this),this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}
// directives
${e.directives}

// uniforms
${e.uniforms}

// varyings
${e.varyings}
var<private> varyings : VaryingsStruct;

// codes
${e.codes}

@vertex
fn main( ${e.attributes} ) -> VaryingsStruct {

	// vars
	${e.vars}

	// flow
	${e.flow}

	return varyings;

}
`}_getWGSLFragmentCode(e){return`${this.getSignature()}
// global
${sO}

// uniforms
${e.uniforms}

// structs
${e.structs}

// codes
${e.codes}

@fragment
fn main( ${e.varyings} ) -> ${e.returnType} {

	// vars
	${e.vars}

	// flow
	${e.flow}

}
`}_getWGSLComputeCode(e,t){return`${this.getSignature()}
// directives
${e.directives}

// system
var<private> instanceIndex : u32;

// locals
${e.scopedArrays}

// uniforms
${e.uniforms}

// codes
${e.codes}

@compute @workgroup_size( ${t} )
fn main( ${e.attributes} ) {

	// system
	instanceIndex = id.x + id.y * numWorkgroups.x * u32(${t}) + id.z * numWorkgroups.x * numWorkgroups.y * u32(${t});

	// vars
	${e.vars}

	// flow
	${e.flow}

}
`}_getWGSLStruct(e,t){return`
struct ${e} {
${t}
};`}_getWGSLStructBinding(e,t,n,r=0,s=0){const a=e+"Struct";return`${this._getWGSLStruct(a,t)}
@binding( ${r} ) @group( ${s} )
var<${n}> ${e} : ${a};`}}class Koe{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.depth&&e.stencil?t=Ue.Depth24PlusStencil8:e.depth&&(t=Ue.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 s=this.backend.renderer,a=s.getRenderTarget();t=a?a.samples:s.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 Zd.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Zd.LineList;if(e.isLine)return Zd.LineStrip;if(e.isMesh)return Zd.TriangleList}getSampleCount(e){let t=1;return e>1&&(t=Math.pow(2,Math.floor(Math.log2(e))),t===2&&(t=4)),t}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.samples)}getPreferredCanvasFormat(){return navigator.userAgent.includes("Quest")?Ue.BGRA8Unorm:navigator.gpu.getPreferredCanvasFormat()}}const Zoe=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]),Joe=new Map([[G7,["float16"]]]),ele=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class tle{constructor(e){this.backend=e}createAttribute(e,t){const n=this._getBufferAttribute(e),r=this.backend,s=r.get(n);let a=s.buffer;if(a===void 0){const l=r.device;let u=n.array;if(e.normalized===!1&&(u.constructor===Int16Array||u.constructor===Uint16Array)){const m=new Uint32Array(u.length);for(let v=0;v<u.length;v++)m[v]=u[v];u=m}if(n.array=u,(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3){u=new u.constructor(n.count*4);for(let m=0;m<n.count;m++)u.set(n.array.subarray(m*3,m*3+3),m*4);n.itemSize=4,n.array=u}const h=u.byteLength+(4-u.byteLength%4)%4;a=l.createBuffer({label:n.name,size:h,usage:t,mappedAtCreation:!0}),new u.constructor(a.getMappedRange()).set(u),a.unmap(),s.buffer=a}}updateAttribute(e){const t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t).buffer,a=t.array,l=this._isTypedArray(a),u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(s,0,a,0);else{const h=l?1:a.BYTES_PER_ELEMENT;for(let m=0,v=u.length;m<v;m++){const x=u[m],S=x.start*h,w=x.count*h;r.queue.writeBuffer(s,0,a,S,w)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){const t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){const s=t[r],a=s.array.BYTES_PER_ELEMENT,l=this._getBufferAttribute(s);let u=n.get(l);if(u===void 0){let v,x;s.isInterleavedBufferAttribute===!0?(v=s.data.stride*a,x=s.data.isInstancedInterleavedBuffer?Sv.Instance:Sv.Vertex):(v=s.itemSize*a,x=s.isInstancedBufferAttribute?Sv.Instance:Sv.Vertex),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(v=4),u={arrayStride:v,attributes:[],stepMode:x},n.set(l,u)}const h=this._getVertexFormat(s),m=s.isInterleavedBufferAttribute===!0?s.offset*a:0;u.attributes.push({shaderLocation:r,offset:m,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,s=t.get(this._getBufferAttribute(e)).buffer,a=s.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(s,0,l,0,a);const h=u.finish();n.queue.submit([h]),await l.mapAsync(GPUMapMode.READ);const m=l.getMappedRange(),v=new e.array.constructor(m.slice(0));return l.unmap(),v.buffer}_getVertexFormat(e){const{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor;let a;if(t===1)a=ele.get(r);else{const u=(Joe.get(s)||Zoe.get(r))[n?1:0];if(u){const h=r.BYTES_PER_ELEMENT*t,v=Math.floor((h+3)/4)*4/r.BYTES_PER_ELEMENT;if(v%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");a=`${u}x${v}`}}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 nle{constructor(e){this.backend=e,this.bindGroupLayoutCache=new WeakMap}createBindingsLayout(e){const t=this.backend,n=t.device,r=[];let s=0;for(const a of e.bindings){const l={binding:s++,visibility:a.visibility};if(a.isUniformBuffer||a.isStorageBuffer){const u={};a.isStorageBuffer&&(a.visibility&4&&(a.access===sa.READ_WRITE||a.access===sa.WRITE_ONLY)?u.type=wS.Storage:u.type=wS.ReadOnlyStorage),l.buffer=u}else if(a.isSampler){const u={};a.texture.isDepthTexture&&a.texture.compareFunction!==null&&(u.type="comparison"),l.sampler=u}else if(a.isSampledTexture&&a.texture.isVideoTexture)l.externalTexture={};else if(a.isSampledTexture&&a.store){const u={};u.format=this.backend.get(a.texture).texture.format;const h=a.access;h===sa.READ_WRITE?u.access=MS.ReadWrite:h===sa.WRITE_ONLY?u.access=MS.WriteOnly:u.access=MS.ReadOnly,l.storageTexture=u}else if(a.isSampledTexture){const u={},{primarySamples:h}=t.utils.getTextureSampleData(a.texture);if(h>1&&(u.multisampled=!0,a.texture.isDepthTexture||(u.sampleType=Ld.UnfilterableFloat)),a.texture.isDepthTexture)u.sampleType=Ld.Depth;else if(a.texture.isDataTexture||a.texture.isDataArrayTexture||a.texture.isData3DTexture){const m=a.texture.type;m===Ns?u.sampleType=Ld.SInt:m===Rr?u.sampleType=Ld.UInt:m===$r&&(this.backend.hasFeature("float32-filterable")?u.sampleType=Ld.Float:u.sampleType=Ld.UnfilterableFloat)}a.isSampledCubeTexture?u.viewDimension=za.Cube:a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?u.viewDimension=za.TwoDArray:a.isSampledTexture3D&&(u.viewDimension=za.ThreeD),l.texture=u}else console.error(`WebGPUBindingUtils: Unsupported binding "${a}".`);r.push(l)}return n.createBindGroupLayout({entries:r})}createBindings(e,t,n,r=0){const{backend:s,bindGroupLayoutCache:a}=this,l=s.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]===r&&(h=l.groups[n])),h===void 0&&(h=this.createBindGroup(e,u),n>0&&(l.groups[n]=h,l.versions[n]=r)),l.group=h,l.layout=u}updateBinding(e){const t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer;n.queue.writeBuffer(s,0,r,0)}createBindGroup(e,t){const n=this.backend,r=n.device;let s=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,m=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,v=r.createBuffer({label:"bindingBuffer_"+l.name,size:h,usage:m});u.buffer=v}a.push({binding:s,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:s,resource:{buffer:u.buffer}})}else if(l.isSampler){const u=n.get(l.texture);a.push({binding:s,resource:u.sampler})}else if(l.isSampledTexture){const u=n.get(l.texture);let h;if(u.externalTexture!==void 0)h=r.importExternalTexture({source:u.externalTexture});else{const m=l.store?1:u.texture.mipLevelCount,v=`view-${u.texture.width}-${u.texture.height}-${m}`;if(h=u[v],h===void 0){const x=Poe.All;let S;l.isSampledCubeTexture?S=za.Cube:l.isSampledTexture3D?S=za.ThreeD:l.texture.isDataArrayTexture||l.texture.isCompressedArrayTexture?S=za.TwoDArray:S=za.TwoD,h=u[v]=u.texture.createView({aspect:x,dimension:S,mipLevelCount:m})}}a.push({binding:s,resource:h})}s++}return r.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:a})}}class ile{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:n,material:r,geometry:s,pipeline:a}=e,{vertexProgram:l,fragmentProgram:u}=a,h=this.backend,m=h.device,v=h.utils,x=h.get(a),S=[];for(const te of e.getBindings()){const re=h.get(te);S.push(re.layout)}const w=h.attributeUtils.createShaderVertexBuffers(e);let R;r.transparent===!0&&r.blending!==Qa&&(R=this._getBlending(r));let C={};r.stencilWrite===!0&&(C={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});const E=this._getColorWriteMask(r),B=[];if(e.context.textures!==null){const te=e.context.textures;for(let re=0;re<te.length;re++){const ne=v.getTextureFormatGPU(te[re]);B.push({format:ne,blend:R,writeMask:E})}}else{const te=v.getCurrentColorFormat(e.context);B.push({format:te,blend:R,writeMask:E})}const L=h.get(l).module,O=h.get(u).module,G=this._getPrimitiveState(n,s,r),q=this._getDepthCompare(r),z=v.getCurrentDepthStencilFormat(e.context),j=this._getSampleCount(e.context),F={label:`renderPipeline_${r.name||r.type}_${r.id}`,vertex:Object.assign({},L,{buffers:w}),fragment:Object.assign({},O,{targets:B}),primitive:G,multisample:{count:j,alphaToCoverageEnabled:r.alphaToCoverage&&j>1},layout:m.createPipelineLayout({bindGroupLayouts:S})},V={},Y=e.context.depth,ee=e.context.stencil;if((Y===!0||ee===!0)&&(Y===!0&&(V.format=z,V.depthWriteEnabled=r.depthWrite,V.depthCompare=q),ee===!0&&(V.stencilFront=C,V.stencilBack={},V.stencilReadMask=r.stencilFuncMask,V.stencilWriteMask=r.stencilWriteMask),F.depthStencil=V),t===null)x.pipeline=m.createRenderPipeline(F);else{const te=new Promise(re=>{m.createRenderPipelineAsync(F).then(ne=>{x.pipeline=ne,re()})});t.push(te)}}createBundleEncoder(e){const t=this.backend,{utils:n,device:r}=t,s=n.getCurrentDepthStencilFormat(e),a=n.getCurrentColorFormat(e),l=this._getSampleCount(e),u={label:"renderBundleEncoder",colorFormats:[a],depthStencilFormat:s,sampleCount:l};return r.createRenderBundleEncoder(u)}createComputePipeline(e,t){const n=this.backend,r=n.device,s=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=r.createComputePipeline({compute:s,layout:r.createPipelineLayout({bindGroupLayouts:l})})}_getBlending(e){let t,n;const r=e.blending,s=e.blendSrc,a=e.blendDst,l=e.blendEquation;if(r===xw){const u=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,h=e.blendDstAlpha!==null?e.blendDstAlpha:a,m=e.blendEquationAlpha!==null?e.blendEquationAlpha:l;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(a),operation:this._getBlendOperation(l)},n={srcFactor:this._getBlendFactor(u),dstFactor:this._getBlendFactor(h),operation:this._getBlendOperation(m)}}else{const u=e.premultipliedAlpha,h=(m,v,x,S)=>{t={srcFactor:m,dstFactor:v,operation:Df.Add},n={srcFactor:x,dstFactor:S,operation:Df.Add}};if(u)switch(r){case Ka:h(Kn.One,Kn.OneMinusSrcAlpha,Kn.One,Kn.OneMinusSrcAlpha);break;case a0:h(Kn.One,Kn.One,Kn.One,Kn.One);break;case o0:h(Kn.Zero,Kn.OneMinusSrc,Kn.Zero,Kn.One);break;case l0:h(Kn.Zero,Kn.Src,Kn.Zero,Kn.SrcAlpha);break}else switch(r){case Ka:h(Kn.SrcAlpha,Kn.OneMinusSrcAlpha,Kn.One,Kn.OneMinusSrcAlpha);break;case a0:h(Kn.SrcAlpha,Kn.One,Kn.SrcAlpha,Kn.One);break;case o0:h(Kn.Zero,Kn.OneMinusSrc,Kn.Zero,Kn.One);break;case l0:h(Kn.Zero,Kn.Src,Kn.Zero,Kn.Src);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};console.error("THREE.WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case Tw:t=Kn.Zero;break;case ww:t=Kn.One;break;case Mw:t=Kn.Src;break;case Ew:t=Kn.OneMinusSrc;break;case qm:t=Kn.SrcAlpha;break;case Vm:t=Kn.OneMinusSrcAlpha;break;case Nw:t=Kn.Dst;break;case Dw:t=Kn.OneMinusDstColor;break;case Cw:t=Kn.DstAlpha;break;case Rw:t=Kn.OneMinusDstAlpha;break;case Pw:t=Kn.SrcAlphaSaturated;break;case dne:t=Kn.Constant;break;case pne:t=Kn.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 tk:t=Bs.Never;break;case WS:t=Bs.Always;break;case nk:t=Bs.Less;break;case rk:t=Bs.LessEqual;break;case ik:t=Bs.Equal;break;case ok:t=Bs.GreaterEqual;break;case sk:t=Bs.Greater;break;case ak:t=Bs.NotEqual;break;default:console.error("THREE.WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case Uf:t=Th.Keep;break;case XF:t=Th.Zero;break;case YF:t=Th.Replace;break;case ek:t=Th.Invert;break;case QF:t=Th.IncrementClamp;break;case KF:t=Th.DecrementClamp;break;case ZF:t=Th.IncrementWrap;break;case JF:t=Th.DecrementWrap;break;default:console.error("THREE.WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case Eo:t=Df.Add;break;case bw:t=Df.Subtract;break;case Sw:t=Df.ReverseSubtract;break;case M7:t=Df.Min;break;case E7:t=Df.Max;break;default:console.error("THREE.WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){const r={},s=this.backend.utils;switch(r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?k0.Uint16:k0.Uint32),n.side){case Nl:r.frontFace=bS.CCW,r.cullMode=SS.Back;break;case hr:r.frontFace=bS.CCW,r.cullMode=SS.Front;break;case as:r.frontFace=bS.CCW,r.cullMode=SS.None;break;default:console.error("THREE.WebGPUPipelineUtils: Unknown material.side value.",n.side);break}return r}_getColorWriteMask(e){return e.colorWrite===!0?RN.All:RN.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=Bs.Always;else{const n=e.depthFunc;switch(n){case Hm:t=Bs.Never;break;case jm:t=Bs.Always;break;case Wm:t=Bs.Less;break;case kh:t=Bs.LessEqual;break;case $m:t=Bs.Equal;break;case Xm:t=Bs.GreaterEqual;break;case Ym:t=Bs.Greater;break;case Qm:t=Bs.NotEqual;break;default:console.error("THREE.WebGPUPipelineUtils: Invalid depth function.",n)}}return t}}class rle extends rO{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.trackTimestamp=e.trackTimestamp===!0,this.device=null,this.context=null,this.colorBuffer=null,this.defaultRenderPassdescriptor=null,this.utils=new Koe(this),this.attributeUtils=new tle(this),this.bindingUtils=new nle(this),this.pipelineUtils=new ile(this),this.textureUtils=new Goe(this),this.occludedResolveCache=new Map}async init(e){await super.init(e);const t=this.parameters;let n;if(t.device===void 0){const a={powerPreference:t.powerPreference},l=typeof navigator<"u"?await navigator.gpu.requestAdapter(a):null;if(l===null)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const u=Object.values(nw),h=[];for(const v of u)l.features.has(v)&&h.push(v);const m={requiredFeatures:h,requiredLimits:t.requiredLimits};n=await l.requestDevice(m)}else n=t.device;n.lost.then(a=>{const l={api:"WebGPU",message:a.message||"Unknown reason",reason:a.reason||null,originalEvent:a};e.onDeviceLost(l)});const r=t.context!==void 0?t.context:e.domElement.getContext("webgpu");this.device=n,this.context=r;const s=t.alpha?"premultiplied":"opaque";this.trackTimestamp=this.trackTimestamp&&this.hasFeature(nw.TimestampQuery),this.context.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s}),this.updateSize()}get coordinateSystem(){return pu}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 r=e.colorAttachments[0];this.renderer.samples>0?r.view=this.colorBuffer.createView():r.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}_getRenderPassDescriptor(e,t={}){const n=e.renderTarget,r=this.get(n);let s=r.descriptors;if(s===void 0||r.width!==n.width||r.height!==n.height||r.dimensions!==n.dimensions||r.activeMipmapLevel!==n.activeMipmapLevel||r.activeCubeFace!==e.activeCubeFace||r.samples!==n.samples||r.loadOp!==t.loadOp){s={},r.descriptors=s;const u=()=>{n.removeEventListener("dispose",u),this.delete(n)};n.addEventListener("dispose",u)}const a=e.getCacheKey();let l=s[a];if(l===void 0){const u=e.textures,h=[];let m;for(let v=0;v<u.length;v++){const x=this.get(u[v]),S={label:`colorAttachment_${v}`,baseMipLevel:e.activeMipmapLevel,mipLevelCount:1,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1,dimension:za.TwoD};n.isRenderTarget3D?(m=e.activeCubeFace,S.baseArrayLayer=0,S.dimension=za.ThreeD,S.depthOrArrayLayers=u[v].image.depth):n.isRenderTargetArray&&(S.dimension=za.TwoDArray,S.depthOrArrayLayers=u[v].image.depth);const w=x.texture.createView(S);let R,C;x.msaaTexture!==void 0?(R=x.msaaTexture.createView(),C=w):(R=w,C=void 0),h.push({view:R,depthSlice:m,resolveTarget:C,loadOp:Wr.Load,storeOp:ia.Store,...t})}if(l={colorAttachments:h},e.depth){const x={view:this.get(e.depthTexture).texture.createView()};l.depthStencilAttachment=x}s[a]=l,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace,r.dimensions=n.dimensions,r.depthSlice=m,r.loadOp=h[0].loadOp}return l}beginRender(e){const t=this.get(e),n=this.device,r=e.occlusionQueryCount;let s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,s=n.createQuerySet({type:"occlusion",count:r,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let a;e.textures===null?a=this._getDefaultRenderPassDescriptor():a=this._getRenderPassDescriptor(e,{loadOp:Wr.Load}),this.initTimestampQuery(e,a),a.occlusionQuerySet=s;const l=a.depthStencilAttachment;if(e.textures!==null){const m=a.colorAttachments;for(let v=0;v<m.length;v++){const x=m[v];e.clearColor?(x.clearValue=v===0?e.clearColorValue:{r:0,g:0,b:0,a:1},x.loadOp=Wr.Clear,x.storeOp=ia.Store):(x.loadOp=Wr.Load,x.storeOp=ia.Store)}}else{const m=a.colorAttachments[0];e.clearColor?(m.clearValue=e.clearColorValue,m.loadOp=Wr.Clear,m.storeOp=ia.Store):(m.loadOp=Wr.Load,m.storeOp=ia.Store)}e.depth&&(e.clearDepth?(l.depthClearValue=e.clearDepthValue,l.depthLoadOp=Wr.Clear,l.depthStoreOp=ia.Store):(l.depthLoadOp=Wr.Load,l.depthStoreOp=ia.Store)),e.stencil&&(e.clearStencil?(l.stencilClearValue=e.clearStencilValue,l.stencilLoadOp=Wr.Clear,l.stencilStoreOp=ia.Store):(l.stencilLoadOp=Wr.Load,l.stencilStoreOp=ia.Store));const u=n.createCommandEncoder({label:"renderContext_"+e.id}),h=u.beginRenderPass(a);if(t.descriptor=a,t.encoder=u,t.currentPass=h,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[],e.viewport&&this.updateViewport(e),e.scissor){const{x:m,y:v,width:x,height:S}=e.scissorValue;h.setScissorRect(m,v,x,S)}}finishRender(e){const t=this.get(e),n=e.occlusionQueryCount;if(t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery(),t.currentPass.end(),n>0){const r=n*8;let s=this.occludedResolveCache.get(r);s===void 0&&(s=this.device.createBuffer({size:r,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(r,s));const a=this.device.createBuffer({size:r,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,s,0),t.encoder.copyBufferToBuffer(s,0,a,0,r),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(this.prepareTimestampBuffer(e,t.encoder),this.device.queue.submit([t.encoder.finish()]),e.textures!==null){const r=e.textures;for(let s=0;s<r.length;s++){const a=r[s];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}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:r}=t;if(n&&r){const s=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<r.length;u++)l[u]!==BigInt(0)&&s.add(r[u]);n.destroy(),t.occluded=s}}updateViewport(e){const{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:a,minDepth:l,maxDepth:u}=e.viewportValue;t.setViewport(n,r,s,a,l,u)}clear(e,t,n,r=null){const s=this.device,a=this.renderer;let l=[],u,h,m,v;if(e){const w=this.getClearColor();if(this.renderer.alpha===!0){const R=w.a;h={r:w.r*R,g:w.g*R,b:w.b*R,a:R}}else h={r:w.r,g:w.g,b:w.b,a:w.a}}if(r===null){m=a.depth,v=a.stencil;const w=this._getDefaultRenderPassDescriptor();if(e){l=w.colorAttachments;const R=l[0];R.clearValue=h,R.loadOp=Wr.Clear,R.storeOp=ia.Store}(m||v)&&(u=w.depthStencilAttachment)}else m=r.depth,v=r.stencil,e&&(l=this._getRenderPassDescriptor(r,{loadOp:Wr.Clear}).colorAttachments),(m||v)&&(u={view:this.get(r.depthTexture).texture.createView()});m&&(t?(u.depthLoadOp=Wr.Clear,u.depthClearValue=a.getClearDepth(),u.depthStoreOp=ia.Store):(u.depthLoadOp=Wr.Load,u.depthStoreOp=ia.Store)),v&&(n?(u.stencilLoadOp=Wr.Clear,u.stencilClearValue=a.getClearStencil(),u.stencilStoreOp=ia.Store):(u.stencilLoadOp=Wr.Load,u.stencilStoreOp=ia.Store));const x=s.createCommandEncoder({});x.beginRenderPass({colorAttachments:l,depthStencilAttachment:u}).end(),s.queue.submit([x.finish()])}beginCompute(e){const t=this.get(e),n={};this.initTimestampQuery(e,n),t.cmdEncoderGPU=this.device.createCommandEncoder(),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(n)}compute(e,t,n,r){const{passEncoderGPU:s}=this.get(e),a=this.get(r).pipeline;s.setPipeline(a);for(let m=0,v=n.length;m<v;m++){const x=n[m],S=this.get(x);s.setBindGroup(m,S.group)}const l=this.device.limits.maxComputeWorkgroupsPerDimension,u=this.get(t);u.dispatchSize===void 0&&(u.dispatchSize={x:0,y:1,z:1});const{dispatchSize:h}=u;t.dispatchCount>l?(h.x=Math.min(t.dispatchCount,l),h.y=Math.ceil(t.dispatchCount/l)):h.x=t.dispatchCount,s.dispatchWorkgroups(h.x,h.y,h.z)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.prepareTimestampBuffer(e,t.cmdEncoderGPU),this.device.queue.submit([t.cmdEncoderGPU.finish()])}async waitForGPU(){await this.device.queue.onSubmittedWorkDone()}draw(e,t){const{object:n,context:r,pipeline:s}=e,a=e.getBindings(),l=this.get(r),u=this.get(s).pipeline,h=l.currentSets,m=l.currentPass,v=e.getDrawParameters();if(v===null)return;h.pipeline!==u&&(m.setPipeline(u),h.pipeline=u);const x=h.bindingGroups;for(let C=0,E=a.length;C<E;C++){const B=a[C],L=this.get(B);x[B.index]!==B.id&&(m.setBindGroup(B.index,L.group),x[B.index]=B.id)}const S=e.getIndex(),w=S!==null;if(w===!0&&h.index!==S){const C=this.get(S).buffer,E=S.array instanceof Uint16Array?k0.Uint16:k0.Uint32;m.setIndexBuffer(C,E),h.index=S}const R=e.getVertexBuffers();for(let C=0,E=R.length;C<E;C++){const B=R[C];if(h.attributes[C]!==B){const L=this.get(B).buffer;m.setVertexBuffer(C,L),h.attributes[C]=B}}if(l.occlusionQuerySet!==void 0){const C=l.lastOcclusionObject;C!==n&&(C!==null&&C.occlusionTest===!0&&(m.endOcclusionQuery(),l.occlusionQueryIndex++),n.occlusionTest===!0&&(m.beginOcclusionQuery(l.occlusionQueryIndex),l.occlusionQueryObjects[l.occlusionQueryIndex]=n),l.lastOcclusionObject=n)}if(n.isBatchedMesh===!0){const C=n._multiDrawStarts,E=n._multiDrawCounts,B=n._multiDrawCount,L=n._multiDrawInstances;for(let O=0;O<B;O++){const G=L?L[O]:1,q=G>1?0:O;w===!0?m.drawIndexed(E[O],G,C[O]/S.array.BYTES_PER_ELEMENT,0,q):m.draw(E[O],G,C[O],q)}}else if(w===!0){const{vertexCount:C,instanceCount:E,firstVertex:B}=v,L=e.getIndirect();if(L!==null){const O=this.get(L).buffer;m.drawIndexedIndirect(O,0)}else m.drawIndexed(C,E,B,0,0);t.update(n,C,E)}else{const{vertexCount:C,instanceCount:E,firstVertex:B}=v,L=e.getIndirect();if(L!==null){const O=this.get(L).buffer;m.drawIndirect(O,0)}else m.draw(C,E,B,0);t.update(n,C,E)}}needsRenderUpdate(e){const t=this.get(e),{object:n,material:r}=e,s=this.utils,a=s.getSampleCountRenderContext(e.context),l=s.getCurrentColorSpace(e.context),u=s.getCurrentColorFormat(e.context),h=s.getCurrentDepthStencilFormat(e.context),m=s.getPrimitiveTopology(n,r);let v=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==a||t.colorSpace!==l||t.colorFormat!==u||t.depthStencilFormat!==h||t.primitiveTopology!==m||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleCount=a,t.colorSpace=l,t.colorFormat=u,t.depthStencilFormat=h,t.primitiveTopology=m,t.clippingContextCacheKey=e.clippingContextCacheKey,v=!0),v}getRenderCacheKey(e){const{object:t,material:n}=e,r=this.utils,s=e.context;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,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.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)}copyTextureToBuffer(e,t,n,r,s,a){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,a)}initTimestampQuery(e,t){if(!this.trackTimestamp)return;const n=this.get(e);if(!n.timeStampQuerySet){const r=e.isComputeNode?"compute":"render",s=this.device.createQuerySet({type:"timestamp",count:2,label:`timestamp_${r}_${e.id}`});Object.assign(t,{timestampWrites:{querySet:s,beginningOfPassWriteIndex:0,endOfPassWriteIndex:1}}),n.timeStampQuerySet=s}}prepareTimestampBuffer(e,t){if(!this.trackTimestamp)return;const n=this.get(e),r=2*BigInt64Array.BYTES_PER_ELEMENT;n.currentTimestampQueryBuffers===void 0&&(n.currentTimestampQueryBuffers={resolveBuffer:this.device.createBuffer({label:"timestamp resolve buffer",size:r,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),resultBuffer:this.device.createBuffer({label:"timestamp result buffer",size:r,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})});const{resolveBuffer:s,resultBuffer:a}=n.currentTimestampQueryBuffers;t.resolveQuerySet(n.timeStampQuerySet,0,2,s,0),a.mapState==="unmapped"&&t.copyBufferToBuffer(s,0,a,0,r)}async resolveTimestampAsync(e,t="render"){if(!this.trackTimestamp)return;const n=this.get(e);if(n.currentTimestampQueryBuffers===void 0)return;const{resultBuffer:r}=n.currentTimestampQueryBuffers;r.mapState==="unmapped"&&r.mapAsync(GPUMapMode.READ).then(()=>{const s=new BigUint64Array(r.getMappedRange()),a=Number(s[1]-s[0])/1e6;this.renderer.info.updateTimestamp(t,a),r.unmap()})}createNodeBuilder(e,t){return new Qoe(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),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}createIndexAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}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,r=null,s=0){let a=0,l=0,u=0,h=0,m=0,v=0,x=e.image.width,S=e.image.height;n!==null&&(h=n.x,m=n.y,v=n.z||0,x=n.width,S=n.height),r!==null&&(a=r.x,l=r.y,u=r.z||0);const w=this.device.createCommandEncoder({label:"copyTextureToTexture_"+e.id+"_"+t.id}),R=this.get(e).texture,C=this.get(t).texture;w.copyTextureToTexture({texture:R,mipLevel:s,origin:{x:h,y:m,z:v}},{texture:C,mipLevel:s,origin:{x:a,y:l,z:u}},[x,S,1]),this.device.queue.submit([w.finish()])}copyFramebufferToTexture(e,t,n){const r=this.get(t);let s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();const a=this.get(e).texture;if(s.format!==a.format){console.error("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,a.format);return}let l;if(r.currentPass?(r.currentPass.end(),l=r.encoder):l=this.device.createCommandEncoder({label:"copyFramebufferToTexture_"+e.id}),l.copyTextureToTexture({texture:s,origin:[n.x,n.y,0]},{texture:a},[n.z,n.w]),e.generateMipmaps&&this.textureUtils.generateMipmaps(e),r.currentPass){const{descriptor:u}=r;for(let h=0;h<u.colorAttachments.length;h++)u.colorAttachments[h].loadOp=Wr.Load;if(t.depth&&(u.depthStencilAttachment.depthLoadOp=Wr.Load),t.stencil&&(u.depthStencilAttachment.stencilLoadOp=Wr.Load),r.currentPass=l.beginRenderPass(u),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor){const{x:h,y:m,width:v,height:x}=t.scissorValue;r.currentPass.setScissorRect(h,m,v,x)}}else this.device.queue.submit([l.finish()])}}class sle extends rD{constructor(e,t,n,r,s,a){super(e,t,n,r,s,a),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class ale extends KB{constructor(){super(),this.addMaterial(fte,"MeshPhongMaterial"),this.addMaterial(QU,"MeshStandardMaterial"),this.addMaterial(Hte,"MeshPhysicalMaterial"),this.addMaterial(Xte,"MeshToonMaterial"),this.addMaterial(ste,"MeshBasicMaterial"),this.addMaterial(cte,"MeshLambertMaterial"),this.addMaterial(Jee,"MeshNormalMaterial"),this.addMaterial(Kte,"MeshMatcapMaterial"),this.addMaterial(Wee,"LineBasicMaterial"),this.addMaterial(Xee,"LineDashedMaterial"),this.addMaterial(Jte,"PointsMaterial"),this.addMaterial(nne,"SpriteMaterial"),this.addMaterial(sne,"ShadowMaterial"),this.addLight(ase,qz),this.addLight(Yae,sD),this.addLight(Qae,Hz),this.addLight(YB,rD),this.addLight(Zae,aD),this.addLight(Jae,kz),this.addLight(eoe,Wz),this.addLight(Kae,sle),this.addToneMapping(gB,N7),this.addToneMapping(vB,D7),this.addToneMapping(_B,P7),this.addToneMapping(yB,L7),this.addToneMapping(xB,U7),this.addToneMapping(bB,B7)}}class aO extends hoe{constructor(e={}){let t;e.forceWebGL?t=CN:(t=rle,e.getFallback=()=>(console.warn("THREE.WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new CN(e)));const n=new t(e);super(n,e),this.library=new ale,this.isWebGPURenderer=!0}}/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */W.BRDF_GGX;W.BRDF_Lambert;W.BasicShadowFilter;W.Break;W.Continue;W.DFGApprox;W.D_GGX;W.Discard;W.EPSILON;W.F_Schlick;const ole=W.Fn;W.INFINITY;const lle=W.If,ule=W.Loop;W.NodeShaderStage;W.NodeType;W.NodeUpdateType;W.NodeAccess;W.PCFShadowFilter;W.PCFSoftShadowFilter;W.PI;W.PI2;W.Return;W.Schlick_to_F0;W.ScriptableNodeResources;W.ShaderNode;W.TBNViewMatrix;W.VSMShadowFilter;W.V_GGX_SmithCorrelated;W.abs;W.acesFilmicToneMapping;W.acos;W.add;W.addNodeElement;W.agxToneMapping;W.all;W.alphaT;W.and;W.anisotropy;W.anisotropyB;W.anisotropyT;W.any;W.append;W.arrayBuffer;const cle=W.asin;W.assign;W.atan;W.atan2;W.atomicAdd;W.atomicAnd;W.atomicFunc;W.atomicMax;W.atomicMin;W.atomicOr;W.atomicStore;W.atomicSub;W.atomicXor;W.attenuationColor;W.attenuationDistance;W.attribute;W.attributeArray;W.backgroundBlurriness;W.backgroundIntensity;W.backgroundRotation;W.batch;W.billboarding;W.bitAnd;W.bitNot;W.bitOr;W.bitXor;W.bitangentGeometry;W.bitangentLocal;W.bitangentView;W.bitangentWorld;W.bitcast;W.blendBurn;W.blendColor;W.blendDodge;W.blendOverlay;W.blendScreen;W.blur;W.bool;W.buffer;W.bufferAttribute;W.bumpMap;W.burn;W.bvec2;W.bvec3;W.bvec4;W.bypass;W.cache;W.call;W.cameraFar;W.cameraNear;W.cameraNormalMatrix;W.cameraPosition;W.cameraProjectionMatrix;W.cameraProjectionMatrixInverse;W.cameraViewMatrix;W.cameraWorldMatrix;W.cbrt;W.cdl;W.ceil;W.checker;W.cineonToneMapping;W.clamp;W.clearcoat;W.clearcoatRoughness;W.code;W.color;W.colorSpaceToWorking;W.colorToDirection;W.compute;W.cond;W.context;W.convert;W.convertColorSpace;W.convertToTexture;const hle=W.cos;W.cross;W.cubeTexture;W.dFdx;W.dFdy;W.dashSize;W.defaultBuildStages;W.defaultShaderStages;W.defined;W.degrees;W.deltaTime;W.densityFog;W.densityFogFactor;W.depth;W.depthPass;W.difference;W.diffuseColor;W.directPointLight;W.directionToColor;W.dispersion;W.distance;W.div;W.dodge;W.dot;W.drawIndex;W.dynamicBufferAttribute;W.element;W.emissive;W.equal;W.equals;W.equirectUV;const fle=W.exp;W.exp2;W.expression;W.faceDirection;W.faceForward;W.faceforward;const Ale=W.float;W.floor;W.fog;W.fract;W.frameGroup;W.frameId;W.frontFacing;W.fwidth;W.gain;W.gapSize;W.getConstNodeType;W.getCurrentStack;W.getDirection;W.getDistanceAttenuation;W.getGeometryRoughness;W.getNormalFromDepth;W.getParallaxCorrectNormal;W.getRoughness;W.getScreenPosition;W.getShIrradianceAt;W.getTextureIndex;W.getViewPosition;W.glsl;W.glslFn;W.grayscale;W.greaterThan;W.greaterThanEqual;W.hash;W.highpModelNormalViewMatrix;W.highpModelViewMatrix;W.hue;W.instance;const dle=W.instanceIndex;W.instancedArray;W.instancedBufferAttribute;W.instancedDynamicBufferAttribute;W.instancedMesh;W.int;W.inverseSqrt;W.inversesqrt;W.invocationLocalIndex;W.invocationSubgroupIndex;W.ior;W.iridescence;W.iridescenceIOR;W.iridescenceThickness;W.ivec2;W.ivec3;W.ivec4;W.js;W.label;W.length;W.lengthSq;W.lessThan;W.lessThanEqual;W.lightPosition;W.lightTargetDirection;W.lightTargetPosition;W.lightViewPosition;W.lightingContext;W.lights;W.linearDepth;W.linearToneMapping;W.localId;W.log;W.log2;W.logarithmicDepthToViewZ;W.loop;W.luminance;W.mediumpModelViewMatrix;W.mat2;W.mat3;W.mat4;W.matcapUV;W.materialAO;W.materialAlphaTest;W.materialAnisotropy;W.materialAnisotropyVector;W.materialAttenuationColor;W.materialAttenuationDistance;W.materialClearcoat;W.materialClearcoatNormal;W.materialClearcoatRoughness;W.materialColor;W.materialDispersion;W.materialEmissive;W.materialIOR;W.materialIridescence;W.materialIridescenceIOR;W.materialIridescenceThickness;W.materialLightMap;W.materialLineDashOffset;W.materialLineDashSize;W.materialLineGapSize;W.materialLineScale;W.materialLineWidth;W.materialMetalness;W.materialNormal;W.materialOpacity;W.materialPointWidth;W.materialReference;W.materialReflectivity;W.materialRefractionRatio;W.materialRotation;W.materialRoughness;W.materialSheen;W.materialSheenRoughness;W.materialShininess;W.materialSpecular;W.materialSpecularColor;W.materialSpecularIntensity;W.materialSpecularStrength;W.materialThickness;W.materialTransmission;W.max;W.maxMipLevel;W.metalness;W.min;W.mix;W.mixElement;W.mod;W.modInt;W.modelDirection;W.modelNormalMatrix;W.modelPosition;W.modelScale;W.modelViewMatrix;W.modelViewPosition;W.modelViewProjection;W.modelWorldMatrix;W.modelWorldMatrixInverse;W.morphReference;W.mrt;W.mul;W.mx_aastep;W.mx_cell_noise_float;W.mx_contrast;W.mx_fractal_noise_float;W.mx_fractal_noise_vec2;W.mx_fractal_noise_vec3;W.mx_fractal_noise_vec4;W.mx_hsvtorgb;W.mx_noise_float;W.mx_noise_vec3;W.mx_noise_vec4;W.mx_ramplr;W.mx_ramptb;W.mx_rgbtohsv;W.mx_safepower;W.mx_splitlr;W.mx_splittb;W.mx_srgb_texture_to_lin_rec709;W.mx_transform_uv;W.mx_worley_noise_float;W.mx_worley_noise_vec2;W.mx_worley_noise_vec3;const ple=W.negate;W.neutralToneMapping;W.nodeArray;W.nodeImmutable;W.nodeObject;W.nodeObjects;W.nodeProxy;W.normalFlat;W.normalGeometry;W.normalLocal;W.normalMap;W.normalView;W.normalWorld;W.normalize;W.not;W.notEqual;W.numWorkgroups;W.objectDirection;W.objectGroup;W.objectPosition;W.objectScale;W.objectViewPosition;W.objectWorldMatrix;W.oneMinus;W.or;W.orthographicDepthToViewZ;W.oscSawtooth;W.oscSine;W.oscSquare;W.oscTriangle;W.output;W.outputStruct;W.overlay;W.overloadingFn;W.parabola;W.parallaxDirection;W.parallaxUV;W.parameter;W.pass;W.passTexture;W.pcurve;W.perspectiveDepthToViewZ;W.pmremTexture;W.pointUV;W.pointWidth;W.positionGeometry;W.positionLocal;W.positionPrevious;W.positionView;W.positionViewDirection;W.positionWorld;W.positionWorldDirection;W.posterize;W.pow;W.pow2;W.pow3;W.pow4;W.property;W.radians;W.rand;W.range;W.rangeFog;W.rangeFogFactor;W.reciprocal;W.reference;W.referenceBuffer;W.reflect;W.reflectVector;W.reflectView;W.reflector;W.refract;W.refractVector;W.refractView;W.reinhardToneMapping;W.remainder;W.remap;W.remapClamp;W.renderGroup;W.renderOutput;W.rendererReference;W.rotate;W.rotateUV;W.roughness;W.round;W.rtt;W.sRGBTransferEOTF;W.sRGBTransferOETF;W.sampler;W.saturate;W.saturation;W.screen;W.screenCoordinate;W.screenSize;W.screenUV;W.scriptable;W.scriptableValue;W.select;W.setCurrentStack;W.shaderStages;W.shadow;W.shadowPositionWorld;W.sharedUniformGroup;W.sheen;W.sheenRoughness;W.shiftLeft;W.shiftRight;W.shininess;W.sign;const mle=W.sin;W.sinc;W.skinning;W.skinningReference;W.smoothstep;W.smoothstepElement;W.specularColor;W.specularF90;W.spherizeUV;W.split;W.spritesheetUV;const gle=W.sqrt;W.stack;W.step;const vle=W.storage;W.storageBarrier;W.storageObject;W.storageTexture;W.string;W.sub;W.subgroupIndex;W.subgroupSize;W.tan;W.tangentGeometry;W.tangentLocal;W.tangentView;W.tangentWorld;W.temp;W.texture;W.texture3D;W.textureBarrier;W.textureBicubic;W.textureCubeUV;W.textureLoad;W.textureSize;W.textureStore;W.thickness;W.threshold;W.time;W.timerDelta;W.timerGlobal;W.timerLocal;W.toOutputColorSpace;W.toWorkingColorSpace;W.toneMapping;W.toneMappingExposure;W.toonOutlinePass;W.transformDirection;W.transformNormal;W.transformNormalToView;W.transformedBentNormalView;W.transformedBitangentView;W.transformedBitangentWorld;W.transformedClearcoatNormalView;W.transformedNormalView;W.transformedNormalWorld;W.transformedTangentView;W.transformedTangentWorld;W.transmission;W.transpose;W.tri;W.tri3;W.triNoise3D;W.triplanarTexture;W.triplanarTextures;W.trunc;W.tslFn;W.uint;const _le=W.uniform;W.uniformArray;W.uniformGroup;W.uniforms;W.userData;W.uv;W.uvec2;W.uvec3;W.uvec4;W.varying;W.varyingProperty;W.vec2;W.vec3;W.vec4;W.vectorComponents;W.velocity;W.vertexColor;W.vertexIndex;W.vibrance;W.viewZToLogarithmicDepth;W.viewZToOrthographicDepth;W.viewZToPerspectiveDepth;W.viewport;W.viewportBottomLeft;W.viewportCoordinate;W.viewportDepthTexture;W.viewportLinearDepth;W.viewportMipTexture;W.viewportResolution;W.viewportSafeUV;W.viewportSharedTexture;W.viewportSize;W.viewportTexture;W.viewportTopLeft;W.viewportUV;W.wgsl;W.wgslFn;W.workgroupArray;W.workgroupBarrier;W.workgroupId;W.workingToColorSpace;W.xor;const BN=new Gc,wv=new he;class oO extends $z{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new Mi(e,3)),this.setAttribute("uv",new Mi(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new h_(t,6,1);return this.setAttribute("instanceStart",new nu(n,3,0)),this.setAttribute("instanceEnd",new nu(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new h_(t,6,1);return this.setAttribute("instanceColorStart",new nu(n,3,0)),this.setAttribute("instanceColorEnd",new nu(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Ez(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Gc);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),BN.setFromBufferAttribute(t),this.boundingBox.union(BN))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new dA),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)wv.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(wv)),wv.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(wv));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}Kt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new gt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Ga.line={uniforms:vy.merge([Kt.common,Kt.fog,Kt.line]),vertexShader:`
		#include <common>
		#include <color_pars_vertex>
		#include <fog_pars_vertex>
		#include <logdepthbuf_pars_vertex>
		#include <clipping_planes_pars_vertex>

		uniform float linewidth;
		uniform vec2 resolution;

		attribute vec3 instanceStart;
		attribute vec3 instanceEnd;

		attribute vec3 instanceColorStart;
		attribute vec3 instanceColorEnd;

		#ifdef WORLD_UNITS

			varying vec4 worldPos;
			varying vec3 worldStart;
			varying vec3 worldEnd;

			#ifdef USE_DASH

				varying vec2 vUv;

			#endif

		#else

			varying vec2 vUv;

		#endif

		#ifdef USE_DASH

			uniform float dashScale;
			attribute float instanceDistanceStart;
			attribute float instanceDistanceEnd;
			varying float vLineDistance;

		#endif

		void trimSegment( const in vec4 start, inout vec4 end ) {

			// trim end segment so it terminates between the camera plane and the near plane

			// conservative estimate of the near plane
			float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
			float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
			float nearEstimate = - 0.5 * b / a;

			float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );

			end.xyz = mix( start.xyz, end.xyz, alpha );

		}

		void main() {

			#ifdef USE_COLOR

				vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;

			#endif

			#ifdef USE_DASH

				vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
				vUv = uv;

			#endif

			float aspect = resolution.x / resolution.y;

			// camera space
			vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
			vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );

			#ifdef WORLD_UNITS

				worldStart = start.xyz;
				worldEnd = end.xyz;

			#else

				vUv = uv;

			#endif

			// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
			// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
			// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
			// perhaps there is a more elegant solution -- WestLangley

			bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column

			if ( perspective ) {

				if ( start.z < 0.0 && end.z >= 0.0 ) {

					trimSegment( start, end );

				} else if ( end.z < 0.0 && start.z >= 0.0 ) {

					trimSegment( end, start );

				}

			}

			// clip space
			vec4 clipStart = projectionMatrix * start;
			vec4 clipEnd = projectionMatrix * end;

			// ndc space
			vec3 ndcStart = clipStart.xyz / clipStart.w;
			vec3 ndcEnd = clipEnd.xyz / clipEnd.w;

			// direction
			vec2 dir = ndcEnd.xy - ndcStart.xy;

			// account for clip-space aspect ratio
			dir.x *= aspect;
			dir = normalize( dir );

			#ifdef WORLD_UNITS

				vec3 worldDir = normalize( end.xyz - start.xyz );
				vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
				vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
				vec3 worldFwd = cross( worldDir, worldUp );
				worldPos = position.y < 0.5 ? start: end;

				// height offset
				float hw = linewidth * 0.5;
				worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;

				// don't extend the line if we're rendering dashes because we
				// won't be rendering the endcaps
				#ifndef USE_DASH

					// cap extension
					worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;

					// add width to the box
					worldPos.xyz += worldFwd * hw;

					// endcaps
					if ( position.y > 1.0 || position.y < 0.0 ) {

						worldPos.xyz -= worldFwd * 2.0 * hw;

					}

				#endif

				// project the worldpos
				vec4 clip = projectionMatrix * worldPos;

				// shift the depth of the projected points so the line
				// segments overlap neatly
				vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
				clip.z = clipPose.z * clip.w;

			#else

				vec2 offset = vec2( dir.y, - dir.x );
				// undo aspect ratio adjustment
				dir.x /= aspect;
				offset.x /= aspect;

				// sign flip
				if ( position.x < 0.0 ) offset *= - 1.0;

				// endcaps
				if ( position.y < 0.0 ) {

					offset += - dir;

				} else if ( position.y > 1.0 ) {

					offset += dir;

				}

				// adjust for linewidth
				offset *= linewidth;

				// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
				offset /= resolution.y;

				// select end
				vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;

				// back to clip space
				offset *= clip.w;

				clip.xy += offset;

			#endif

			gl_Position = clip;

			vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation

			#include <logdepthbuf_vertex>
			#include <clipping_planes_vertex>
			#include <fog_vertex>

		}
		`,fragmentShader:`
		uniform vec3 diffuse;
		uniform float opacity;
		uniform float linewidth;

		#ifdef USE_DASH

			uniform float dashOffset;
			uniform float dashSize;
			uniform float gapSize;

		#endif

		varying float vLineDistance;

		#ifdef WORLD_UNITS

			varying vec4 worldPos;
			varying vec3 worldStart;
			varying vec3 worldEnd;

			#ifdef USE_DASH

				varying vec2 vUv;

			#endif

		#else

			varying vec2 vUv;

		#endif

		#include <common>
		#include <color_pars_fragment>
		#include <fog_pars_fragment>
		#include <logdepthbuf_pars_fragment>
		#include <clipping_planes_pars_fragment>

		vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {

			float mua;
			float mub;

			vec3 p13 = p1 - p3;
			vec3 p43 = p4 - p3;

			vec3 p21 = p2 - p1;

			float d1343 = dot( p13, p43 );
			float d4321 = dot( p43, p21 );
			float d1321 = dot( p13, p21 );
			float d4343 = dot( p43, p43 );
			float d2121 = dot( p21, p21 );

			float denom = d2121 * d4343 - d4321 * d4321;

			float numer = d1343 * d4321 - d1321 * d4343;

			mua = numer / denom;
			mua = clamp( mua, 0.0, 1.0 );
			mub = ( d1343 + d4321 * ( mua ) ) / d4343;
			mub = clamp( mub, 0.0, 1.0 );

			return vec2( mua, mub );

		}

		void main() {

			#include <clipping_planes_fragment>

			#ifdef USE_DASH

				if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps

				if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX

			#endif

			float alpha = opacity;

			#ifdef WORLD_UNITS

				// Find the closest points on the view ray and the line segment
				vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
				vec3 lineDir = worldEnd - worldStart;
				vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );

				vec3 p1 = worldStart + lineDir * params.x;
				vec3 p2 = rayEnd * params.y;
				vec3 delta = p1 - p2;
				float len = length( delta );
				float norm = len / linewidth;

				#ifndef USE_DASH

					#ifdef USE_ALPHA_TO_COVERAGE

						float dnorm = fwidth( norm );
						alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );

					#else

						if ( norm > 0.5 ) {

							discard;

						}

					#endif

				#endif

			#else

				#ifdef USE_ALPHA_TO_COVERAGE

					// artifacts appear on some hardware if a derivative is taken within a conditional
					float a = vUv.x;
					float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
					float len2 = a * a + b * b;
					float dlen = fwidth( len2 );

					if ( abs( vUv.y ) > 1.0 ) {

						alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );

					}

				#else

					if ( abs( vUv.y ) > 1.0 ) {

						float a = vUv.x;
						float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
						float len2 = a * a + b * b;

						if ( len2 > 1.0 ) discard;

					}

				#endif

			#endif

			vec4 diffuseColor = vec4( diffuse, alpha );

			#include <logdepthbuf_fragment>
			#include <color_fragment>

			gl_FragColor = vec4( diffuseColor.rgb, alpha );

			#include <tonemapping_fragment>
			#include <colorspace_fragment>
			#include <fog_fragment>
			#include <premultiplied_alpha_fragment>

		}
		`};class qE extends Ja{constructor(e){super({type:"LineMaterial",uniforms:vy.clone(Ga.line.uniforms),vertexShader:Ga.line.vertexShader,fragmentShader:Ga.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const ES=new Ln,ON=new he,IN=new he,Os=new Ln,Is=new Ln,jl=new Ln,CS=new he,RS=new kn,Fs=new Qz,FN=new he,Mv=new Gc,Ev=new dA,Wl=new Ln;let Jl,rA;function kN(i,e,t){return Wl.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Wl.multiplyScalar(1/Wl.w),Wl.x=rA/t.width,Wl.y=rA/t.height,Wl.applyMatrix4(i.projectionMatrixInverse),Wl.multiplyScalar(1/Wl.w),Math.abs(Math.max(Wl.x,Wl.y))}function yle(i,e){const t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,a=Math.min(n.instanceCount,r.count);for(let l=0,u=a;l<u;l++){Fs.start.fromBufferAttribute(r,l),Fs.end.fromBufferAttribute(s,l),Fs.applyMatrix4(t);const h=new he,m=new he;Jl.distanceSqToSegment(Fs.start,Fs.end,m,h),m.distanceTo(h)<rA*.5&&e.push({point:m,pointOnLine:h,distance:Jl.origin.distanceTo(m),object:i,face:null,faceIndex:l,uv:null,uv1:null})}}function xle(i,e,t){const n=e.projectionMatrix,s=i.material.resolution,a=i.matrixWorld,l=i.geometry,u=l.attributes.instanceStart,h=l.attributes.instanceEnd,m=Math.min(l.instanceCount,u.count),v=-e.near;Jl.at(1,jl),jl.w=1,jl.applyMatrix4(e.matrixWorldInverse),jl.applyMatrix4(n),jl.multiplyScalar(1/jl.w),jl.x*=s.x/2,jl.y*=s.y/2,jl.z=0,CS.copy(jl),RS.multiplyMatrices(e.matrixWorldInverse,a);for(let x=0,S=m;x<S;x++){if(Os.fromBufferAttribute(u,x),Is.fromBufferAttribute(h,x),Os.w=1,Is.w=1,Os.applyMatrix4(RS),Is.applyMatrix4(RS),Os.z>v&&Is.z>v)continue;if(Os.z>v){const L=Os.z-Is.z,O=(Os.z-v)/L;Os.lerp(Is,O)}else if(Is.z>v){const L=Is.z-Os.z,O=(Is.z-v)/L;Is.lerp(Os,O)}Os.applyMatrix4(n),Is.applyMatrix4(n),Os.multiplyScalar(1/Os.w),Is.multiplyScalar(1/Is.w),Os.x*=s.x/2,Os.y*=s.y/2,Is.x*=s.x/2,Is.y*=s.y/2,Fs.start.copy(Os),Fs.start.z=0,Fs.end.copy(Is),Fs.end.z=0;const R=Fs.closestPointToPointParameter(CS,!0);Fs.at(R,FN);const C=M0.lerp(Os.z,Is.z,R),E=C>=-1&&C<=1,B=CS.distanceTo(FN)<rA*.5;if(E&&B){Fs.start.fromBufferAttribute(u,x),Fs.end.fromBufferAttribute(h,x),Fs.start.applyMatrix4(a),Fs.end.applyMatrix4(a);const L=new he,O=new he;Jl.distanceSqToSegment(Fs.start,Fs.end,O,L),t.push({point:O,pointOnLine:L,distance:Jl.origin.distanceTo(O),object:i,face:null,faceIndex:x,uv:null,uv1:null})}}}class ble extends zi{constructor(e=new oO,t=new qE({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let a=0,l=0,u=t.count;a<u;a++,l+=2)ON.fromBufferAttribute(t,a),IN.fromBufferAttribute(n,a),r[l]=l===0?0:r[l-1],r[l+1]=r[l]+ON.distanceTo(IN);const s=new h_(r,2,1);return e.setAttribute("instanceDistanceStart",new nu(s,1,0)),e.setAttribute("instanceDistanceEnd",new nu(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,r=e.camera;r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Jl=e.ray;const a=this.matrixWorld,l=this.geometry,u=this.material;rA=u.linewidth+s,l.boundingSphere===null&&l.computeBoundingSphere(),Ev.copy(l.boundingSphere).applyMatrix4(a);let h;if(n)h=rA*.5;else{const v=Math.max(r.near,Ev.distanceToPoint(Jl.origin));h=kN(r,v,u.resolution)}if(Ev.radius+=h,Jl.intersectsSphere(Ev)===!1)return;l.boundingBox===null&&l.computeBoundingBox(),Mv.copy(l.boundingBox).applyMatrix4(a);let m;if(n)m=rA*.5;else{const v=Math.max(r.near,Mv.distanceToPoint(Jl.origin));m=kN(r,v,u.resolution)}Mv.expandByScalar(m),Jl.intersectsBox(Mv)!==!1&&(n?yle(this,t):xle(this,r,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(ES),this.material.uniforms.resolution.value.set(ES.z,ES.w))}}class lO extends oO{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){const t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Sle extends ble{constructor(e=new lO,t=new qE({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}class zN extends tM{constructor(e,t={}){const n=t.font;if(n===void 0)super();else{const r=n.generateShapes(e,t.size);t.depth===void 0&&t.height!==void 0&&console.warn("THREE.TextGeometry: .height is now depreciated. Please use .depth instead"),t.depth=t.depth!==void 0?t.depth:t.height!==void 0?t.height:50,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}}class Tle{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const n=[],r=wle(e,t,this.data);for(let s=0,a=r.length;s<a;s++)n.push(...r[s].toShapes());return n}}function wle(i,e,t){const n=Array.from(i),r=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*r,a=[];let l=0,u=0;for(let h=0;h<n.length;h++){const m=n[h];if(m===`
`)l=0,u-=s;else{const v=Mle(m,r,l,u,t);l+=v.offsetX,a.push(v.path)}}return a}function Mle(i,e,t,n,r){const s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}const a=new Kz;let l,u,h,m,v,x,S,w;if(s.o){const R=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let C=0,E=R.length;C<E;)switch(R[C++]){case"m":l=R[C++]*e+t,u=R[C++]*e+n,a.moveTo(l,u);break;case"l":l=R[C++]*e+t,u=R[C++]*e+n,a.lineTo(l,u);break;case"q":h=R[C++]*e+t,m=R[C++]*e+n,v=R[C++]*e+t,x=R[C++]*e+n,a.quadraticCurveTo(v,x,h,m);break;case"b":h=R[C++]*e+t,m=R[C++]*e+n,v=R[C++]*e+t,x=R[C++]*e+n,S=R[C++]*e+t,w=R[C++]*e+n,a.bezierCurveTo(v,x,S,w,h,m);break}}return{offsetX:s.ha*e,path:a}}function rw(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Ele(i){if(Array.isArray(i))return i}function Cle(i){if(Array.isArray(i))return rw(i)}function uO(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function Rle(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function GN(i,e,t,n,r,s,a){try{var l=i[s](a),u=l.value}catch(h){return void t(h)}l.done?e(u):Promise.resolve(u).then(n,r)}function Nle(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function a(u){GN(s,n,r,a,l,"next",u)}function l(u){GN(s,n,r,a,l,"throw",u)}a(void 0)})}}function tx(i,e,t){return e=z0(e),kle(i,HE()?Reflect.construct(e,t||[],z0(i).constructor):e.apply(i,t))}function Dle(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function nx(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function mm(i,e){return i.get(uO(i,e))}function NS(i,e,t){Dle(i,e),e.set(i,t)}function DS(i,e,t){return i.set(uO(i,e),t),t}function VE(i,e,t){if(HE())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function Ple(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,cO(n.key),n)}}function ix(i,e,t){return e&&Ple(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ps(i,e,t){return(e=cO(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function sw(){return sw=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=zle(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},sw.apply(null,arguments)}function z0(i){return z0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},z0(i)}function rx(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&ow(i,e)}function HE(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(HE=function(){return!!i})()}function Lle(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Ule(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function Ble(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ole(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qN(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Hi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qN(Object(t),!0).forEach(function(n){Ps(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):qN(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ile(i,e){if(i==null)return{};var t,n,r=Fle(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function Fle(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function kle(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Rle(i)}function aw(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(S,w,R,C){var E=w&&w.prototype instanceof l?w:l,B=Object.create(E.prototype);return yo(B,"_invoke",(function(L,O,G){var q,z,j,F=0,V=G||[],Y=!1,ee={p:0,n:0,v:i,a:te,f:te.bind(i,4),d:function(re,ne){return q=re,z=0,j=i,ee.n=ne,a}};function te(re,ne){for(z=re,j=ne,e=0;!Y&&F&&!Q&&e<V.length;e++){var Q,ae=V[e],de=ee.p,Te=ae[2];re>3?(Q=Te===ne)&&(j=ae[(z=ae[4])?5:(z=3,3)],ae[4]=ae[5]=i):ae[0]<=de&&((Q=re<2&&de<ae[1])?(z=0,ee.v=ne,ee.n=ae[1]):de<Te&&(Q=re<3||ae[0]>ne||ne>Te)&&(ae[4]=re,ae[5]=ne,ee.n=Te,z=0))}if(Q||re>1)return a;throw Y=!0,ne}return function(re,ne,Q){if(F>1)throw TypeError("Generator is already running");for(Y&&ne===1&&te(ne,Q),z=ne,j=Q;(e=z<2?i:j)||!Y;){q||(z?z<3?(z>1&&(ee.n=-1),te(z,j)):ee.n=j:ee.v=j);try{if(F=2,q){if(z||(re="next"),e=q[re]){if(!(e=e.call(q,j)))throw TypeError("iterator result is not an object");if(!e.done)return e;j=e.value,z<2&&(z=0)}else z===1&&(e=q.return)&&e.call(q),z<2&&(j=TypeError("The iterator does not provide a '"+re+"' method"),z=1);q=i}else if((e=(Y=ee.n<0)?j:L.call(O,ee))!==a)break}catch(ae){q=i,z=1,j=ae}finally{F=1}}return{value:e,done:Y}}})(S,R,C),!0),B}var a={};function l(){}function u(){}function h(){}e=Object.getPrototypeOf;var m=[][n]?e(e([][n]())):(yo(e={},n,function(){return this}),e),v=h.prototype=l.prototype=Object.create(m);function x(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,h):(S.__proto__=h,yo(S,r,"GeneratorFunction")),S.prototype=Object.create(v),S}return u.prototype=h,yo(v,"constructor",h),yo(h,"constructor",u),u.displayName="GeneratorFunction",yo(h,r,"GeneratorFunction"),yo(v),yo(v,r,"Generator"),yo(v,n,function(){return this}),yo(v,"toString",function(){return"[object Generator]"}),(aw=function(){return{w:s,m:x}})()}function yo(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}yo=function(s,a,l,u){function h(m,v){yo(s,m,function(x){return this._invoke(m,v,x)})}a?r?r(s,a,{value:l,enumerable:!u,configurable:!u,writable:!u}):s[a]=l:(h("next",0),h("throw",1),h("return",2))},yo(i,e,t,n)}function ow(i,e){return ow=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ow(i,e)}function gr(i,e){return Ele(i)||Ule(i,e)||hO(i,e)||Ble()}function zle(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=z0(i))!==null;);return i}function PS(i,e,t,n){var r=sw(z0(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function Qi(i){return Cle(i)||Lle(i)||hO(i)||Ole()}function Gle(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function cO(i){var e=Gle(i,"string");return typeof e=="symbol"?e:e+""}function hO(i,e){if(i){if(typeof i=="string")return rw(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?rw(i,e):void 0}}var fO=function(e){e instanceof Array?e.forEach(fO):(e.map&&e.map.dispose(),e.dispose())},jE=function(e){e.geometry&&e.geometry.dispose(),e.material&&fO(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(jE)},nr=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),jE(t)}};function wa(i,e){var t=new e;return{linkProp:function(r){return{default:t[r](),onChange:function(a,l){l[i][r](a)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var a=s[i],l=arguments.length,u=new Array(l>1?l-1:0),h=1;h<l;h++)u[h-1]=arguments[h];var m=a[r].apply(a,u);return m===a?this:m}}}}var cr=100;function VN(){return cr}function el(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=cr*(1+t),a=Math.sin(n);return{x:s*a*Math.cos(r),y:s*Math.cos(n),z:s*a*Math.sin(r)}}function AO(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),a=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-a*180/Math.PI-(a<-Math.PI/2?360:0),altitude:r/cr-1}}function Vf(i){return i*Math.PI/180}var Dg=window.THREE?window.THREE:{BackSide:hr,BufferAttribute:wr,Color:an,Mesh:zi,ShaderMaterial:Ja},qle=`
uniform float hollowRadius;

varying vec3 vVertexWorldPosition;
varying vec3 vVertexNormal;
varying float vCameraDistanceToObjCenter;
varying float vVertexAngularDistanceToHollowRadius;

void main() {    
  vVertexNormal	= normalize(normalMatrix * normal);
  vVertexWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;
  
  vec4 objCenterViewPosition = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);
  vCameraDistanceToObjCenter = length(objCenterViewPosition);
  
  float edgeAngle = atan(hollowRadius / vCameraDistanceToObjCenter);
  float vertexAngle = acos(dot(normalize(modelViewMatrix * vec4(position, 1.0)), normalize(objCenterViewPosition)));
  vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle;

  gl_Position	= projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}`,Vle=`
uniform vec3 color;
uniform float coefficient;
uniform float power;
uniform float hollowRadius;

varying vec3 vVertexNormal;
varying vec3 vVertexWorldPosition;
varying float vCameraDistanceToObjCenter;
varying float vVertexAngularDistanceToHollowRadius;

void main() {
  if (vCameraDistanceToObjCenter < hollowRadius) discard; // inside the hollowRadius
  if (vVertexAngularDistanceToHollowRadius < 0.0) discard; // frag position is within the hollow radius

  vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition;
  vec3 viewCameraToVertex	= (viewMatrix * vec4(worldCameraToVertex, 0.0)).xyz;
  viewCameraToVertex = normalize(viewCameraToVertex);
  float intensity	= pow(
    coefficient + dot(vVertexNormal, viewCameraToVertex),
    power
  );
  gl_FragColor = vec4(color, intensity);
}`;function Hle(i,e,t,n){return new Dg.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:qle,fragmentShader:Vle,uniforms:{coefficient:{value:i},color:{value:new Dg.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function jle(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var a=i.attributes.normal.array[r],l=i.attributes.position.array[r];n[r]=l+a*e}return t.setAttribute("position",new Dg.BufferAttribute(n,3)),t}var Wle=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,a=s===void 0?"gold":s,l=r.size,u=l===void 0?2:l,h=r.coefficient,m=h===void 0?.5:h,v=r.power,x=v===void 0?1:v,S=r.hollowRadius,w=S===void 0?0:S,R=r.backside,C=R===void 0?!0:R;nx(this,e),n=tx(this,e);var E=jle(t,u),B=Hle(m,a,x,w);return C&&(B.side=Dg.BackSide),n.geometry=E,n.material=B,n}return rx(e,i),ix(e)})(Dg.Mesh),$l=window.THREE?window.THREE:{Color:an,Group:ja,LineBasicMaterial:$0,LineSegments:j7,Mesh:zi,MeshPhongMaterial:iD,SphereGeometry:Eu,SRGBColorSpace:_n,TextureLoader:rM},dO=xs({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){nr(e.globeObj),nr(e.tileEngine),nr(e.graticulesObj)}},stateInit:function(){var e=new $l.MeshPhongMaterial({color:0}),t=new $l.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new tY(cr),r=new $l.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new $l.LineSegments(new cP(_X(),cr,2),new $l.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){nr(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new $l.SphereGeometry(cr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new $l.TextureLoader().load(e.globeImageUrl,function(l){l.colorSpace=$l.SRGBColorSpace,n.map=l,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new $l.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new $l.TextureLoader().load(e.bumpImageUrl,function(l){n.bumpMap=l,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),nr(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var a=e.atmosphereObj=new Wle(e.globeObj.geometry,{color:e.atmosphereColor,size:cr*e.atmosphereAltitude,hollowRadius:cr,coefficient:.1,power:3.5});a.visible=!!e.showAtmosphere,a.__globeObjType="atmosphere",e.scene.add(a)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),wu=function(e){return isNaN(e)?parseInt(yn(e).toHex(),16):e},Rl=function(e){return e&&isNaN(e)?cA(e).opacity:1},jh=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,a=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(a){var l=a.slice(1),u=gr(l,4),h=u[0],m=u[1],v=u[2],x=u[3];r=new an("rgb(".concat(+h,",").concat(+m,",").concat(+v,")")),s=Math.min(+x,1)}else r=new an(e);n&&r.convertLinearToSRGB();var S=r.toArray();return t?[].concat(Qi(S),[s]):S};function $le(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var HN=window.THREE?window.THREE:{BufferAttribute:wr};function Mu(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new HN.BufferAttribute(new t(i),e);for(var n=new HN.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function Xle(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var LS=new WeakMap,Cv=new WeakMap,Rv=new WeakMap,ao=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,a=s===void 0?"__data":s,l=r.objBindAttr,u=l===void 0?"__threeObj":l,h=r.removeDelay,m=h===void 0?0:h;return nx(this,e),n=tx(this,e),Ps(n,"scene",void 0),NS(n,LS,void 0),NS(n,Cv,void 0),NS(n,Rv,void 0),n.scene=t,DS(LS,n,a),DS(Cv,n,u),DS(Rv,n,m),n.onRemoveObj(function(){}),n}return rx(e,i),ix(e,[{key:"onCreateObj",value:function(n){var r=this;return PS(e,"onCreateObj",this)([function(s){var a=n(s);return s[mm(Cv,r)]=a,a[mm(LS,r)]=s,r.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return PS(e,"onRemoveObj",this)([function(s,a){var l=PS(e,"getData",r)([s]);n(s,a);var u=function(){r.scene.remove(s),nr(s),delete l[mm(Cv,r)]};mm(Rv,r)?setTimeout(u,mm(Rv,r)):u()}]),this}}])})(NQ),_l=window.THREE?window.THREE:{BufferGeometry:Ki,CylinderGeometry:eM,Matrix4:kn,Mesh:zi,MeshLambertMaterial:Vc,Object3D:vr,Vector3:he},jN=Object.assign({},yM),WN=jN.BufferGeometryUtils||jN,pO=xs({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=Rt(e.pointLat),r=Rt(e.pointLng),s=Rt(e.pointAltitude),a=Rt(e.pointRadius),l=Rt(e.pointColor),u=new _l.CylinderGeometry(1,1,1,e.pointResolution);u.applyMatrix4(new _l.Matrix4().makeRotationX(Math.PI/2)),u.applyMatrix4(new _l.Matrix4().makeTranslation(0,0,-.5));var h=2*Math.PI*cr/360,m={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&nr(e.scene),e.dataMapper.scene=e.pointsMerge?new _l.Object3D:e.scene,e.dataMapper.onCreateObj(S).onUpdateObj(w).digest(e.pointsData),e.pointsMerge){var v=e.pointsData.length?(WN.mergeGeometries||WN.mergeBufferGeometries)(e.pointsData.map(function(R){var C=e.dataMapper.getObj(R),E=C.geometry.clone();C.updateMatrix(),E.applyMatrix4(C.matrix);var B=jh(l(R));return E.setAttribute("color",Mu(Array(E.getAttribute("position").count).fill(B),4)),E})):new _l.BufferGeometry,x=new _l.Mesh(v,new _l.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));x.__globeObjType="points",x.__data=e.pointsData,e.dataMapper.clear(),nr(e.scene),e.scene.add(x)}function S(){var R=new _l.Mesh(u);return R.__globeObjType="point",R}function w(R,C){var E=function(j){var F=R.__currentTargetD=j,V=F.r,Y=F.alt,ee=F.lat,te=F.lng;Object.assign(R.position,el(ee,te));var re=e.pointsMerge?new _l.Vector3(0,0,0):e.scene.localToWorld(new _l.Vector3(0,0,0));R.lookAt(re),R.scale.x=R.scale.y=Math.min(30,V)*h,R.scale.z=Math.max(Y*cr,.1)},B={alt:+s(C),r:+a(C),lat:+n(C),lng:+r(C)},L=R.__currentTargetD||Object.assign({},B,{alt:-.001});if(Object.keys(B).some(function(z){return L[z]!==B[z]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?E(B):e.tweenGroup.add(new ca(L).to(B,e.pointsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(E).start())),!e.pointsMerge){var O=l(C),G=O?Rl(O):0,q=!!G;R.visible=q,q&&(m.hasOwnProperty(O)||(m[O]=new _l.MeshLambertMaterial({color:wu(O),transparent:G<1,opacity:G})),R.material=m[O])}}}}),mO=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`
    `.concat(Zn.common,`
    `).concat(Zn.logdepthbuf_pars_vertex,`
  
    uniform float dashTranslate; 

    attribute vec4 color;
    varying vec4 vColor;
    
    attribute float relDistance;
    varying float vRelDistance;

    void main() {
      // pass through colors and distances
      vColor = color;
      vRelDistance = relDistance + dashTranslate;
      gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
  
      `).concat(Zn.logdepthbuf_vertex,`
    }
  `),fragmentShader:`
    `.concat(Zn.logdepthbuf_pars_fragment,`

    uniform float dashOffset; 
    uniform float dashSize;
    uniform float gapSize; 
    
    varying vec4 vColor;
    varying float vRelDistance;
    
    void main() {
      // ignore pixels in the gap
      if (vRelDistance < dashOffset) discard;
      if (mod(vRelDistance - dashOffset, dashSize + gapSize) > dashSize) discard;
    
      // set px color: [r, g, b, a], interpolated between vertices 
      gl_FragColor = vColor; 
  
      `).concat(Zn.logdepthbuf_fragment,`
    }
  `)}},lw=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;
varying float vSurfaceRadius;
varying vec3 vPos;
`+e.vertexShader).replace("void main() {",["void main() {","vSurfaceRadius = surfaceRadius;","vPos = position;"].join(`
`)),e.fragmentShader=(`uniform float uSurfaceRadius;
varying float vSurfaceRadius;
varying vec3 vPos;
`+e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join(`
`)),e},Yle=function(e){return e.vertexShader=`
    attribute float r;
    
    const float PI = 3.1415926535897932384626433832795;
    float toRad(in float a) {
      return a * PI / 180.0;
    }
    
    vec3 Polar2Cartesian(in vec3 c) { // [lat, lng, r]
      float phi = toRad(90.0 - c.x);
      float theta = toRad(90.0 - c.y);
      float r = c.z;
      return vec3( // x,y,z
        r * sin(phi) * cos(theta),
        r * cos(phi),
        r * sin(phi) * sin(theta)
      );
    }
    
    vec2 Cartesian2Polar(in vec3 p) {
      float r = sqrt(p.x * p.x + p.y * p.y + p.z * p.z);
      float phi = acos(p.y / r);
      float theta = atan(p.z, p.x);
      return vec2( // lat,lng
        90.0 - phi * 180.0 / PI,
        90.0 - theta * 180.0 / PI - (theta < -PI / 2.0 ? 360.0 : 0.0)
      );
    }
    `.concat(e.vertexShader.replace("}",`                  
        vec3 pos = Polar2Cartesian(vec3(Cartesian2Polar(position), r));
        gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
      }
    `),`
  `),e},WE=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},Qle=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},Kle=["stroke"],yl=window.THREE?window.THREE:{BufferGeometry:Ki,CubicBezierCurve3:X7,Curve:Pl,Group:ja,Line:xy,Mesh:zi,NormalBlending:Ka,ShaderMaterial:Ja,TubeGeometry:nM,Vector3:he},Zle=L0.default||L0,gO=xs({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new Zle,sharedMaterial:new yl.ShaderMaterial(Hi(Hi({},mO()),{},{transparent:!0,blending:yl.NormalBlending}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new yl.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var a=gr(s,2),l=a[1];return l}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var a=s.children[0],l=a.__dashAnimateStep*r,u=a.material.uniforms.dashTranslate.value%1e9;a.material.uniforms.dashTranslate.value=u+l})})},update:function(e){var t=Rt(e.arcStartLat),n=Rt(e.arcStartLng),r=Rt(e.arcStartAltitude),s=Rt(e.arcEndLat),a=Rt(e.arcEndLng),l=Rt(e.arcEndAltitude),u=Rt(e.arcAltitude),h=Rt(e.arcAltitudeAutoScale),m=Rt(e.arcStroke),v=Rt(e.arcColor),x=Rt(e.arcDashLength),S=Rt(e.arcDashGap),w=Rt(e.arcDashInitialGap),R=Rt(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(L,O){var G=m(O),q=G!=null;if(!L.children.length||q!==(L.children[0].type==="Mesh")){nr(L);var z=q?new yl.Mesh:new yl.Line(new yl.BufferGeometry);z.material=e.sharedMaterial.clone(),L.add(z)}var j=L.children[0];Object.assign(j.material.uniforms,{dashSize:{value:x(O)},gapSize:{value:S(O)},dashOffset:{value:w(O)}});var F=R(O);j.__dashAnimateStep=F>0?1e3/F:0;var V=E(v(O),e.arcCurveResolution,q?e.arcCircularResolution+1:1),Y=B(e.arcCurveResolution,q?e.arcCircularResolution+1:1,!0);j.geometry.setAttribute("color",V),j.geometry.setAttribute("relDistance",Y);var ee=function(Q){var ae=L.__currentTargetD=Q,de=ae.stroke,Te=Ile(ae,Kle),be=C(Te);q?(j.geometry&&j.geometry.dispose(),j.geometry=new yl.TubeGeometry(be,e.arcCurveResolution,de/2,e.arcCircularResolution),j.geometry.setAttribute("color",V),j.geometry.setAttribute("relDistance",Y)):j.geometry.setFromPoints(be.getPoints(e.arcCurveResolution))},te={stroke:G,alt:u(O),altAutoScale:+h(O),startLat:+t(O),startLng:+n(O),startAlt:+r(O),endLat:+s(O),endLng:+a(O),endAlt:+l(O)},re=L.__currentTargetD||Object.assign({},te,{altAutoScale:-.001});Object.keys(te).some(function(ne){return re[ne]!==te[ne]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?ee(te):e.tweenGroup.add(new ca(re).to(te,e.arcsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(ee).start()))}).digest(e.arcsData);function C(L){var O=L.alt,G=L.altAutoScale,q=L.startLat,z=L.startLng,j=L.startAlt,F=L.endLat,V=L.endLng,Y=L.endAlt,ee=function(Se){var Ce=gr(Se,3),dt=Ce[0],At=Ce[1],wt=Ce[2],Ft=el(At,dt,wt),$e=Ft.x,rt=Ft.y,ce=Ft.z;return new yl.Vector3($e,rt,ce)},te=[z,q],re=[V,F],ne=O;if(ne==null&&(ne=Vh(te,re)/2*G+Math.max(j,Y)),ne||j||Y){var Q=pM(te,re),ae=function(Se,Ce){return Ce+(Ce-Se)*(Se<Ce?.5:.25)},de=[.25,.75].map(function(ze){return[].concat(Qi(Q(ze)),[ae(ze<.5?j:Y,ne)])}),Te=gr(de,2),be=Te[0],ue=Te[1],we=VE(yl.CubicBezierCurve3,Qi([[].concat(te,[j]),be,ue,[].concat(re,[Y])].map(ee)));return we}else{var We=.001;return Ne.apply(void 0,Qi([[].concat(te,[We]),[].concat(re,[We])].map(ee)))}function Ne(ze,Se){var Ce=ze.angleTo(Se),dt=Ce===0?function(){return ze.clone()}:function(wt){return new yl.Vector3().addVectors(ze.clone().multiplyScalar(Math.sin((1-wt)*Ce)),Se.clone().multiplyScalar(Math.sin(wt*Ce))).divideScalar(Math.sin(Ce))},At=new yl.Curve;return At.getPoint=dt,At}}function E(L,O){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,q=O+1,z;if(L instanceof Array||L instanceof Function){var j=L instanceof Array?Pc().domain(L.map(function(ne,Q){return Q/(L.length-1)})).range(L):L;z=function(Q){return jh(j(Q),!0,!0)}}else{var F=jh(L,!0,!0);z=function(){return F}}for(var V=[],Y=0,ee=q;Y<ee;Y++)for(var te=z(Y/(ee-1)),re=0;re<G;re++)V.push(te);return Mu(V,4)}function B(L){for(var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,q=L+1,z=[],j=0,F=q;j<F;j++)for(var V=j/(F-1),Y=0;Y<O;Y++)z.push(V);return G&&z.reverse(),Mu(z,1)}}}),wh=window.THREE?window.THREE:{BufferGeometry:Ki,DoubleSide:as,Mesh:zi,MeshLambertMaterial:Vc,Object3D:vr},$N=Object.assign({},yM),XN=$N.BufferGeometryUtils||$N,vO=xs({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=Rt(e.hexBinPointLat),r=Rt(e.hexBinPointLng),s=Rt(e.hexBinPointWeight),a=Rt(e.hexAltitude),l=Rt(e.hexTopColor),u=Rt(e.hexSideColor),h=Rt(e.hexMargin),m=ZK(e.hexBinPointsData.map(function(B){return Hi(Hi({},B),{},{h3Idx:IZ(n(B),r(B),e.hexBinResolution)})}),"h3Idx"),v=Object.entries(m).map(function(B){var L=gr(B,2),O=L[0],G=L[1];return{h3Idx:O,points:G,sumWeight:G.reduce(function(q,z){return q+ +s(z)},0)}}),x={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&nr(e.scene),e.dataMapper.scene=e.hexBinMerge?new wh.Object3D:e.scene,e.dataMapper.id(function(B){return B.h3Idx}).onCreateObj(C).onUpdateObj(E).digest(v),e.hexBinMerge){var S=v.length?(XN.mergeGeometries||XN.mergeBufferGeometries)(v.map(function(B){var L=e.dataMapper.getObj(B),O=L.geometry.toNonIndexed();L.updateMatrix(),O.applyMatrix4(L.matrix);var G=jh(l(B)),q=jh(u(B)),z=O.getAttribute("position").count,j=O.groups[0].count;return O.setAttribute("color",Mu(Qi(new Array(z)).map(function(F,V){return V>=j?G:q}),4)),O})):new wh.BufferGeometry,w=new wh.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:wh.DoubleSide});w.onBeforeCompile=function(B){w.userData.shader=lw(B)};var R=new wh.Mesh(S,w);R.__globeObjType="hexBinPoints",R.__data=v,e.dataMapper.clear(),nr(e.scene),e.scene.add(R)}function C(B){var L=new wh.Mesh;L.__hexCenter=RP(B.h3Idx),L.__hexGeoJson=NP(B.h3Idx,!0).reverse();var O=L.__hexCenter[1];return L.__hexGeoJson.forEach(function(G){var q=G[0];Math.abs(O-q)>170&&(G[0]+=O>q?360:-360)}),L.__globeObjType="hexbin",L}function E(B,L){var O=function(ae,de,Te){return ae-(ae-de)*Te},G=Math.max(0,Math.min(1,+h(L))),q=gr(B.__hexCenter,2),z=q[0],j=q[1],F=G===0?B.__hexGeoJson:B.__hexGeoJson.map(function(Q){var ae=gr(Q,2),de=ae[0],Te=ae[1];return[[de,j],[Te,z]].map(function(be){var ue=gr(be,2),we=ue[0],We=ue[1];return O(we,We,G)})}),V=e.hexTopCurvatureResolution;B.geometry&&B.geometry.dispose(),B.geometry=new wM([F],0,cr,!1,!0,!0,V);var Y={alt:+a(L)},ee=function(ae){var de=B.__currentTargetD=ae,Te=de.alt;B.scale.x=B.scale.y=B.scale.z=1+Te;var be=cr/(Te+1);B.geometry.setAttribute("surfaceRadius",Mu(Array(B.geometry.getAttribute("position").count).fill(be),1))},te=B.__currentTargetD||Object.assign({},Y,{alt:-.001});if(Object.keys(Y).some(function(Q){return te[Q]!==Y[Q]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?ee(Y):e.tweenGroup.add(new ca(te).to(Y,e.hexTransitionDuration).easing(os.Quadratic.InOut).onUpdate(ee).start())),!e.hexBinMerge){var re=u(L),ne=l(L);[re,ne].forEach(function(Q){if(!x.hasOwnProperty(Q)){var ae=Rl(Q);x[Q]=WE(new wh.MeshLambertMaterial({color:wu(Q),transparent:ae<1,opacity:ae,side:wh.DoubleSide}),lw)}}),B.material=[re,ne].map(function(Q){return x[Q]})}}}}),_O=function(e){return e*e},wc=function(e){return e*Math.PI/180};function Jle(i,e){var t=Math.sqrt,n=Math.cos,r=function(m){return _O(Math.sin(m/2))},s=wc(i[1]),a=wc(e[1]),l=wc(i[0]),u=wc(e[0]);return 2*Math.asin(t(r(a-s)+n(s)*n(a)*r(u-l)))}var eue=Math.sqrt(2*Math.PI);function tue(i,e){return Math.exp(-_O(i/e)/2)/(e*eue)}var nue=function(e){var t=gr(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},l=a.lngAccessor,u=l===void 0?function(C){return C[0]}:l,h=a.latAccessor,m=h===void 0?function(C){return C[1]}:h,v=a.weightAccessor,x=v===void 0?function(){return 1}:v,S=a.bandwidth,w=[n,r],R=S*Math.PI/180;return YW(s.map(function(C){var E=x(C);if(!E)return 0;var B=Jle(w,[u(C),m(C)]);return tue(B,R)*E}))},iue=(function(){var i=Nle(aw().m(function e(t){var n,r,s,a,l,u,h,m,v,x,S,w,R,C,E,B,L,O,G,q,z,j,F,V,Y,ee,te,re,ne,Q,ae,de,Te,be,ue,we,We,Ne,ze,Se,Ce=arguments,dt,At,wt;return aw().w(function(Ft){for(;;)switch(Ft.n){case 0:if(r=Ce.length>1&&Ce[1]!==void 0?Ce[1]:[],s=Ce.length>2&&Ce[2]!==void 0?Ce[2]:{},a=s.lngAccessor,l=a===void 0?function($e){return $e[0]}:a,u=s.latAccessor,h=u===void 0?function($e){return $e[1]}:u,m=s.weightAccessor,v=m===void 0?function(){return 1}:m,x=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Ft.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Ft.a(2,t.map(function($e){return nue($e,r,{lngAccessor:l,latAccessor:h,weightAccessor:v,bandwidth:x})}));case 1:return S=4,w=ole,R=lle,C=_le,E=vle,B=Ale,L=dle,O=ule,G=gle,q=mle,z=hle,j=cle,F=fle,V=ple,Y=E(new t_(new Float32Array(t.flat().map(wc)),2),"vec2",t.length),ee=E(new t_(new Float32Array(r.map(function($e){return[wc(l($e)),wc(h($e)),v($e)]}).flat()),3),"vec3",r.length),te=new t_(t.length,1),re=E(te,"float",t.length),ne=B(Math.PI),Q=G(ne.mul(2)),ae=function(rt){return rt.mul(rt)},de=function(rt){return ae(q(rt.div(2)))},Te=function(rt,ce){var Gt=B(rt[1]),ht=B(ce[1]),Pt=B(rt[0]),yt=B(ce[0]);return B(2).mul(j(G(de(ht.sub(Gt)).add(z(Gt).mul(z(ht)).mul(de(yt.sub(Pt)))))))},be=function(rt,ce){return F(V(ae(rt.div(ce)).div(2))).div(ce.mul(Q))},ue=C(wc(x)),we=C(wc(x*S)),We=C(r.length),Ne=w(function(){var $e=Y.element(L),rt=re.element(L);rt.assign(0),O(We,function(ce){var Gt=ce.i,ht=ee.element(Gt),Pt=ht.z;R(Pt,function(){var yt=Te(ht.xy,$e.xy);R(yt&&yt.lessThan(we),function(){rt.addAssign(be(yt,ue).mul(Pt))})})})}),ze=Ne().compute(t.length),Se=new aO,Ft.n=2,Se.computeAsync(ze);case 2:return dt=Array,At=Float32Array,Ft.n=3,Se.getArrayBufferAsync(te);case 3:return wt=Ft.v,Ft.a(2,dt.from.call(dt,new At(wt)))}},e)}));return function(t){return i.apply(this,arguments)}})(),Nv=window.THREE?window.THREE:{Mesh:zi,MeshLambertMaterial:Vc,SphereGeometry:Eu},rue=3.5,sue=.1,YN=100,aue=function(e){var t=cA(kZ(e));return t.opacity=Math.cbrt(e),t.formatRgb()},yO=xs({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return aue}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new Nv.Mesh(new Nv.SphereGeometry(cr),WE(new Nv.MeshLambertMaterial({vertexColors:!0,transparent:!0}),Yle));return s.__globeObjType="heatmap",s})},update:function(e){var t=Rt(e.heatmapPoints),n=Rt(e.heatmapPointLat),r=Rt(e.heatmapPointLng),s=Rt(e.heatmapPointWeight),a=Rt(e.heatmapBandwidth),l=Rt(e.heatmapColorFn),u=Rt(e.heatmapColorSaturation),h=Rt(e.heatmapBaseAltitude),m=Rt(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(v,x){var S=a(x),w=l(x),R=u(x),C=h(x),E=m(x),B=t(x).map(function(z){var j=n(z),F=r(z),V=el(j,F),Y=V.x,ee=V.y,te=V.z;return{x:Y,y:ee,z:te,lat:j,lng:F,weight:s(z)}}),L=Math.max(sue,S/rue),O=Math.ceil(360/(L||-1));v.geometry.parameters.widthSegments!==O&&(v.geometry.dispose(),v.geometry=new Nv.SphereGeometry(cr,O,O/2));var G=Xle(v.geometry.getAttribute("position")),q=G.map(function(z){var j=gr(z,3),F=j[0],V=j[1],Y=j[2],ee=AO({x:F,y:V,z:Y}),te=ee.lng,re=ee.lat;return[te,re]});iue(q,B,{latAccessor:function(j){return j.lat},lngAccessor:function(j){return j.lng},weightAccessor:function(j){return j.weight},bandwidth:S}).then(function(z){var j=Qi(new Array(YN)).map(function(ee,te){return jh(w(te/(YN-1)))}),F=function(te){var re=v.__currentTargetD=te,ne=re.kdeVals,Q=re.topAlt,ae=re.saturation,de=WW(ne.map(Math.abs))||1e-15,Te=ND([0,de/ae],j);v.geometry.setAttribute("color",Mu(ne.map(function(ue){return Te(Math.abs(ue))}),4));var be=Pc([0,de],[cr*(1+C),cr*(1+(Q||C))]);v.geometry.setAttribute("r",Mu(ne.map(be)))},V={kdeVals:z,topAlt:E,saturation:R},Y=v.__currentTargetD||Object.assign({},V,{kdeVals:z.map(function(){return 0}),topAlt:E&&C,saturation:.5});Y.kdeVals.length!==z.length&&(Y.kdeVals=z.slice()),Object.keys(V).some(function(ee){return Y[ee]!==V[ee]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?F(V):e.tweenGroup.add(new ca(Y).to(V,e.heatmapsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(F).start()))})}).digest(e.heatmapsData)}}),Mh=window.THREE?window.THREE:{DoubleSide:as,Group:ja,LineBasicMaterial:$0,LineSegments:j7,Mesh:zi,MeshBasicMaterial:pA},xO=xs({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new Mh.Group;return s.__defaultSideMaterial=WE(new Mh.MeshBasicMaterial({side:Mh.DoubleSide,depthWrite:!0}),lw),s.__defaultCapMaterial=new Mh.MeshBasicMaterial({side:Mh.DoubleSide,depthWrite:!0}),s.add(new Mh.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new Mh.LineSegments(void 0,new Mh.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=Rt(e.polygonGeoJsonGeometry),n=Rt(e.polygonAltitude),r=Rt(e.polygonCapCurvatureResolution),s=Rt(e.polygonCapColor),a=Rt(e.polygonCapMaterial),l=Rt(e.polygonSideColor),u=Rt(e.polygonSideMaterial),h=Rt(e.polygonStrokeColor),m=[];e.polygonsData.forEach(function(v){var x={data:v,capColor:s(v),capMaterial:a(v),sideColor:l(v),sideMaterial:u(v),strokeColor:h(v),altitude:+n(v),capCurvatureResolution:+r(v)},S=t(v),w=v.__id||"".concat(Math.round(Math.random()*1e9));v.__id=w,S.type==="Polygon"?m.push(Hi({id:"".concat(w,"_0"),coords:S.coordinates},x)):S.type==="MultiPolygon"?m.push.apply(m,Qi(S.coordinates.map(function(R,C){return Hi({id:"".concat(w,"_").concat(C),coords:R},x)}))):console.warn("Unsupported GeoJson geometry type: ".concat(S.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(v,x){var S=x.coords,w=x.capColor,R=x.capMaterial,C=x.sideColor,E=x.sideMaterial,B=x.strokeColor,L=x.altitude,O=x.capCurvatureResolution,G=gr(v.children,2),q=G[0],z=G[1],j=!!B;z.visible=j;var F=!!(w||R),V=!!(C||E);oue(q.geometry.parameters||{},{polygonGeoJson:S,curvatureResolution:O,closedTop:F,includeSides:V})||(q.geometry&&q.geometry.dispose(),q.geometry=new wM(S,0,cr,!1,F,V,O)),j&&(!z.geometry.parameters||z.geometry.parameters.geoJson.coordinates!==S||z.geometry.parameters.resolution!==O)&&(z.geometry&&z.geometry.dispose(),z.geometry=new cP({type:"Polygon",coordinates:S},cr,O));var Y=V?0:-1,ee=F?V?1:0:-1;if(Y>=0&&(q.material[Y]=E||v.__defaultSideMaterial),ee>=0&&(q.material[ee]=R||v.__defaultCapMaterial),[[!E&&C,Y],[!R&&w,ee]].forEach(function(de){var Te=gr(de,2),be=Te[0],ue=Te[1];if(!(!be||ue<0)){var we=q.material[ue],We=Rl(be);we.color.set(wu(be)),we.transparent=We<1,we.opacity=We}}),j){var te=z.material,re=Rl(B);te.color.set(wu(B)),te.transparent=re<1,te.opacity=re}var ne={alt:L},Q=function(Te){var be=v.__currentTargetD=Te,ue=be.alt;q.scale.x=q.scale.y=q.scale.z=1+ue,j&&(z.scale.x=z.scale.y=z.scale.z=1+ue+1e-4),Qle(v.__defaultSideMaterial,function(we){return we.uSurfaceRadius.value=cr/(ue+1)})},ae=v.__currentTargetD||Object.assign({},ne,{alt:-.001});Object.keys(ne).some(function(de){return ae[de]!==ne[de]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||ae.alt===ne.alt?Q(ne):e.tweenGroup.add(new ca(ae).to(ne,e.polygonsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(Q).start()))}).digest(m)}});function oue(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=gr(n,2),s=r[0],a=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],a)})}var Bd=window.THREE?window.THREE:{BufferGeometry:Ki,DoubleSide:as,Mesh:zi,MeshLambertMaterial:Vc,Vector3:he},QN=Object.assign({},yM),KN=QN.BufferGeometryUtils||QN,bO=xs({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Bd.Mesh(void 0,new Bd.MeshLambertMaterial({side:Bd.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=Rt(e.hexPolygonGeoJsonGeometry),n=Rt(e.hexPolygonColor),r=Rt(e.hexPolygonAltitude),s=Rt(e.hexPolygonResolution),a=Rt(e.hexPolygonMargin),l=Rt(e.hexPolygonUseDots),u=Rt(e.hexPolygonCurvatureResolution),h=Rt(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(m,v){var x=t(v),S=s(v),w=r(v),R=Math.max(0,Math.min(1,+a(v))),C=l(v),E=u(v),B=h(v),L=n(v),O=Rl(L);m.material.color.set(wu(L)),m.material.transparent=O<1,m.material.opacity=O;var G={alt:w,margin:R,curvatureResolution:E},q={geoJson:x,h3Res:S},z=m.__currentTargetD||Object.assign({},G,{alt:-.001}),j=m.__currentMemD||q;if(Object.keys(G).some(function(ee){return z[ee]!==G[ee]})||Object.keys(q).some(function(ee){return j[ee]!==q[ee]})){m.__currentMemD=q;var F=[];x.type==="Polygon"?R6(x.coordinates,S,!0).forEach(function(ee){return F.push(ee)}):x.type==="MultiPolygon"?x.coordinates.forEach(function(ee){return R6(ee,S,!0).forEach(function(te){return F.push(te)})}):console.warn("Unsupported GeoJson geometry type: ".concat(x.type,". Skipping geometry..."));var V=F.map(function(ee){var te=RP(ee),re=NP(ee,!0).reverse(),ne=te[1];return re.forEach(function(Q){var ae=Q[0];Math.abs(ne-ae)>170&&(Q[0]+=ne>ae?360:-360)}),{h3Idx:ee,hexCenter:te,hexGeoJson:re}}),Y=function(te){var re=m.__currentTargetD=te,ne=re.alt,Q=re.margin,ae=re.curvatureResolution;m.geometry&&m.geometry.dispose(),m.geometry=V.length?(KN.mergeGeometries||KN.mergeBufferGeometries)(V.map(function(de){var Te=gr(de.hexCenter,2),be=Te[0],ue=Te[1];if(C){var we=el(be,ue,ne),We=el(de.hexGeoJson[0][1],de.hexGeoJson[0][0],ne),Ne=.85*(1-Q)*new Bd.Vector3(we.x,we.y,we.z).distanceTo(new Bd.Vector3(We.x,We.y,We.z)),ze=new by(Ne,B);return ze.rotateX(Vf(-be)),ze.rotateY(Vf(ue)),ze.translate(we.x,we.y,we.z),ze}else{var Se=function(At,wt,Ft){return At-(At-wt)*Ft},Ce=Q===0?de.hexGeoJson:de.hexGeoJson.map(function(dt){var At=gr(dt,2),wt=At[0],Ft=At[1];return[[wt,ue],[Ft,be]].map(function($e){var rt=gr($e,2),ce=rt[0],Gt=rt[1];return Se(ce,Gt,Q)})});return new wM([Ce],cr,cr*(1+ne),!1,!0,!1,ae)}})):new Bd.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?Y(G):e.tweenGroup.add(new ca(z).to(G,e.hexPolygonsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(Y).start())}}).digest(e.hexPolygonsData)}}),lue=window.THREE?window.THREE:{Vector3:he};function uue(i,e){var t=function(a,l){var u=a[a.length-1];return[].concat(Qi(a),Qi(Array(l-a.length).fill(u)))},n=Math.max(i.length,e.length),r=h$.apply(void 0,Qi([i,e].map(function(s){return s.map(function(a){var l=a.x,u=a.y,h=a.z;return[l,u,h]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(a){var l=gr(a,3),u=l[0],h=l[1],m=l[2];return new lue.Vector3(u,h,m)})}}var Pf=window.THREE?window.THREE:{BufferGeometry:Ki,Color:an,Group:ja,Line:xy,NormalBlending:Ka,ShaderMaterial:Ja,Vector3:he},cue=L0.default||L0,SO=xs({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new cue,sharedMaterial:new Pf.ShaderMaterial(Hi(Hi({},mO()),{},{transparent:!0,blending:Pf.NormalBlending}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Pf.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var a=gr(s,2),l=a[1];return l}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var a=s.children[0],l=a.__dashAnimateStep*r;if(a.type==="Line"){var u=a.material.uniforms.dashTranslate.value%1e9;a.material.uniforms.dashTranslate.value=u+l}else if(a.type==="Line2"){for(var h=a.material.dashOffset-l,m=a.material.dashSize+a.material.gapSize;h<=-m;)h+=m;a.material.dashOffset=h}})})},update:function(e){var t=Rt(e.pathPoints),n=Rt(e.pathPointLat),r=Rt(e.pathPointLng),s=Rt(e.pathPointAlt),a=Rt(e.pathStroke),l=Rt(e.pathColor),u=Rt(e.pathDashLength),h=Rt(e.pathDashGap),m=Rt(e.pathDashInitialGap),v=Rt(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(C,E){var B=a(E),L=B!=null;if(!C.children.length||L===(C.children[0].type==="Line")){nr(C);var O=L?new Sle(new lO,new qE):new Pf.Line(new Pf.BufferGeometry,e.sharedMaterial.clone());C.add(O)}var G=C.children[0],q=S(t(E),n,r,s,e.pathResolution),z=v(E);if(G.__dashAnimateStep=z>0?1e3/z:0,L){G.material.resolution=e.rendererSize;{var V=u(E),Y=h(E),ee=m(E);G.material.dashed=Y>0,G.material.dashed?G.material.defines.USE_DASH="":delete G.material.defines.USE_DASH,G.material.dashed&&(G.material.dashScale=1/x(q),G.material.dashSize=V,G.material.gapSize=Y,G.material.dashOffset=-ee)}{var te=l(E);if(te instanceof Array){var re=w(l(E),q.length-1,1,!1);G.geometry.setColors(re.array),G.material.vertexColors=!0}else{var ne=te,Q=Rl(ne);G.material.color=new Pf.Color(wu(ne)),G.material.transparent=Q<1,G.material.opacity=Q,G.material.vertexColors=!1}}G.material.needsUpdate=!0}else{Object.assign(G.material.uniforms,{dashSize:{value:u(E)},gapSize:{value:h(E)},dashOffset:{value:m(E)}});var j=w(l(E),q.length),F=R(q.length,1,!0);G.geometry.setAttribute("color",j),G.geometry.setAttribute("relDistance",F)}var ae=uue(C.__currentTargetD&&C.__currentTargetD.points||[q[0]],q),de=function(we){var We=C.__currentTargetD=we,Ne=We.stroke,ze=We.interpolK,Se=C.__currentTargetD.points=ae(ze);if(L){var Ce;G.geometry.setPositions((Ce=[]).concat.apply(Ce,Qi(Se.map(function(dt){var At=dt.x,wt=dt.y,Ft=dt.z;return[At,wt,Ft]})))),G.material.linewidth=Ne,G.material.dashed&&G.computeLineDistances()}else G.geometry.setFromPoints(Se),G.geometry.computeBoundingSphere()},Te={stroke:B,interpolK:1},be=Object.assign({},C.__currentTargetD||Te,{interpolK:0});Object.keys(Te).some(function(ue){return be[ue]!==Te[ue]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?de(Te):e.tweenGroup.add(new ca(be).to(Te,e.pathTransitionDuration).easing(os.Quadratic.InOut).onUpdate(de).start()))}).digest(e.pathsData);function x(C){var E=0,B;return C.forEach(function(L){B&&(E+=B.distanceTo(L)),B=L}),E}function S(C,E,B,L,O){var G=function(F,V,Y){for(var ee=[],te=1;te<=Y;te++)ee.push(F+(V-F)*te/(Y+1));return ee},q=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Y=[],ee=null;return F.forEach(function(te){if(ee){for(;Math.abs(ee[1]-te[1])>180;)ee[1]+=360*(ee[1]<te[1]?1:-1);var re=Math.sqrt(Math.pow(te[0]-ee[0],2)+Math.pow(te[1]-ee[1],2));if(re>V)for(var ne=Math.floor(re/V),Q=G(ee[0],te[0],ne),ae=G(ee[1],te[1],ne),de=G(ee[2],te[2],ne),Te=0,be=Q.length;Te<be;Te++)Y.push([Q[Te],ae[Te],de[Te]])}Y.push(ee=te)}),Y},z=function(F){var V=gr(F,3),Y=V[0],ee=V[1],te=V[2],re=el(Y,ee,te),ne=re.x,Q=re.y,ae=re.z;return new Pf.Vector3(ne,Q,ae)};return q(C.map(function(j){return[E(j),B(j),L(j)]}),O).map(z)}function w(C,E){var B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,L=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,O=E+1,G;if(C instanceof Array||C instanceof Function){var q=C instanceof Array?Pc().domain(C.map(function(te,re){return re/(C.length-1)})).range(C):C;G=function(re){return jh(q(re),L,!0)}}else{var z=jh(C,L,!0);G=function(){return z}}for(var j=[],F=0,V=O;F<V;F++)for(var Y=G(F/(V-1)),ee=0;ee<B;ee++)j.push(Y);return Mu(j,L?4:3)}function R(C){for(var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,L=C+1,O=[],G=0,q=L;G<q;G++)for(var z=G/(q-1),j=0;j<E;j++)O.push(z);return B&&O.reverse(),Mu(O,1)}}}),Dv=window.THREE?window.THREE:{Euler:la,Mesh:zi,MeshLambertMaterial:Vc,SphereGeometry:Eu},TO=xs({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new Dv.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new Dv.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=Rt(e.tileLat),n=Rt(e.tileLng),r=Rt(e.tileAltitude),s=Rt(e.tileWidth),a=Rt(e.tileHeight),l=Rt(e.tileUseGlobeProjection),u=Rt(e.tileMaterial),h=Rt(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(m,v){m.material=u(v);var x=l(v),S=h(v),w=function(B){var L=m.__currentTargetD=B,O=L.lat,G=L.lng,q=L.alt,z=L.width,j=L.height,F=Od(G),V=Od(-O);m.geometry&&m.geometry.dispose(),m.geometry=new Dv.SphereGeometry(cr*(1+q),Math.ceil(z/(S||-1)),Math.ceil(j/(S||-1)),Od(90-z/2)+(x?F:0),Od(z),Od(90-j/2)+(x?V:0),Od(j)),x||m.setRotationFromEuler(new Dv.Euler(V,F,0,"YXZ"))},R={lat:+t(v),lng:+n(v),alt:+r(v),width:+s(v),height:+a(v)},C=m.__currentTargetD||Object.assign({},R,{width:0,height:0});Object.keys(R).some(function(E){return C[E]!==R[E]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?w(R):e.tweenGroup.add(new ca(C).to(R,e.tilesTransitionDuration).easing(os.Quadratic.InOut).onUpdate(w).start()))}).digest(e.tilesData)}}),Od=function(e){return e*Math.PI/180},gm=window.THREE?window.THREE:{BufferGeometry:Ki,Color:an,Points:Qk,PointsMaterial:Kw},wO=xs({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new gm.Points(new gm.BufferGeometry,new gm.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=Rt(t.particlesList),a=Rt(t.particleLat),l=Rt(t.particleLng),u=Rt(t.particleAltitude);n.geometry.setAttribute("position",Mu(s(r).map(function(h){return Object.values(el(a(h),l(h),u(h)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(l){return t.hasOwnProperty(l)})&&e.dataMapper.digest(e.particlesData);var n=Rt(e.particlesColor),r=Rt(e.particlesSize),s=Rt(e.particlesSizeAttenuation),a=Rt(e.particlesTexture);e.dataMapper.entries().forEach(function(l){var u=gr(l,2),h=u[0],m=u[1];if(m.material.size=r(h),m.material.sizeAttenuation=s(h),e.particlesTexture)m.material.color=new gm.Color(16777215),m.material.transparent=!1,m.material.alphaTest=.5,m.material.map=a(h);else{var v=n(h),x=Rl(v);m.material.color=new gm.Color(wu(v)),m.material.transparent=x<1,m.material.opacity=x,m.material.alphaTest=0}})}}),hue=window.THREE?window.THREE:{BufferGeometry:Ki},fue=(function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;nx(this,e),t=tx(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],a=0;a<=r;a++){var l=(a/r-.25)*Math.PI*2;s.push({x:Math.cos(l)*n,y:Math.sin(l)*n,z:0})}return t.setFromPoints(s),t}return rx(e,i),ix(e)})(hue.BufferGeometry),Id=window.THREE?window.THREE:{Color:an,Group:ja,Line:xy,LineBasicMaterial:$0,Vector3:he},Aue=L0.default||L0,MO=xs({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Id.Group;return s.__globeObjType="ring",s}),t.ticker=new Aue,t.ticker.onTick.add(function(s){if(t.ringsData.length){var a=Rt(t.ringColor),l=Rt(t.ringAltitude),u=Rt(t.ringMaxRadius),h=Rt(t.ringPropagationSpeed),m=Rt(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(v){var x=gr(v,2),S=x[1];return S}).forEach(function(v){var x=gr(v,2),S=x[0],w=x[1];if((w.__nextRingTime||0)<=s){var R=m(S)/1e3;w.__nextRingTime=s+(R<=0?1/0:R);var C=new Id.Line(new fue(1,t.ringResolution),new Id.LineBasicMaterial),E=a(S),B=E instanceof Array||E instanceof Function,L;B?E instanceof Array?(L=Pc().domain(E.map(function(Y,ee){return ee/(E.length-1)})).range(E),C.material.transparent=E.some(function(Y){return Rl(Y)<1})):(L=E,C.material.transparent=!0):(C.material.color=new Id.Color(wu(E)),$le(C.material,Rl(E)));var O=cr*(1+l(S)),G=u(S),q=G*Math.PI/180,z=h(S),j=z<=0,F=function(ee){var te=ee.t,re=(j?1-te:te)*q;if(C.scale.x=C.scale.y=O*Math.sin(re),C.position.z=O*(1-Math.cos(re)),B){var ne=L(te);C.material.color=new Id.Color(wu(ne)),C.material.transparent&&(C.material.opacity=Rl(ne))}};if(z===0)F({t:0}),w.add(C);else{var V=Math.abs(G/z)*1e3;t.tweenGroup.add(new ca({t:0}).to({t:1},V).onUpdate(F).onStart(function(){return w.add(C)}).onComplete(function(){w.remove(C),jE(C)}).start())}}})}})},update:function(e){var t=Rt(e.ringLat),n=Rt(e.ringLng),r=Rt(e.ringAltitude),s=e.scene.localToWorld(new Id.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(a,l){var u=t(l),h=n(l),m=r(l);Object.assign(a.position,el(u,h,m)),a.lookAt(s)}).digest(e.ringsData)}}),due={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},ο:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"¦":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},Τ:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},Π:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},ΐ:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"²":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"–":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},Κ:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},ƒ:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},ό:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"»":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"©":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},ώ:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"«":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"∙":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},ÿ:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},µ:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},Ι:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},Ύ:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"’":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},Ν:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},ς:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},Ψ:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},ι:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},Ά:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},ε:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},Δ:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"‰":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"—":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},ρ:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"¯":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},Η:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},Α:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"…":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},ν:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"¶":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},β:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},Μ:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},Ό:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Ή:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"•":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"¥":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},γ:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},α:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"­":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},Χ:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"†":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"°":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},Ξ:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "}," ":{x_min:0,x_max:0,ha:853},Ϋ:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"”":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},Ί:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},Β:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},υ:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},χ:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},ί:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},Ζ:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"¨":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"‹":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"„":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},δ:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},έ:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},ω:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"´":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"±":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},ϋ:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"§":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},Ω:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},ύ:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"™":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},ή:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},Θ:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"®":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},Ε:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"³":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},σ:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},ζ:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},θ:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},Ο:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},Γ:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},Έ:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},Ώ:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},Ϊ:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"½":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},Ρ:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},ª:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"΅":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},Φ:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"⁋":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},Σ:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"›":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"£":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"¬":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},λ:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},τ:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},ξ:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},Λ:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},ΰ:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},Υ:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},μ:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},φ:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"‘":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},ϊ:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},π:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},ά:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},κ:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},ψ:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},η:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},pue="normal",mue=1189,gue=-100,vue="normal",_ue={yMin:-334,xMin:-111,yMax:1189,xMax:1672},yue=1e3,xue={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) Μagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"Μagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r
\r
Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r
\r
The above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r
\r
The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word "MgOpen", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r
\r
This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "MgOpen" name.\r
\r
The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r
\r
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},bue=-334,Sue="Helvetiker",Tue=1522,wue=50,Mue={glyphs:due,cssFontWeight:pue,ascender:mue,underlinePosition:gue,cssFontStyle:vue,boundingBox:_ue,resolution:yue,original_font_information:xue,descender:bue,familyName:Sue,lineHeight:Tue,underlineThickness:wue},xl=Hi(Hi({},window.THREE?window.THREE:{BoxGeometry:$h,CircleGeometry:by,DoubleSide:as,Group:ja,Mesh:zi,MeshLambertMaterial:Vc,TextGeometry:zN,Vector3:he}),{},{Font:Tle,TextGeometry:zN}),EO=xs({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:Mue,onChange:function(e,t){t.font=new xl.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r;var s=new xl.CircleGeometry(1,32);t.dataMapper=new ao(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var a=new xl.MeshLambertMaterial;a.side=as;var l=new xl.Group;l.add(new xl.Mesh(s,a));var u=new xl.Mesh(void 0,a);l.add(u);var h=new xl.Mesh;return h.visible=!1,u.add(h),l.__globeObjType="label",l})},update:function(e){var t=Rt(e.labelLat),n=Rt(e.labelLng),r=Rt(e.labelAltitude),s=Rt(e.labelText),a=Rt(e.labelSize),l=Rt(e.labelRotation),u=Rt(e.labelColor),h=Rt(e.labelIncludeDot),m=Rt(e.labelDotRadius),v=Rt(e.labelDotOrientation),x=new Set(["right","top","bottom"]),S=2*Math.PI*cr/360;e.dataMapper.onUpdateObj(function(w,R){var C=gr(w.children,2),E=C[0],B=C[1],L=gr(B.children,1),O=L[0],G=u(R),q=Rl(G);B.material.color.set(wu(G)),B.material.transparent=q<1,B.material.opacity=q;var z=h(R),j=v(R);!z||!x.has(j)&&(j="bottom");var F=z?+m(R)*S:1e-12;E.scale.x=E.scale.y=F;var V=+a(R)*S;if(B.geometry&&B.geometry.dispose(),B.geometry=new xl.TextGeometry(s(R),{font:e.font,size:V,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),O.geometry&&O.geometry.dispose(),B.geometry.computeBoundingBox(),O.geometry=VE(xl.BoxGeometry,Qi(new xl.Vector3().subVectors(B.geometry.boundingBox.max,B.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),j!=="right"&&B.geometry.center(),z){var Y=F+V/2;j==="right"&&(B.position.x=Y),B.position.y={right:-V/2,top:Y+V/2,bottom:-Y-V/2}[j]}var ee=function(Q){var ae=w.__currentTargetD=Q,de=ae.lat,Te=ae.lng,be=ae.alt,ue=ae.rot,we=ae.scale;Object.assign(w.position,el(de,Te,be)),w.lookAt(e.scene.localToWorld(new xl.Vector3(0,0,0))),w.rotateY(Math.PI),w.rotateZ(-ue*Math.PI/180),w.scale.x=w.scale.y=w.scale.z=we},te={lat:+t(R),lng:+n(R),alt:+r(R),rot:+l(R),scale:1},re=w.__currentTargetD||Object.assign({},te,{scale:1e-12});Object.keys(te).some(function(ne){return re[ne]!==te[ne]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?ee(te):e.tweenGroup.add(new ca(re).to(te,e.labelsTransitionDuration).easing(os.Quadratic.InOut).onUpdate(ee).start()))}).digest(e.labelsData)}}),Eue=Hi(Hi({},window.THREE?window.THREE:{}),{},{CSS2DObject:Bj}),CO=xs({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=gr(r,2),a=s[1];return a}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;nr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new ao(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var a=Rt(t.htmlElement)(s),l=new Eue.CSS2DObject(a);return l.__globeObjType="html",l})},update:function(e,t){var n=this,r=Rt(e.htmlLat),s=Rt(e.htmlLng),a=Rt(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,u){var h=function(x){var S=l.__currentTargetD=x,w=S.alt,R=S.lat,C=S.lng;Object.assign(l.position,el(R,C,w)),n.updateObjVisibility(l)},m={lat:+r(u),lng:+s(u),alt:+a(u)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!l.__currentTargetD?h(m):e.tweenGroup.add(new ca(l.__currentTargetD).to(m,e.htmlTransitionDuration).easing(os.Quadratic.InOut).onUpdate(h).start())}).digest(e.htmlElementsData)}}),Pv=window.THREE?window.THREE:{Group:ja,Mesh:zi,MeshLambertMaterial:Vc,SphereGeometry:Eu},RO=xs({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new Pv.Mesh(new Pv.SphereGeometry(1,16,8),new Pv.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=Rt(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new Pv.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=Rt(e.objectLat),r=Rt(e.objectLng),s=Rt(e.objectAltitude),a=Rt(e.objectFacesSurface),l=Rt(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(u,h){var m=+n(h),v=+r(h),x=+s(h);Object.assign(u.position,el(m,v,x)),a(h)?u.setRotationFromEuler(new la(Vf(-m),Vf(v),0,"YXZ")):u.rotation.set(0,0,0);var S=u.children[0],w=l(h);w&&S.setRotationFromEuler(new la(Vf(w.x||0),Vf(w.y||0),Vf(w.z||0)))}).digest(e.objectsData)}}),NO=xs({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){nr(e),t.scene=e,t.dataMapper=new ao(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=Rt(t.customThreeObject)(n,cr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||nr(e.scene);var n=Rt(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,cr)}).digest(e.customLayerData)}}),Lv=window.THREE?window.THREE:{Camera:_y,Group:ja,Vector2:gt,Vector3:he},Cue=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],DO=wa("globeLayer",dO),Rue=Object.assign.apply(Object,Qi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return Ps({},i,DO.linkProp(i))}))),Nue=Object.assign.apply(Object,Qi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return Ps({},i,DO.linkMethod(i))}))),Due=wa("pointsLayer",pO),Pue=Object.assign.apply(Object,Qi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return Ps({},i,Due.linkProp(i))}))),Lue=wa("arcsLayer",gO),Uue=Object.assign.apply(Object,Qi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return Ps({},i,Lue.linkProp(i))}))),Bue=wa("hexBinLayer",vO),Oue=Object.assign.apply(Object,Qi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return Ps({},i,Bue.linkProp(i))}))),Iue=wa("heatmapsLayer",yO),Fue=Object.assign.apply(Object,Qi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return Ps({},i,Iue.linkProp(i))}))),kue=wa("hexedPolygonsLayer",bO),zue=Object.assign.apply(Object,Qi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return Ps({},i,kue.linkProp(i))}))),Gue=wa("polygonsLayer",xO),que=Object.assign.apply(Object,Qi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return Ps({},i,Gue.linkProp(i))}))),Vue=wa("pathsLayer",SO),Hue=Object.assign.apply(Object,Qi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return Ps({},i,Vue.linkProp(i))}))),jue=wa("tilesLayer",TO),Wue=Object.assign.apply(Object,Qi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return Ps({},i,jue.linkProp(i))}))),$ue=wa("particlesLayer",wO),Xue=Object.assign.apply(Object,Qi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return Ps({},i,$ue.linkProp(i))}))),Yue=wa("ringsLayer",MO),Que=Object.assign.apply(Object,Qi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return Ps({},i,Yue.linkProp(i))}))),Kue=wa("labelsLayer",EO),Zue=Object.assign.apply(Object,Qi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return Ps({},i,Kue.linkProp(i))}))),Jue=wa("htmlElementsLayer",CO),ece=Object.assign.apply(Object,Qi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return Ps({},i,Jue.linkProp(i))}))),tce=wa("objectsLayer",RO),nce=Object.assign.apply(Object,Qi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return Ps({},i,tce.linkProp(i))}))),ice=wa("customLayer",NO),rce=Object.assign.apply(Object,Qi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Ps({},i,ice.linkProp(i))}))),sce=xs({props:Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi(Hi({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new Lv.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},Rue),Pue),Uue),Oue),Fue),que),zue),Hue),Wue),Xue),Que),Zue),ece),nce),rce),methods:Hi({getGlobeRadius:VN,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return el.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return AO.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof Lv.Camera?t.position:t,r=VN(),s=void 0;if(e.scene&&n){var a,l,u,h;s=function(v){a===void 0&&(a=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),l===void 0&&(l=a.length()),u===void 0&&(u=Math.sqrt(Math.pow(l,2)-Math.pow(r,2))),h===void 0&&(h=Math.acos(u/l));var x=a.distanceTo(v);if(x<u)return!1;var S=v.length(),w=Math.acos((Math.pow(l,2)+Math.pow(x,2)-Math.pow(S,2))/(2*l*x));return w<h}}e.layersThatNeedUpdatePov.forEach(function(m){return m.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(m){return m.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},Nue),stateInit:function(){var e=new My,t={tweenGroup:e},n={globeLayer:dO(t),pointsLayer:pO(t),arcsLayer:gO(t),hexBinLayer:vO(t),heatmapsLayer:yO(t),polygonsLayer:xO(t),hexedPolygonsLayer:bO(t),pathsLayer:SO(t),tilesLayer:TO(t),particlesLayer:wO(t),ringsLayer:MO(t),labelsLayer:EO(t),htmlElementsLayer:CO(t),objectsLayer:RO(t),customLayer:NO(t)};return Hi(Hi({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,a=n.waitForGlobeReady,l=a===void 0?!0:a;nr(e),t.scene=e,t.scene.visible=!1,Cue.forEach(function(h){var m=new Lv.Group;t.scene.add(m),t[h](m)});var u=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new ca({k:1e-6}).to({k:1},600).easing(os.Quadratic.Out).onUpdate(function(v){var x=v.k;return t.scene.scale.set(x,x,x)}).start());var m=new Lv.Vector3(0,1,0);t.tweenGroup.add(new ca({rot:Math.PI*2}).to({rot:0},1200).easing(os.Quintic.Out).onUpdate(function(v){var x=v.rot;return t.scene.setRotationFromAxisAngle(m,x)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};l?t.globeLayer.onReady(u):u(),this._animationCycle()},update:function(e){}});function ace(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var a;nx(this,s);for(var l=arguments.length,u=new Array(l),h=0;h<l;h++)u[h]=arguments[h];return a=tx(this,s,[].concat(u)),a.__kapsuleInstance=VE(i,[].concat(Qi(t?[a]:[]),u)),a}return rx(s,r),ix(s)})(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,a=(s=this.__kapsuleInstance)[r].apply(s,arguments);return a===this.__kapsuleInstance?this:a}}),n}var oce=window.THREE?window.THREE:{Group:ja},PO=ace(sce,oce.Group,!0);const US={type:"change"},$E={type:"start"},XE={type:"end"},ZN=1e-6,Ii={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},Uv=new gt,Eh=new gt,lce=new he,Bv=new he,BS=new he,Fd=new mu,JN=new he,Ov=new he,OS=new he,Iv=new he;class uce extends aM{constructor(e,t=null){super(e,t),this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:Xo.ROTATE,MIDDLE:Xo.DOLLY,RIGHT:Xo.PAN},this.state=Ii.NONE,this.keyState=Ii.NONE,this.target=new he,this._lastPosition=new he,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new he,this._movePrev=new gt,this._moveCurr=new gt,this._lastAxis=new he,this._zoomStart=new gt,this._zoomEnd=new gt,this._panStart=new gt,this._panEnd=new gt,this._pointers=[],this._pointerPositions={},this._onPointerMove=hce.bind(this),this._onPointerDown=cce.bind(this),this._onPointerUp=fce.bind(this),this._onPointerCancel=Ace.bind(this),this._onContextMenu=yce.bind(this),this._onMouseWheel=_ce.bind(this),this._onKeyDown=pce.bind(this),this._onKeyUp=dce.bind(this),this._onTouchStart=xce.bind(this),this._onTouchMove=bce.bind(this),this._onTouchEnd=Sce.bind(this),this._onMouseDown=mce.bind(this),this._onMouseMove=gce.bind(this),this._onMouseUp=vce.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(),this.handleResize()),this.update()}connect(){window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}handleResize(){const e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>ZN&&(this.dispatchEvent(US),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>ZN||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(US),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Ii.NONE,this.keyState=Ii.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(US),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Eh.copy(this._panEnd).sub(this._panStart),Eh.lengthSq()){if(this.object.isOrthographicCamera){const e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;Eh.x*=e,Eh.y*=t}Eh.multiplyScalar(this._eye.length()*this.panSpeed),Bv.copy(this._eye).cross(this.object.up).setLength(Eh.x),Bv.add(lce.copy(this.object.up).setLength(Eh.y)),this.object.position.add(Bv),this.target.add(Bv),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Eh.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){Iv.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=Iv.length();e?(this._eye.copy(this.object.position).sub(this.target),JN.copy(this._eye).normalize(),Ov.copy(this.object.up).normalize(),OS.crossVectors(Ov,JN).normalize(),Ov.setLength(this._moveCurr.y-this._movePrev.y),OS.setLength(this._moveCurr.x-this._movePrev.x),Iv.copy(Ov.add(OS)),BS.crossVectors(Iv,this._eye).normalize(),e*=this.rotateSpeed,Fd.setFromAxisAngle(BS,e),this._eye.applyQuaternion(Fd),this.object.up.applyQuaternion(Fd),this._lastAxis.copy(BS),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Fd.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Fd),this.object.up.applyQuaternion(Fd)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Ii.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=M0.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=M0.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return Uv.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),Uv}_getMouseOnCircle(e,t){return Uv.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),Uv}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new gt,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}}function cce(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i))}function hce(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function fce(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchEnd(i):this._onMouseUp(),this._removePointer(i),this._pointers.length===0&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp)))}function Ace(i){this._removePointer(i)}function dce(){this.enabled!==!1&&(this.keyState=Ii.NONE,window.addEventListener("keydown",this._onKeyDown))}function pce(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===Ii.NONE&&(i.code===this.keys[Ii.ROTATE]&&!this.noRotate?this.keyState=Ii.ROTATE:i.code===this.keys[Ii.ZOOM]&&!this.noZoom?this.keyState=Ii.ZOOM:i.code===this.keys[Ii.PAN]&&!this.noPan&&(this.keyState=Ii.PAN)))}function mce(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Xo.DOLLY:this.state=Ii.ZOOM;break;case Xo.ROTATE:this.state=Ii.ROTATE;break;case Xo.PAN:this.state=Ii.PAN;break;default:this.state=Ii.NONE}const t=this.keyState!==Ii.NONE?this.keyState:this.state;t===Ii.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===Ii.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===Ii.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent($E)}function gce(i){const e=this.keyState!==Ii.NONE?this.keyState:this.state;e===Ii.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===Ii.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===Ii.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function vce(){this.state=Ii.NONE,this.dispatchEvent(XE)}function _ce(i){if(this.enabled!==!1&&this.noZoom!==!0){switch(i.preventDefault(),i.deltaMode){case 2:this._zoomStart.y-=i.deltaY*.025;break;case 1:this._zoomStart.y-=i.deltaY*.01;break;default:this._zoomStart.y-=i.deltaY*25e-5;break}this.dispatchEvent($E),this.dispatchEvent(XE)}}function yce(i){this.enabled!==!1&&i.preventDefault()}function xce(i){switch(this._trackPointer(i),this._pointers.length){case 1:this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);break;default:this.state=Ii.TOUCH_ZOOM_PAN;const e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);const n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,r=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,r)),this._panEnd.copy(this._panStart);break}this.dispatchEvent($E)}function bce(i){switch(this._trackPointer(i),this._pointers.length){case 1:this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY));break;default:const e=this._getSecondPointerPosition(i),t=i.pageX-e.x,n=i.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);const r=(i.pageX+e.x)/2,s=(i.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s));break}}function Sce(i){switch(this._pointers.length){case 0:this.state=Ii.NONE;break;case 1:this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=Ii.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==i.pointerId){const t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(XE)}const e7={type:"change"},YE={type:"start"},LO={type:"end"},Fv=new Og,t7=new Yl,Tce=Math.cos(70*M0.DEG2RAD),ps=new he,Fa=2*Math.PI,tr={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},IS=1e-6;class wce extends aM{constructor(e,t=null){super(e,t),this.state=tr.NONE,this.enabled=!0,this.target=new he,this.cursor=new he,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Xo.ROTATE,MIDDLE:Xo.DOLLY,RIGHT:Xo.PAN},this.touches={ONE:Gd.ROTATE,TWO:Gd.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new he,this._lastQuaternion=new mu,this._lastTargetPosition=new he,this._quat=new mu().setFromUnitVectors(e.up,new he(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new R5,this._sphericalDelta=new R5,this._scale=1,this._panOffset=new he,this._rotateStart=new gt,this._rotateEnd=new gt,this._rotateDelta=new gt,this._panStart=new gt,this._panEnd=new gt,this._panDelta=new gt,this._dollyStart=new gt,this._dollyEnd=new gt,this._dollyDelta=new gt,this._dollyDirection=new he,this._mouse=new gt,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Ece.bind(this),this._onPointerDown=Mce.bind(this),this._onPointerUp=Cce.bind(this),this._onContextMenu=Bce.bind(this),this._onMouseWheel=Dce.bind(this),this._onKeyDown=Pce.bind(this),this._onTouchStart=Lce.bind(this),this._onTouchMove=Uce.bind(this),this._onMouseDown=Rce.bind(this),this._onMouseMove=Nce.bind(this),this._interceptControlDown=Oce.bind(this),this._interceptControlUp=Ice.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(e7),this.update(),this.state=tr.NONE}update(e=null){const t=this.object.position;ps.copy(t).sub(this.target),ps.applyQuaternion(this._quat),this._spherical.setFromVector3(ps),this.autoRotate&&this.state===tr.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Fa:n>Math.PI&&(n-=Fa),r<-Math.PI?r+=Fa:r>Math.PI&&(r-=Fa),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(ps.setFromSpherical(this._spherical),ps.applyQuaternion(this._quatInverse),t.copy(this.target).add(ps),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){const l=ps.length();a=this._clampDistance(l*this._scale);const u=l-a;this.object.position.addScaledVector(this._dollyDirection,u),this.object.updateMatrixWorld(),s=!!u}else if(this.object.isOrthographicCamera){const l=new he(this._mouse.x,this._mouse.y,0);l.unproject(this.object);const u=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=u!==this.object.zoom;const h=new he(this._mouse.x,this._mouse.y,0);h.unproject(this.object),this.object.position.sub(h).add(l),this.object.updateMatrixWorld(),a=ps.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(Fv.origin.copy(this.object.position),Fv.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Fv.direction))<Tce?this.object.lookAt(this.target):(t7.setFromNormalAndCoplanarPoint(this.object.up,this.target),Fv.intersectPlane(t7,this.target))))}else if(this.object.isOrthographicCamera){const a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>IS||8*(1-this._lastQuaternion.dot(this.object.quaternion))>IS||this._lastTargetPosition.distanceToSquared(this.target)>IS?(this.dispatchEvent(e7),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Fa/60*this.autoRotateSpeed*e:Fa/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ps.setFromMatrixColumn(t,0),ps.multiplyScalar(-e),this._panOffset.add(ps)}_panUp(e,t){this.screenSpacePanning===!0?ps.setFromMatrixColumn(t,1):(ps.setFromMatrixColumn(t,0),ps.crossVectors(this.object.up,ps)),ps.multiplyScalar(e),this._panOffset.add(ps)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;ps.copy(r).sub(this.target);let s=ps.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,a=n.width,l=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/l)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Fa*this._rotateDelta.x/t.clientHeight),this._rotateUp(Fa*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Fa*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Fa*this._rotateDelta.x/t.clientHeight),this._rotateUp(Fa*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const a=(e.pageX+t.x)*.5,l=(e.pageY+t.y)*.5;this._updateZoomParameters(a,l)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new gt,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}}function Mce(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i)))}function Ece(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function Cce(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(LO),this.state=tr.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function Rce(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Xo.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=tr.DOLLY;break;case Xo.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=tr.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=tr.ROTATE}break;case Xo.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=tr.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=tr.PAN}break;default:this.state=tr.NONE}this.state!==tr.NONE&&this.dispatchEvent(YE)}function Nce(i){switch(this.state){case tr.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case tr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case tr.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function Dce(i){this.enabled===!1||this.enableZoom===!1||this.state!==tr.NONE||(i.preventDefault(),this.dispatchEvent(YE),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(LO))}function Pce(i){this.enabled!==!1&&this._handleKeyDown(i)}function Lce(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Gd.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=tr.TOUCH_ROTATE;break;case Gd.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=tr.TOUCH_PAN;break;default:this.state=tr.NONE}break;case 2:switch(this.touches.TWO){case Gd.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=tr.TOUCH_DOLLY_PAN;break;case Gd.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=tr.TOUCH_DOLLY_ROTATE;break;default:this.state=tr.NONE}break;default:this.state=tr.NONE}this.state!==tr.NONE&&this.dispatchEvent(YE)}function Uce(i){switch(this._trackPointer(i),this.state){case tr.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case tr.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case tr.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case tr.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=tr.NONE}}function Bce(i){this.enabled!==!1&&i.preventDefault()}function Oce(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Ice(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const Fce={type:"change"},n7=1e-6,i7=new mu;class kce extends aM{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new he(0,0,0),this._rotationVector=new he(0,0,0),this._lastQuaternion=new mu,this._lastPosition=new he,this._status=0,this._onKeyDown=zce.bind(this),this._onKeyUp=Gce.bind(this),this._onPointerMove=Vce.bind(this),this._onPointerDown=qce.bind(this),this._onPointerUp=Hce.bind(this),this._onPointerCancel=jce.bind(this),this._onContextMenu=Wce.bind(this),t!==null&&this.connect()}connect(){window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu)}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu)}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;const t=this.object,n=e*this.movementSpeed,r=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),i7.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(i7),(this._lastPosition.distanceToSquared(t.position)>n7||8*(1-this._lastQuaternion.dot(t.quaternion))>n7)&&(this.dispatchEvent(Fce),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){const e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}}function zce(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function Gce(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function qce(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function Vce(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){const e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function Hce(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function jce(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function Wce(i){this.enabled!==!1&&i.preventDefault()}const $ce={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`

		varying vec2 vUv;

		void main() {

			vUv = uv;
			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );

		}`,fragmentShader:`

		uniform float opacity;

		uniform sampler2D tDiffuse;

		varying vec2 vUv;

		void main() {

			vec4 texel = texture2D( tDiffuse, vUv );
			gl_FragColor = opacity * texel;


		}`};class sx{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const Xce=new kg(-1,1,1,-1,0,1);class Yce extends Ki{constructor(){super(),this.setAttribute("position",new Mi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Mi([0,2,0,0,2,0],2))}}const Qce=new Yce;class Kce{constructor(e){this._mesh=new zi(Qce,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Xce)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Zce extends sx{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Ja?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=vy.clone(e.uniforms),this.material=new Ja({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Kce(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class r7 extends sx{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let a,l;this.inverse?(a=0,l=1):(a=1,l=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),s.buffers.stencil.setClear(l),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}}class Jce extends sx{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class ehe{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new gt);this._width=n.width,this._height=n.height,t=new qh(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Gs}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Zce($ce),this.copyPass.material.blending=Qa,this.clock=new oD}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let r=0,s=this.passes.length;r<s;r++){const a=this.passes[r];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),a.needsSwap){if(n){const l=this.renderer.getContext(),u=this.renderer.state.buffers.stencil;u.setFunc(l.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),u.setFunc(l.EQUAL,1,4294967295)}this.swapBuffers()}r7!==void 0&&(a instanceof r7?n=!0:a instanceof Jce&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new gt);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class the extends sx{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new an}render(e,t,n){const r=e.autoClear;e.autoClear=!1;let s,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=r}}function io(){return io=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},io.apply(null,arguments)}function nhe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Pg(i,e){return Pg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Pg(i,e)}function ihe(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Pg(i,e)}function uw(i){return uw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uw(i)}function rhe(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function UO(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(UO=function(){return!!i})()}function she(i,e,t){if(UO())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Pg(r,t.prototype),r}function cw(i){var e=typeof Map=="function"?new Map:void 0;return cw=function(n){if(n===null||!rhe(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return she(n,arguments,uw(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Pg(r,n)},cw(i)}var ru=(function(i){ihe(e,i);function e(t){var n;return n=i.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this,nhe(n)}return e})(cw(Error));function FS(i){return Math.round(i*255)}function ahe(i,e,t){return FS(i)+","+FS(e)+","+FS(t)}function oy(i,e,t,n){if(n===void 0&&(n=ahe),e===0)return n(t,t,t);var r=(i%360+360)%360/60,s=(1-Math.abs(2*t-1))*e,a=s*(1-Math.abs(r%2-1)),l=0,u=0,h=0;r>=0&&r<1?(l=s,u=a):r>=1&&r<2?(l=a,u=s):r>=2&&r<3?(u=s,h=a):r>=3&&r<4?(u=a,h=s):r>=4&&r<5?(l=a,h=s):r>=5&&r<6&&(l=s,h=a);var m=t-s/2,v=l+m,x=u+m,S=h+m;return n(v,x,S)}var s7={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function ohe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return s7[e]?"#"+s7[e]:i}var lhe=/^#[a-fA-F0-9]{6}$/,uhe=/^#[a-fA-F0-9]{8}$/,che=/^#[a-fA-F0-9]{3}$/,hhe=/^#[a-fA-F0-9]{4}$/,kS=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,fhe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,Ahe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,dhe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function G0(i){if(typeof i!="string")throw new ru(3);var e=ohe(i);if(e.match(lhe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(uhe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(che))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(hhe)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=kS.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=fhe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var a=Ahe.exec(e);if(a){var l=parseInt(""+a[1],10),u=parseInt(""+a[2],10)/100,h=parseInt(""+a[3],10)/100,m="rgb("+oy(l,u,h)+")",v=kS.exec(m);if(!v)throw new ru(4,e,m);return{red:parseInt(""+v[1],10),green:parseInt(""+v[2],10),blue:parseInt(""+v[3],10)}}var x=dhe.exec(e.substring(0,50));if(x){var S=parseInt(""+x[1],10),w=parseInt(""+x[2],10)/100,R=parseInt(""+x[3],10)/100,C="rgb("+oy(S,w,R)+")",E=kS.exec(C);if(!E)throw new ru(4,e,C);return{red:parseInt(""+E[1],10),green:parseInt(""+E[2],10),blue:parseInt(""+E[3],10),alpha:parseFloat(""+x[4])>1?parseFloat(""+x[4])/100:parseFloat(""+x[4])}}throw new ru(5)}function phe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),a=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:a,alpha:i.alpha}:{hue:0,saturation:0,lightness:a};var l,u=r-s,h=a>.5?u/(2-r-s):u/(r+s);switch(r){case e:l=(t-n)/u+(t<n?6:0);break;case t:l=(n-e)/u+2;break;default:l=(e-t)/u+4;break}return l*=60,i.alpha!==void 0?{hue:l,saturation:h,lightness:a,alpha:i.alpha}:{hue:l,saturation:h,lightness:a}}function Qh(i){return phe(G0(i))}var mhe=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},hw=mhe;function Ff(i){var e=i.toString(16);return e.length===1?"0"+e:e}function zS(i){return Ff(Math.round(i*255))}function ghe(i,e,t){return hw("#"+zS(i)+zS(e)+zS(t))}function BO(i,e,t){return oy(i,e,t,ghe)}function vhe(i,e,t){if(typeof i=="object"&&e===void 0&&t===void 0)return BO(i.hue,i.saturation,i.lightness);throw new ru(1)}function _he(i,e,t,n){if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?BO(i.hue,i.saturation,i.lightness):"rgba("+oy(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new ru(2)}function OO(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return hw("#"+Ff(i)+Ff(e)+Ff(t));if(typeof i=="object"&&e===void 0&&t===void 0)return hw("#"+Ff(i.red)+Ff(i.green)+Ff(i.blue));throw new ru(6)}function ax(i,e,t,n){if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?OO(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")";throw new ru(7)}var yhe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},xhe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},bhe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},She=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Kh(i){if(typeof i!="object")throw new ru(8);if(xhe(i))return ax(i);if(yhe(i))return OO(i);if(She(i))return _he(i);if(bhe(i))return vhe(i);throw new ru(8)}function IO(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):IO(i,e,r)}}function Do(i){return IO(i,i.length,[])}function The(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{hue:t.hue+parseFloat(i)}))}Do(The);function J0(i,e,t){return Math.max(i,Math.min(e,t))}function whe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{lightness:J0(0,1,t.lightness-parseFloat(i))}))}Do(whe);function Mhe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{saturation:J0(0,1,t.saturation-parseFloat(i))}))}Do(Mhe);function Ehe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{lightness:J0(0,1,t.lightness+parseFloat(i))}))}Do(Ehe);function Che(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=G0(e),r=io({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=G0(t),a=io({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),l=r.alpha-a.alpha,u=parseFloat(i)*2-1,h=u*l===-1?u:u+l,m=1+u*l,v=(h/m+1)/2,x=1-v,S={red:Math.floor(r.red*v+a.red*x),green:Math.floor(r.green*v+a.green*x),blue:Math.floor(r.blue*v+a.blue*x),alpha:r.alpha*parseFloat(i)+a.alpha*(1-parseFloat(i))};return ax(S)}var Rhe=Do(Che),FO=Rhe;function Nhe(i,e){if(e==="transparent")return e;var t=G0(e),n=typeof t.alpha=="number"?t.alpha:1,r=io({},t,{alpha:J0(0,1,(n*100+parseFloat(i)*100)/100)});return ax(r)}var Dhe=Do(Nhe),Phe=Dhe;function Lhe(i,e){if(e==="transparent")return e;var t=Qh(e);return Kh(io({},t,{saturation:J0(0,1,t.saturation+parseFloat(i))}))}Do(Lhe);function Uhe(i,e){return e==="transparent"?e:Kh(io({},Qh(e),{hue:parseFloat(i)}))}Do(Uhe);function Bhe(i,e){return e==="transparent"?e:Kh(io({},Qh(e),{lightness:parseFloat(i)}))}Do(Bhe);function Ohe(i,e){return e==="transparent"?e:Kh(io({},Qh(e),{saturation:parseFloat(i)}))}Do(Ohe);function Ihe(i,e){return e==="transparent"?e:FO(parseFloat(i),"rgb(0, 0, 0)",e)}Do(Ihe);function Fhe(i,e){return e==="transparent"?e:FO(parseFloat(i),"rgb(255, 255, 255)",e)}Do(Fhe);function khe(i,e){if(e==="transparent")return e;var t=G0(e),n=typeof t.alpha=="number"?t.alpha:1,r=io({},t,{alpha:J0(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return ax(r)}Do(khe);var fw="http://www.w3.org/1999/xhtml";const a7={svg:"http://www.w3.org/2000/svg",xhtml:fw,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function kO(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),a7.hasOwnProperty(e)?{space:a7[e],local:i}:i}function zhe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===fw&&e.documentElement.namespaceURI===fw?e.createElement(i):e.createElementNS(t,i)}}function Ghe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function zO(i){var e=kO(i);return(e.local?Ghe:zhe)(e)}function qhe(){}function GO(i){return i==null?qhe:function(){return this.querySelector(i)}}function Vhe(i){typeof i!="function"&&(i=GO(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],a=s.length,l=n[r]=new Array(a),u,h,m=0;m<a;++m)(u=s[m])&&(h=i.call(u,u.__data__,m,s))&&("__data__"in u&&(h.__data__=u.__data__),l[m]=h);return new tl(n,this._parents)}function Hhe(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function jhe(){return[]}function Whe(i){return i==null?jhe:function(){return this.querySelectorAll(i)}}function $he(i){return function(){return Hhe(i.apply(this,arguments))}}function Xhe(i){typeof i=="function"?i=$he(i):i=Whe(i);for(var e=this._groups,t=e.length,n=[],r=[],s=0;s<t;++s)for(var a=e[s],l=a.length,u,h=0;h<l;++h)(u=a[h])&&(n.push(i.call(u,u.__data__,h,a)),r.push(u));return new tl(n,r)}function Yhe(i){return function(){return this.matches(i)}}function qO(i){return function(e){return e.matches(i)}}var Qhe=Array.prototype.find;function Khe(i){return function(){return Qhe.call(this.children,i)}}function Zhe(){return this.firstElementChild}function Jhe(i){return this.select(i==null?Zhe:Khe(typeof i=="function"?i:qO(i)))}var efe=Array.prototype.filter;function tfe(){return Array.from(this.children)}function nfe(i){return function(){return efe.call(this.children,i)}}function ife(i){return this.selectAll(i==null?tfe:nfe(typeof i=="function"?i:qO(i)))}function rfe(i){typeof i!="function"&&(i=Yhe(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],a=s.length,l=n[r]=[],u,h=0;h<a;++h)(u=s[h])&&i.call(u,u.__data__,h,s)&&l.push(u);return new tl(n,this._parents)}function VO(i){return new Array(i.length)}function sfe(){return new tl(this._enter||this._groups.map(VO),this._parents)}function ly(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}ly.prototype={constructor:ly,appendChild:function(i){return this._parent.insertBefore(i,this._next)},insertBefore:function(i,e){return this._parent.insertBefore(i,e)},querySelector:function(i){return this._parent.querySelector(i)},querySelectorAll:function(i){return this._parent.querySelectorAll(i)}};function afe(i){return function(){return i}}function ofe(i,e,t,n,r,s){for(var a=0,l,u=e.length,h=s.length;a<h;++a)(l=e[a])?(l.__data__=s[a],n[a]=l):t[a]=new ly(i,s[a]);for(;a<u;++a)(l=e[a])&&(r[a]=l)}function lfe(i,e,t,n,r,s,a){var l,u,h=new Map,m=e.length,v=s.length,x=new Array(m),S;for(l=0;l<m;++l)(u=e[l])&&(x[l]=S=a.call(u,u.__data__,l,e)+"",h.has(S)?r[l]=u:h.set(S,u));for(l=0;l<v;++l)S=a.call(i,s[l],l,s)+"",(u=h.get(S))?(n[l]=u,u.__data__=s[l],h.delete(S)):t[l]=new ly(i,s[l]);for(l=0;l<m;++l)(u=e[l])&&h.get(x[l])===u&&(r[l]=u)}function ufe(i){return i.__data__}function cfe(i,e){if(!arguments.length)return Array.from(this,ufe);var t=e?lfe:ofe,n=this._parents,r=this._groups;typeof i!="function"&&(i=afe(i));for(var s=r.length,a=new Array(s),l=new Array(s),u=new Array(s),h=0;h<s;++h){var m=n[h],v=r[h],x=v.length,S=hfe(i.call(m,m&&m.__data__,h,n)),w=S.length,R=l[h]=new Array(w),C=a[h]=new Array(w),E=u[h]=new Array(x);t(m,v,R,C,E,S,e);for(var B=0,L=0,O,G;B<w;++B)if(O=R[B]){for(B>=L&&(L=B+1);!(G=C[L])&&++L<w;);O._next=G||null}}return a=new tl(a,n),a._enter=l,a._exit=u,a}function hfe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function ffe(){return new tl(this._exit||this._groups.map(VO),this._parents)}function Afe(i,e,t){var n=this.enter(),r=this,s=this.exit();return typeof i=="function"?(n=i(n),n&&(n=n.selection())):n=n.append(i+""),e!=null&&(r=e(r),r&&(r=r.selection())),t==null?s.remove():t(s),n&&r?n.merge(r).order():r}function dfe(i){for(var e=i.selection?i.selection():i,t=this._groups,n=e._groups,r=t.length,s=n.length,a=Math.min(r,s),l=new Array(r),u=0;u<a;++u)for(var h=t[u],m=n[u],v=h.length,x=l[u]=new Array(v),S,w=0;w<v;++w)(S=h[w]||m[w])&&(x[w]=S);for(;u<r;++u)l[u]=t[u];return new tl(l,this._parents)}function pfe(){for(var i=this._groups,e=-1,t=i.length;++e<t;)for(var n=i[e],r=n.length-1,s=n[r],a;--r>=0;)(a=n[r])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function mfe(i){i||(i=gfe);function e(v,x){return v&&x?i(v.__data__,x.__data__):!v-!x}for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s){for(var a=t[s],l=a.length,u=r[s]=new Array(l),h,m=0;m<l;++m)(h=a[m])&&(u[m]=h);u.sort(e)}return new tl(r,this._parents).order()}function gfe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function vfe(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function _fe(){return Array.from(this)}function yfe(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length;r<s;++r){var a=n[r];if(a)return a}return null}function xfe(){let i=0;for(const e of this)++i;return i}function bfe(){return!this.node()}function Sfe(i){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,a=r.length,l;s<a;++s)(l=r[s])&&i.call(l,l.__data__,s,r);return this}function Tfe(i){return function(){this.removeAttribute(i)}}function wfe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function Mfe(i,e){return function(){this.setAttribute(i,e)}}function Efe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function Cfe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function Rfe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,t)}}function Nfe(i,e){var t=kO(i);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?wfe:Tfe:typeof e=="function"?t.local?Rfe:Cfe:t.local?Efe:Mfe)(t,e))}function HO(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function Dfe(i){return function(){this.style.removeProperty(i)}}function Pfe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function Lfe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function Ufe(i,e,t){return arguments.length>1?this.each((e==null?Dfe:typeof e=="function"?Lfe:Pfe)(i,e,t??"")):Bfe(this.node(),i)}function Bfe(i,e){return i.style.getPropertyValue(e)||HO(i).getComputedStyle(i,null).getPropertyValue(e)}function Ofe(i){return function(){delete this[i]}}function Ife(i,e){return function(){this[i]=e}}function Ffe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function kfe(i,e){return arguments.length>1?this.each((e==null?Ofe:typeof e=="function"?Ffe:Ife)(i,e)):this.node()[i]}function jO(i){return i.trim().split(/^|\s+/)}function QE(i){return i.classList||new WO(i)}function WO(i){this._node=i,this._names=jO(i.getAttribute("class")||"")}WO.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function $O(i,e){for(var t=QE(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function XO(i,e){for(var t=QE(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function zfe(i){return function(){$O(this,i)}}function Gfe(i){return function(){XO(this,i)}}function qfe(i,e){return function(){(e.apply(this,arguments)?$O:XO)(this,i)}}function Vfe(i,e){var t=jO(i+"");if(arguments.length<2){for(var n=QE(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?qfe:e?zfe:Gfe)(t,e))}function Hfe(){this.textContent=""}function jfe(i){return function(){this.textContent=i}}function Wfe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function $fe(i){return arguments.length?this.each(i==null?Hfe:(typeof i=="function"?Wfe:jfe)(i)):this.node().textContent}function Xfe(){this.innerHTML=""}function Yfe(i){return function(){this.innerHTML=i}}function Qfe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function Kfe(i){return arguments.length?this.each(i==null?Xfe:(typeof i=="function"?Qfe:Yfe)(i)):this.node().innerHTML}function Zfe(){this.nextSibling&&this.parentNode.appendChild(this)}function Jfe(){return this.each(Zfe)}function eAe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tAe(){return this.each(eAe)}function nAe(i){var e=typeof i=="function"?i:zO(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function iAe(){return null}function rAe(i,e){var t=typeof i=="function"?i:zO(i),n=e==null?iAe:typeof e=="function"?e:GO(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function sAe(){var i=this.parentNode;i&&i.removeChild(this)}function aAe(){return this.each(sAe)}function oAe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function lAe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function uAe(i){return this.select(i?lAe:oAe)}function cAe(i){return arguments.length?this.property("__data__",i):this.node().__data__}function hAe(i){return function(e){i.call(this,e,this.__data__)}}function fAe(i){return i.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function AAe(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t<r;++t)s=e[t],(!i.type||s.type===i.type)&&s.name===i.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function dAe(i,e,t){return function(){var n=this.__on,r,s=hAe(e);if(n){for(var a=0,l=n.length;a<l;++a)if((r=n[a]).type===i.type&&r.name===i.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=t),r.value=e;return}}this.addEventListener(i.type,s,t),r={type:i.type,name:i.name,value:e,listener:s,options:t},n?n.push(r):this.__on=[r]}}function pAe(i,e,t){var n=fAe(i+""),r,s=n.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,h=l.length,m;u<h;++u)for(r=0,m=l[u];r<s;++r)if((a=n[r]).type===m.type&&a.name===m.name)return m.value}return}for(l=e?dAe:AAe,r=0;r<s;++r)this.each(l(n[r],e,t));return this}function YO(i,e,t){var n=HO(i),r=n.CustomEvent;typeof r=="function"?r=new r(e,t):(r=n.document.createEvent("Event"),t?(r.initEvent(e,t.bubbles,t.cancelable),r.detail=t.detail):r.initEvent(e,!1,!1)),i.dispatchEvent(r)}function mAe(i,e){return function(){return YO(this,i,e)}}function gAe(i,e){return function(){return YO(this,i,e.apply(this,arguments))}}function vAe(i,e){return this.each((typeof e=="function"?gAe:mAe)(i,e))}function*_Ae(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length,a;r<s;++r)(a=n[r])&&(yield a)}var yAe=[null];function tl(i,e){this._groups=i,this._parents=e}function xAe(){return this}tl.prototype={constructor:tl,select:Vhe,selectAll:Xhe,selectChild:Jhe,selectChildren:ife,filter:rfe,data:cfe,enter:sfe,exit:ffe,join:Afe,merge:dfe,selection:xAe,order:pfe,sort:mfe,call:vfe,nodes:_fe,node:yfe,size:xfe,empty:bfe,each:Sfe,attr:Nfe,style:Ufe,property:kfe,classed:Vfe,text:$fe,html:Kfe,raise:Jfe,lower:tAe,append:nAe,insert:rAe,remove:aAe,clone:uAe,datum:cAe,on:pAe,dispatch:vAe,[Symbol.iterator]:_Ae};function bAe(i){return typeof i=="string"?new tl([[document.querySelector(i)]],[document.documentElement]):new tl([[i]],yAe)}function SAe(i){let e;for(;e=i.sourceEvent;)i=e;return i}function TAe(i,e){if(i=SAe(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop]}}return[i.pageX,i.pageY]}var i1,Tr,QO,KO,Hf,o7,ZO,JO,eI,KE,Aw,dw,uy={},cy=[],wAe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ox=Array.isArray;function su(i,e){for(var t in e)i[t]=e[t];return i}function ZE(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function MAe(i,e,t){var n,r,s,a={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:a[s]=e[s];if(arguments.length>2&&(a.children=arguments.length>3?i1.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)a[s]===void 0&&(a[s]=i.defaultProps[s]);return Gm(i,a,n,r,null)}function Gm(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++QO,__i:-1,__u:0};return r==null&&Tr.vnode!=null&&Tr.vnode(s),s}function lx(i){return i.children}function r_(i,e){this.props=i,this.context=e}function q0(i,e){if(e==null)return i.__?q0(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?q0(i):null}function EAe(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=su({},e);s.__v=e.__v+1,Tr.vnode&&Tr.vnode(s),JE(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??q0(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,rI(n,s,r),e.__e=e.__=null,s.__e!=t&&tI(s)}}function tI(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),tI(i)}function l7(i){(!i.__d&&(i.__d=!0)&&Hf.push(i)&&!hy.__r++||o7!=Tr.debounceRendering)&&((o7=Tr.debounceRendering)||ZO)(hy)}function hy(){for(var i,e=1;Hf.length;)Hf.length>e&&Hf.sort(JO),i=Hf.shift(),e=Hf.length,EAe(i);hy.__r=0}function nI(i,e,t,n,r,s,a,l,u,h,m){var v,x,S,w,R,C,E,B=n&&n.__k||cy,L=e.length;for(u=CAe(t,e,B,u,L),v=0;v<L;v++)(S=t.__k[v])!=null&&(x=S.__i!=-1&&B[S.__i]||uy,S.__i=v,C=JE(i,S,x,r,s,a,l,u,h,m),w=S.__e,S.ref&&x.ref!=S.ref&&(x.ref&&e4(x.ref,null,S),m.push(S.ref,S.__c||w,S)),R==null&&w!=null&&(R=w),(E=!!(4&S.__u))||x.__k===S.__k?u=iI(S,u,i,E):typeof S.type=="function"&&C!==void 0?u=C:w&&(u=w.nextSibling),S.__u&=-7);return t.__e=R,u}function CAe(i,e,t,n,r){var s,a,l,u,h,m=t.length,v=m,x=0;for(i.__k=new Array(r),s=0;s<r;s++)(a=e[s])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=i.__k[s]=Gm(null,a,null,null,null):ox(a)?a=i.__k[s]=Gm(lx,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=i.__k[s]=Gm(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):i.__k[s]=a,u=s+x,a.__=i,a.__b=i.__b+1,l=null,(h=a.__i=RAe(a,t,u,v))!=-1&&(v--,(l=t[h])&&(l.__u|=2)),l==null||l.__v==null?(h==-1&&(r>m?x--:r<m&&x++),typeof a.type!="function"&&(a.__u|=4)):h!=u&&(h==u-1?x--:h==u+1?x++:(h>u?x--:x++,a.__u|=4))):i.__k[s]=null;if(v)for(s=0;s<m;s++)(l=t[s])!=null&&(2&l.__u)==0&&(l.__e==n&&(n=q0(l)),aI(l,l));return n}function iI(i,e,t,n){var r,s;if(typeof i.type=="function"){for(r=i.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=i,e=iI(r[s],e,t,n));return e}i.__e!=e&&(n&&(e&&i.type&&!e.parentNode&&(e=q0(i)),t.insertBefore(i.__e,e||null)),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function RAe(i,e,t,n){var r,s,a,l=i.key,u=i.type,h=e[t],m=h!=null&&(2&h.__u)==0;if(h===null&&l==null||m&&l==h.key&&u==h.type)return t;if(n>(m?1:0)){for(r=t-1,s=t+1;r>=0||s<e.length;)if((h=e[a=r>=0?r--:s++])!=null&&(2&h.__u)==0&&l==h.key&&u==h.type)return a}return-1}function u7(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||wAe.test(e)?t:t+"px"}function kv(i,e,t,n,r){var s,a;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||u7(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||u7(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(eI,"$1")),a=e.toLowerCase(),e=a in i||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t.u=n.u:(t.u=KE,i.addEventListener(e,s?dw:Aw,s)):i.removeEventListener(e,s?dw:Aw,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function c7(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=KE++;else if(e.t<t.u)return;return t(Tr.event?Tr.event(e):e)}}}function JE(i,e,t,n,r,s,a,l,u,h){var m,v,x,S,w,R,C,E,B,L,O,G,q,z,j,F=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(u=!!(32&t.__u),s=[l=e.__e=t.__e]),(m=Tr.__b)&&m(e);e:if(typeof F=="function")try{if(E=e.props,B="prototype"in F&&F.prototype.render,L=(m=F.contextType)&&n[m.__c],O=m?L?L.props.value:m.__:n,t.__c?C=(v=e.__c=t.__c).__=v.__E:(B?e.__c=v=new F(E,O):(e.__c=v=new r_(E,O),v.constructor=F,v.render=DAe),L&&L.sub(v),v.state||(v.state={}),v.__n=n,x=v.__d=!0,v.__h=[],v._sb=[]),B&&v.__s==null&&(v.__s=v.state),B&&F.getDerivedStateFromProps!=null&&(v.__s==v.state&&(v.__s=su({},v.__s)),su(v.__s,F.getDerivedStateFromProps(E,v.__s))),S=v.props,w=v.state,v.__v=e,x)B&&F.getDerivedStateFromProps==null&&v.componentWillMount!=null&&v.componentWillMount(),B&&v.componentDidMount!=null&&v.__h.push(v.componentDidMount);else{if(B&&F.getDerivedStateFromProps==null&&E!==S&&v.componentWillReceiveProps!=null&&v.componentWillReceiveProps(E,O),e.__v==t.__v||!v.__e&&v.shouldComponentUpdate!=null&&v.shouldComponentUpdate(E,v.__s,O)===!1){e.__v!=t.__v&&(v.props=E,v.state=v.__s,v.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(V){V&&(V.__=e)}),cy.push.apply(v.__h,v._sb),v._sb=[],v.__h.length&&a.push(v);break e}v.componentWillUpdate!=null&&v.componentWillUpdate(E,v.__s,O),B&&v.componentDidUpdate!=null&&v.__h.push(function(){v.componentDidUpdate(S,w,R)})}if(v.context=O,v.props=E,v.__P=i,v.__e=!1,G=Tr.__r,q=0,B)v.state=v.__s,v.__d=!1,G&&G(e),m=v.render(v.props,v.state,v.context),cy.push.apply(v.__h,v._sb),v._sb=[];else do v.__d=!1,G&&G(e),m=v.render(v.props,v.state,v.context),v.state=v.__s;while(v.__d&&++q<25);v.state=v.__s,v.getChildContext!=null&&(n=su(su({},n),v.getChildContext())),B&&!x&&v.getSnapshotBeforeUpdate!=null&&(R=v.getSnapshotBeforeUpdate(S,w)),z=m!=null&&m.type===lx&&m.key==null?sI(m.props.children):m,l=nI(i,ox(z)?z:[z],e,t,n,r,s,a,l,u,h),v.base=e.__e,e.__u&=-161,v.__h.length&&a.push(v),C&&(v.__E=v.__=null)}catch(V){if(e.__v=null,u||s!=null)if(V.then){for(e.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;s[s.indexOf(l)]=null,e.__e=l}else{for(j=s.length;j--;)ZE(s[j]);pw(e)}else e.__e=t.__e,e.__k=t.__k,V.then||pw(e);Tr.__e(V,e,t)}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):l=e.__e=NAe(t.__e,e,t,n,r,s,a,u,h);return(m=Tr.diffed)&&m(e),128&e.__u?void 0:l}function pw(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(pw))}function rI(i,e,t){for(var n=0;n<t.length;n++)e4(t[n],t[++n],t[++n]);Tr.__c&&Tr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Tr.__e(s,r.__v)}})}function sI(i){return typeof i!="object"||i==null||i.__b>0?i:ox(i)?i.map(sI):su({},i)}function NAe(i,e,t,n,r,s,a,l,u){var h,m,v,x,S,w,R,C=t.props||uy,E=e.props,B=e.type;if(B=="svg"?r="http://www.w3.org/2000/svg":B=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(h=0;h<s.length;h++)if((S=s[h])&&"setAttribute"in S==!!B&&(B?S.localName==B:S.nodeType==3)){i=S,s[h]=null;break}}if(i==null){if(B==null)return document.createTextNode(E);i=document.createElementNS(r,B,E.is&&E),l&&(Tr.__m&&Tr.__m(e,s),l=!1),s=null}if(B==null)C===E||l&&i.data==E||(i.data=E);else{if(s=s&&i1.call(i.childNodes),!l&&s!=null)for(C={},h=0;h<i.attributes.length;h++)C[(S=i.attributes[h]).name]=S.value;for(h in C)S=C[h],h=="dangerouslySetInnerHTML"?v=S:h=="children"||h in E||h=="value"&&"defaultValue"in E||h=="checked"&&"defaultChecked"in E||kv(i,h,null,S,r);for(h in E)S=E[h],h=="children"?x=S:h=="dangerouslySetInnerHTML"?m=S:h=="value"?w=S:h=="checked"?R=S:l&&typeof S!="function"||C[h]===S||kv(i,h,S,C[h],r);if(m)l||v&&(m.__html==v.__html||m.__html==i.innerHTML)||(i.innerHTML=m.__html),e.__k=[];else if(v&&(i.innerHTML=""),nI(e.type=="template"?i.content:i,ox(x)?x:[x],e,t,n,B=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,a,s?s[0]:t.__k&&q0(t,0),l,u),s!=null)for(h=s.length;h--;)ZE(s[h]);l||(h="value",B=="progress"&&w==null?i.removeAttribute("value"):w!=null&&(w!==i[h]||B=="progress"&&!w||B=="option"&&w!=C[h])&&kv(i,h,w,C[h],r),h="checked",R!=null&&R!=i[h]&&kv(i,h,R,C[h],r))}return i}function e4(i,e,t){try{if(typeof i=="function"){var n=typeof i.__u=="function";n&&i.__u(),n&&e==null||(i.__u=i(e))}else i.current=e}catch(r){Tr.__e(r,t)}}function aI(i,e,t){var n,r;if(Tr.unmount&&Tr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||e4(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Tr.__e(s,e)}n.base=n.__P=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&aI(n[r],e,t||typeof i.type!="function");t||ZE(i.__e),i.__c=i.__=i.__e=void 0}function DAe(i,e,t){return this.constructor(i,t)}function PAe(i,e,t){var n,r,s,a;e==document&&(e=document.documentElement),Tr.__&&Tr.__(i,e),r=(n=!1)?null:e.__k,s=[],a=[],JE(e,i=e.__k=MAe(lx,null,[i]),r||uy,uy,e.namespaceURI,r?null:e.firstChild?i1.call(e.childNodes):null,s,r?r.__e:e.firstChild,n,a),rI(s,i,a)}function oI(i,e,t){var n,r,s,a,l=su({},i.props);for(s in i.type&&i.type.defaultProps&&(a=i.type.defaultProps),e)s=="key"?n=e[s]:s=="ref"?r=e[s]:l[s]=e[s]===void 0&&a!=null?a[s]:e[s];return arguments.length>2&&(l.children=arguments.length>3?i1.call(arguments,2):t),Gm(i.type,l,n||i.key,r||i.ref,null)}i1=cy.slice,Tr={__e:function(i,e,t,n){for(var r,s,a;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),a=r.__d),a)return r.__E=r}catch(l){i=l}throw i}},QO=0,KO=function(i){return i!=null&&i.constructor===void 0},r_.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=su({},this.state),typeof i=="function"&&(i=i(su({},t),this.props)),i&&su(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),l7(this))},r_.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),l7(this))},r_.prototype.render=lx,Hf=[],ZO=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,JO=function(i,e){return i.__v.__b-e.__v.__b},hy.__r=0,eI=/(PointerCapture)$|Capture$/i,KE=0,Aw=c7(!1),dw=c7(!0);function h7(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function LAe(i){if(Array.isArray(i))return i}function UAe(i,e,t){return(e=zAe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function BAe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function OAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function f7(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function IAe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?f7(Object(t),!0).forEach(function(n){UAe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):f7(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function FAe(i,e){return LAe(i)||BAe(i,e)||GAe(i,e)||OAe()}function kAe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function zAe(i){var e=kAe(i,"string");return typeof e=="symbol"?e:e+""}function fy(i){"@babel/helpers - typeof";return fy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fy(i)}function GAe(i,e){if(i){if(typeof i=="string")return h7(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h7(i,e):void 0}}var mw=function(e){if(fy(e)!=="object")return e;var t=oI(e);if(t.props){var n;t.props=IAe({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(mw):mw(t.props.children))}return t},qAe=function(e){return KO(oI(e))},VAe=function(e,t){delete t.__k,PAe(mw(e),t)};function HAe(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var jAe=`.float-tooltip-kap {
  position: absolute;
  width: max-content; /* prevent shrinking near right edge */
  max-width: max(50%, 150px);
  padding: 3px 5px;
  border-radius: 3px;
  font: 12px sans-serif;
  color: #eee;
  background: rgba(0,0,0,0.6);
  pointer-events: none;
}
`;HAe(jAe);var WAe=xs({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,a=!!e&&fy(e)==="object"&&!!e.node&&typeof e.node=="function",l=bAe(a?e.node():e);l.style("position")==="static"&&l.style("position","relative"),t.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(h){var m=FAe(h,2),v=m[0],x=m[1];return t.tooltipEl.style(v,x)}),t.tooltipEl.style("left","-10000px").style("display","none");var u="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,l.on("mousemove.".concat(u),function(h){t.mouseInside=!0;var m=TAe(h),v=l.node(),x=v.offsetWidth,S=v.offsetHeight,w=[t.offsetX===null||t.offsetX===void 0?"-".concat(m[0]/x*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?S>130&&S-m[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",m[0]+"px").style("top",m[1]+"px").style("transform","translate(".concat(w.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(u),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(u),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):qAe(e.content)?(e.tooltipEl.text(""),VAe(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function $Ae(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var XAe=`.scene-nav-info {
  position: absolute;
  bottom: 5px;
  width: 100%;
  text-align: center;
  color: slategrey;
  opacity: 0.7;
  font-size: 10px;
  font-family: sans-serif;
  pointer-events: none;
  user-select: none;
}

.scene-container canvas:focus {
  outline: none;
}`;$Ae(XAe);function gw(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function YAe(i){if(Array.isArray(i))return i}function QAe(i){if(Array.isArray(i))return gw(i)}function KAe(i,e,t){return(e=rde(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ZAe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function JAe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,a,l=[],u=!0,h=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(u=(n=s.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(m){h=!0,r=m}finally{try{if(!u&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(h)throw r}}return l}}function ede(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tde(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nde(i,e){return YAe(i)||JAe(i,e)||lI(i,e)||ede()}function Lf(i){return QAe(i)||ZAe(i)||lI(i)||tde()}function ide(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function rde(i){var e=ide(i,"string");return typeof e=="symbol"?e:e+""}function lI(i,e){if(i){if(typeof i=="string")return gw(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?gw(i,e):void 0}}var br=window.THREE?window.THREE:{WebGLRenderer:Uj,Scene:Yw,PerspectiveCamera:ya,Raycaster:Yz,SRGBColorSpace:_n,TextureLoader:rM,Vector2:gt,Vector3:he,Box3:Gc,Color:an,Mesh:zi,SphereGeometry:Eu,MeshBasicMaterial:pA,BackSide:hr,Clock:oD},uI=xs({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.clock.getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(a){return a.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(a,l){return e.hoverOrderComparator(a.object,l.object)});var s=r.find(function(a){return e.hoverFilter(a.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&Rt(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var a=t,l=n||{x:0,y:0,z:0};if(!r)m(a),v(l);else{var u=Object.assign({},s.position),h=x();e.tweenGroup.add(new ca(u).to(a,r).easing(os.Quadratic.Out).onUpdate(m).start()),e.tweenGroup.add(new ca(h).to(l,r/3).easing(os.Quadratic.Out).onUpdate(v).start())}return this}return Object.assign({},s.position,{lookAt:x()});function m(S){var w=S.x,R=S.y,C=S.z;w!==void 0&&(s.position.x=w),R!==void 0&&(s.position.y=R),C!==void 0&&(s.position.z=C)}function v(S){var w=new br.Vector3(S.x,S.y,S.z);e.controls.enabled&&e.controls.target?e.controls.target=w:s.lookAt(w)}function x(){return Object.assign(new br.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),a=3;a<r;a++)s[a-3]=arguments[a];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var a=new br.Vector3(0,0,0),l=Math.max.apply(Math,Lf(Object.entries(t).map(function(S){var w=nde(S,2),R=w[0],C=w[1];return Math.max.apply(Math,Lf(C.map(function(E){return Math.abs(a[R]-E)})))})))*2,u=(1-r*2/e.height)*s.fov,h=l/Math.atan(u*Math.PI/180),m=h/s.aspect,v=Math.max(h,m);if(v>0){var x=a.clone().sub(s.position).normalize().multiplyScalar(-v);this.cameraPosition(x,a,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new br.Box3(new br.Vector3(0,0,0),new br.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,Lf(["x","y","z"].map(function(s){return KAe({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new br.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new br.Vector2(t/e.width*2-1,-(n/e.height)*2+1),a=new br.Raycaster;return a.setFromCamera(s,e.camera),Object.assign({},a.ray.at(r,new br.Vector3))},intersectingObjects:function(e,t,n){var r=new br.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new br.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls}},stateInit:function(){return{scene:new br.Scene,camera:new br.PerspectiveCamera,clock:new br.Clock,tweenGroup:new My,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,a=n.useWebGPU,l=a===void 0?!1:a,u=n.rendererConfig,h=u===void 0?{}:u,m=n.extraRenderers,v=m===void 0?[]:m,x=n.waitForLoadComplete,S=x===void 0?!0:x;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new WAe(t.container),t.pointerPos=new br.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(w){return t.container.addEventListener(w,function(R){if(w==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&R.type==="pointermove"&&(R.pressure>0||t.isPointerPressed)&&(R.pointerType==="mouse"||R.movementX===void 0||[R.movementX,R.movementY].some(function(B){return Math.abs(B)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var C=E(t.container);t.pointerPos.x=R.pageX-C.left,t.pointerPos.y=R.pageY-C.top}function E(B){var L=B.getBoundingClientRect(),O=window.pageXOffset||document.documentElement.scrollLeft,G=window.pageYOffset||document.documentElement.scrollTop;return{top:L.top+G,left:L.left+O}}},{passive:!0})}),t.container.addEventListener("pointerup",function(w){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){w.button===0&&t.onClick(t.hoverObj||null,w,t.intersection),w.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,w,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(w){t.onRightClick&&w.preventDefault()}),t.renderer=new(l?aO:br.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},h)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=v,t.extraRenderers.forEach(function(w){w.domElement.style.position="absolute",w.domElement.style.top="0px",w.domElement.style.pointerEvents="none",t.container.appendChild(w.domElement)}),t.postProcessingComposer=new ehe(t.renderer),t.postProcessingComposer.addPass(new the(t.scene,t.camera)),t.controls=new{trackball:uce,orbit:wce,fly:kce}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(Lf(t.extraRenderers)).forEach(function(w){return w.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new br.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!S,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(Lf(e.extraRenderers)).forEach(function(S){return S.setSize(r,s)}),e.camera.aspect=r/s;var a=e.viewOffset.slice(0,2);a.some(function(S){return S})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(Lf(a),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var l,u=e.width,h=e.height,m=e.viewOffset.slice(0,2);m.some(function(S){return S})?(l=e.camera).setViewOffset.apply(l,[u,h].concat(Lf(m),[u,h])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new br.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var v=G0(e.backgroundColor).alpha;v===void 0&&(v=1),e.renderer.setClearColor(new br.Color(Phe(1,e.backgroundColor)),v)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new br.TextureLoader().load(e.backgroundImageUrl,function(S){S.colorSpace=br.SRGBColorSpace,e.skysphere.material=new br.MeshBasicMaterial({map:S,side:br.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&x()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&x())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(S){return e.scene.remove(S)}),e.lights.forEach(function(S){return e.scene.add(S)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(S){return e.scene.remove(S)}),e.objects.forEach(function(S){return e.scene.add(S)}));function x(){e.loadComplete=e.scene.visible=!0}}});function sde(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var ade=`.scene-container .clickable {
  cursor: pointer;
}`;sde(ade);function vw(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function ode(i){if(Array.isArray(i))return vw(i)}function r1(i,e,t){return(e=Ade(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function lde(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function ude(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A7(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function jf(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?A7(Object(t),!0).forEach(function(n){r1(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):A7(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function cde(i,e){if(i==null)return{};var t,n,r=hde(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function hde(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function ux(i){return ode(i)||lde(i)||dde(i)||ude()}function fde(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Ade(i){var e=fde(i,"string");return typeof e=="symbol"?e:e+""}function dde(i,e){if(i){if(typeof i=="string")return vw(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?vw(i,e):void 0}}function cI(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(a,l){l[i][r](a)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var a=s[i],l=arguments.length,u=new Array(l>1?l-1:0),h=1;h<l;h++)u[h-1]=arguments[h];var m=a[r].apply(a,u);return m===a?this:m}}}}var pde=["rendererConfig","waitForGlobeReady"],vm=jf(jf({},window.THREE?window.THREE:{AmbientLight:aD,DirectionalLight:sD,Vector2:gt,REVISION:V0}),{},{CSS2DRenderer:Oj}),hI=cI("globe",PO),mde=Object.assign.apply(Object,ux(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return r1({},i,hI.linkProp(i))}))),gde=Object.assign.apply(Object,ux(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return r1({},i,hI.linkMethod(i))}))),fI=cI("renderObjs",uI),vde=Object.assign.apply(Object,ux(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return r1({},i,fI.linkProp(i))}))),_de=Object.assign.apply(Object,ux(["lights","postProcessingComposer"].map(function(i){return r1({},i,fI.linkMethod(i))}))),yde=xs({props:jf(jf({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},mde),vde),methods:jf(jf({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(u){return s[u]=+s[u]}),!n)l(s);else{for(;r.lng-s.lng>180;)r.lng-=360;for(;r.lng-s.lng<-180;)r.lng+=360;e.tweenGroup.add(new ca(r).to(s,n).easing(os.Cubic.InOut).onUpdate(l).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(u){var h=u.lat,m=u.lng,v=u.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(h,m,v)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var a=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(a.x,a.y,a.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(u){return(u.object.__globeObjType||u.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),a=s.lat,l=s.lng;return{lat:a,lng:l}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){e.globe._destructor(),this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([])}},gde),_de),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=cde(e,pde),a=new PO(jf({waitForGlobeReady:r},s));return{globe:a,renderObjs:uI({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new vm.CSS2DRenderer]}).skyRadius(a.getGlobeRadius()*500).showNavInfo(!1).objects([a]).lights([new vm.AmbientLight(13421772,Math.PI),new vm.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new My}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new vm.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),a=t.renderObjs.controls();t.renderObjs.camera().near=.05,a.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),a.maxDistance=s*100,a.enablePan=!1,a.enableDamping=!0,a.dampingFactor=.1,a.rotateSpeed=.3,a.zoomSpeed=.3,a.zoomToCursor=!0,a.addEventListener("change",function(){a.target.setScalar(0);var h=n.pointOfView();a.rotateSpeed=h.altitude*.3,a.zoomSpeed=Math.sqrt(h.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(h)});var l=function(m){for(var v=m;v&&!v.hasOwnProperty("__globeObjType");)v=v.parent;return v},u={point:function(m){return m},arc:function(m){return m},polygon:function(m){return m.data},path:function(m){return m},heatmap:function(m){return m},hexbin:function(m){return m},hexPolygon:function(m){return m},tile:function(m){return m},particles:function(m,v){return!v||!v.hasOwnProperty("index")||m.length<=v.index?m:m[v.index]},label:function(m){return m},object:function(m){return m},custom:function(m){return m}};vm.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(h){var m=l(h);if(!m)return!1;var v=m.__globeObjType;if(v!=="globe"&&!u.hasOwnProperty(v))return!1;var x=u.hasOwnProperty(v)&&m.__data?u[v](m.__data):null;return["points","hexBinPoints"].some(function(S){return S===v})&&Array.isArray(x)?!1:t.pointerEventsFilter(m,x)}).tooltipContent(function(h,m){var v={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},x=l(h),S=x&&x.__globeObjType;return x&&S&&v.hasOwnProperty(S)&&u.hasOwnProperty(S)&&Rt(v[S])(u[S](x.__data,m))||""}).onHover(function(h,m,v){var x={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},S={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},w=l(h);if(w&&!x.hasOwnProperty(w.__globeObjType)&&(w=null),w!==t.hoverObj){var R,C=t.hoverObj?t.hoverObj.__globeObjType:null,E=t.hoverData,B=w?w.__globeObjType:null,L=(R=w)!==null&&R!==void 0&&R.__data?u[B](w.__data,v):null;C&&C!==B&&x[C]&&x[C](null,E||null),B&&x[B]&&x[B](L,C===B?E:null),t.renderObjs.renderer().domElement.classList[B&&S[B]&&Rt(t.showPointerCursor)(B,L)?"add":"remove"]("clickable"),t.hoverObj=w,t.hoverData=L}}).onClick(function(h,m,v){if(h){var x={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},S=l(h),w=S.__globeObjType;if(S&&x.hasOwnProperty(w)&&x[w]){var R=[m],C=v!=null&&v.isVector3?v:v==null?void 0:v.point;if(w==="globe"){var E=n.toGeoCoords(C),B=E.lat,L=E.lng;R.unshift({lat:B,lng:L})}else R.push(n.toGeoCoords(C));u.hasOwnProperty(w)&&R.unshift(u[w](S.__data,v)),x[w].apply(x,R)}}}).onRightClick(function(h,m,v){if(h){var x={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},S=l(h),w=S.__globeObjType;if(S&&x.hasOwnProperty(w)&&x[w]){var R=[m],C=v!=null&&v.isVector3?v:v==null?void 0:v.point;if(w==="globe"){var E=n.toGeoCoords(C),B=E.lat,L=E.lng;R.unshift({lat:B,lng:L})}else R.push(n.toGeoCoords(C));u.hasOwnProperty(w)&&R.unshift(u[w](S.__data,v)),x[w].apply(x,R)}}}),this._animationCycle()}});const xde=[{id:"default",color:"#e67e22",label:"Sunset"},{id:"purple",color:"#9b59b6",label:"Midnight"},{id:"forest",color:"#2ecc71",label:"Forest"},{id:"ocean",color:"#3498db",label:"Ocean"},{id:"cherry",color:"#e74c6f",label:"Cherry"}],GS=2;function bde({data:i}){const e=xe.useRef(null),t=xe.useRef(null),n=xe.useRef(void 0),[r,s]=xe.useState(()=>localStorage.getItem("radio-theme")||"default"),[a,l]=xe.useState([]),[u,h]=xe.useState(null),[m,v]=xe.useState([]),[x,S]=xe.useState(!1),[w,R]=xe.useState({}),[C,E]=xe.useState([]),[B,L]=xe.useState(""),[O,G]=xe.useState(""),[q,z]=xe.useState(""),[j,F]=xe.useState([]),[V,Y]=xe.useState(!1),[ee,te]=xe.useState([]),[re,ne]=xe.useState(!1),[Q,ae]=xe.useState(!1),[de,Te]=xe.useState(.5),[be,ue]=xe.useState(null),[we,We]=xe.useState(!1),[Ne,ze]=xe.useState(!1),Se=xe.useRef(void 0),Ce=xe.useRef(void 0),dt=xe.useRef(B);xe.useEffect(()=>{fetch("/api/radio/places").then(X=>X.json()).then(l).catch(console.error),fetch("/api/radio/guilds").then(X=>X.json()).then(X=>{if(E(X),X.length>0){L(X[0].id);const le=X[0].voiceChannels.find(Re=>Re.members>0)??X[0].voiceChannels[0];le&&G(le.id)}}).catch(console.error),fetch("/api/radio/favorites").then(X=>X.json()).then(te).catch(console.error)},[]),xe.useEffect(()=>{dt.current=B},[B]),xe.useEffect(()=>{i!=null&&i.guildId&&"playing"in i&&i.type!=="radio_voicestats"?R(X=>{if(i.playing)return{...X,[i.guildId]:i.playing};const le={...X};return delete le[i.guildId],le}):i!=null&&i.playing&&!(i!=null&&i.guildId)&&R(i.playing),i!=null&&i.favorites&&te(i.favorites),i!=null&&i.volumes&&B&&i.volumes[B]!=null&&Te(i.volumes[B]),(i==null?void 0:i.volume)!=null&&(i==null?void 0:i.guildId)===B&&Te(i.volume),(i==null?void 0:i.type)==="radio_voicestats"&&i.guildId===dt.current&&ue({voicePing:i.voicePing,gatewayPing:i.gatewayPing,status:i.status,channelName:i.channelName,connectedSince:i.connectedSince})},[i,B]),xe.useEffect(()=>{if(localStorage.setItem("radio-theme",r),t.current&&e.current){const le=getComputedStyle(e.current.parentElement).getPropertyValue("--accent-rgb").trim();t.current.pointColor(()=>`rgba(${le}, 0.85)`).atmosphereColor(`rgba(${le}, 0.25)`)}},[r]);const At=xe.useRef(u);At.current=u;const wt=xe.useRef(re);wt.current=re;const Ft=xe.useCallback(()=>{var le;const X=(le=t.current)==null?void 0:le.controls();X&&(X.autoRotate=!1),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{var pe;if(At.current||wt.current)return;const Re=(pe=t.current)==null?void 0:pe.controls();Re&&(Re.autoRotate=!0)},5e3)},[]);xe.useEffect(()=>{var le;const X=(le=t.current)==null?void 0:le.controls();X&&(u||re?(X.autoRotate=!1,n.current&&clearTimeout(n.current)):X.autoRotate=!0)},[u,re]);const $e=xe.useRef(void 0);$e.current=X=>{h(X),ne(!1),S(!0),v([]),Ft(),t.current&&t.current.pointOfView({lat:X.geo[1],lng:X.geo[0],altitude:.4},800),fetch(`/api/radio/place/${X.id}/channels`).then(le=>le.json()).then(le=>{v(le),S(!1)}).catch(()=>S(!1))},xe.useEffect(()=>{const X=e.current;if(!X)return;X.clientWidth>0&&X.clientHeight>0&&ze(!0);const le=new ResizeObserver(Re=>{for(const pe of Re){const{width:Me,height:nt}=pe.contentRect;Me>0&&nt>0&&ze(!0)}});return le.observe(X),()=>le.disconnect()},[]),xe.useEffect(()=>{if(!e.current||a.length===0)return;const X=e.current.clientWidth,le=e.current.clientHeight;if(t.current){t.current.pointsData(a),X>0&&le>0&&t.current.width(X).height(le);return}if(X===0||le===0)return;const pe=getComputedStyle(e.current.parentElement).getPropertyValue("--accent-rgb").trim()||"230, 126, 34",Me=new yde(e.current).backgroundColor("rgba(0,0,0,0)").atmosphereColor(`rgba(${pe}, 0.25)`).atmosphereAltitude(.12).globeImageUrl("/nasa-blue-marble.jpg").pointsData(a).pointLat($t=>$t.geo[1]).pointLng($t=>$t.geo[0]).pointColor(()=>`rgba(${pe}, 0.85)`).pointRadius($t=>Math.max(.12,Math.min(.45,.06+($t.size??1)*.005))).pointAltitude(.001).pointResolution(24).pointLabel($t=>`<div style="font-family:system-ui;font-size:13px;color:#fff;background:rgba(30,31,34,0.92);padding:6px 10px;border-radius:6px;border:1px solid rgba(${pe},0.3);pointer-events:none"><b>${$t.title}</b><br/><span style="color:#949ba4;font-size:11px">${$t.country}</span></div>`).onPointClick($t=>{var kt;return(kt=$e.current)==null?void 0:kt.call($e,$t)}).width(e.current.clientWidth).height(e.current.clientHeight);Me.renderer().setPixelRatio(window.devicePixelRatio),Me.pointOfView({lat:48,lng:10,altitude:GS});const nt=Me.controls();nt&&(nt.autoRotate=!0,nt.autoRotateSpeed=.3);let lt=GS;const Ot=()=>{const kt=Me.pointOfView().altitude;if(Math.abs(kt-lt)/lt<.05)return;lt=kt;const Vt=Math.sqrt(kt/GS);Me.pointRadius(Nn=>Math.max(.12,Math.min(.45,.06+(Nn.size??1)*.005))*Math.max(.15,Math.min(2.5,Vt)))};nt.addEventListener("change",Ot),t.current=Me;const jt=e.current,pt=()=>Ft();jt.addEventListener("mousedown",pt),jt.addEventListener("touchstart",pt),jt.addEventListener("wheel",pt);const Yt=()=>{if(e.current&&t.current){const $t=e.current.clientWidth,kt=e.current.clientHeight;$t>0&&kt>0&&t.current.width($t).height(kt)}};window.addEventListener("resize",Yt);const rn=new ResizeObserver(()=>Yt());return rn.observe(jt),()=>{nt.removeEventListener("change",Ot),jt.removeEventListener("mousedown",pt),jt.removeEventListener("touchstart",pt),jt.removeEventListener("wheel",pt),window.removeEventListener("resize",Yt),rn.disconnect()}},[a,Ft,Ne]);const rt=xe.useCallback(async(X,le,Re,pe)=>{if(!(!B||!O)){ae(!0);try{(await(await fetch("/api/radio/play",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:B,voiceChannelId:O,stationId:X,stationName:le,placeName:Re??(u==null?void 0:u.title)??"",country:pe??(u==null?void 0:u.country)??""})})).json()).ok&&(R(lt=>{var Ot,jt;return{...lt,[B]:{stationId:X,stationName:le,placeName:Re??(u==null?void 0:u.title)??"",country:pe??(u==null?void 0:u.country)??"",startedAt:new Date().toISOString(),channelName:((jt=(Ot=C.find(pt=>pt.id===B))==null?void 0:Ot.voiceChannels.find(pt=>pt.id===O))==null?void 0:jt.name)??""}}}),Ft())}catch(Me){console.error(Me)}ae(!1)}},[B,O,u,C]),ce=xe.useCallback(async()=>{B&&(await fetch("/api/radio/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:B})}),R(X=>{const le={...X};return delete le[B],le}))},[B]),Gt=xe.useCallback(X=>{if(z(X),Se.current&&clearTimeout(Se.current),!X.trim()){F([]),Y(!1);return}Se.current=setTimeout(async()=>{try{const Re=await(await fetch(`/api/radio/search?q=${encodeURIComponent(X)}`)).json();F(Re),Y(!0)}catch{F([])}},350)},[]),ht=xe.useCallback(X=>{var le,Re,pe;if(Y(!1),z(""),F([]),X.type==="channel"){const Me=(le=X.url.match(/\/listen\/[^/]+\/([^/]+)/))==null?void 0:le[1];Me&&rt(Me,X.title,X.subtitle,"")}else if(X.type==="place"){const Me=(Re=X.url.match(/\/visit\/[^/]+\/([^/]+)/))==null?void 0:Re[1],nt=a.find(lt=>lt.id===Me);nt&&((pe=$e.current)==null||pe.call($e,nt))}},[a,rt]),Pt=xe.useCallback(async(X,le)=>{try{const pe=await(await fetch("/api/radio/favorites",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({stationId:X,stationName:le,placeName:(u==null?void 0:u.title)??"",country:(u==null?void 0:u.country)??"",placeId:(u==null?void 0:u.id)??""})})).json();pe.favorites&&te(pe.favorites)}catch{}},[u]),yt=xe.useCallback(X=>{Te(X),B&&(Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>{fetch("/api/radio/volume",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:B,volume:X})}).catch(console.error)},100))},[B]),en=X=>ee.some(le=>le.stationId===X),xt=B?w[B]:null,fe=C.find(X=>X.id===B);return k.jsxs("div",{className:"radio-container","data-theme":r,children:[k.jsxs("header",{className:"radio-topbar",children:[k.jsxs("div",{className:"radio-topbar-left",children:[k.jsx("span",{className:"radio-topbar-logo",children:"🌍"}),k.jsx("span",{className:"radio-topbar-title",children:"World Radio"}),C.length>1&&k.jsx("select",{className:"radio-sel",value:B,onChange:X=>{L(X.target.value);const le=C.find(pe=>pe.id===X.target.value),Re=(le==null?void 0:le.voiceChannels.find(pe=>pe.members>0))??(le==null?void 0:le.voiceChannels[0]);G((Re==null?void 0:Re.id)??"")},children:C.map(X=>k.jsx("option",{value:X.id,children:X.name},X.id))}),k.jsxs("select",{className:"radio-sel",value:O,onChange:X=>G(X.target.value),children:[k.jsx("option",{value:"",children:"Voice Channel..."}),fe==null?void 0:fe.voiceChannels.map(X=>k.jsxs("option",{value:X.id,children:["🔊"," ",X.name,X.members>0?` (${X.members})`:""]},X.id))]})]}),xt&&k.jsxs("div",{className:"radio-topbar-np",children:[k.jsxs("div",{className:"radio-eq radio-eq-np",children:[k.jsx("span",{}),k.jsx("span",{}),k.jsx("span",{})]}),k.jsxs("div",{className:"radio-np-info",children:[k.jsx("span",{className:"radio-np-name",children:xt.stationName}),k.jsxs("span",{className:"radio-np-loc",children:[xt.placeName,xt.country?`, ${xt.country}`:""]})]})]}),k.jsxs("div",{className:"radio-topbar-right",children:[xt&&k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"radio-volume",children:[k.jsx("span",{className:"radio-volume-icon",children:de===0?"🔇":de<.4?"🔉":"🔊"}),k.jsx("input",{type:"range",className:"radio-volume-slider",min:0,max:1,step:.01,value:de,onChange:X=>yt(Number(X.target.value))}),k.jsxs("span",{className:"radio-volume-val",children:[Math.round(de*100),"%"]})]}),k.jsxs("div",{className:"radio-conn",onClick:()=>We(!0),title:"Verbindungsdetails",children:[k.jsx("span",{className:"radio-conn-dot"}),"Verbunden",(be==null?void 0:be.voicePing)!=null&&k.jsxs("span",{className:"radio-conn-ping",children:[be.voicePing,"ms"]})]}),k.jsxs("button",{className:"radio-topbar-stop",onClick:ce,children:["⏹"," Stop"]})]}),k.jsx("div",{className:"radio-theme-inline",children:xde.map(X=>k.jsx("div",{className:`radio-theme-dot ${r===X.id?"active":""}`,style:{background:X.color},title:X.label,onClick:()=>s(X.id)},X.id))})]})]}),k.jsxs("div",{className:"radio-globe-wrap",children:[k.jsx("div",{className:"radio-globe",ref:e}),k.jsxs("div",{className:"radio-search",children:[k.jsxs("div",{className:"radio-search-wrap",children:[k.jsx("span",{className:"radio-search-icon",children:"🔍"}),k.jsx("input",{className:"radio-search-input",type:"text",placeholder:"Sender oder Stadt suchen...",value:q,onChange:X=>Gt(X.target.value),onFocus:()=>{j.length&&Y(!0)}}),q&&k.jsx("button",{className:"radio-search-clear",onClick:()=>{z(""),F([]),Y(!1)},children:"✕"})]}),V&&j.length>0&&k.jsx("div",{className:"radio-search-results",children:j.slice(0,12).map(X=>k.jsxs("button",{className:"radio-search-result",onClick:()=>ht(X),children:[k.jsx("span",{className:"radio-search-result-icon",children:X.type==="channel"?"📻":X.type==="place"?"📍":"🌍"}),k.jsxs("div",{className:"radio-search-result-text",children:[k.jsx("span",{className:"radio-search-result-title",children:X.title}),k.jsx("span",{className:"radio-search-result-sub",children:X.subtitle})]})]},X.id+X.url))})]}),!u&&!re&&k.jsxs("button",{className:"radio-fab",onClick:()=>{ne(!0),h(null)},title:"Favoriten",children:["⭐",ee.length>0&&k.jsx("span",{className:"radio-fab-badge",children:ee.length})]}),re&&k.jsxs("div",{className:"radio-panel open",children:[k.jsxs("div",{className:"radio-panel-header",children:[k.jsxs("h3",{children:["⭐"," Favoriten"]}),k.jsx("button",{className:"radio-panel-close",onClick:()=>ne(!1),children:"✕"})]}),k.jsx("div",{className:"radio-panel-body",children:ee.length===0?k.jsx("div",{className:"radio-panel-empty",children:"Noch keine Favoriten"}):ee.map(X=>k.jsxs("div",{className:`radio-station ${(xt==null?void 0:xt.stationId)===X.stationId?"playing":""}`,children:[k.jsxs("div",{className:"radio-station-info",children:[k.jsx("span",{className:"radio-station-name",children:X.stationName}),k.jsxs("span",{className:"radio-station-loc",children:[X.placeName,", ",X.country]})]}),k.jsxs("div",{className:"radio-station-btns",children:[k.jsx("button",{className:"radio-btn-play",onClick:()=>rt(X.stationId,X.stationName,X.placeName,X.country),disabled:!O||Q,children:"▶"}),k.jsx("button",{className:"radio-btn-fav active",onClick:()=>Pt(X.stationId,X.stationName),children:"★"})]})]},X.stationId))})]}),u&&!re&&k.jsxs("div",{className:"radio-panel open",children:[k.jsxs("div",{className:"radio-panel-header",children:[k.jsxs("div",{children:[k.jsx("h3",{children:u.title}),k.jsx("span",{className:"radio-panel-sub",children:u.country})]}),k.jsx("button",{className:"radio-panel-close",onClick:()=>h(null),children:"✕"})]}),k.jsx("div",{className:"radio-panel-body",children:x?k.jsxs("div",{className:"radio-panel-loading",children:[k.jsx("div",{className:"radio-spinner"}),"Sender werden geladen..."]}):m.length===0?k.jsx("div",{className:"radio-panel-empty",children:"Keine Sender gefunden"}):m.map(X=>k.jsxs("div",{className:`radio-station ${(xt==null?void 0:xt.stationId)===X.id?"playing":""}`,children:[k.jsxs("div",{className:"radio-station-info",children:[k.jsx("span",{className:"radio-station-name",children:X.title}),(xt==null?void 0:xt.stationId)===X.id&&k.jsxs("span",{className:"radio-station-live",children:[k.jsxs("span",{className:"radio-eq",children:[k.jsx("span",{}),k.jsx("span",{}),k.jsx("span",{})]}),"Live"]})]}),k.jsxs("div",{className:"radio-station-btns",children:[(xt==null?void 0:xt.stationId)===X.id?k.jsx("button",{className:"radio-btn-stop",onClick:ce,children:"⏹"}):k.jsx("button",{className:"radio-btn-play",onClick:()=>rt(X.id,X.title),disabled:!O||Q,children:"▶"}),k.jsx("button",{className:`radio-btn-fav ${en(X.id)?"active":""}`,onClick:()=>Pt(X.id,X.title),children:en(X.id)?"★":"☆"})]})]},X.id))})]}),k.jsxs("div",{className:"radio-counter",children:["📻"," ",a.length.toLocaleString("de-DE")," Sender weltweit"]}),k.jsx("a",{className:"radio-attribution",href:"https://science.nasa.gov/earth/earth-observatory/blue-marble-next-generation/",target:"_blank",rel:"noreferrer",children:"Imagery © NASA Blue Marble"})]}),we&&(()=>{const X=be!=null&&be.connectedSince?Math.floor((Date.now()-new Date(be.connectedSince).getTime())/1e3):0,le=Math.floor(X/3600),Re=Math.floor(X%3600/60),pe=X%60,Me=le>0?`${le}h ${String(Re).padStart(2,"0")}m ${String(pe).padStart(2,"0")}s`:Re>0?`${Re}m ${String(pe).padStart(2,"0")}s`:`${pe}s`,nt=lt=>lt==null?"var(--text-faint)":lt<80?"var(--success)":lt<150?"#f0a830":"#e04040";return k.jsx("div",{className:"radio-modal-overlay",onClick:()=>We(!1),children:k.jsxs("div",{className:"radio-modal",onClick:lt=>lt.stopPropagation(),children:[k.jsxs("div",{className:"radio-modal-header",children:[k.jsx("span",{children:"📡"}),k.jsx("span",{children:"Verbindungsdetails"}),k.jsx("button",{className:"radio-modal-close",onClick:()=>We(!1),children:"✕"})]}),k.jsxs("div",{className:"radio-modal-body",children:[k.jsxs("div",{className:"radio-modal-stat",children:[k.jsx("span",{className:"radio-modal-label",children:"Voice Ping"}),k.jsxs("span",{className:"radio-modal-value",children:[k.jsx("span",{className:"radio-modal-dot",style:{background:nt((be==null?void 0:be.voicePing)??null)}}),(be==null?void 0:be.voicePing)!=null?`${be.voicePing} ms`:"---"]})]}),k.jsxs("div",{className:"radio-modal-stat",children:[k.jsx("span",{className:"radio-modal-label",children:"Gateway Ping"}),k.jsxs("span",{className:"radio-modal-value",children:[k.jsx("span",{className:"radio-modal-dot",style:{background:nt((be==null?void 0:be.gatewayPing)??null)}}),be&&be.gatewayPing>=0?`${be.gatewayPing} ms`:"---"]})]}),k.jsxs("div",{className:"radio-modal-stat",children:[k.jsx("span",{className:"radio-modal-label",children:"Status"}),k.jsx("span",{className:"radio-modal-value",style:{color:(be==null?void 0:be.status)==="ready"?"var(--success)":"#f0a830"},children:(be==null?void 0:be.status)==="ready"?"Verbunden":(be==null?void 0:be.status)??"Warte auf Verbindung"})]}),k.jsxs("div",{className:"radio-modal-stat",children:[k.jsx("span",{className:"radio-modal-label",children:"Kanal"}),k.jsx("span",{className:"radio-modal-value",children:(be==null?void 0:be.channelName)||"---"})]}),k.jsxs("div",{className:"radio-modal-stat",children:[k.jsx("span",{className:"radio-modal-label",children:"Verbunden seit"}),k.jsx("span",{className:"radio-modal-value",children:Me||"---"})]})]})]})})})()]})}function Sde(i,e,t=365){const n=new Date(Date.now()+t*24*60*60*1e3).toUTCString();document.cookie=`${encodeURIComponent(i)}=${encodeURIComponent(e)}; expires=${n}; path=/; SameSite=Lax`}function Tde(i){const e=`${encodeURIComponent(i)}=`,t=document.cookie.split(";");for(const n of t){const r=n.trim();if(r.startsWith(e))return decodeURIComponent(r.slice(e.length))}return null}const us="/api/soundboard";async function d7(i,e,t,n){const r=new URL(`${us}/sounds`,window.location.origin);i&&r.searchParams.set("q",i),e!==void 0&&r.searchParams.set("folder",e),r.searchParams.set("fuzzy","0");const s=await fetch(r.toString());if(!s.ok)throw new Error("Fehler beim Laden der Sounds");return s.json()}async function wde(){const i=await fetch(`${us}/analytics`);if(!i.ok)throw new Error("Fehler beim Laden der Analytics");return i.json()}async function Mde(){const i=await fetch(`${us}/categories`,{credentials:"include"});if(!i.ok)throw new Error("Fehler beim Laden der Kategorien");return i.json()}async function Ede(){const i=await fetch(`${us}/channels`);if(!i.ok)throw new Error("Fehler beim Laden der Channels");return i.json()}async function Cde(){const i=await fetch(`${us}/selected-channels`);if(!i.ok)throw new Error("Fehler beim Laden der Channel-Auswahl");const e=await i.json();return(e==null?void 0:e.selected)||{}}async function Rde(i,e){if(!(await fetch(`${us}/selected-channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i,channelId:e})})).ok)throw new Error("Channel-Auswahl setzen fehlgeschlagen")}async function Nde(i,e,t,n,r){const s=await fetch(`${us}/play`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({soundName:i,guildId:e,channelId:t,volume:n,relativePath:r})});if(!s.ok){const a=await s.json().catch(()=>({}));throw new Error((a==null?void 0:a.error)||"Play fehlgeschlagen")}}async function Dde(i,e,t,n,r){const s=await fetch(`${us}/play-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:i,guildId:e,channelId:t,volume:n,filename:r})}),a=await s.json().catch(()=>({}));if(!s.ok)throw new Error((a==null?void 0:a.error)||"Play-URL fehlgeschlagen");return a}async function Pde(i,e){const t=await fetch(`${us}/download-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:i,filename:e})}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error((n==null?void 0:n.error)||"Download fehlgeschlagen");return n}async function Lde(i,e){if(!(await fetch(`${us}/party/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i,channelId:e})})).ok)throw new Error("Partymode Start fehlgeschlagen")}async function Ude(i){if(!(await fetch(`${us}/party/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i})})).ok)throw new Error("Partymode Stop fehlgeschlagen")}async function p7(i,e){const t=await fetch(`${us}/volume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({guildId:i,volume:e})});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error((n==null?void 0:n.error)||"Volume aendern fehlgeschlagen")}}async function Bde(i){const e=new URL(`${us}/volume`,window.location.origin);e.searchParams.set("guildId",i);const t=await fetch(e.toString());if(!t.ok)throw new Error("Fehler beim Laden der Lautstaerke");const n=await t.json();return typeof(n==null?void 0:n.volume)=="number"?n.volume:1}async function Ode(){const i=await fetch(`${us}/admin/status`,{credentials:"include"});if(!i.ok)return!1;const e=await i.json();return!!(e!=null&&e.authenticated)}async function Ide(i){return(await fetch(`${us}/admin/login`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({password:i})})).ok}async function Fde(){await fetch(`${us}/admin/logout`,{method:"POST",credentials:"include"})}async function kde(i){if(!(await fetch(`${us}/admin/sounds/delete`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({paths:i})})).ok)throw new Error("Loeschen fehlgeschlagen")}async function zde(i,e){const t=await fetch(`${us}/admin/sounds/rename`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({from:i,to:e})});if(!t.ok)throw new Error("Umbenennen fehlgeschlagen");const n=await t.json();return n==null?void 0:n.to}function Gde(i,e){return new Promise((t,n)=>{const r=new FormData;r.append("files",i);const s=new XMLHttpRequest;s.open("POST",`${us}/upload`),s.upload.onprogress=a=>{a.lengthComputable&&e(Math.round(a.loaded/a.total*100))},s.onload=()=>{var a,l;if(s.status===200)try{const u=JSON.parse(s.responseText);t(((l=(a=u.files)==null?void 0:a[0])==null?void 0:l.name)??i.name)}catch{t(i.name)}else try{n(new Error(JSON.parse(s.responseText).error))}catch{n(new Error(`HTTP ${s.status}`))}},s.onerror=()=>n(new Error("Netzwerkfehler")),s.send(r)})}const qde=[{id:"default",color:"#5865f2",label:"Discord"},{id:"purple",color:"#9b59b6",label:"Midnight"},{id:"forest",color:"#2ecc71",label:"Forest"},{id:"sunset",color:"#e67e22",label:"Sunset"},{id:"ocean",color:"#3498db",label:"Ocean"}],m7=["#3b82f6","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#06b6d4","#ef4444","#a855f7","#84cc16","#d946ef","#0ea5e9","#f43f5e","#10b981"];function Vde({data:i}){const[e,t]=xe.useState([]),[n,r]=xe.useState(0),[s,a]=xe.useState([]),[l,u]=xe.useState([]),[h,m]=xe.useState({totalSounds:0,totalPlays:0,mostPlayed:[]}),[v,x]=xe.useState("all"),[S,w]=xe.useState(""),[R,C]=xe.useState(""),[E,B]=xe.useState(""),[L,O]=xe.useState(!1),[G,q]=xe.useState(null),[z,j]=xe.useState([]),[F,V]=xe.useState(""),Y=xe.useRef(""),[ee,te]=xe.useState(!1),[re,ne]=xe.useState(1),[Q,ae]=xe.useState(""),[de,Te]=xe.useState({}),[be,ue]=xe.useState(()=>localStorage.getItem("jb-theme")||"default"),[we,We]=xe.useState(()=>parseInt(localStorage.getItem("jb-card-size")||"110")),[Ne,ze]=xe.useState(!1),[Se,Ce]=xe.useState([]),dt=xe.useRef(!1),At=xe.useRef(void 0),[wt,Ft]=xe.useState(!1),[$e,rt]=xe.useState(!1),[ce,Gt]=xe.useState(""),[ht,Pt]=xe.useState([]),[yt,en]=xe.useState(!1),[xt,fe]=xe.useState(""),[X,le]=xe.useState({}),[Re,pe]=xe.useState(""),[Me,nt]=xe.useState(""),[lt,Ot]=xe.useState(!1),[jt,pt]=xe.useState([]),[Yt,rn]=xe.useState(!1),$t=xe.useRef(0),kt=xe.useRef(void 0),[Vt,Nn]=xe.useState(null),[_i,me]=xe.useState(!1),[bt,tt]=xe.useState(null),[St,qt]=xe.useState(""),[Ht,xn]=xe.useState(null),[qi,rr]=xe.useState(0);xe.useEffect(()=>{dt.current=Ne},[Ne]),xe.useEffect(()=>{Y.current=F},[F]),xe.useEffect(()=>{const ye=cn=>{var Yn;Array.from(((Yn=cn.dataTransfer)==null?void 0:Yn.items)??[]).some(xi=>xi.kind==="file")&&($t.current++,Ot(!0))},ot=()=>{$t.current=Math.max(0,$t.current-1),$t.current===0&&Ot(!1)},Nt=cn=>cn.preventDefault(),Jt=cn=>{var xi;cn.preventDefault(),$t.current=0,Ot(!1);const Yn=Array.from(((xi=cn.dataTransfer)==null?void 0:xi.files)??[]).filter(js=>/\.(mp3|wav)$/i.test(js.name));Yn.length&&Hs(Yn)};return window.addEventListener("dragenter",ye),window.addEventListener("dragleave",ot),window.addEventListener("dragover",Nt),window.addEventListener("drop",Jt),()=>{window.removeEventListener("dragenter",ye),window.removeEventListener("dragleave",ot),window.removeEventListener("dragover",Nt),window.removeEventListener("drop",Jt)}},[wt]);const pn=xe.useCallback((ye,ot="info")=>{tt({msg:ye,type:ot}),setTimeout(()=>tt(null),3e3)},[]),$i=xe.useCallback(ye=>ye.relativePath??ye.fileName,[]),Jr=["youtube.com","www.youtube.com","m.youtube.com","youtu.be","music.youtube.com","instagram.com","www.instagram.com"],Ze=xe.useCallback(ye=>{const ot=ye.trim();return!ot||/^https?:\/\//i.test(ot)?ot:"https://"+ot},[]),vt=xe.useCallback(ye=>{try{const ot=new URL(Ze(ye)),Nt=ot.hostname.toLowerCase();return!!(ot.pathname.toLowerCase().endsWith(".mp3")||Jr.some(Jt=>Nt===Jt||Nt.endsWith("."+Jt)))}catch{return!1}},[Ze]),zt=xe.useCallback(ye=>{try{const ot=new URL(Ze(ye)),Nt=ot.hostname.toLowerCase();return Nt.includes("youtube")||Nt==="youtu.be"?"youtube":Nt.includes("instagram")?"instagram":ot.pathname.toLowerCase().endsWith(".mp3")?"mp3":null}catch{return null}},[Ze]),at=F?F.split(":")[0]:"",d=F?F.split(":")[1]:"",J=xe.useMemo(()=>z.find(ye=>`${ye.guildId}:${ye.channelId}`===F),[z,F]);xe.useEffect(()=>{const ye=()=>{const Nt=new Date,Jt=String(Nt.getHours()).padStart(2,"0"),cn=String(Nt.getMinutes()).padStart(2,"0"),Yn=String(Nt.getSeconds()).padStart(2,"0");qt(`${Jt}:${cn}:${Yn}`)};ye();const ot=setInterval(ye,1e3);return()=>clearInterval(ot)},[]),xe.useEffect(()=>{(async()=>{try{const[ye,ot]=await Promise.all([Ede(),Cde()]);if(j(ye),ye.length){const Nt=ye[0].guildId,Jt=ot[Nt],cn=Jt&&ye.find(Yn=>Yn.guildId===Nt&&Yn.channelId===Jt);V(cn?`${Nt}:${Jt}`:`${ye[0].guildId}:${ye[0].channelId}`)}}catch(ye){pn((ye==null?void 0:ye.message)||"Channel-Fehler","error")}try{Ft(await Ode())}catch{}try{const ye=await Mde();u(ye.categories||[])}catch{}})()},[]),xe.useEffect(()=>{localStorage.setItem("jb-theme",be)},[be]);const $n=xe.useRef(null);xe.useEffect(()=>{const ye=$n.current;if(!ye)return;ye.style.setProperty("--card-size",we+"px");const ot=we/110;ye.style.setProperty("--card-emoji",Math.round(28*ot)+"px"),ye.style.setProperty("--card-font",Math.max(9,Math.round(11*ot))+"px"),localStorage.setItem("jb-card-size",String(we))},[we]),xe.useEffect(()=>{var ye,ot,Nt,Jt,cn,Yn,xi,js;if(i){if(i.soundboard){const pi=i.soundboard;Array.isArray(pi.party)&&Ce(pi.party);try{const Pr=pi.selected||{},Ei=(ye=Y.current)==null?void 0:ye.split(":")[0];Ei&&Pr[Ei]&&V(`${Ei}:${Pr[Ei]}`)}catch{}try{const Pr=pi.volumes||{},Ei=(ot=Y.current)==null?void 0:ot.split(":")[0];Ei&&typeof Pr[Ei]=="number"&&ne(Pr[Ei])}catch{}try{const Pr=pi.nowplaying||{},Ei=(Nt=Y.current)==null?void 0:Nt.split(":")[0];Ei&&typeof Pr[Ei]=="string"&&ae(Pr[Ei])}catch{}try{const Pr=pi.voicestats||{},Ei=(Jt=Y.current)==null?void 0:Jt.split(":")[0];Ei&&Pr[Ei]&&Nn(Pr[Ei])}catch{}}if(i.type==="soundboard_party")Ce(pi=>{const Pr=new Set(pi);return i.active?Pr.add(i.guildId):Pr.delete(i.guildId),Array.from(Pr)});else if(i.type==="soundboard_channel"){const pi=(cn=Y.current)==null?void 0:cn.split(":")[0];i.guildId===pi&&V(`${i.guildId}:${i.channelId}`)}else if(i.type==="soundboard_volume"){const pi=(Yn=Y.current)==null?void 0:Yn.split(":")[0];i.guildId===pi&&typeof i.volume=="number"&&ne(i.volume)}else if(i.type==="soundboard_nowplaying"){const pi=(xi=Y.current)==null?void 0:xi.split(":")[0];i.guildId===pi&&ae(i.name||"")}else if(i.type==="soundboard_voicestats"){const pi=(js=Y.current)==null?void 0:js.split(":")[0];i.guildId===pi&&Nn({voicePing:i.voicePing,gatewayPing:i.gatewayPing,status:i.status,channelName:i.channelName,connectedSince:i.connectedSince})}}},[i]),xe.useEffect(()=>{ze(at?Se.includes(at):!1)},[F,Se,at]),xe.useEffect(()=>{(async()=>{try{let ye="__all__";v==="recent"?ye="__recent__":S&&(ye=S);const ot=await d7(R,ye,void 0,!1);t(ot.items),r(ot.total),a(ot.folders)}catch(ye){pn((ye==null?void 0:ye.message)||"Sounds-Fehler","error")}})()},[v,S,R,qi,pn]),xe.useEffect(()=>{Gn()},[qi]),xe.useEffect(()=>{const ye=Tde("favs");if(ye)try{Te(JSON.parse(ye))}catch{}},[]),xe.useEffect(()=>{try{Sde("favs",JSON.stringify(de))}catch{}},[de]),xe.useEffect(()=>{F&&(async()=>{try{const ye=await Bde(at);ne(ye)}catch{}})()},[F]),xe.useEffect(()=>{const ye=()=>{te(!1),xn(null)};return document.addEventListener("click",ye),()=>document.removeEventListener("click",ye)},[]),xe.useEffect(()=>{$e&&wt&&oe()},[$e,wt]);async function Gn(){try{const ye=await wde();m(ye)}catch{}}async function Xn(ye){if(!F)return pn("Bitte einen Voice-Channel auswaehlen","error");try{await Nde(ye.name,at,d,re,ye.relativePath),ae(ye.name),Gn()}catch(ot){pn((ot==null?void 0:ot.message)||"Play fehlgeschlagen","error")}}function un(){var Jt;const ye=Ze(E);if(!ye)return pn("Bitte einen Link eingeben","error");if(!vt(ye))return pn("Nur YouTube, Instagram oder direkte MP3-Links","error");const ot=zt(ye);let Nt="";if(ot==="mp3")try{Nt=((Jt=new URL(ye).pathname.split("/").pop())==null?void 0:Jt.replace(/\.mp3$/i,""))??""}catch{}q({url:ye,type:ot,filename:Nt,phase:"input"})}async function qn(){if(G){q(ye=>ye?{...ye,phase:"downloading"}:null);try{let ye;const ot=G.filename.trim()||void 0;F&&at&&d?ye=(await Dde(G.url,at,d,re,ot)).saved:ye=(await Pde(G.url,ot)).saved,q(Nt=>Nt?{...Nt,phase:"done",savedName:ye}:null),B(""),rr(Nt=>Nt+1),Gn(),setTimeout(()=>q(null),2500)}catch(ye){q(ot=>ot?{...ot,phase:"error",error:(ye==null?void 0:ye.message)||"Fehler"}:null)}}}async function Hs(ye){if(!wt){pn("Admin-Login erforderlich zum Hochladen","error");return}kt.current&&clearTimeout(kt.current);const ot=ye.map(Jt=>({id:Math.random().toString(36).slice(2),file:Jt,status:"waiting",progress:0}));pt(ot),rn(!0);const Nt=[...ot];for(let Jt=0;Jt<Nt.length;Jt++){Nt[Jt]={...Nt[Jt],status:"uploading"},pt([...Nt]);try{const cn=await Gde(Nt[Jt].file,Yn=>{Nt[Jt]={...Nt[Jt],progress:Yn},pt([...Nt])});Nt[Jt]={...Nt[Jt],status:"done",progress:100,savedName:cn}}catch(cn){Nt[Jt]={...Nt[Jt],status:"error",error:(cn==null?void 0:cn.message)??"Fehler"}}pt([...Nt])}rr(Jt=>Jt+1),Gn(),kt.current=setTimeout(()=>{rn(!1),pt([])},3500)}async function li(){if(F){ae("");try{await fetch(`${us}/stop?guildId=${encodeURIComponent(at)}`,{method:"POST"})}catch{}}}async function Fn(){if(!Z.length||!F)return;const ye=Z[Math.floor(Math.random()*Z.length)];Xn(ye)}async function cs(){if(Ne){await li();try{await Ude(at)}catch{}}else{if(!F)return pn("Bitte einen Channel auswaehlen","error");try{await Lde(at,d)}catch{}}}async function Ma(ye){const ot=`${ye.guildId}:${ye.channelId}`;V(ot),te(!1);try{await Rde(ye.guildId,ye.channelId)}catch{}}function Ul(ye){Te(ot=>({...ot,[ye]:!ot[ye]}))}async function oe(){en(!0);try{const ye=await d7("","__all__",void 0,!1);Pt(ye.items||[])}catch(ye){pn((ye==null?void 0:ye.message)||"Admin-Sounds konnten nicht geladen werden","error")}finally{en(!1)}}function Fe(ye){le(ot=>({...ot,[ye]:!ot[ye]}))}function Qe(ye){pe($i(ye)),nt(ye.name)}function Xe(){pe(""),nt("")}async function ke(){if(!Re)return;const ye=Me.trim().replace(/\.(mp3|wav)$/i,"");if(!ye){pn("Bitte einen gueltigen Namen eingeben","error");return}try{await zde(Re,ye),pn("Sound umbenannt"),Xe(),rr(ot=>ot+1),$e&&await oe()}catch(ot){pn((ot==null?void 0:ot.message)||"Umbenennen fehlgeschlagen","error")}}async function It(ye){if(ye.length!==0)try{await kde(ye),pn(ye.length===1?"Sound geloescht":`${ye.length} Sounds geloescht`),le({}),Xe(),rr(ot=>ot+1),$e&&await oe()}catch(ot){pn((ot==null?void 0:ot.message)||"Loeschen fehlgeschlagen","error")}}async function Xt(){try{await Ide(ce)?(Ft(!0),Gt(""),pn("Admin eingeloggt")):pn("Falsches Passwort","error")}catch{pn("Login fehlgeschlagen","error")}}async function mt(){try{await Fde(),Ft(!1),le({}),Xe(),pn("Ausgeloggt")}catch{}}const Z=xe.useMemo(()=>v==="favorites"?e.filter(ye=>de[ye.relativePath??ye.fileName]):e,[e,v,de]),Bt=xe.useMemo(()=>Object.values(de).filter(Boolean).length,[de]),bn=xe.useMemo(()=>s.filter(ye=>!["__all__","__recent__","__top3__"].includes(ye.key)),[s]),fn=xe.useMemo(()=>{const ye={};return bn.forEach((ot,Nt)=>{ye[ot.key]=m7[Nt%m7.length]}),ye},[bn]),ui=xe.useMemo(()=>{const ye=new Set,ot=new Set;return Z.forEach((Nt,Jt)=>{const cn=Nt.name.charAt(0).toUpperCase();ye.has(cn)||(ye.add(cn),ot.add(Jt))}),ot},[Z]),ci=xe.useMemo(()=>{const ye={};return z.forEach(ot=>{ye[ot.guildName]||(ye[ot.guildName]=[]),ye[ot.guildName].push(ot)}),ye},[z]),yi=xe.useMemo(()=>{const ye=xt.trim().toLowerCase();return ye?ht.filter(ot=>{const Nt=$i(ot).toLowerCase();return ot.name.toLowerCase().includes(ye)||(ot.folder||"").toLowerCase().includes(ye)||Nt.includes(ye)}):ht},[xt,ht,$i]),K=xe.useMemo(()=>Object.keys(X).filter(ye=>X[ye]),[X]),Un=xe.useMemo(()=>yi.filter(ye=>!!X[$i(ye)]).length,[yi,X,$i]),mn=yi.length>0&&Un===yi.length,yr=h.mostPlayed.slice(0,10),hi=h.totalSounds||n,bs=St.slice(0,5),fa=St.slice(5);return k.jsxs("div",{className:"sb-app","data-theme":be,ref:$n,children:[Ne&&k.jsx("div",{className:"party-overlay active"}),k.jsxs("header",{className:"topbar",children:[k.jsxs("div",{className:"topbar-left",children:[k.jsx("div",{className:"sb-app-logo",children:k.jsx("span",{className:"material-icons",style:{fontSize:16,color:"white"},children:"music_note"})}),k.jsx("span",{className:"sb-app-title",children:"Soundboard"}),k.jsxs("div",{className:"channel-dropdown",onClick:ye=>ye.stopPropagation(),children:[k.jsxs("button",{className:`channel-btn ${ee?"open":""}`,onClick:()=>te(!ee),children:[k.jsx("span",{className:"material-icons cb-icon",children:"headset"}),F&&k.jsx("span",{className:"channel-status"}),k.jsx("span",{className:"channel-label",children:J?`${J.channelName}${J.members?` (${J.members})`:""}`:"Channel..."}),k.jsx("span",{className:"material-icons chevron",children:"expand_more"})]}),ee&&k.jsxs("div",{className:"channel-menu visible",children:[Object.entries(ci).map(([ye,ot])=>k.jsxs(UF.Fragment,{children:[k.jsx("div",{className:"channel-menu-header",children:ye}),ot.map(Nt=>k.jsxs("div",{className:`channel-option ${`${Nt.guildId}:${Nt.channelId}`===F?"active":""}`,onClick:()=>Ma(Nt),children:[k.jsx("span",{className:"material-icons co-icon",children:"volume_up"}),Nt.channelName,Nt.members?` (${Nt.members})`:""]},`${Nt.guildId}:${Nt.channelId}`))]},ye)),z.length===0&&k.jsx("div",{className:"channel-option",style:{color:"var(--text-faint)",cursor:"default"},children:"Keine Channels verfuegbar"})]})]})]}),k.jsx("div",{className:"clock-wrap",children:k.jsxs("div",{className:"clock",children:[bs,k.jsx("span",{className:"clock-seconds",children:fa})]})}),k.jsxs("div",{className:"topbar-right",children:[Q&&k.jsxs("div",{className:"now-playing",children:[k.jsxs("div",{className:"np-waves active",children:[k.jsx("div",{className:"np-wave-bar"}),k.jsx("div",{className:"np-wave-bar"}),k.jsx("div",{className:"np-wave-bar"}),k.jsx("div",{className:"np-wave-bar"})]}),k.jsx("span",{className:"np-label",children:"Last Played:"})," ",k.jsx("span",{className:"np-name",children:Q})]}),F&&k.jsxs("div",{className:"connection",onClick:()=>me(!0),style:{cursor:"pointer"},title:"Verbindungsdetails",children:[k.jsx("span",{className:"conn-dot"}),"Verbunden",(Vt==null?void 0:Vt.voicePing)!=null&&k.jsxs("span",{className:"conn-ping",children:[Vt.voicePing,"ms"]})]}),k.jsx("button",{className:`admin-btn-icon ${wt?"active":""}`,onClick:()=>rt(!0),title:"Admin",children:k.jsx("span",{className:"material-icons",children:"settings"})})]})]}),k.jsxs("div",{className:"toolbar",children:[k.jsxs("div",{className:"cat-tabs",children:[k.jsxs("button",{className:`cat-tab ${v==="all"?"active":""}`,onClick:()=>{x("all"),w("")},children:["Alle",k.jsx("span",{className:"tab-count",children:n})]}),k.jsx("button",{className:`cat-tab ${v==="recent"?"active":""}`,onClick:()=>{x("recent"),w("")},children:"Neu hinzugefuegt"}),k.jsxs("button",{className:`cat-tab ${v==="favorites"?"active":""}`,onClick:()=>{x("favorites"),w("")},children:["Favoriten",Bt>0&&k.jsx("span",{className:"tab-count",children:Bt})]})]}),k.jsxs("div",{className:"search-wrap",children:[k.jsx("span",{className:"material-icons search-icon",children:"search"}),k.jsx("input",{className:"search-input",type:"text",placeholder:"Suchen...",value:R,onChange:ye=>C(ye.target.value)}),R&&k.jsx("button",{className:"search-clear",onClick:()=>C(""),children:k.jsx("span",{className:"material-icons",style:{fontSize:14},children:"close"})})]}),k.jsxs("div",{className:"url-import-wrap",children:[k.jsx("span",{className:"material-icons url-import-icon",children:zt(E)==="youtube"?"smart_display":zt(E)==="instagram"?"photo_camera":"link"}),k.jsx("input",{className:"url-import-input",type:"text",placeholder:"YouTube / Instagram / MP3-Link...",value:E,onChange:ye=>B(ye.target.value),onKeyDown:ye=>{ye.key==="Enter"&&un()}}),E&&k.jsx("span",{className:`url-import-tag ${vt(E)?"valid":"invalid"}`,children:zt(E)==="youtube"?"YT":zt(E)==="instagram"?"IG":zt(E)==="mp3"?"MP3":"?"}),k.jsx("button",{className:"url-import-btn",onClick:()=>{un()},disabled:L||!!E&&!vt(E),title:"Sound herunterladen",children:L?"Laedt...":"Download"})]}),k.jsx("div",{className:"toolbar-spacer"}),k.jsxs("div",{className:"volume-control",children:[k.jsx("span",{className:"material-icons vol-icon",onClick:()=>{const ye=re>0?0:.5;ne(ye),at&&p7(at,ye).catch(()=>{})},children:re===0?"volume_off":re<.5?"volume_down":"volume_up"}),k.jsx("input",{type:"range",className:"vol-slider",min:0,max:1,step:.01,value:re,onChange:ye=>{const ot=parseFloat(ye.target.value);ne(ot),at&&(At.current&&clearTimeout(At.current),At.current=setTimeout(()=>{p7(at,ot).catch(()=>{})},120))},style:{"--vol":`${Math.round(re*100)}%`}}),k.jsxs("span",{className:"vol-pct",children:[Math.round(re*100),"%"]})]}),k.jsxs("button",{className:"tb-btn random",onClick:Fn,title:"Zufaelliger Sound",children:[k.jsx("span",{className:"material-icons tb-icon",children:"shuffle"}),"Random"]}),k.jsxs("button",{className:`tb-btn party ${Ne?"active":""}`,onClick:cs,title:"Party Mode",children:[k.jsx("span",{className:"material-icons tb-icon",children:Ne?"celebration":"auto_awesome"}),Ne?"Party!":"Party"]}),k.jsxs("button",{className:"tb-btn stop",onClick:li,title:"Alle stoppen",children:[k.jsx("span",{className:"material-icons tb-icon",children:"stop"}),"Stop"]}),k.jsxs("div",{className:"size-control",title:"Button-Groesse",children:[k.jsx("span",{className:"material-icons sc-icon",children:"grid_view"}),k.jsx("input",{type:"range",className:"size-slider",min:80,max:160,value:we,onChange:ye=>We(parseInt(ye.target.value))})]}),k.jsx("div",{className:"theme-selector",children:qde.map(ye=>k.jsx("div",{className:`theme-dot ${be===ye.id?"active":""}`,style:{background:ye.color},title:ye.label,onClick:()=>ue(ye.id)},ye.id))})]}),k.jsxs("div",{className:"analytics-strip",children:[k.jsxs("div",{className:"analytics-card",children:[k.jsx("span",{className:"material-icons analytics-icon",children:"library_music"}),k.jsxs("div",{className:"analytics-copy",children:[k.jsx("span",{className:"analytics-label",children:"Sounds gesamt"}),k.jsx("strong",{className:"analytics-value",children:hi})]})]}),k.jsxs("div",{className:"analytics-card analytics-wide",children:[k.jsx("span",{className:"material-icons analytics-icon",children:"leaderboard"}),k.jsxs("div",{className:"analytics-copy",children:[k.jsx("span",{className:"analytics-label",children:"Most Played"}),k.jsx("div",{className:"analytics-top-list",children:yr.length===0?k.jsx("span",{className:"analytics-muted",children:"Noch keine Plays"}):yr.map((ye,ot)=>k.jsxs("span",{className:"analytics-chip",children:[ot+1,". ",ye.name," (",ye.count,")"]},ye.relativePath))})]})]})]}),v==="all"&&bn.length>0&&k.jsx("div",{className:"category-strip",children:bn.map(ye=>{const ot=fn[ye.key]||"#888",Nt=S===ye.key;return k.jsxs("button",{className:`cat-chip ${Nt?"active":""}`,onClick:()=>w(Nt?"":ye.key),style:Nt?{borderColor:ot,color:ot}:void 0,children:[k.jsx("span",{className:"cat-dot",style:{background:ot}}),ye.name.replace(/\s*\(\d+\)\s*$/,""),k.jsx("span",{className:"cat-count",children:ye.count})]},ye.key)})}),k.jsx("main",{className:"main",children:Z.length===0?k.jsxs("div",{className:"empty-state visible",children:[k.jsx("div",{className:"empty-emoji",children:v==="favorites"?"⭐":"🔇"}),k.jsx("div",{className:"empty-title",children:v==="favorites"?"Noch keine Favoriten":R?`Kein Sound fuer "${R}" gefunden`:"Keine Sounds vorhanden"}),k.jsx("div",{className:"empty-desc",children:v==="favorites"?"Klick den Stern auf einem Sound!":"Hier gibt's noch nichts zu hoeren."})]}):k.jsx("div",{className:"sound-grid",children:Z.map((ye,ot)=>{var Pr;const Nt=ye.relativePath??ye.fileName,Jt=!!de[Nt],cn=Q===ye.name,Yn=ye.isRecent||((Pr=ye.badges)==null?void 0:Pr.includes("new")),xi=ye.name.charAt(0).toUpperCase(),js=ui.has(ot),pi=ye.folder&&fn[ye.folder]||"var(--accent)";return k.jsxs("div",{className:`sound-card ${cn?"playing":""} ${js?"has-initial":""}`,style:{animationDelay:`${Math.min(ot*20,400)}ms`},onClick:Ei=>{const Zh=Ei.currentTarget,Bl=Zh.getBoundingClientRect(),nl=document.createElement("div");nl.className="ripple";const Bi=Math.max(Bl.width,Bl.height);nl.style.width=nl.style.height=Bi+"px",nl.style.left=Ei.clientX-Bl.left-Bi/2+"px",nl.style.top=Ei.clientY-Bl.top-Bi/2+"px",Zh.appendChild(nl),setTimeout(()=>nl.remove(),500),Xn(ye)},onContextMenu:Ei=>{Ei.preventDefault(),Ei.stopPropagation(),xn({x:Math.min(Ei.clientX,window.innerWidth-170),y:Math.min(Ei.clientY,window.innerHeight-140),sound:ye})},title:`${ye.name}${ye.folder?` (${ye.folder})`:""}`,children:[Yn&&k.jsx("span",{className:"new-badge",children:"NEU"}),k.jsx("span",{className:`fav-star ${Jt?"active":""}`,onClick:Ei=>{Ei.stopPropagation(),Ul(Nt)},children:k.jsx("span",{className:"material-icons fav-icon",children:Jt?"star":"star_border"})}),js&&k.jsx("span",{className:"sound-emoji",style:{color:pi},children:xi}),k.jsx("span",{className:"sound-name",children:ye.name}),ye.folder&&k.jsx("span",{className:"sound-duration",children:ye.folder}),k.jsxs("div",{className:"playing-indicator",children:[k.jsx("div",{className:"wave-bar"}),k.jsx("div",{className:"wave-bar"}),k.jsx("div",{className:"wave-bar"}),k.jsx("div",{className:"wave-bar"})]})]},Nt)})})}),Ht&&k.jsxs("div",{className:"ctx-menu visible",style:{left:Ht.x,top:Ht.y},onClick:ye=>ye.stopPropagation(),children:[k.jsxs("div",{className:"ctx-item",onClick:()=>{Xn(Ht.sound),xn(null)},children:[k.jsx("span",{className:"material-icons ctx-icon",children:"play_arrow"}),"Abspielen"]}),k.jsxs("div",{className:"ctx-item",onClick:()=>{Ul(Ht.sound.relativePath??Ht.sound.fileName),xn(null)},children:[k.jsx("span",{className:"material-icons ctx-icon",children:de[Ht.sound.relativePath??Ht.sound.fileName]?"star":"star_border"}),"Favorit"]}),wt&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"ctx-sep"}),k.jsxs("div",{className:"ctx-item danger",onClick:async()=>{const ye=Ht.sound.relativePath??Ht.sound.fileName;await It([ye]),xn(null)},children:[k.jsx("span",{className:"material-icons ctx-icon",children:"delete"}),"Loeschen"]})]})]}),_i&&(()=>{const ye=Vt!=null&&Vt.connectedSince?Math.floor((Date.now()-new Date(Vt.connectedSince).getTime())/1e3):0,ot=Math.floor(ye/3600),Nt=Math.floor(ye%3600/60),Jt=ye%60,cn=ot>0?`${ot}h ${String(Nt).padStart(2,"0")}m ${String(Jt).padStart(2,"0")}s`:Nt>0?`${Nt}m ${String(Jt).padStart(2,"0")}s`:`${Jt}s`,Yn=xi=>xi==null?"var(--muted)":xi<80?"var(--green)":xi<150?"#f0a830":"#e04040";return k.jsx("div",{className:"conn-modal-overlay",onClick:()=>me(!1),children:k.jsxs("div",{className:"conn-modal",onClick:xi=>xi.stopPropagation(),children:[k.jsxs("div",{className:"conn-modal-header",children:[k.jsx("span",{className:"material-icons",style:{fontSize:20,color:"var(--green)"},children:"cell_tower"}),k.jsx("span",{children:"Verbindungsdetails"}),k.jsx("button",{className:"conn-modal-close",onClick:()=>me(!1),children:k.jsx("span",{className:"material-icons",children:"close"})})]}),k.jsxs("div",{className:"conn-modal-body",children:[k.jsxs("div",{className:"conn-stat",children:[k.jsx("span",{className:"conn-stat-label",children:"Voice Ping"}),k.jsxs("span",{className:"conn-stat-value",children:[k.jsx("span",{className:"conn-ping-dot",style:{background:Yn((Vt==null?void 0:Vt.voicePing)??null)}}),(Vt==null?void 0:Vt.voicePing)!=null?`${Vt.voicePing} ms`:"---"]})]}),k.jsxs("div",{className:"conn-stat",children:[k.jsx("span",{className:"conn-stat-label",children:"Gateway Ping"}),k.jsxs("span",{className:"conn-stat-value",children:[k.jsx("span",{className:"conn-ping-dot",style:{background:Yn((Vt==null?void 0:Vt.gatewayPing)??null)}}),Vt&&Vt.gatewayPing>=0?`${Vt.gatewayPing} ms`:"---"]})]}),k.jsxs("div",{className:"conn-stat",children:[k.jsx("span",{className:"conn-stat-label",children:"Status"}),k.jsx("span",{className:"conn-stat-value",style:{color:(Vt==null?void 0:Vt.status)==="ready"?"var(--green)":"#f0a830"},children:(Vt==null?void 0:Vt.status)==="ready"?"Verbunden":(Vt==null?void 0:Vt.status)??"Warte auf Verbindung"})]}),k.jsxs("div",{className:"conn-stat",children:[k.jsx("span",{className:"conn-stat-label",children:"Kanal"}),k.jsx("span",{className:"conn-stat-value",children:(Vt==null?void 0:Vt.channelName)||"---"})]}),k.jsxs("div",{className:"conn-stat",children:[k.jsx("span",{className:"conn-stat-label",children:"Verbunden seit"}),k.jsx("span",{className:"conn-stat-value",children:cn||"---"})]})]})]})})})(),bt&&k.jsxs("div",{className:`toast ${bt.type}`,children:[k.jsx("span",{className:"material-icons toast-icon",children:bt.type==="error"?"error_outline":"check_circle"}),bt.msg]}),$e&&k.jsx("div",{className:"admin-overlay",onClick:ye=>{ye.target===ye.currentTarget&&rt(!1)},children:k.jsxs("div",{className:"admin-panel",children:[k.jsxs("h3",{children:["Admin",k.jsx("button",{className:"admin-close",onClick:()=>rt(!1),children:k.jsx("span",{className:"material-icons",style:{fontSize:18},children:"close"})})]}),wt?k.jsxs("div",{className:"admin-shell",children:[k.jsxs("div",{className:"admin-header-row",children:[k.jsx("p",{className:"admin-status",children:"Eingeloggt als Admin"}),k.jsxs("div",{className:"admin-actions-inline",children:[k.jsx("button",{className:"admin-btn-action outline",onClick:()=>{oe()},disabled:yt,children:"Aktualisieren"}),k.jsx("button",{className:"admin-btn-action outline",onClick:mt,children:"Logout"})]})]}),k.jsxs("div",{className:"admin-field admin-search-field",children:[k.jsx("label",{children:"Sounds verwalten"}),k.jsx("input",{type:"text",value:xt,onChange:ye=>fe(ye.target.value),placeholder:"Nach Name, Ordner oder Pfad filtern..."})]}),k.jsxs("div",{className:"admin-bulk-row",children:[k.jsxs("label",{className:"admin-select-all",children:[k.jsx("input",{type:"checkbox",checked:mn,onChange:ye=>{const ot=ye.target.checked,Nt={...X};yi.forEach(Jt=>{Nt[$i(Jt)]=ot}),le(Nt)}}),k.jsxs("span",{children:["Alle sichtbaren auswaehlen (",Un,"/",yi.length,")"]})]}),k.jsx("button",{className:"admin-btn-action danger",disabled:K.length===0,onClick:async()=>{window.confirm(`Wirklich ${K.length} Sound(s) loeschen?`)&&await It(K)},children:"Ausgewaehlte loeschen"})]}),k.jsx("div",{className:"admin-list-wrap",children:yt?k.jsx("div",{className:"admin-empty",children:"Lade Sounds..."}):yi.length===0?k.jsx("div",{className:"admin-empty",children:"Keine Sounds gefunden."}):k.jsx("div",{className:"admin-list",children:yi.map(ye=>{const ot=$i(ye),Nt=Re===ot;return k.jsxs("div",{className:"admin-item",children:[k.jsx("label",{className:"admin-item-check",children:k.jsx("input",{type:"checkbox",checked:!!X[ot],onChange:()=>Fe(ot)})}),k.jsxs("div",{className:"admin-item-main",children:[k.jsx("div",{className:"admin-item-name",children:ye.name}),k.jsxs("div",{className:"admin-item-meta",children:[ye.folder?`Ordner: ${ye.folder}`:"Root"," · ",ot]}),Nt&&k.jsxs("div",{className:"admin-rename-row",children:[k.jsx("input",{value:Me,onChange:Jt=>nt(Jt.target.value),onKeyDown:Jt=>{Jt.key==="Enter"&&ke(),Jt.key==="Escape"&&Xe()},placeholder:"Neuer Name..."}),k.jsx("button",{className:"admin-btn-action primary",onClick:()=>{ke()},children:"Speichern"}),k.jsx("button",{className:"admin-btn-action outline",onClick:Xe,children:"Abbrechen"})]})]}),!Nt&&k.jsxs("div",{className:"admin-item-actions",children:[k.jsx("button",{className:"admin-btn-action outline",onClick:()=>Qe(ye),children:"Umbenennen"}),k.jsx("button",{className:"admin-btn-action danger ghost",onClick:async()=>{window.confirm(`Sound "${ye.name}" loeschen?`)&&await It([ot])},children:"Loeschen"})]})]},ot)})})})]}):k.jsxs("div",{children:[k.jsxs("div",{className:"admin-field",children:[k.jsx("label",{children:"Passwort"}),k.jsx("input",{type:"password",value:ce,onChange:ye=>Gt(ye.target.value),onKeyDown:ye=>ye.key==="Enter"&&Xt(),placeholder:"Admin-Passwort..."})]}),k.jsx("button",{className:"admin-btn-action primary",onClick:Xt,children:"Login"})]})]})}),lt&&k.jsx("div",{className:"drop-overlay",children:k.jsxs("div",{className:"drop-zone",children:[k.jsx("span",{className:"material-icons drop-icon",children:"cloud_upload"}),k.jsx("div",{className:"drop-title",children:"MP3 & WAV hier ablegen"}),k.jsx("div",{className:"drop-sub",children:"Mehrere Dateien gleichzeitig moeglich"})]})}),Yt&&jt.length>0&&k.jsxs("div",{className:"upload-queue",children:[k.jsxs("div",{className:"uq-header",children:[k.jsx("span",{className:"material-icons",style:{fontSize:16},children:"upload"}),k.jsx("span",{children:jt.every(ye=>ye.status==="done"||ye.status==="error")?`${jt.filter(ye=>ye.status==="done").length} von ${jt.length} hochgeladen`:`Lade hoch… (${jt.filter(ye=>ye.status==="done").length}/${jt.length})`}),k.jsx("button",{className:"uq-close",onClick:()=>{rn(!1),pt([])},children:k.jsx("span",{className:"material-icons",style:{fontSize:14},children:"close"})})]}),k.jsx("div",{className:"uq-list",children:jt.map(ye=>k.jsxs("div",{className:`uq-item uq-${ye.status}`,children:[k.jsx("span",{className:"material-icons uq-file-icon",children:"audio_file"}),k.jsxs("div",{className:"uq-info",children:[k.jsx("div",{className:"uq-name",title:ye.savedName??ye.file.name,children:ye.savedName??ye.file.name}),k.jsxs("div",{className:"uq-size",children:[(ye.file.size/1024).toFixed(0)," KB"]})]}),(ye.status==="waiting"||ye.status==="uploading")&&k.jsx("div",{className:"uq-progress-wrap",children:k.jsx("div",{className:"uq-progress-bar",style:{width:`${ye.progress}%`}})}),k.jsx("span",{className:`material-icons uq-status-icon uq-status-${ye.status}`,children:ye.status==="done"?"check_circle":ye.status==="error"?"error":ye.status==="uploading"?"sync":"schedule"}),ye.status==="error"&&k.jsx("div",{className:"uq-error",children:ye.error})]},ye.id))})]}),G&&k.jsx("div",{className:"dl-modal-overlay",onClick:()=>G.phase!=="downloading"&&q(null),children:k.jsxs("div",{className:"dl-modal",onClick:ye=>ye.stopPropagation(),children:[k.jsxs("div",{className:"dl-modal-header",children:[k.jsx("span",{className:"material-icons",style:{fontSize:20},children:G.type==="youtube"?"smart_display":G.type==="instagram"?"photo_camera":"audio_file"}),k.jsx("span",{children:G.phase==="input"?"Sound herunterladen":G.phase==="downloading"?"Wird heruntergeladen...":G.phase==="done"?"Fertig!":"Fehler"}),G.phase!=="downloading"&&k.jsx("button",{className:"dl-modal-close",onClick:()=>q(null),children:k.jsx("span",{className:"material-icons",style:{fontSize:16},children:"close"})})]}),k.jsxs("div",{className:"dl-modal-body",children:[k.jsxs("div",{className:"dl-modal-url",children:[k.jsx("span",{className:`dl-modal-tag ${G.type??""}`,children:G.type==="youtube"?"YouTube":G.type==="instagram"?"Instagram":"MP3"}),k.jsx("span",{className:"dl-modal-url-text",title:G.url,children:G.url.length>60?G.url.slice(0,57)+"...":G.url})]}),G.phase==="input"&&k.jsxs("div",{className:"dl-modal-field",children:[k.jsx("label",{className:"dl-modal-label",children:"Dateiname"}),k.jsxs("div",{className:"dl-modal-input-wrap",children:[k.jsx("input",{className:"dl-modal-input",type:"text",placeholder:G.type==="mp3"?"Dateiname...":"Wird automatisch erkannt...",value:G.filename,onChange:ye=>q(ot=>ot?{...ot,filename:ye.target.value}:null),onKeyDown:ye=>{ye.key==="Enter"&&qn()},autoFocus:!0}),k.jsx("span",{className:"dl-modal-ext",children:".mp3"})]}),k.jsx("span",{className:"dl-modal-hint",children:"Leer lassen = automatischer Name"})]}),G.phase==="downloading"&&k.jsxs("div",{className:"dl-modal-progress",children:[k.jsx("div",{className:"dl-modal-spinner"}),k.jsx("span",{children:G.type==="youtube"||G.type==="instagram"?"Audio wird extrahiert...":"MP3 wird heruntergeladen..."})]}),G.phase==="done"&&k.jsxs("div",{className:"dl-modal-success",children:[k.jsx("span",{className:"material-icons dl-modal-check",children:"check_circle"}),k.jsxs("span",{children:["Gespeichert als ",k.jsx("b",{children:G.savedName})]})]}),G.phase==="error"&&k.jsxs("div",{className:"dl-modal-error",children:[k.jsx("span",{className:"material-icons",style:{color:"#e74c3c"},children:"error"}),k.jsx("span",{children:G.error})]})]}),G.phase==="input"&&k.jsxs("div",{className:"dl-modal-actions",children:[k.jsx("button",{className:"dl-modal-cancel",onClick:()=>q(null),children:"Abbrechen"}),k.jsxs("button",{className:"dl-modal-submit",onClick:()=>void qn(),children:[k.jsx("span",{className:"material-icons",style:{fontSize:16},children:"download"}),"Herunterladen"]})]}),G.phase==="error"&&k.jsxs("div",{className:"dl-modal-actions",children:[k.jsx("button",{className:"dl-modal-cancel",onClick:()=>q(null),children:"Schliessen"}),k.jsxs("button",{className:"dl-modal-submit",onClick:()=>q(ye=>ye?{...ye,phase:"input",error:void 0}:null),children:[k.jsx("span",{className:"material-icons",style:{fontSize:16},children:"refresh"}),"Nochmal"]})]})]})})]})}const g7={IRON:"#6b6b6b",BRONZE:"#8c6239",SILVER:"#8c8c8c",GOLD:"#d4a017",PLATINUM:"#28b29e",EMERALD:"#1e9e5e",DIAMOND:"#576cce",MASTER:"#9d48e0",GRANDMASTER:"#e44c3e",CHALLENGER:"#f4c874"},Hde={SOLORANKED:"Ranked Solo",FLEXRANKED:"Ranked Flex",NORMAL:"Normal",ARAM:"ARAM",ARENA:"Arena",URF:"URF",BOT:"Co-op vs AI"},jde="https://ddragon.leagueoflegends.com/cdn/15.5.1/img";function zv(i){return`${jde}/champion/${i}.png`}function v7(i){const e=Math.floor((Date.now()-new Date(i).getTime())/1e3);return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function Wde(i){const e=Math.floor(i/60),t=i%60;return`${e}:${String(t).padStart(2,"0")}`}function _7(i,e,t){return e===0?"Perfect":((i+t)/e).toFixed(2)}function y7(i,e){const t=i+e;return t>0?Math.round(i/t*100):0}function $de(i,e){if(!i)return"Unranked";const t=["","I","II","III","IV"];return`${i.charAt(0)}${i.slice(1).toLowerCase()}${e?" "+(t[e]??e):""}`}function Xde({data:i}){var we,We,Ne,ze;const[e,t]=xe.useState(""),[n,r]=xe.useState("EUW"),[s,a]=xe.useState([]),[l,u]=xe.useState(null),[h,m]=xe.useState([]),[v,x]=xe.useState(!1),[S,w]=xe.useState(null),[R,C]=xe.useState([]),[E,B]=xe.useState(null),[L,O]=xe.useState({}),[G,q]=xe.useState(!1),[z,j]=xe.useState(!1),[F,V]=xe.useState(null),Y=xe.useRef(null),ee=xe.useRef(null);xe.useEffect(()=>{fetch("/api/lolstats/regions").then(Se=>Se.json()).then(a).catch(()=>{}),fetch("/api/lolstats/recent").then(Se=>Se.json()).then(C).catch(()=>{})},[]),xe.useEffect(()=>{i&&(i.recentSearches&&C(i.recentSearches),i.regions&&!s.length&&a(i.regions))},[i]);const te=xe.useCallback(async(Se,Ce,dt)=>{j(!0);try{const At=`gameName=${encodeURIComponent(Se)}&tagLine=${encodeURIComponent(Ce)}&region=${dt}`,wt=await fetch(`/api/lolstats/renew?${At}`,{method:"POST"});if(wt.ok){const Ft=await wt.json();return Ft.last_updated_at&&V(Ft.last_updated_at),Ft.renewed??!1}}catch{}return j(!1),!1},[]),re=xe.useCallback(async(Se,Ce,dt,At=!1)=>{var rt,ce;let wt=Se??"",Ft=Ce??"";const $e=dt??n;if(!wt){const Gt=e.split("#");wt=((rt=Gt[0])==null?void 0:rt.trim())??"",Ft=((ce=Gt[1])==null?void 0:ce.trim())??""}if(!wt||!Ft){w("Bitte im Format Name#Tag eingeben");return}x(!0),w(null),u(null),m([]),B(null),O({}),ee.current={gameName:wt,tagLine:Ft,region:$e},At||te(wt,Ft,$e).finally(()=>j(!1));try{const Gt=`gameName=${encodeURIComponent(wt)}&tagLine=${encodeURIComponent(Ft)}&region=${$e}`,[ht,Pt]=await Promise.all([fetch(`/api/lolstats/profile?${Gt}`),fetch(`/api/lolstats/matches?${Gt}&limit=10`)]);if(!ht.ok){const en=await ht.json();throw new Error(en.error??`Fehler ${ht.status}`)}const yt=await ht.json();if(u(yt),yt.updated_at&&V(yt.updated_at),Pt.ok){const en=await Pt.json();m(Array.isArray(en)?en:[])}}catch(Gt){w(Gt.message)}x(!1)},[e,n,te]),ne=xe.useCallback(async()=>{const Se=ee.current;if(!(!Se||z)){j(!0);try{await te(Se.gameName,Se.tagLine,Se.region),await new Promise(Ce=>setTimeout(Ce,1500)),await re(Se.gameName,Se.tagLine,Se.region,!0)}finally{j(!1)}}},[te,re,z]),Q=xe.useCallback(async()=>{if(!(!l||G)){q(!0);try{const Se=`gameName=${encodeURIComponent(l.game_name)}&tagLine=${encodeURIComponent(l.tagline)}&region=${n}&limit=20`,Ce=await fetch(`/api/lolstats/matches?${Se}`);if(Ce.ok){const dt=await Ce.json();m(Array.isArray(dt)?dt:[])}}catch{}q(!1)}},[l,n,G]),ae=xe.useCallback(async Se=>{var Ce;if(E===Se.id){B(null);return}if(B(Se.id),!(((Ce=Se.participants)==null?void 0:Ce.length)>=10||L[Se.id]))try{const dt=`region=${n}&createdAt=${encodeURIComponent(Se.created_at)}`,At=await fetch(`/api/lolstats/match/${encodeURIComponent(Se.id)}?${dt}`);if(At.ok){const wt=await At.json();O(Ft=>({...Ft,[Se.id]:wt}))}}catch{}},[E,L,n]),de=xe.useCallback(Se=>{t(`${Se.game_name}#${Se.tag_line}`),r(Se.region),re(Se.game_name,Se.tag_line,Se.region)},[re]),Te=xe.useCallback(Se=>{var dt,At,wt;if(!l)return((dt=Se.participants)==null?void 0:dt[0])??null;const Ce=l.game_name.toLowerCase();return((At=Se.participants)==null?void 0:At.find(Ft=>{var $e,rt;return((rt=($e=Ft.summoner)==null?void 0:$e.game_name)==null?void 0:rt.toLowerCase())===Ce}))??((wt=Se.participants)==null?void 0:wt[0])??null},[l]),be=Se=>{var ce,Gt,ht;const Ce=Te(Se);if(!Ce)return null;const dt=((ce=Ce.stats)==null?void 0:ce.result)==="WIN",At=_7(Ce.stats.kill,Ce.stats.death,Ce.stats.assist),wt=(Ce.stats.minion_kill??0)+(Ce.stats.neutral_minion_kill??0),Ft=Se.game_length_second>0?(wt/(Se.game_length_second/60)).toFixed(1):"0",$e=E===Se.id,rt=L[Se.id]??(((Gt=Se.participants)==null?void 0:Gt.length)>=10?Se:null);return k.jsxs("div",{children:[k.jsxs("div",{className:`lol-match ${dt?"win":"loss"}`,onClick:()=>ae(Se),children:[k.jsx("div",{className:"lol-match-result",children:dt?"W":"L"}),k.jsxs("div",{className:"lol-match-champ",children:[k.jsx("img",{src:zv(Ce.champion_name),alt:Ce.champion_name,title:Ce.champion_name}),k.jsx("span",{className:"lol-match-champ-level",children:Ce.stats.champion_level})]}),k.jsxs("div",{className:"lol-match-kda",children:[k.jsxs("div",{className:"lol-match-kda-nums",children:[Ce.stats.kill,"/",Ce.stats.death,"/",Ce.stats.assist]}),k.jsxs("div",{className:`lol-match-kda-ratio ${At==="Perfect"?"perfect":Number(At)>=4?"great":""}`,children:[At," KDA"]})]}),k.jsxs("div",{className:"lol-match-stats",children:[k.jsxs("span",{children:[wt," CS (",Ft,"/m)"]}),k.jsxs("span",{children:[Ce.stats.ward_place," wards"]})]}),k.jsx("div",{className:"lol-match-items",children:(Ce.items_names??[]).slice(0,7).map((Pt,yt)=>Pt?k.jsx("img",{src:zv("Aatrox"),alt:Pt,title:Pt,style:{background:"var(--bg-deep)"},onError:en=>{en.target.style.display="none"}},yt):k.jsx("div",{className:"lol-match-item-empty"},yt))}),k.jsxs("div",{className:"lol-match-meta",children:[k.jsx("div",{className:"lol-match-duration",children:Wde(Se.game_length_second)}),k.jsx("div",{className:"lol-match-queue",children:Hde[Se.game_type]??Se.game_type}),k.jsxs("div",{className:"lol-match-ago",children:[v7(Se.created_at)," ago"]})]})]}),$e&&rt&&k.jsx("div",{className:"lol-match-detail",children:ue(rt,(ht=Ce.summoner)==null?void 0:ht.game_name)})]},Se.id)},ue=(Se,Ce)=>{var $e,rt,ce,Gt,ht;const dt=(($e=Se.participants)==null?void 0:$e.filter(Pt=>Pt.team_key==="BLUE"))??[],At=((rt=Se.participants)==null?void 0:rt.filter(Pt=>Pt.team_key==="RED"))??[],wt=(ht=(Gt=(ce=Se.teams)==null?void 0:ce.find(Pt=>Pt.key==="BLUE"))==null?void 0:Gt.game_stat)==null?void 0:ht.is_win,Ft=(Pt,yt,en)=>k.jsxs("div",{className:"lol-match-detail-team",children:[k.jsxs("div",{className:`lol-match-detail-team-header ${yt?"win":"loss"}`,children:[en," — ",yt?"Victory":"Defeat"]}),Pt.map((xt,fe)=>{var Re,pe,Me,nt,lt,Ot,jt,pt,Yt,rn,$t,kt;const X=((pe=(Re=xt.summoner)==null?void 0:Re.game_name)==null?void 0:pe.toLowerCase())===(Ce==null?void 0:Ce.toLowerCase()),le=(((Me=xt.stats)==null?void 0:Me.minion_kill)??0)+(((nt=xt.stats)==null?void 0:nt.neutral_minion_kill)??0);return k.jsxs("div",{className:`lol-detail-row ${X?"me":""}`,children:[k.jsx("img",{className:"lol-detail-champ",src:zv(xt.champion_name),alt:xt.champion_name}),k.jsx("span",{className:"lol-detail-name",title:`${(lt=xt.summoner)==null?void 0:lt.game_name}#${(Ot=xt.summoner)==null?void 0:Ot.tagline}`,children:((jt=xt.summoner)==null?void 0:jt.game_name)??xt.champion_name}),k.jsxs("span",{className:"lol-detail-kda",children:[(pt=xt.stats)==null?void 0:pt.kill,"/",(Yt=xt.stats)==null?void 0:Yt.death,"/",(rn=xt.stats)==null?void 0:rn.assist]}),k.jsxs("span",{className:"lol-detail-cs",children:[le," CS"]}),k.jsxs("span",{className:"lol-detail-dmg",children:[(((($t=xt.stats)==null?void 0:$t.total_damage_dealt_to_champions)??0)/1e3).toFixed(1),"k"]}),k.jsxs("span",{className:"lol-detail-gold",children:[((((kt=xt.stats)==null?void 0:kt.gold_earned)??0)/1e3).toFixed(1),"k"]})]},fe)})]});return k.jsxs(k.Fragment,{children:[Ft(dt,wt,"Blue Team"),Ft(At,wt===void 0?void 0:!wt,"Red Team")]})};return k.jsxs("div",{className:"lol-container",children:[k.jsxs("div",{className:"lol-search",children:[k.jsx("input",{ref:Y,className:"lol-search-input",placeholder:"Summoner Name#Tag",value:e,onChange:Se=>t(Se.target.value),onKeyDown:Se=>Se.key==="Enter"&&re()}),k.jsx("select",{className:"lol-search-region",value:n,onChange:Se=>r(Se.target.value),children:s.map(Se=>k.jsx("option",{value:Se.code,children:Se.code},Se.code))}),k.jsx("button",{className:"lol-search-btn",onClick:()=>re(),disabled:v,children:v?"...":"Search"})]}),R.length>0&&k.jsx("div",{className:"lol-recent",children:R.map((Se,Ce)=>k.jsxs("button",{className:"lol-recent-chip",onClick:()=>de(Se),children:[Se.profile_image_url&&k.jsx("img",{src:Se.profile_image_url,alt:""}),Se.game_name,"#",Se.tag_line,Se.tier&&k.jsx("span",{className:"lol-recent-tier",style:{color:g7[Se.tier]},children:Se.tier})]},Ce))}),S&&k.jsx("div",{className:"lol-error",children:S}),v&&k.jsxs("div",{className:"lol-loading",children:[k.jsx("div",{className:"lol-spinner"}),"Lade Profil..."]}),l&&!v&&k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"lol-profile",children:[k.jsx("img",{className:"lol-profile-icon",src:l.profile_image_url,alt:""}),k.jsxs("div",{className:"lol-profile-info",children:[k.jsxs("h2",{children:[l.game_name,k.jsxs("span",{children:["#",l.tagline]})]}),k.jsxs("div",{className:"lol-profile-level",children:["Level ",l.level]}),((we=l.ladder_rank)==null?void 0:we.rank)&&k.jsxs("div",{className:"lol-profile-ladder",children:["Ladder Rank #",l.ladder_rank.rank.toLocaleString()," / ",(We=l.ladder_rank.total)==null?void 0:We.toLocaleString()]}),F&&k.jsxs("div",{className:"lol-profile-updated",children:["Updated ",v7(F)," ago"]})]}),k.jsxs("button",{className:`lol-update-btn ${z?"renewing":""}`,onClick:ne,disabled:z,title:"Refresh data from Riot servers",children:[k.jsx("span",{className:"lol-update-icon",children:z?"⟳":"↻"}),z?"Updating...":"Update"]})]}),k.jsx("div",{className:"lol-ranked-row",children:(l.league_stats??[]).filter(Se=>Se.game_type==="SOLORANKED"||Se.game_type==="FLEXRANKED").map(Se=>{const Ce=Se.tier_info,dt=!!(Ce!=null&&Ce.tier),At=g7[(Ce==null?void 0:Ce.tier)??""]??"var(--text-normal)";return k.jsxs("div",{className:`lol-ranked-card ${dt?"has-rank":""}`,style:{"--tier-color":At},children:[k.jsx("div",{className:"lol-ranked-type",children:Se.game_type==="SOLORANKED"?"Ranked Solo/Duo":"Ranked Flex"}),dt?k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"lol-ranked-tier",style:{color:At},children:[$de(Ce.tier,Ce.division),k.jsxs("span",{className:"lol-ranked-lp",children:[Ce.lp," LP"]})]}),k.jsxs("div",{className:"lol-ranked-record",children:[Se.win,"W ",Se.lose,"L",k.jsxs("span",{className:"lol-ranked-wr",children:["(",y7(Se.win??0,Se.lose??0),"%)"]}),Se.is_hot_streak&&k.jsx("span",{className:"lol-ranked-streak",children:"🔥"})]})]}):k.jsx("div",{className:"lol-ranked-tier",children:"Unranked"})]},Se.game_type)})}),((ze=(Ne=l.most_champions)==null?void 0:Ne.champion_stats)==null?void 0:ze.length)>0&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"lol-section-title",children:"Top Champions"}),k.jsx("div",{className:"lol-champs",children:l.most_champions.champion_stats.slice(0,7).map(Se=>{const Ce=y7(Se.win,Se.lose),dt=Se.play>0?_7(Se.kill/Se.play,Se.death/Se.play,Se.assist/Se.play):"0";return k.jsxs("div",{className:"lol-champ-card",children:[k.jsx("img",{className:"lol-champ-icon",src:zv(Se.champion_name),alt:Se.champion_name}),k.jsxs("div",{children:[k.jsx("div",{className:"lol-champ-name",children:Se.champion_name}),k.jsxs("div",{className:"lol-champ-stats",children:[Se.play," games · ",Ce,"% WR"]}),k.jsxs("div",{className:"lol-champ-kda",children:[dt," KDA"]})]})]},Se.champion_name)})})]}),h.length>0&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"lol-section-title",children:"Match History"}),k.jsx("div",{className:"lol-matches",children:h.map(Se=>be(Se))}),h.length<20&&k.jsx("button",{className:"lol-load-more",onClick:Q,disabled:G,children:G?"Laden...":"Mehr laden"})]})]}),!l&&!v&&!S&&k.jsxs("div",{className:"lol-empty",children:[k.jsx("div",{className:"lol-empty-icon",children:"⚔️"}),k.jsx("h3",{children:"League of Legends Stats"}),k.jsx("p",{children:"Gib einen Summoner Name#Tag ein und wähle die Region"})]})]})}const x7={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}]};function qS(i){const e=Math.max(0,Math.floor((Date.now()-new Date(i).getTime())/1e3)),t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${n}:${String(r).padStart(2,"0")}`}function Yde({data:i}){var fe,X;const[e,t]=xe.useState([]),[n,r]=xe.useState(()=>localStorage.getItem("streaming_name")||""),[s,a]=xe.useState("Screen Share"),[l,u]=xe.useState(""),[h,m]=xe.useState(null),[v,x]=xe.useState(null),[S,w]=xe.useState(null),[R,C]=xe.useState(!1),[E,B]=xe.useState(!1),[L,O]=xe.useState(null),[,G]=xe.useState(0),[q,z]=xe.useState(null),[j,F]=xe.useState(null),V=xe.useRef(null),Y=xe.useRef(""),ee=xe.useRef(null),te=xe.useRef(null),re=xe.useRef(null),ne=xe.useRef(new Map),Q=xe.useRef(null),ae=xe.useRef(new Map),de=xe.useRef(null),Te=xe.useRef(1e3),be=xe.useRef(!1),ue=xe.useRef(null);xe.useEffect(()=>{be.current=R},[R]),xe.useEffect(()=>{ue.current=L},[L]),xe.useEffect(()=>{if(!(e.length>0||R))return;const Re=setInterval(()=>G(pe=>pe+1),1e3);return()=>clearInterval(Re)},[e.length,R]),xe.useEffect(()=>{i!=null&&i.streams&&t(i.streams)},[i]),xe.useEffect(()=>{n&&localStorage.setItem("streaming_name",n)},[n]),xe.useEffect(()=>{if(!q)return;const le=()=>z(null);return document.addEventListener("click",le),()=>document.removeEventListener("click",le)},[q]);const we=xe.useCallback(le=>{var Re;((Re=V.current)==null?void 0:Re.readyState)===WebSocket.OPEN&&V.current.send(JSON.stringify(le))},[]),We=xe.useCallback((le,Re,pe)=>{if(le.remoteDescription)le.addIceCandidate(new RTCIceCandidate(pe)).catch(()=>{});else{let Me=ae.current.get(Re);Me||(Me=[],ae.current.set(Re,Me)),Me.push(pe)}},[]),Ne=xe.useCallback((le,Re)=>{const pe=ae.current.get(Re);if(pe){for(const Me of pe)le.addIceCandidate(new RTCIceCandidate(Me)).catch(()=>{});ae.current.delete(Re)}},[]),ze=xe.useCallback(()=>{Q.current&&(Q.current.close(),Q.current=null),re.current&&(re.current.srcObject=null)},[]),Se=xe.useRef(()=>{});Se.current=le=>{var Re;switch(le.type){case"welcome":Y.current=le.clientId,le.streams&&t(le.streams);break;case"broadcast_started":w(le.streamId),C(!0),be.current=!0,B(!1);break;case"stream_available":break;case"stream_ended":((Re=ue.current)==null?void 0:Re.streamId)===le.streamId&&(ze(),O(null));break;case"viewer_joined":{const pe=le.viewerId,Me=ne.current.get(pe);Me&&(Me.close(),ne.current.delete(pe)),ae.current.delete(pe);const nt=new RTCPeerConnection(x7);ne.current.set(pe,nt);const lt=ee.current;if(lt)for(const jt of lt.getTracks())nt.addTrack(jt,lt);nt.onicecandidate=jt=>{jt.candidate&&we({type:"ice_candidate",targetId:pe,candidate:jt.candidate.toJSON()})};const Ot=nt.getSenders().find(jt=>{var pt;return((pt=jt.track)==null?void 0:pt.kind)==="video"});if(Ot){const jt=Ot.getParameters();(!jt.encodings||jt.encodings.length===0)&&(jt.encodings=[{}]),jt.encodings[0].maxFramerate=60,jt.encodings[0].maxBitrate=8e6,Ot.setParameters(jt).catch(()=>{})}nt.createOffer().then(jt=>nt.setLocalDescription(jt)).then(()=>we({type:"offer",targetId:pe,sdp:nt.localDescription})).catch(console.error);break}case"viewer_left":{const pe=ne.current.get(le.viewerId);pe&&(pe.close(),ne.current.delete(le.viewerId)),ae.current.delete(le.viewerId);break}case"offer":{const pe=le.fromId;Q.current&&(Q.current.close(),Q.current=null),ae.current.delete(pe);const Me=new RTCPeerConnection(x7);Q.current=Me,Me.ontrack=nt=>{re.current&&nt.streams[0]&&(re.current.srcObject=nt.streams[0]),O(lt=>lt&&{...lt,phase:"connected"})},Me.onicecandidate=nt=>{nt.candidate&&we({type:"ice_candidate",targetId:pe,candidate:nt.candidate.toJSON()})},Me.oniceconnectionstatechange=()=>{(Me.iceConnectionState==="failed"||Me.iceConnectionState==="disconnected")&&O(nt=>nt&&{...nt,phase:"error",error:"Verbindung verloren"})},Me.setRemoteDescription(new RTCSessionDescription(le.sdp)).then(()=>(Ne(Me,pe),Me.createAnswer())).then(nt=>Me.setLocalDescription(nt)).then(()=>we({type:"answer",targetId:pe,sdp:Me.localDescription})).catch(console.error);break}case"answer":{const pe=ne.current.get(le.fromId);pe&&pe.setRemoteDescription(new RTCSessionDescription(le.sdp)).then(()=>Ne(pe,le.fromId)).catch(console.error);break}case"ice_candidate":{if(!le.candidate)break;const pe=ne.current.get(le.fromId);pe?We(pe,le.fromId,le.candidate):Q.current&&We(Q.current,le.fromId,le.candidate);break}case"error":le.code==="WRONG_PASSWORD"?x(pe=>pe&&{...pe,error:le.message}):m(le.message),B(!1);break}};const Ce=xe.useCallback(()=>{if(V.current&&V.current.readyState===WebSocket.OPEN)return;const le=location.protocol==="https:"?"wss":"ws",Re=new WebSocket(`${le}://${location.host}/ws/streaming`);V.current=Re,Re.onopen=()=>{Te.current=1e3},Re.onmessage=pe=>{let Me;try{Me=JSON.parse(pe.data)}catch{return}Se.current(Me)},Re.onclose=()=>{V.current=null,(be.current||ue.current)&&(de.current=setTimeout(()=>{Te.current=Math.min(Te.current*2,1e4),Ce()},Te.current))},Re.onerror=()=>{Re.close()}},[]),dt=xe.useCallback(async()=>{var le,Re;if(!n.trim()){m("Bitte gib einen Namen ein.");return}if(!l.trim()){m("Passwort ist Pflicht.");return}if(!((le=navigator.mediaDevices)!=null&&le.getDisplayMedia)){m("Dein Browser unterstützt keine Bildschirmfreigabe.");return}m(null),B(!0);try{const pe=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:{ideal:60},width:{ideal:1920},height:{ideal:1080}},audio:!0});ee.current=pe,te.current&&(te.current.srcObject=pe),(Re=pe.getVideoTracks()[0])==null||Re.addEventListener("ended",()=>{At()}),Ce();const Me=()=>{var nt;((nt=V.current)==null?void 0:nt.readyState)===WebSocket.OPEN?we({type:"start_broadcast",name:n.trim(),title:s.trim()||"Screen Share",password:l.trim()}):setTimeout(Me,100)};Me()}catch(pe){B(!1),pe.name==="NotAllowedError"?m("Bildschirmfreigabe wurde abgelehnt."):m(`Fehler: ${pe.message}`)}},[n,s,l,Ce,we]),At=xe.useCallback(()=>{var le;we({type:"stop_broadcast"}),(le=ee.current)==null||le.getTracks().forEach(Re=>Re.stop()),ee.current=null,te.current&&(te.current.srcObject=null);for(const Re of ne.current.values())Re.close();ne.current.clear(),C(!1),be.current=!1,w(null),u("")},[we]),wt=xe.useCallback(le=>{x({streamId:le.id,streamTitle:le.title,broadcasterName:le.broadcasterName,password:"",error:null})},[]),Ft=xe.useCallback(()=>{if(!v)return;if(!v.password.trim()){x(Me=>Me&&{...Me,error:"Passwort eingeben."});return}const{streamId:le,password:Re}=v;x(null),m(null),O({streamId:le,phase:"connecting"}),Ce();const pe=()=>{var Me;((Me=V.current)==null?void 0:Me.readyState)===WebSocket.OPEN?we({type:"join_viewer",name:n.trim()||"Viewer",streamId:le,password:Re.trim()}):setTimeout(pe,100)};pe()},[v,n,Ce,we]),$e=xe.useCallback(()=>{we({type:"leave_viewer"}),ze(),O(null)},[ze,we]);xe.useEffect(()=>{const le=pe=>{(be.current||ue.current)&&pe.preventDefault()},Re=()=>{Y.current&&navigator.sendBeacon("/api/streaming/disconnect",JSON.stringify({clientId:Y.current}))};return window.addEventListener("beforeunload",le),window.addEventListener("pagehide",Re),()=>{window.removeEventListener("beforeunload",le),window.removeEventListener("pagehide",Re)}},[]);const rt=xe.useRef(null),[ce,Gt]=xe.useState(!1),ht=xe.useCallback(()=>{const le=rt.current;le&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):le.requestFullscreen().catch(()=>{}))},[]);xe.useEffect(()=>{const le=()=>Gt(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",le),()=>document.removeEventListener("fullscreenchange",le)},[]),xe.useEffect(()=>()=>{var le;(le=ee.current)==null||le.getTracks().forEach(Re=>Re.stop());for(const Re of ne.current.values())Re.close();Q.current&&Q.current.close(),V.current&&V.current.close(),de.current&&clearTimeout(de.current)},[]);const Pt=xe.useRef(null);xe.useEffect(()=>{const Re=new URLSearchParams(location.search).get("viewStream");if(Re){Pt.current=Re;const pe=new URL(location.href);pe.searchParams.delete("viewStream"),window.history.replaceState({},"",pe.toString())}},[]),xe.useEffect(()=>{const le=Pt.current;if(!le||e.length===0)return;const Re=e.find(pe=>pe.id===le);Re&&(Pt.current=null,wt(Re))},[e,wt]);const yt=xe.useCallback(le=>{const Re=new URL(location.href);return Re.searchParams.set("viewStream",le),Re.hash="",Re.toString()},[]),en=xe.useCallback(le=>{navigator.clipboard.writeText(yt(le)).then(()=>{F(le),setTimeout(()=>F(null),2e3)}).catch(()=>{})},[yt]),xt=xe.useCallback(le=>{window.open(yt(le),"_blank","noopener"),z(null)},[yt]);if(L){const le=e.find(Re=>Re.id===L.streamId);return k.jsxs("div",{className:"stream-viewer-overlay",ref:rt,children:[k.jsxs("div",{className:"stream-viewer-header",children:[k.jsxs("div",{className:"stream-viewer-header-left",children:[k.jsxs("span",{className:"stream-live-badge",children:[k.jsx("span",{className:"stream-live-dot"})," LIVE"]}),k.jsxs("div",{children:[k.jsx("div",{className:"stream-viewer-title",children:(le==null?void 0:le.title)||"Stream"}),k.jsxs("div",{className:"stream-viewer-subtitle",children:[(le==null?void 0:le.broadcasterName)||"..."," ",le?` · ${le.viewerCount} Zuschauer`:""]})]})]}),k.jsxs("div",{className:"stream-viewer-header-right",children:[k.jsx("button",{className:"stream-viewer-fullscreen",onClick:ht,title:ce?"Vollbild verlassen":"Vollbild",children:ce?"✖":"⛶"}),k.jsx("button",{className:"stream-viewer-close",onClick:$e,children:"Verlassen"})]})]}),k.jsxs("div",{className:"stream-viewer-video",children:[L.phase==="connecting"?k.jsxs("div",{className:"stream-viewer-connecting",children:[k.jsx("div",{className:"stream-viewer-spinner"}),"Verbindung wird hergestellt..."]}):L.phase==="error"?k.jsxs("div",{className:"stream-viewer-connecting",children:[L.error||"Verbindungsfehler",k.jsx("button",{className:"stream-btn",onClick:$e,children:"Zurück"})]}):null,k.jsx("video",{ref:re,autoPlay:!0,playsInline:!0,style:L.phase==="connected"?{}:{display:"none"}})]})]})}return k.jsxs("div",{className:"stream-container",children:[h&&k.jsxs("div",{className:"stream-error",children:[h,k.jsx("button",{className:"stream-error-dismiss",onClick:()=>m(null),children:"×"})]}),k.jsxs("div",{className:"stream-topbar",children:[k.jsx("input",{className:"stream-input stream-input-name",placeholder:"Dein Name",value:n,onChange:le=>r(le.target.value),disabled:R}),k.jsx("input",{className:"stream-input stream-input-title",placeholder:"Stream-Titel",value:s,onChange:le=>a(le.target.value),disabled:R}),k.jsx("input",{className:"stream-input stream-input-password",type:"password",placeholder:"Passwort",value:l,onChange:le=>u(le.target.value),disabled:R}),R?k.jsxs("button",{className:"stream-btn stream-btn-stop",onClick:At,children:["⏹"," Stream beenden"]}):k.jsx("button",{className:"stream-btn",onClick:dt,disabled:E,children:E?"Starte...":"🖥️ Stream starten"})]}),e.length===0&&!R?k.jsxs("div",{className:"stream-empty",children:[k.jsx("div",{className:"stream-empty-icon",children:"📺"}),k.jsx("h3",{children:"Keine aktiven Streams"}),k.jsx("p",{children:"Starte einen Stream, um deinen Bildschirm zu teilen."})]}):k.jsxs("div",{className:"stream-grid",children:[R&&k.jsxs("div",{className:"stream-tile own broadcasting",children:[k.jsxs("div",{className:"stream-tile-preview",children:[k.jsx("video",{ref:te,autoPlay:!0,playsInline:!0,muted:!0}),k.jsxs("span",{className:"stream-live-badge",children:[k.jsx("span",{className:"stream-live-dot"})," LIVE"]}),k.jsxs("span",{className:"stream-tile-viewers",children:["👥"," ",((fe=e.find(le=>le.id===S))==null?void 0:fe.viewerCount)??0]})]}),k.jsxs("div",{className:"stream-tile-info",children:[k.jsxs("div",{className:"stream-tile-meta",children:[k.jsxs("div",{className:"stream-tile-name",children:[n," (Du)"]}),k.jsx("div",{className:"stream-tile-title",children:s})]}),k.jsx("span",{className:"stream-tile-time",children:S&&((X=e.find(le=>le.id===S))!=null&&X.startedAt)?qS(e.find(le=>le.id===S).startedAt):"0:00"})]})]}),e.filter(le=>le.id!==S).map(le=>k.jsxs("div",{className:"stream-tile",onClick:()=>xt(le.id),children:[k.jsxs("div",{className:"stream-tile-preview",children:[k.jsx("span",{className:"stream-tile-icon",children:"🖥️"}),k.jsxs("span",{className:"stream-live-badge",children:[k.jsx("span",{className:"stream-live-dot"})," LIVE"]}),k.jsxs("span",{className:"stream-tile-viewers",children:["👥"," ",le.viewerCount]}),le.hasPassword&&k.jsx("span",{className:"stream-tile-lock",children:"🔒"})]}),k.jsxs("div",{className:"stream-tile-info",children:[k.jsxs("div",{className:"stream-tile-meta",children:[k.jsx("div",{className:"stream-tile-name",children:le.broadcasterName}),k.jsx("div",{className:"stream-tile-title",children:le.title})]}),k.jsx("span",{className:"stream-tile-time",children:qS(le.startedAt)}),k.jsxs("div",{className:"stream-tile-menu-wrap",children:[k.jsx("button",{className:"stream-tile-menu",onClick:Re=>{Re.stopPropagation(),z(q===le.id?null:le.id)},children:"⋮"}),q===le.id&&k.jsxs("div",{className:"stream-tile-dropdown",onClick:Re=>Re.stopPropagation(),children:[k.jsxs("div",{className:"stream-tile-dropdown-header",children:[k.jsx("div",{className:"stream-tile-dropdown-name",children:le.broadcasterName}),k.jsx("div",{className:"stream-tile-dropdown-title",children:le.title}),k.jsxs("div",{className:"stream-tile-dropdown-detail",children:["👥"," ",le.viewerCount," Zuschauer · ",qS(le.startedAt)]})]}),k.jsx("div",{className:"stream-tile-dropdown-divider"}),k.jsxs("button",{className:"stream-tile-dropdown-item",onClick:()=>xt(le.id),children:["🗗"," In neuem Fenster öffnen"]}),k.jsx("button",{className:"stream-tile-dropdown-item",onClick:()=>{en(le.id),z(null)},children:j===le.id?"✅ Kopiert!":"🔗 Link teilen"})]})]})]})]},le.id))]}),v&&k.jsx("div",{className:"stream-pw-overlay",onClick:()=>x(null),children:k.jsxs("div",{className:"stream-pw-modal",onClick:le=>le.stopPropagation(),children:[k.jsx("h3",{children:v.broadcasterName}),k.jsx("p",{children:v.streamTitle}),v.error&&k.jsx("div",{className:"stream-pw-modal-error",children:v.error}),k.jsx("input",{className:"stream-input",type:"password",placeholder:"Stream-Passwort",value:v.password,onChange:le=>x(Re=>Re&&{...Re,password:le.target.value,error:null}),onKeyDown:le=>{le.key==="Enter"&&Ft()},autoFocus:!0}),k.jsxs("div",{className:"stream-pw-actions",children:[k.jsx("button",{className:"stream-pw-cancel",onClick:()=>x(null),children:"Abbrechen"}),k.jsx("button",{className:"stream-btn",onClick:Ft,children:"Beitreten"})]})]})})]})}function b7(i){const e=Math.floor(i),t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${n}:${String(r).padStart(2,"0")}`}function Qde(i){const e=i.match(/(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/);return e?{type:"youtube",videoId:e[1]}:/\.(mp4|webm|ogg)(\?|$)/i.test(i)||i.startsWith("http")?{type:"direct",url:i}:null}function Kde({data:i}){var Re;const[e,t]=xe.useState([]),[n,r]=xe.useState(()=>localStorage.getItem("wt_name")||""),[s,a]=xe.useState(""),[l,u]=xe.useState(""),[h,m]=xe.useState(null),[v,x]=xe.useState(null),[S,w]=xe.useState(null),[R,C]=xe.useState(""),[E,B]=xe.useState(()=>{const pe=localStorage.getItem("wt_volume");return pe?parseFloat(pe):1}),[L,O]=xe.useState(!1),[G,q]=xe.useState(0),[z,j]=xe.useState(0),[F,V]=xe.useState(null),[Y,ee]=xe.useState(!1),te=xe.useRef(null),re=xe.useRef(""),ne=xe.useRef(null),Q=xe.useRef(1e3),ae=xe.useRef(null),de=xe.useRef(null),Te=xe.useRef(null),be=xe.useRef(null),ue=xe.useRef(null),we=xe.useRef(null),We=xe.useRef(!1),Ne=xe.useRef(!1),ze=xe.useRef(null);xe.useEffect(()=>{ae.current=h},[h]);const Se=h!=null&&re.current===h.hostId;xe.useEffect(()=>{i!=null&&i.rooms&&t(i.rooms)},[i]),xe.useEffect(()=>{n&&localStorage.setItem("wt_name",n)},[n]),xe.useEffect(()=>{localStorage.setItem("wt_volume",String(E)),Te.current&&typeof Te.current.setVolume=="function"&&Te.current.setVolume(E*100),be.current&&(be.current.volume=E)},[E]),xe.useEffect(()=>{if(window.YT){We.current=!0;return}const pe=document.createElement("script");pe.src="https://www.youtube.com/iframe_api",document.head.appendChild(pe);const Me=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{We.current=!0,Me&&Me()}},[]);const Ce=xe.useCallback(pe=>{var Me;((Me=te.current)==null?void 0:Me.readyState)===WebSocket.OPEN&&te.current.send(JSON.stringify(pe))},[]),dt=xe.useCallback(()=>we.current==="youtube"&&Te.current&&typeof Te.current.getCurrentTime=="function"?Te.current.getCurrentTime():we.current==="direct"&&be.current?be.current.currentTime:null,[]);xe.useCallback(()=>we.current==="youtube"&&Te.current&&typeof Te.current.getDuration=="function"?Te.current.getDuration()||0:we.current==="direct"&&be.current&&be.current.duration||0,[]);const At=xe.useCallback(()=>{if(Te.current){try{Te.current.destroy()}catch{}Te.current=null}be.current&&(be.current.pause(),be.current.removeAttribute("src"),be.current.load()),we.current=null,ze.current&&(clearInterval(ze.current),ze.current=null)},[]),wt=xe.useCallback(pe=>{At(),V(null);const Me=Qde(pe);if(Me)if(Me.type==="youtube"){if(we.current="youtube",!We.current||!ue.current)return;const nt=ue.current,lt=document.createElement("div");lt.id="wt-yt-player-"+Date.now(),nt.innerHTML="",nt.appendChild(lt),Te.current=new window.YT.Player(lt.id,{videoId:Me.videoId,playerVars:{autoplay:1,controls:0,modestbranding:1,rel:0},events:{onReady:Ot=>{Ot.target.setVolume(E*100),q(Ot.target.getDuration()||0),ze.current=setInterval(()=>{Te.current&&typeof Te.current.getCurrentTime=="function"&&(j(Te.current.getCurrentTime()),q(Te.current.getDuration()||0))},500)},onStateChange:Ot=>{if(Ot.data===window.YT.PlayerState.ENDED){const jt=ae.current;jt&&re.current===jt.hostId&&Ce({type:"skip"})}},onError:Ot=>{const jt=Ot.data;V(jt===101||jt===150?"Embedding deaktiviert — Video kann nur auf YouTube angesehen werden.":jt===100?"Video nicht gefunden oder entfernt.":"Wiedergabefehler — Video wird übersprungen."),setTimeout(()=>{const pt=ae.current;pt&&re.current===pt.hostId&&Ce({type:"skip"})},3e3)}}})}else we.current="direct",be.current&&(be.current.src=Me.url,be.current.volume=E,be.current.play().catch(()=>{}))},[At,E,Ce]);xe.useEffect(()=>{const pe=be.current;if(!pe)return;const Me=()=>{const lt=ae.current;lt&&re.current===lt.hostId&&Ce({type:"skip"})},nt=()=>{j(pe.currentTime),q(pe.duration||0)};return pe.addEventListener("ended",Me),pe.addEventListener("timeupdate",nt),()=>{pe.removeEventListener("ended",Me),pe.removeEventListener("timeupdate",nt)}},[Ce]);const Ft=xe.useRef(()=>{});Ft.current=pe=>{var Me,nt,lt,Ot,jt,pt,Yt,rn,$t,kt,Vt,Nn,_i,me;switch(pe.type){case"welcome":re.current=pe.clientId,pe.rooms&&t(pe.rooms);break;case"room_created":{const bt=pe.room;m({id:bt.id,name:bt.name,hostId:bt.hostId,members:bt.members||[],currentVideo:bt.currentVideo||null,playing:bt.playing||!1,currentTime:bt.currentTime||0,queue:bt.queue||[]});break}case"room_joined":{const bt=pe.room;m({id:bt.id,name:bt.name,hostId:bt.hostId,members:bt.members||[],currentVideo:bt.currentVideo||null,playing:bt.playing||!1,currentTime:bt.currentTime||0,queue:bt.queue||[]}),(Me=bt.currentVideo)!=null&&Me.url&&setTimeout(()=>wt(bt.currentVideo.url),100);break}case"playback_state":{const bt=ae.current;if(!bt)break;const tt=pe.currentVideo,St=(nt=bt.currentVideo)==null?void 0:nt.url;if(tt!=null&&tt.url&&tt.url!==St?wt(tt.url):!tt&&St&&At(),we.current==="youtube"&&Te.current){const qt=(Ot=(lt=Te.current).getPlayerState)==null?void 0:Ot.call(lt);pe.playing&&qt!==((pt=(jt=window.YT)==null?void 0:jt.PlayerState)==null?void 0:pt.PLAYING)?(rn=(Yt=Te.current).playVideo)==null||rn.call(Yt):!pe.playing&&qt===((kt=($t=window.YT)==null?void 0:$t.PlayerState)==null?void 0:kt.PLAYING)&&((Nn=(Vt=Te.current).pauseVideo)==null||Nn.call(Vt))}else we.current==="direct"&&be.current&&(pe.playing&&be.current.paused?be.current.play().catch(()=>{}):!pe.playing&&!be.current.paused&&be.current.pause());if(pe.currentTime!==void 0&&!Ne.current){const qt=dt();qt!==null&&Math.abs(qt-pe.currentTime)>2&&(we.current==="youtube"&&Te.current?(me=(_i=Te.current).seekTo)==null||me.call(_i,pe.currentTime,!0):we.current==="direct"&&be.current&&(be.current.currentTime=pe.currentTime))}m(qt=>qt&&{...qt,currentVideo:tt||null,playing:pe.playing,currentTime:pe.currentTime??qt.currentTime});break}case"queue_updated":m(bt=>bt&&{...bt,queue:pe.queue});break;case"members_updated":m(bt=>bt&&{...bt,members:pe.members,hostId:pe.hostId});break;case"error":pe.code==="WRONG_PASSWORD"?x(bt=>bt&&{...bt,error:pe.message}):w(pe.message);break}};const $e=xe.useCallback(()=>{if(te.current&&(te.current.readyState===WebSocket.OPEN||te.current.readyState===WebSocket.CONNECTING))return;const pe=location.protocol==="https:"?"wss":"ws",Me=new WebSocket(`${pe}://${location.host}/ws/watch-together`);te.current=Me,Me.onopen=()=>{Q.current=1e3},Me.onmessage=nt=>{let lt;try{lt=JSON.parse(nt.data)}catch{return}Ft.current(lt)},Me.onclose=()=>{te.current===Me&&(te.current=null),ae.current&&(ne.current=setTimeout(()=>{Q.current=Math.min(Q.current*2,1e4),$e()},Q.current))},Me.onerror=()=>{Me.close()}},[]),rt=xe.useCallback(()=>{if(!n.trim()){w("Bitte gib einen Namen ein.");return}if(!s.trim()){w("Bitte gib einen Raumnamen ein.");return}w(null),$e();const pe=Date.now(),Me=()=>{var nt;((nt=te.current)==null?void 0:nt.readyState)===WebSocket.OPEN?Ce({type:"create_room",name:s.trim(),userName:n.trim(),password:l.trim()||void 0}):Date.now()-pe>1e4?w("Verbindung zum Server fehlgeschlagen."):setTimeout(Me,100)};Me()},[n,s,l,$e,Ce]),ce=xe.useCallback((pe,Me)=>{if(!n.trim()){w("Bitte gib einen Namen ein.");return}w(null),$e();const nt=Date.now(),lt=()=>{var Ot;((Ot=te.current)==null?void 0:Ot.readyState)===WebSocket.OPEN?Ce({type:"join_room",userName:n.trim(),roomId:pe,password:(Me==null?void 0:Me.trim())||void 0}):Date.now()-nt>1e4?w("Verbindung zum Server fehlgeschlagen."):setTimeout(lt,100)};lt()},[n,$e,Ce]),Gt=xe.useCallback(()=>{Ce({type:"leave_room"}),At(),m(null),C(""),q(0),j(0)},[Ce,At]),ht=xe.useCallback(async()=>{const pe=R.trim();if(!pe)return;C(""),ee(!0);let Me="";try{const nt=await fetch(`/api/watch-together/video-info?url=${encodeURIComponent(pe)}`);nt.ok&&(Me=(await nt.json()).title||"")}catch{}Ce({type:"add_to_queue",url:pe,title:Me||void 0}),ee(!1)},[R,Ce]),Pt=xe.useCallback(pe=>{Ce({type:"remove_from_queue",index:pe})},[Ce]),yt=xe.useCallback(()=>{const pe=ae.current;pe&&Ce({type:pe.playing?"pause":"resume"})},[Ce]),en=xe.useCallback(()=>{Ce({type:"skip"})},[Ce]),xt=xe.useCallback(pe=>{var Me,nt;Ne.current=!0,Ce({type:"seek",time:pe}),we.current==="youtube"&&Te.current?(nt=(Me=Te.current).seekTo)==null||nt.call(Me,pe,!0):we.current==="direct"&&be.current&&(be.current.currentTime=pe),j(pe),setTimeout(()=>{Ne.current=!1},1e3)},[Ce]);xe.useEffect(()=>{if(!Se||!(h!=null&&h.playing))return;const pe=setInterval(()=>{const Me=dt();Me!==null&&Ce({type:"report_time",time:Me})},2e3);return()=>clearInterval(pe)},[Se,h==null?void 0:h.playing,Ce,dt]);const fe=xe.useCallback(()=>{const pe=de.current;pe&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):pe.requestFullscreen().catch(()=>{}))},[]);xe.useEffect(()=>{const pe=()=>O(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",pe),()=>document.removeEventListener("fullscreenchange",pe)},[]),xe.useEffect(()=>{const pe=nt=>{ae.current&&nt.preventDefault()},Me=()=>{re.current&&navigator.sendBeacon("/api/watch-together/disconnect",JSON.stringify({clientId:re.current}))};return window.addEventListener("beforeunload",pe),window.addEventListener("pagehide",Me),()=>{window.removeEventListener("beforeunload",pe),window.removeEventListener("pagehide",Me)}},[]),xe.useEffect(()=>()=>{At(),te.current&&te.current.close(),ne.current&&clearTimeout(ne.current)},[At]);const X=xe.useCallback(()=>{if(!v)return;if(!v.password.trim()){x(nt=>nt&&{...nt,error:"Passwort eingeben."});return}const{roomId:pe,password:Me}=v;x(null),ce(pe,Me)},[v,ce]),le=xe.useCallback(pe=>{pe.hasPassword?x({roomId:pe.id,roomName:pe.name,password:"",error:null}):ce(pe.id)},[ce]);if(h){const pe=h.members.find(Me=>Me.id===h.hostId);return k.jsxs("div",{className:"wt-room-overlay",ref:de,children:[k.jsxs("div",{className:"wt-room-header",children:[k.jsxs("div",{className:"wt-room-header-left",children:[k.jsx("span",{className:"wt-room-name",children:h.name}),k.jsxs("span",{className:"wt-room-members",children:[h.members.length," Mitglieder"]}),pe&&k.jsxs("span",{className:"wt-host-badge",children:["Host: ",pe.name]})]}),k.jsxs("div",{className:"wt-room-header-right",children:[k.jsx("button",{className:"wt-fullscreen-btn",onClick:fe,title:L?"Vollbild verlassen":"Vollbild",children:L?"✖":"⛶"}),k.jsx("button",{className:"wt-leave-btn",onClick:Gt,children:"Verlassen"})]})]}),k.jsxs("div",{className:"wt-room-body",children:[k.jsxs("div",{className:"wt-player-section",children:[k.jsxs("div",{className:"wt-player-wrap",children:[k.jsx("div",{ref:ue,className:"wt-yt-container",style:we.current==="youtube"?{}:{display:"none"}}),k.jsx("video",{ref:be,className:"wt-video-element",style:we.current==="direct"?{}:{display:"none"},playsInline:!0}),F&&k.jsxs("div",{className:"wt-player-error",children:[k.jsx("div",{className:"wt-error-icon",children:"⚠️"}),k.jsx("p",{children:F}),((Re=h.currentVideo)==null?void 0:Re.url)&&k.jsx("a",{className:"wt-yt-link",href:h.currentVideo.url,target:"_blank",rel:"noopener noreferrer",children:"Auf YouTube öffnen ↗"}),k.jsx("p",{className:"wt-skip-info",children:"Wird in 3 Sekunden übersprungen..."})]}),!h.currentVideo&&k.jsxs("div",{className:"wt-player-placeholder",children:[k.jsx("div",{className:"wt-placeholder-icon",children:"🎬"}),k.jsx("p",{children:"Fuege ein Video zur Warteschlange hinzu"})]})]}),k.jsxs("div",{className:"wt-controls",children:[Se?k.jsxs(k.Fragment,{children:[k.jsx("button",{className:"wt-ctrl-btn",onClick:yt,disabled:!h.currentVideo,title:h.playing?"Pause":"Abspielen",children:h.playing?"⏸":"▶"}),k.jsx("button",{className:"wt-ctrl-btn",onClick:en,disabled:!h.currentVideo,title:"Weiter",children:"⏭"}),k.jsx("input",{className:"wt-seek",type:"range",min:0,max:G||0,step:.5,value:z,onChange:Me=>xt(parseFloat(Me.target.value)),disabled:!h.currentVideo})]}):k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"wt-ctrl-status",children:h.playing?"▶":"⏸"}),k.jsx("div",{className:"wt-seek-readonly",children:k.jsx("div",{className:"wt-seek-progress",style:{width:G>0?`${z/G*100}%`:"0%"}})})]}),k.jsxs("span",{className:"wt-time",children:[b7(z)," / ",b7(G)]}),k.jsxs("div",{className:"wt-volume",children:[k.jsx("span",{className:"wt-volume-icon",children:E===0?"🔇":E<.5?"🔉":"🔊"}),k.jsx("input",{className:"wt-volume-slider",type:"range",min:0,max:1,step:.01,value:E,onChange:Me=>B(parseFloat(Me.target.value))})]})]})]}),k.jsxs("div",{className:"wt-queue-panel",children:[k.jsxs("div",{className:"wt-queue-header",children:["Warteschlange (",h.queue.length,")"]}),k.jsx("div",{className:"wt-queue-list",children:h.queue.length===0?k.jsx("div",{className:"wt-queue-empty",children:"Keine Videos in der Warteschlange"}):h.queue.map((Me,nt)=>{var lt;return k.jsxs("div",{className:`wt-queue-item${((lt=h.currentVideo)==null?void 0:lt.url)===Me.url?" playing":""}${Se?" clickable":""}`,onClick:()=>Se&&Ce({type:"play_video",index:nt}),title:Se?"Klicken zum Abspielen":void 0,children:[k.jsxs("div",{className:"wt-queue-item-info",children:[k.jsx("div",{className:"wt-queue-item-title",children:Me.title||Me.url}),k.jsx("div",{className:"wt-queue-item-by",children:Me.addedBy})]}),Se&&k.jsx("button",{className:"wt-queue-item-remove",onClick:()=>Pt(nt),title:"Entfernen",children:"×"})]},nt)})}),k.jsxs("div",{className:"wt-queue-add",children:[k.jsx("input",{className:"wt-input wt-queue-input",placeholder:"Video-URL eingeben",value:R,onChange:Me=>C(Me.target.value),onKeyDown:Me=>{Me.key==="Enter"&&ht()}}),k.jsx("button",{className:"wt-btn wt-queue-add-btn",onClick:ht,disabled:Y,children:Y?"Laden...":"Hinzufuegen"})]})]})]})]})}return k.jsxs("div",{className:"wt-container",children:[S&&k.jsxs("div",{className:"wt-error",children:[S,k.jsx("button",{className:"wt-error-dismiss",onClick:()=>w(null),children:"×"})]}),k.jsxs("div",{className:"wt-topbar",children:[k.jsx("input",{className:"wt-input wt-input-name",placeholder:"Dein Name",value:n,onChange:pe=>r(pe.target.value)}),k.jsx("input",{className:"wt-input wt-input-room",placeholder:"Raumname",value:s,onChange:pe=>a(pe.target.value)}),k.jsx("input",{className:"wt-input wt-input-password",type:"password",placeholder:"Passwort (optional)",value:l,onChange:pe=>u(pe.target.value)}),k.jsx("button",{className:"wt-btn",onClick:rt,children:"Raum erstellen"})]}),e.length===0?k.jsxs("div",{className:"wt-empty",children:[k.jsx("div",{className:"wt-empty-icon",children:"🎬"}),k.jsx("h3",{children:"Keine aktiven Raeume"}),k.jsx("p",{children:"Erstelle einen Raum, um gemeinsam Videos zu schauen."})]}):k.jsx("div",{className:"wt-grid",children:e.map(pe=>k.jsxs("div",{className:"wt-tile",onClick:()=>le(pe),children:[k.jsxs("div",{className:"wt-tile-preview",children:[k.jsx("span",{className:"wt-tile-icon",children:"🎬"}),k.jsxs("span",{className:"wt-tile-members",children:["👥"," ",pe.memberCount]}),pe.hasPassword&&k.jsx("span",{className:"wt-tile-lock",children:"🔒"}),pe.playing&&k.jsx("span",{className:"wt-tile-playing",children:"▶"})]}),k.jsx("div",{className:"wt-tile-info",children:k.jsxs("div",{className:"wt-tile-meta",children:[k.jsx("div",{className:"wt-tile-name",children:pe.name}),k.jsx("div",{className:"wt-tile-host",children:pe.hostName})]})})]},pe.id))}),v&&k.jsx("div",{className:"wt-modal-overlay",onClick:()=>x(null),children:k.jsxs("div",{className:"wt-modal",onClick:pe=>pe.stopPropagation(),children:[k.jsx("h3",{children:v.roomName}),k.jsx("p",{children:"Raum-Passwort"}),v.error&&k.jsx("div",{className:"wt-modal-error",children:v.error}),k.jsx("input",{className:"wt-input",type:"password",placeholder:"Passwort",value:v.password,onChange:pe=>x(Me=>Me&&{...Me,password:pe.target.value,error:null}),onKeyDown:pe=>{pe.key==="Enter"&&X()},autoFocus:!0}),k.jsxs("div",{className:"wt-modal-actions",children:[k.jsx("button",{className:"wt-modal-cancel",onClick:()=>x(null),children:"Abbrechen"}),k.jsx("button",{className:"wt-btn",onClick:X,children:"Beitreten"})]})]})})]})}const Zde={radio:bde,soundboard:Vde,lolstats:Xde,streaming:Yde,"watch-together":Kde};function Jde(){const[i,e]=xe.useState(!1),[t,n]=xe.useState([]),[r,s]=xe.useState(()=>localStorage.getItem("hub_activeTab")??""),a=x=>{s(x),localStorage.setItem("hub_activeTab",x)},[l,u]=xe.useState({}),h=xe.useRef(null);xe.useEffect(()=>{fetch("/api/plugins").then(x=>x.json()).then(x=>{if(n(x),new URLSearchParams(location.search).has("viewStream")&&x.some(C=>C.name==="streaming")){a("streaming");return}const w=localStorage.getItem("hub_activeTab"),R=x.some(C=>C.name===w);x.length>0&&!R&&a(x[0].name)}).catch(()=>{})},[]),xe.useEffect(()=>{let x=null,S;function w(){x=new EventSource("/api/events"),h.current=x,x.onopen=()=>e(!0),x.onmessage=R=>{try{const C=JSON.parse(R.data);C.type==="snapshot"?u(E=>({...E,...C})):C.plugin&&u(E=>({...E,[C.plugin]:{...E[C.plugin]||{},...C}}))}catch{}},x.onerror=()=>{e(!1),x==null||x.close(),S=setTimeout(w,3e3)}}return w(),()=>{x==null||x.close(),clearTimeout(S)}},[]);const m="1.0.0-dev",v={radio:"🌍",soundboard:"🎵",lolstats:"⚔️",stats:"📊",events:"📅",games:"🎲",gamevote:"🎮",streaming:"📺","watch-together":"🎬"};return k.jsxs("div",{className:"hub-app",children:[k.jsxs("header",{className:"hub-header",children:[k.jsxs("div",{className:"hub-header-left",children:[k.jsx("span",{className:"hub-logo",children:"🎮"}),k.jsx("span",{className:"hub-title",children:"Gaming Hub"}),k.jsx("span",{className:`hub-conn-dot ${i?"online":""}`})]}),k.jsx("nav",{className:"hub-tabs",children:t.map(x=>k.jsxs("button",{className:`hub-tab ${r===x.name?"active":""}`,onClick:()=>a(x.name),title:x.description,children:[k.jsx("span",{className:"hub-tab-icon",children:v[x.name]??"📦"}),k.jsx("span",{className:"hub-tab-label",children:x.name})]},x.name))}),k.jsxs("div",{className:"hub-header-right",children:[!window.electronAPI&&k.jsx("a",{className:"hub-download-btn",href:"/downloads/GamingHub-Setup.exe",download:!0,title:"Desktop App herunterladen",children:"⬇️"}),k.jsxs("span",{className:"hub-version",children:["v",m]})]})]}),k.jsx("main",{className:"hub-content",children:t.length===0?k.jsxs("div",{className:"hub-empty",children:[k.jsx("span",{className:"hub-empty-icon",children:"📦"}),k.jsx("h2",{children:"Keine Plugins geladen"}),k.jsx("p",{children:"Plugins werden im Server konfiguriert."})]}):t.map(x=>{const S=Zde[x.name];if(!S)return null;const w=r===x.name;return k.jsx("div",{className:`hub-tab-panel ${w?"active":""}`,style:w?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{display:"none"},children:k.jsx(S,{data:l[x.name]||{}})},x.name)})})]})}LF.createRoot(document.getElementById("root")).render(k.jsx(Jde,{}));
