From 597172d35da88a2fd0cfe6d8efd49ccb426c506d Mon Sep 17 00:00:00 2001 From: Finite <33845166+finia2NA@users.noreply.github.com> Date: Mon, 27 May 2024 01:40:09 +0200 Subject: [PATCH] Updates --- assets/index-BnUYEtN8.css | 1 - assets/index-Ty_uxmEA.js | 3996 ------------------------------------- index.html | 5 +- 3 files changed, 2 insertions(+), 4000 deletions(-) delete mode 100644 assets/index-BnUYEtN8.css delete mode 100644 assets/index-Ty_uxmEA.js diff --git a/assets/index-BnUYEtN8.css b/assets/index-BnUYEtN8.css deleted file mode 100644 index c711475..0000000 --- a/assets/index-BnUYEtN8.css +++ /dev/null @@ -1 +0,0 @@ -#root{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.fixed{position:fixed}.m-4{margin:1rem}.mb-4{margin-bottom:1rem}.mt-1{margin-top:.25rem}.mt-6{margin-top:1.5rem}.block{display:block}.flex{display:flex}.flex-row{flex-direction:row}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.p-2{padding:.5rem}.text-left{text-align:left}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.font-medium{font-weight:500}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))} diff --git a/assets/index-Ty_uxmEA.js b/assets/index-Ty_uxmEA.js deleted file mode 100644 index e9e8da1..0000000 --- a/assets/index-Ty_uxmEA.js +++ /dev/null @@ -1,3996 +0,0 @@ -var Iz=Object.defineProperty;var Dz=(n,e,t)=>e in n?Iz(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Ha=(n,e,t)=>(Dz(n,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).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 i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function ts(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var g3={exports:{}},My={},v3={exports:{}},Ft={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var rm=Symbol.for("react.element"),Uz=Symbol.for("react.portal"),Oz=Symbol.for("react.fragment"),kz=Symbol.for("react.strict_mode"),Nz=Symbol.for("react.profiler"),Fz=Symbol.for("react.provider"),zz=Symbol.for("react.context"),Bz=Symbol.for("react.forward_ref"),Gz=Symbol.for("react.suspense"),Vz=Symbol.for("react.memo"),Hz=Symbol.for("react.lazy"),oA=Symbol.iterator;function Wz(n){return n===null||typeof n!="object"?null:(n=oA&&n[oA]||n["@@iterator"],typeof n=="function"?n:null)}var y3={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_3=Object.assign,x3={};function ih(n,e,t){this.props=n,this.context=e,this.refs=x3,this.updater=t||y3}ih.prototype.isReactComponent={};ih.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};ih.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function w3(){}w3.prototype=ih.prototype;function BE(n,e,t){this.props=n,this.context=e,this.refs=x3,this.updater=t||y3}var GE=BE.prototype=new w3;GE.constructor=BE;_3(GE,ih.prototype);GE.isPureReactComponent=!0;var aA=Array.isArray,S3=Object.prototype.hasOwnProperty,VE={current:null},E3={key:!0,ref:!0,__self:!0,__source:!0};function M3(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)S3.call(e,i)&&!E3.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1>>1,z=I[U];if(0>>1;Ur(te,k))ser(ne,te)?(I[U]=ne,I[se]=k,U=se):(I[U]=te,I[J]=k,U=J);else if(ser(ne,k))I[U]=ne,I[se]=k,U=se;else break e}}return O}function r(I,O){var k=I.sortIndex-O.sortIndex;return k!==0?k:I.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,f=null,h=3,m=!1,v=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(I){for(var O=t(u);O!==null;){if(O.callback===null)i(u);else if(O.startTime<=I)i(u),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(u)}}function E(I){if(x=!1,w(I),!v)if(t(l)!==null)v=!0,V(M);else{var O=t(u);O!==null&&W(E,O.startTime-I)}}function M(I,O){v=!1,x&&(x=!1,g(P),P=-1),m=!0;var k=h;try{for(w(O),f=t(l);f!==null&&(!(f.expirationTime>O)||I&&!N());){var U=f.callback;if(typeof U=="function"){f.callback=null,h=f.priorityLevel;var z=U(f.expirationTime<=O);O=n.unstable_now(),typeof z=="function"?f.callback=z:f===t(l)&&i(l),w(O)}else i(l);f=t(l)}if(f!==null)var Q=!0;else{var J=t(u);J!==null&&W(E,J.startTime-O),Q=!1}return Q}finally{f=null,h=k,m=!1}}var b=!1,C=null,P=-1,A=5,L=-1;function N(){return!(n.unstable_now()-LI||125U?(I.sortIndex=k,e(u,I),t(l)===null&&I===t(u)&&(x?(g(P),P=-1):x=!0,W(E,k-U))):(I.sortIndex=z,e(l,I),v||m||(v=!0,V(M))),I},n.unstable_shouldYield=N,n.unstable_wrapCallback=function(I){var O=h;return function(){var k=h;h=O;try{return I.apply(this,arguments)}finally{h=k}}}})(R3);C3.exports=R3;var t4=C3.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var n4=Y,es=t4;function We(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Dw=Object.prototype.hasOwnProperty,i4=/^[: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]*$/,uA={},cA={};function r4(n){return Dw.call(cA,n)?!0:Dw.call(uA,n)?!1:i4.test(n)?cA[n]=!0:(uA[n]=!0,!1)}function s4(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function o4(n,e,t,i){if(e===null||typeof e>"u"||s4(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function vr(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Ni={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Ni[n]=new vr(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Ni[e]=new vr(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Ni[n]=new vr(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Ni[n]=new vr(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Ni[n]=new vr(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Ni[n]=new vr(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Ni[n]=new vr(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Ni[n]=new vr(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Ni[n]=new vr(n,5,!1,n.toLowerCase(),null,!1,!1)});var WE=/[\-:]([a-z])/g;function jE(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(WE,jE);Ni[e]=new vr(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(WE,jE);Ni[e]=new vr(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(WE,jE);Ni[e]=new vr(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Ni[n]=new vr(n,1,!1,n.toLowerCase(),null,!1,!1)});Ni.xlinkHref=new vr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Ni[n]=new vr(n,1,!1,n.toLowerCase(),null,!0,!0)});function XE(n,e,t,i){var r=Ni.hasOwnProperty(e)?Ni[e]:null;(r!==null?r.type!==0:i||!(2a||r[o]!==s[a]){var l=` -`+r[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{F1=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Id(n):""}function a4(n){switch(n.tag){case 5:return Id(n.type);case 16:return Id("Lazy");case 13:return Id("Suspense");case 19:return Id("SuspenseList");case 0:case 2:case 15:return n=z1(n.type,!1),n;case 11:return n=z1(n.type.render,!1),n;case 1:return n=z1(n.type,!0),n;default:return""}}function Nw(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case af:return"Fragment";case of:return"Portal";case Uw:return"Profiler";case $E:return"StrictMode";case Ow:return"Suspense";case kw:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case I3:return(n.displayName||"Context")+".Consumer";case L3:return(n._context.displayName||"Context")+".Provider";case YE:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case qE:return e=n.displayName||null,e!==null?e:Nw(n.type)||"Memo";case el:e=n._payload,n=n._init;try{return Nw(n(e))}catch{}}return null}function l4(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Nw(e);case 8:return e===$E?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function El(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function U3(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function u4(n){var e=U3(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Tg(n){n._valueTracker||(n._valueTracker=u4(n))}function O3(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=U3(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Ev(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Fw(n,e){var t=e.checked;return Gn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function hA(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=El(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function k3(n,e){e=e.checked,e!=null&&XE(n,"checked",e,!1)}function zw(n,e){k3(n,e);var t=El(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?Bw(n,e.type,t):e.hasOwnProperty("defaultValue")&&Bw(n,e.type,El(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function dA(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function Bw(n,e,t){(e!=="number"||Ev(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Dd=Array.isArray;function bf(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=bg.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function cp(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Gd={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},c4=["Webkit","ms","Moz","O"];Object.keys(Gd).forEach(function(n){c4.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Gd[e]=Gd[n]})});function B3(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Gd.hasOwnProperty(n)&&Gd[n]?(""+e).trim():e+"px"}function G3(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=B3(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var f4=Gn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Hw(n,e){if(e){if(f4[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(We(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(We(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(We(61))}if(e.style!=null&&typeof e.style!="object")throw Error(We(62))}}function Ww(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var jw=null;function KE(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Xw=null,Af=null,Cf=null;function gA(n){if(n=am(n)){if(typeof Xw!="function")throw Error(We(280));var e=n.stateNode;e&&(e=Ry(e),Xw(n.stateNode,n.type,e))}}function V3(n){Af?Cf?Cf.push(n):Cf=[n]:Af=n}function H3(){if(Af){var n=Af,e=Cf;if(Cf=Af=null,gA(n),e)for(n=0;n>>=0,n===0?32:31-(S4(n)/E4|0)|0}var Ag=64,Cg=4194304;function Ud(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Av(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=Ud(a):(s&=o,s!==0&&(i=Ud(s)))}else o=t&~r,o!==0?i=Ud(o):s!==0&&(i=Ud(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0t;t++)e.push(n);return e}function sm(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-to(e),n[e]=t}function A4(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0=Hd),TA=" ",bA=!1;function uI(n,e){switch(n){case"keyup":return tB.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cI(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var lf=!1;function iB(n,e){switch(n){case"compositionend":return cI(e);case"keypress":return e.which!==32?null:(bA=!0,TA);case"textInput":return n=e.data,n===TA&&bA?null:n;default:return null}}function rB(n,e){if(lf)return n==="compositionend"||!rM&&uI(n,e)?(n=aI(),J0=tM=sl=null,lf=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=PA(t)}}function pI(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?pI(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function mI(){for(var n=window,e=Ev();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Ev(n.document)}return e}function sM(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function dB(n){var e=mI(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&pI(t.ownerDocument.documentElement,t)){if(i!==null&&sM(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=LA(t,s);var o=LA(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,uf=null,Qw=null,jd=null,Jw=!1;function IA(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Jw||uf==null||uf!==Ev(i)||(i=uf,"selectionStart"in i&&sM(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),jd&&gp(jd,i)||(jd=i,i=Pv(Qw,"onSelect"),0hf||(n.current=sS[hf],sS[hf]=null,hf--)}function xn(n,e){hf++,sS[hf]=n.current,n.current=e}var Ml={},er=Pl(Ml),Ur=Pl(!1),Fu=Ml;function zf(n,e){var t=n.type.contextTypes;if(!t)return Ml;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Or(n){return n=n.childContextTypes,n!=null}function Iv(){Sn(Ur),Sn(er)}function zA(n,e,t){if(er.current!==Ml)throw Error(We(168));xn(er,e),xn(Ur,t)}function MI(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(We(108,l4(n)||"Unknown",r));return Gn({},t,i)}function Dv(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Ml,Fu=er.current,xn(er,n),xn(Ur,Ur.current),!0}function BA(n,e,t){var i=n.stateNode;if(!i)throw Error(We(169));t?(n=MI(n,e,Fu),i.__reactInternalMemoizedMergedChildContext=n,Sn(Ur),Sn(er),xn(er,n)):Sn(Ur),xn(Ur,t)}var fa=null,Py=!1,J1=!1;function TI(n){fa===null?fa=[n]:fa.push(n)}function TB(n){Py=!0,TI(n)}function Ll(){if(!J1&&fa!==null){J1=!0;var n=0,e=an;try{var t=fa;for(an=1;n>=o,r-=o,pa=1<<32-to(e)+r|t<P?(A=C,C=null):A=C.sibling;var L=h(g,C,w[P],E);if(L===null){C===null&&(C=A);break}n&&C&&L.alternate===null&&e(g,C),y=s(L,y,P),b===null?M=L:b.sibling=L,b=L,C=A}if(P===w.length)return t(g,C),bn&&pu(g,P),M;if(C===null){for(;PP?(A=C,C=null):A=C.sibling;var N=h(g,C,L.value,E);if(N===null){C===null&&(C=A);break}n&&C&&N.alternate===null&&e(g,C),y=s(N,y,P),b===null?M=N:b.sibling=N,b=N,C=A}if(L.done)return t(g,C),bn&&pu(g,P),M;if(C===null){for(;!L.done;P++,L=w.next())L=f(g,L.value,E),L!==null&&(y=s(L,y,P),b===null?M=L:b.sibling=L,b=L);return bn&&pu(g,P),M}for(C=i(g,C);!L.done;P++,L=w.next())L=m(C,g,P,L.value,E),L!==null&&(n&&L.alternate!==null&&C.delete(L.key===null?P:L.key),y=s(L,y,P),b===null?M=L:b.sibling=L,b=L);return n&&C.forEach(function(F){return e(g,F)}),bn&&pu(g,P),M}function _(g,y,w,E){if(typeof w=="object"&&w!==null&&w.type===af&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Mg:e:{for(var M=w.key,b=y;b!==null;){if(b.key===M){if(M=w.type,M===af){if(b.tag===7){t(g,b.sibling),y=r(b,w.props.children),y.return=g,g=y;break e}}else if(b.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===el&&HA(M)===b.type){t(g,b.sibling),y=r(b,w.props),y.ref=jh(g,b,w),y.return=g,g=y;break e}t(g,b);break}else e(g,b);b=b.sibling}w.type===af?(y=Pu(w.props.children,g.mode,E,w.key),y.return=g,g=y):(E=av(w.type,w.key,w.props,null,g.mode,E),E.ref=jh(g,y,w),E.return=g,g=E)}return o(g);case of:e:{for(b=w.key;y!==null;){if(y.key===b)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){t(g,y.sibling),y=r(y,w.children||[]),y.return=g,g=y;break e}else{t(g,y);break}else e(g,y);y=y.sibling}y=ax(w,g.mode,E),y.return=g,g=y}return o(g);case el:return b=w._init,_(g,y,b(w._payload),E)}if(Dd(w))return v(g,y,w,E);if(Bh(w))return x(g,y,w,E);Og(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(t(g,y.sibling),y=r(y,w),y.return=g,g=y):(t(g,y),y=ox(w,g.mode,E),y.return=g,g=y),o(g)):t(g,y)}return _}var Gf=RI(!0),PI=RI(!1),kv=Pl(null),Nv=null,mf=null,uM=null;function cM(){uM=mf=Nv=null}function fM(n){var e=kv.current;Sn(kv),n._currentValue=e}function lS(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Pf(n,e){Nv=n,uM=mf=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Ir=!0),n.firstContext=null)}function Is(n){var e=n._currentValue;if(uM!==n)if(n={context:n,memoizedValue:e,next:null},mf===null){if(Nv===null)throw Error(We(308));mf=n,Nv.dependencies={lanes:0,firstContext:n}}else mf=mf.next=n;return e}var Su=null;function hM(n){Su===null?Su=[n]:Su.push(n)}function LI(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,hM(e)):(t.next=r.next,r.next=t),e.interleaved=t,Ea(n,i)}function Ea(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var tl=!1;function dM(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function II(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function va(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function dl(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Wt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,Ea(n,t)}return r=i.interleaved,r===null?(e.next=e,hM(i)):(e.next=r.next,r.next=e),i.interleaved=e,Ea(n,t)}function tv(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,QE(n,t)}}function WA(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function Fv(n,e,t,i){var r=n.updateQueue;tl=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var c=n.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var f=r.baseState;o=0,c=u=l=null,a=s;do{var h=a.lane,m=a.eventTime;if((i&h)===h){c!==null&&(c=c.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=n,x=a;switch(h=e,m=t,x.tag){case 1:if(v=x.payload,typeof v=="function"){f=v.call(m,f,h);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=x.payload,h=typeof v=="function"?v.call(m,f,h):v,h==null)break e;f=Gn({},f,h);break e;case 2:tl=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,h=r.effects,h===null?r.effects=[a]:h.push(a))}else m={eventTime:m,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=m,l=f):c=c.next=m,o|=h;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;h=a,a=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);if(c===null&&(l=f),r.baseState=l,r.firstBaseUpdate=u,r.lastBaseUpdate=c,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);Gu|=o,n.lanes=o,n.memoizedState=f}}function jA(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var i=tx.transition;tx.transition={};try{n(!1),e()}finally{an=t,tx.transition=i}}function qI(){return Ds().memoizedState}function RB(n,e,t){var i=ml(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},KI(n))ZI(e,t);else if(t=LI(n,e,t,i),t!==null){var r=mr();no(t,n,i,r),QI(t,e,i)}}function PB(n,e,t){var i=ml(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(KI(n))ZI(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,ro(a,o)){var l=e.interleaved;l===null?(r.next=r,hM(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=LI(n,e,r,i),t!==null&&(r=mr(),no(t,n,i,r),QI(t,e,i))}}function KI(n){var e=n.alternate;return n===zn||e!==null&&e===zn}function ZI(n,e){Xd=Bv=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function QI(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,QE(n,t)}}var Gv={readContext:Is,useCallback:Xi,useContext:Xi,useEffect:Xi,useImperativeHandle:Xi,useInsertionEffect:Xi,useLayoutEffect:Xi,useMemo:Xi,useReducer:Xi,useRef:Xi,useState:Xi,useDebugValue:Xi,useDeferredValue:Xi,useTransition:Xi,useMutableSource:Xi,useSyncExternalStore:Xi,useId:Xi,unstable_isNewReconciler:!1},LB={readContext:Is,useCallback:function(n,e){return Mo().memoizedState=[n,e===void 0?null:e],n},useContext:Is,useEffect:$A,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,iv(4194308,4,WI.bind(null,e,n),t)},useLayoutEffect:function(n,e){return iv(4194308,4,n,e)},useInsertionEffect:function(n,e){return iv(4,2,n,e)},useMemo:function(n,e){var t=Mo();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=Mo();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=RB.bind(null,zn,n),[i.memoizedState,n]},useRef:function(n){var e=Mo();return n={current:n},e.memoizedState=n},useState:XA,useDebugValue:wM,useDeferredValue:function(n){return Mo().memoizedState=n},useTransition:function(){var n=XA(!1),e=n[0];return n=CB.bind(null,n[1]),Mo().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=zn,r=Mo();if(bn){if(t===void 0)throw Error(We(407));t=t()}else{if(t=e(),Ri===null)throw Error(We(349));Bu&30||kI(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,$A(FI.bind(null,i,s,n),[n]),i.flags|=2048,Mp(9,NI.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=Mo(),e=Ri.identifierPrefix;if(bn){var t=ma,i=pa;t=(i&~(1<<32-to(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Sp++,0<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[Ao]=e,n[_p]=i,lD(n,e,!1,!1),e.stateNode=n;e:{switch(o=Ww(t,i),t){case"dialog":wn("cancel",n),wn("close",n),r=i;break;case"iframe":case"object":case"embed":wn("load",n),r=i;break;case"video":case"audio":for(r=0;rWf&&(e.flags|=128,i=!0,Xh(s,!1),e.lanes=4194304)}else{if(!i)if(n=zv(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Xh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!bn)return $i(e),null}else 2*ti()-s.renderingStartTime>Wf&&t!==1073741824&&(e.flags|=128,i=!0,Xh(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=ti(),e.sibling=null,t=Un.current,xn(Un,i?t&1|2:t&1),e):($i(e),null);case 22:case 23:return AM(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?qr&1073741824&&($i(e),e.subtreeFlags&6&&(e.flags|=8192)):$i(e),null;case 24:return null;case 25:return null}throw Error(We(156,e.tag))}function zB(n,e){switch(aM(e),e.tag){case 1:return Or(e.type)&&Iv(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Vf(),Sn(Ur),Sn(er),gM(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return mM(e),null;case 13:if(Sn(Un),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(We(340));Bf()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return Sn(Un),null;case 4:return Vf(),null;case 10:return fM(e.type._context),null;case 22:case 23:return AM(),null;case 24:return null;default:return null}}var Ng=!1,Zi=!1,BB=typeof WeakSet=="function"?WeakSet:Set,st=null;function gf(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Xn(n,e,i)}else t.current=null}function vS(n,e,t){try{t()}catch(i){Xn(n,e,i)}}var rC=!1;function GB(n,e){if(eS=Cv,n=mI(),sM(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,u=0,c=0,f=n,h=null;t:for(;;){for(var m;f!==t||r!==0&&f.nodeType!==3||(a=o+r),f!==s||i!==0&&f.nodeType!==3||(l=o+i),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)h=f,f=m;for(;;){if(f===n)break t;if(h===t&&++u===r&&(a=o),h===s&&++c===i&&(l=o),(m=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=m}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(tS={focusedElem:n,selectionRange:t},Cv=!1,st=e;st!==null;)if(e=st,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,st=n;else for(;st!==null;){e=st;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var x=v.memoizedProps,_=v.memoizedState,g=e.stateNode,y=g.getSnapshotBeforeUpdate(e.elementType===e.type?x:$s(e.type,x),_);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(We(163))}}catch(E){Xn(e,e.return,E)}if(n=e.sibling,n!==null){n.return=e.return,st=n;break}st=e.return}return v=rC,rC=!1,v}function $d(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&vS(e,t,s)}r=r.next}while(r!==i)}}function Dy(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function yS(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function fD(n){var e=n.alternate;e!==null&&(n.alternate=null,fD(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Ao],delete e[_p],delete e[rS],delete e[EB],delete e[MB])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function hD(n){return n.tag===5||n.tag===3||n.tag===4}function sC(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||hD(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function _S(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Lv));else if(i!==4&&(n=n.child,n!==null))for(_S(n,e,t),n=n.sibling;n!==null;)_S(n,e,t),n=n.sibling}function xS(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(xS(n,e,t),n=n.sibling;n!==null;)xS(n,e,t),n=n.sibling}var Di=null,qs=!1;function Wa(n,e,t){for(t=t.child;t!==null;)dD(n,e,t),t=t.sibling}function dD(n,e,t){if(Po&&typeof Po.onCommitFiberUnmount=="function")try{Po.onCommitFiberUnmount(Ty,t)}catch{}switch(t.tag){case 5:Zi||gf(t,e);case 6:var i=Di,r=qs;Di=null,Wa(n,e,t),Di=i,qs=r,Di!==null&&(qs?(n=Di,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Di.removeChild(t.stateNode));break;case 18:Di!==null&&(qs?(n=Di,t=t.stateNode,n.nodeType===8?Q1(n.parentNode,t):n.nodeType===1&&Q1(n,t),pp(n)):Q1(Di,t.stateNode));break;case 4:i=Di,r=qs,Di=t.stateNode.containerInfo,qs=!0,Wa(n,e,t),Di=i,qs=r;break;case 0:case 11:case 14:case 15:if(!Zi&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&vS(t,e,o),r=r.next}while(r!==i)}Wa(n,e,t);break;case 1:if(!Zi&&(gf(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Xn(t,e,a)}Wa(n,e,t);break;case 21:Wa(n,e,t);break;case 22:t.mode&1?(Zi=(i=Zi)||t.memoizedState!==null,Wa(n,e,t),Zi=i):Wa(n,e,t);break;default:Wa(n,e,t)}}function oC(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new BB),e.forEach(function(i){var r=KB.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function zs(n,e){var t=e.deletions;if(t!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=ti()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*HB(i/1960))-i,10n?16:n,ol===null)var i=!1;else{if(n=ol,ol=null,Wv=0,Wt&6)throw Error(We(331));var r=Wt;for(Wt|=4,st=n.current;st!==null;){var s=st,o=s.child;if(st.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lti()-TM?Ru(n,0):MM|=t),kr(n,e)}function wD(n,e){e===0&&(n.mode&1?(e=Cg,Cg<<=1,!(Cg&130023424)&&(Cg=4194304)):e=1);var t=mr();n=Ea(n,e),n!==null&&(sm(n,e,t),kr(n,t))}function qB(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),wD(n,t)}function KB(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(We(314))}i!==null&&i.delete(e),wD(n,t)}var SD;SD=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ur.current)Ir=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Ir=!1,NB(n,e,t);Ir=!!(n.flags&131072)}else Ir=!1,bn&&e.flags&1048576&&bI(e,Ov,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;rv(n,e),n=e.pendingProps;var r=zf(e,er.current);Pf(e,t),r=yM(null,e,i,n,r,t);var s=_M();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Or(i)?(s=!0,Dv(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,dM(e),r.updater=Iy,e.stateNode=r,r._reactInternals=e,cS(e,i,n,t),e=dS(null,e,i,!0,s,t)):(e.tag=0,bn&&s&&oM(e),dr(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(rv(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=QB(i),n=$s(i,n),r){case 0:e=hS(null,e,i,n,t);break e;case 1:e=tC(null,e,i,n,t);break e;case 11:e=JA(null,e,i,n,t);break e;case 14:e=eC(null,e,i,$s(i.type,n),t);break e}throw Error(We(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:$s(i,r),hS(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:$s(i,r),tC(n,e,i,r,t);case 3:e:{if(sD(e),n===null)throw Error(We(387));i=e.pendingProps,s=e.memoizedState,r=s.element,II(n,e),Fv(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Hf(Error(We(423)),e),e=nC(n,e,i,t,r);break e}else if(i!==r){r=Hf(Error(We(424)),e),e=nC(n,e,i,t,r);break e}else for(Kr=hl(e.stateNode.containerInfo.firstChild),Qr=e,bn=!0,Ks=null,t=PI(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Bf(),i===r){e=Ma(n,e,t);break e}dr(n,e,i,t)}e=e.child}return e;case 5:return DI(e),n===null&&aS(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,nS(i,r)?o=null:s!==null&&nS(i,s)&&(e.flags|=32),rD(n,e),dr(n,e,o,t),e.child;case 6:return n===null&&aS(e),null;case 13:return oD(n,e,t);case 4:return pM(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Gf(e,null,i,t):dr(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:$s(i,r),JA(n,e,i,r,t);case 7:return dr(n,e,e.pendingProps,t),e.child;case 8:return dr(n,e,e.pendingProps.children,t),e.child;case 12:return dr(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,xn(kv,i._currentValue),i._currentValue=o,s!==null)if(ro(s.value,o)){if(s.children===r.children&&!Ur.current){e=Ma(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=va(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),lS(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(We(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),lS(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}dr(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Pf(e,t),r=Is(r),i=i(r),e.flags|=1,dr(n,e,i,t),e.child;case 14:return i=e.type,r=$s(i,e.pendingProps),r=$s(i.type,r),eC(n,e,i,r,t);case 15:return nD(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:$s(i,r),rv(n,e),e.tag=1,Or(i)?(n=!0,Dv(e)):n=!1,Pf(e,t),JI(e,i,r),cS(e,i,r,t),dS(null,e,i,!0,n,t);case 19:return aD(n,e,t);case 22:return iD(n,e,t)}throw Error(We(156,e.tag))};function ED(n,e){return K3(n,e)}function ZB(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cs(n,e,t,i){return new ZB(n,e,t,i)}function RM(n){return n=n.prototype,!(!n||!n.isReactComponent)}function QB(n){if(typeof n=="function")return RM(n)?1:0;if(n!=null){if(n=n.$$typeof,n===YE)return 11;if(n===qE)return 14}return 2}function gl(n,e){var t=n.alternate;return t===null?(t=Cs(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function av(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")RM(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case af:return Pu(t.children,r,s,e);case $E:o=8,r|=8;break;case Uw:return n=Cs(12,t,e,r|2),n.elementType=Uw,n.lanes=s,n;case Ow:return n=Cs(13,t,e,r),n.elementType=Ow,n.lanes=s,n;case kw:return n=Cs(19,t,e,r),n.elementType=kw,n.lanes=s,n;case D3:return Oy(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case L3:o=10;break e;case I3:o=9;break e;case YE:o=11;break e;case qE:o=14;break e;case el:o=16,i=null;break e}throw Error(We(130,n==null?n:typeof n,""))}return e=Cs(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function Pu(n,e,t,i){return n=Cs(7,n,i,e),n.lanes=t,n}function Oy(n,e,t,i){return n=Cs(22,n,i,e),n.elementType=D3,n.lanes=t,n.stateNode={isHidden:!1},n}function ox(n,e,t){return n=Cs(6,n,null,e),n.lanes=t,n}function ax(n,e,t){return e=Cs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function JB(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=G1(0),this.expirationTimes=G1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=G1(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function PM(n,e,t,i,r,s,o,a,l){return n=new JB(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Cs(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},dM(s),n}function e5(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(AD)}catch(n){console.error(n)}}AD(),A3.exports=ns;var s5=A3.exports,CD,pC=s5;CD=Iw.createRoot=pC.createRoot,Iw.hydrateRoot=pC.hydrateRoot;/** - * @license - * Copyright 2010-2023 Three.js Authors - * SPDX-License-Identifier: MIT - */const By="154",RD={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},o5={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},PD=0,TS=1,LD=2,a5=3,ID=0,Gy=1,Kd=2,Ys=3,ko=0,Ji=1,On=2,l5=2,ya=0,Lu=1,bS=2,AS=3,CS=4,DD=5,yu=100,UD=101,OD=102,RS=103,PS=104,kD=200,ND=201,FD=202,zD=203,UM=204,OM=205,BD=206,GD=207,VD=208,HD=209,WD=210,jD=0,XD=1,$D=2,$v=3,YD=4,qD=5,KD=6,ZD=7,um=0,QD=1,JD=2,io=0,eU=1,tU=2,nU=3,kM=4,iU=5,Vy=300,Tl=301,bl=302,bp=303,Ap=304,oh=306,Cp=1e3,Qi=1001,Rp=1002,ei=1003,Yv=1004,u5=1004,Zd=1005,c5=1005,An=1006,NM=1007,f5=1007,Al=1008,h5=1008,Io=1009,rU=1010,sU=1011,Hy=1012,FM=1013,ga=1014,Co=1015,jf=1016,zM=1017,BM=1018,vl=1020,oU=1021,Lr=1023,aU=1024,lU=1025,yl=1026,Hu=1027,uU=1028,GM=1029,cU=1030,VM=1031,HM=1033,lv=33776,uv=33777,cv=33778,fv=33779,LS=35840,IS=35841,DS=35842,US=35843,fU=36196,OS=37492,kS=37496,NS=37808,FS=37809,zS=37810,BS=37811,GS=37812,VS=37813,HS=37814,WS=37815,jS=37816,XS=37817,$S=37818,YS=37819,qS=37820,KS=37821,hv=36492,hU=36283,ZS=36284,QS=36285,JS=36286,dU=2200,pU=2201,mU=2202,Pp=2300,Lp=2301,dv=2302,Mu=2400,Tu=2401,Ip=2402,Wy=2500,WM=2501,d5=0,p5=1,m5=2,jM=3e3,_l=3001,gU=3200,XM=3201,Il=0,vU=1,xl="",At="srgb",so="srgb-linear",$M="display-p3",g5=0,pv=7680,v5=7681,y5=7682,_5=7683,x5=34055,w5=34056,S5=5386,E5=512,M5=513,T5=514,b5=515,A5=516,C5=517,R5=518,yU=519,_U=512,xU=513,wU=514,SU=515,EU=516,MU=517,TU=518,bU=519,Dp=35044,P5=35048,L5=35040,I5=35045,D5=35049,U5=35041,O5=35046,k5=35050,N5=35042,F5="100",eE="300 es",qv=1035,Ro=2e3,Up=2001;let Ca=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const 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 i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s>8&255]+Yi[n>>16&255]+Yi[n>>24&255]+"-"+Yi[e&255]+Yi[e>>8&255]+"-"+Yi[e>>16&15|64]+Yi[e>>24&255]+"-"+Yi[t&63|128]+Yi[t>>8&255]+"-"+Yi[t>>16&255]+Yi[t>>24&255]+Yi[i&255]+Yi[i>>8&255]+Yi[i>>16&255]+Yi[i>>24&255]).toLowerCase()}function $n(n,e,t){return Math.max(e,Math.min(t,n))}function YM(n,e){return(n%e+e)%e}function z5(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function B5(n,e,t){return n!==e?(t-n)/(e-n):0}function Qd(n,e,t){return(1-t)*n+t*e}function G5(n,e,t,i){return Qd(n,e,1-Math.exp(-t*i))}function V5(n,e=1){return e-Math.abs(YM(n,e*2)-e)}function H5(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function W5(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function j5(n,e){return n+Math.floor(Math.random()*(e-n+1))}function X5(n,e){return n+Math.random()*(e-n)}function $5(n){return n*(.5-Math.random())}function Y5(n){n!==void 0&&(mC=n);let e=mC+=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 q5(n){return n*Iu}function K5(n){return n*Xf}function tE(n){return(n&n-1)===0&&n!==0}function AU(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Kv(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Z5(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),u=s((e+i)/2),c=o((e+i)/2),f=s((e-i)/2),h=o((e-i)/2),m=s((i-e)/2),v=o((i-e)/2);switch(r){case"XYX":n.set(a*c,l*f,l*h,a*u);break;case"YZY":n.set(l*h,a*c,l*f,a*u);break;case"ZXZ":n.set(l*f,l*h,a*c,a*u);break;case"XZX":n.set(a*c,l*v,l*m,a*u);break;case"YXY":n.set(l*m,a*c,l*v,a*u);break;case"ZYZ":n.set(l*v,l*m,a*c,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Zr(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Dt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Zv={DEG2RAD:Iu,RAD2DEG:Xf,generateUUID:Jr,clamp:$n,euclideanModulo:YM,mapLinear:z5,inverseLerp:B5,lerp:Qd,damp:G5,pingpong:V5,smoothstep:H5,smootherstep:W5,randInt:j5,randFloat:X5,randFloatSpread:$5,seededRandom:Y5,degToRad:q5,radToDeg:K5,isPowerOfTwo:tE,ceilPowerOfTwo:AU,floorPowerOfTwo:Kv,setQuaternionFromProperEuler:Z5,normalize:Dt,denormalize:Zr};class Pe{constructor(e=0,t=0){Pe.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos($n(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Pt{constructor(e,t,i,r,s,o,a,l,u){Pt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,u)}set(e,t,i,r,s,o,a,l,u){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=s,c[5]=l,c[6]=i,c[7]=o,c[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],u=i[1],c=i[4],f=i[7],h=i[2],m=i[5],v=i[8],x=r[0],_=r[3],g=r[6],y=r[1],w=r[4],E=r[7],M=r[2],b=r[5],C=r[8];return s[0]=o*x+a*y+l*M,s[3]=o*_+a*w+l*b,s[6]=o*g+a*E+l*C,s[1]=u*x+c*y+f*M,s[4]=u*_+c*w+f*b,s[7]=u*g+c*E+f*C,s[2]=h*x+m*y+v*M,s[5]=h*_+m*w+v*b,s[8]=h*g+m*E+v*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],c=e[8];return t*o*c-t*a*u-i*s*c+i*a*l+r*s*u-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],c=e[8],f=c*o-a*u,h=a*l-c*s,m=u*s-o*l,v=t*f+i*h+r*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/v;return e[0]=f*x,e[1]=(r*u-c*i)*x,e[2]=(a*i-r*o)*x,e[3]=h*x,e[4]=(c*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=m*x,e[7]=(i*l-u*t)*x,e[8]=(o*t-i*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),u=Math.sin(s);return this.set(i*l,i*u,-i*(l*o+u*a)+o+e,-r*u,r*l,-r*(-u*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(lx.makeScale(e,t)),this}rotate(e){return this.premultiply(lx.makeRotation(-e)),this}translate(e,t){return this.premultiply(lx.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),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const lx=new Pt;function CU(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const Q5={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function yf(n,e){return new Q5[n](e)}function Op(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const gC={};function Jd(n){n in gC||(gC[n]=!0,console.warn(n))}function If(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ux(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const J5=new Pt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),eG=new Pt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function tG(n){return n.convertSRGBToLinear().applyMatrix3(eG)}function nG(n){return n.applyMatrix3(J5).convertLinearToSRGB()}const iG={[so]:n=>n,[At]:n=>n.convertSRGBToLinear(),[$M]:tG},rG={[so]:n=>n,[At]:n=>n.convertLinearToSRGB(),[$M]:nG},_s={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return so},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=iG[e],r=rG[t];if(i===void 0||r===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let bc;class qM{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{bc===void 0&&(bc=Op("canvas")),bc.width=e.width,bc.height=e.height;const i=bc.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=bc}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=Op("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Vy)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Cp:e.x=e.x-Math.floor(e.x);break;case Qi:e.x=e.x<0?0:1;break;case Rp: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 Cp:e.y=e.y-Math.floor(e.y);break;case Qi:e.y=e.y<0?0:1;break;case Rp:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Jd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===At?_l:jM}set encoding(e){Jd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===_l?At:xl}}Bn.DEFAULT_IMAGE=null;Bn.DEFAULT_MAPPING=Vy;Bn.DEFAULT_ANISOTROPY=1;class Kt{constructor(e=0,t=0,i=0,r=1){Kt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,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,i,r){return this.x=e,this.y=t,this.z=i,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,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,u=l[0],c=l[4],f=l[8],h=l[1],m=l[5],v=l[9],x=l[2],_=l[6],g=l[10];if(Math.abs(c-h)<.01&&Math.abs(f-x)<.01&&Math.abs(v-_)<.01){if(Math.abs(c+h)<.1&&Math.abs(f+x)<.1&&Math.abs(v+_)<.1&&Math.abs(u+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(u+1)/2,E=(m+1)/2,M=(g+1)/2,b=(c+h)/4,C=(f+x)/4,P=(v+_)/4;return w>E&&w>M?w<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(w),r=b/i,s=C/i):E>M?E<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(E),i=b/r,s=P/r):M<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(M),i=C/s,r=P/s),this.set(i,r,s,t),this}let y=Math.sqrt((_-v)*(_-v)+(f-x)*(f-x)+(h-c)*(h-c));return Math.abs(y)<.001&&(y=1),this.x=(_-v)/y,this.y=(f-x)/y,this.z=(h-c)/y,this.w=Math.acos((u+m+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class oo extends Ca{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Kt(0,0,e,t),this.scissorTest=!1,this.viewport=new Kt(0,0,e,t);const r={width:e,height:t,depth:1};i.encoding!==void 0&&(Jd("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===_l?At:xl),this.texture=new Bn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:An,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new bu(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class jy extends Bn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=ei,this.minFilter=ei,this.wrapR=Qi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class aG extends oo{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new jy(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class KM extends Bn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=ei,this.minFilter=ei,this.wrapR=Qi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class lG extends oo{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new KM(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class uG extends oo{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,w=1-g*g;if(w>Number.EPSILON){const M=Math.sqrt(w),b=Math.atan2(M,g*y);_=Math.sin(_*b)/M,a=Math.sin(a*b)/M}const E=a*y;if(l=l*_+h*E,u=u*_+m*E,c=c*_+v*E,f=f*_+x*E,_===1-a){const M=1/Math.sqrt(l*l+u*u+c*c+f*f);l*=M,u*=M,c*=M,f*=M}}e[t]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],u=i[r+2],c=i[r+3],f=s[o],h=s[o+1],m=s[o+2],v=s[o+3];return e[t]=a*v+c*f+l*m-u*h,e[t+1]=l*v+c*h+u*f-a*m,e[t+2]=u*v+c*m+a*h-l*f,e[t+3]=c*v-a*f-l*h-u*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,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){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,u=a(i/2),c=a(r/2),f=a(s/2),h=l(i/2),m=l(r/2),v=l(s/2);switch(o){case"XYZ":this._x=h*c*f+u*m*v,this._y=u*m*f-h*c*v,this._z=u*c*v+h*m*f,this._w=u*c*f-h*m*v;break;case"YXZ":this._x=h*c*f+u*m*v,this._y=u*m*f-h*c*v,this._z=u*c*v-h*m*f,this._w=u*c*f+h*m*v;break;case"ZXY":this._x=h*c*f-u*m*v,this._y=u*m*f+h*c*v,this._z=u*c*v+h*m*f,this._w=u*c*f-h*m*v;break;case"ZYX":this._x=h*c*f-u*m*v,this._y=u*m*f+h*c*v,this._z=u*c*v-h*m*f,this._w=u*c*f+h*m*v;break;case"YZX":this._x=h*c*f+u*m*v,this._y=u*m*f+h*c*v,this._z=u*c*v-h*m*f,this._w=u*c*f-h*m*v;break;case"XZY":this._x=h*c*f-u*m*v,this._y=u*m*f-h*c*v,this._z=u*c*v+h*m*f,this._w=u*c*f+h*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],u=t[2],c=t[6],f=t[10],h=i+a+f;if(h>0){const m=.5/Math.sqrt(h+1);this._w=.25/m,this._x=(c-l)*m,this._y=(s-u)*m,this._z=(o-r)*m}else if(i>a&&i>f){const m=2*Math.sqrt(1+i-a-f);this._w=(c-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+u)/m}else if(a>f){const m=2*Math.sqrt(1+a-i-f);this._w=(s-u)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+c)/m}else{const m=2*Math.sqrt(1+f-i-a);this._w=(o-r)/m,this._x=(s+u)/m,this._y=(l+c)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs($n(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);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 i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,u=t._z,c=t._w;return this._x=i*c+o*a+r*u-s*l,this._y=r*c+o*l+s*a-i*u,this._z=s*c+o*u+i*l-r*a,this._w=o*c-i*a-r*l-s*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const u=Math.sqrt(l),c=Math.atan2(u,a),f=Math.sin((1-t)*c)/u,h=Math.sin(t*c)/u;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=r*f+this._y*h,this._z=s*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ${constructor(e=0,t=0,i=0){$.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(vC.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(vC.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,u=l*t+o*r-a*i,c=l*i+a*t-s*r,f=l*r+s*i-o*t,h=-s*t-o*i-a*r;return this.x=u*l+h*-s+c*-a-f*-o,this.y=c*l+h*-o+f*-s-u*-a,this.z=f*l+h*-a+u*-o-c*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return fx.copy(this).projectOnVector(e),this.sub(fx)}reflect(e){return this.sub(fx.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos($n(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+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,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,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()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const fx=new $,vC=new ki;class rs{constructor(e=new $(1/0,1/0,1/0),t=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Qo),Qo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Yh),Bg.subVectors(this.max,Yh),Cc.subVectors(e.a,Yh),Rc.subVectors(e.b,Yh),Pc.subVectors(e.c,Yh),ja.subVectors(Rc,Cc),Xa.subVectors(Pc,Rc),eu.subVectors(Cc,Pc);let t=[0,-ja.z,ja.y,0,-Xa.z,Xa.y,0,-eu.z,eu.y,ja.z,0,-ja.x,Xa.z,0,-Xa.x,eu.z,0,-eu.x,-ja.y,ja.x,0,-Xa.y,Xa.x,0,-eu.y,eu.x,0];return!hx(t,Cc,Rc,Pc,Bg)||(t=[1,0,0,0,1,0,0,0,1],!hx(t,Cc,Rc,Pc,Bg))?!1:(Gg.crossVectors(ja,Xa),t=[Gg.x,Gg.y,Gg.z],hx(t,Cc,Rc,Pc,Bg))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Qo).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:(Zo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Zo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Zo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Zo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Zo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Zo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Zo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Zo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Zo),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 Zo=[new $,new $,new $,new $,new $,new $,new $,new $],Qo=new $,Ac=new rs,Cc=new $,Rc=new $,Pc=new $,ja=new $,Xa=new $,eu=new $,Yh=new $,Bg=new $,Gg=new $,tu=new $;function hx(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){tu.fromArray(n,s);const a=r.x*Math.abs(tu.x)+r.y*Math.abs(tu.y)+r.z*Math.abs(tu.z),l=e.dot(tu),u=t.dot(tu),c=i.dot(tu);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>a)return!1}return!0}const cG=new rs,qh=new $,dx=new $;let ss=class{constructor(e=new $,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):cG.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.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;qh.subVectors(e,this.center);const t=qh.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(qh,r/i),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):(dx.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(qh.copy(e.center).add(dx)),this.expandByPoint(qh.copy(e.center).sub(dx))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const Jo=new $,px=new $,Vg=new $,$a=new $,mx=new $,Hg=new $,gx=new $;class ah{constructor(e=new $,t=new $(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,Jo)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Jo.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Jo.copy(this.origin).addScaledVector(this.direction,t),Jo.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){px.copy(e).add(t).multiplyScalar(.5),Vg.copy(t).sub(e).normalize(),$a.copy(this.origin).sub(px);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Vg),a=$a.dot(this.direction),l=-$a.dot(Vg),u=$a.lengthSq(),c=Math.abs(1-o*o);let f,h,m,v;if(c>0)if(f=o*l-a,h=o*a-l,v=s*c,f>=0)if(h>=-v)if(h<=v){const x=1/c;f*=x,h*=x,m=f*(f+o*h+2*a)+h*(o*f+h+2*l)+u}else h=s,f=Math.max(0,-(o*h+a)),m=-f*f+h*(h+2*l)+u;else h=-s,f=Math.max(0,-(o*h+a)),m=-f*f+h*(h+2*l)+u;else h<=-v?(f=Math.max(0,-(-o*s+a)),h=f>0?-s:Math.min(Math.max(-s,-l),s),m=-f*f+h*(h+2*l)+u):h<=v?(f=0,h=Math.min(Math.max(-s,-l),s),m=h*(h+2*l)+u):(f=Math.max(0,-(o*s+a)),h=f>0?s:Math.min(Math.max(-s,-l),s),m=-f*f+h*(h+2*l)+u);else h=o>0?-s:s,f=Math.max(0,-(o*h+a)),m=-f*f+h*(h+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(px).addScaledVector(Vg,h),m}intersectSphere(e,t){Jo.subVectors(e.center,this.origin);const i=Jo.dot(this.direction),r=Jo.dot(Jo)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const u=1/this.direction.x,c=1/this.direction.y,f=1/this.direction.z,h=this.origin;return u>=0?(i=(e.min.x-h.x)*u,r=(e.max.x-h.x)*u):(i=(e.max.x-h.x)*u,r=(e.min.x-h.x)*u),c>=0?(s=(e.min.y-h.y)*c,o=(e.max.y-h.y)*c):(s=(e.max.y-h.y)*c,o=(e.min.y-h.y)*c),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Jo)!==null}intersectTriangle(e,t,i,r,s){mx.subVectors(t,e),Hg.subVectors(i,e),gx.crossVectors(mx,Hg);let o=this.direction.dot(gx),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;$a.subVectors(this.origin,e);const l=a*this.direction.dot(Hg.crossVectors($a,Hg));if(l<0)return null;const u=a*this.direction.dot(mx.cross($a));if(u<0||l+u>o)return null;const c=-a*$a.dot(gx);return c<0?null:this.at(c/o,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 xt{constructor(e,t,i,r,s,o,a,l,u,c,f,h,m,v,x,_){xt.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,i,r,s,o,a,l,u,c,f,h,m,v,x,_)}set(e,t,i,r,s,o,a,l,u,c,f,h,m,v,x,_){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=u,g[6]=c,g[10]=f,g[14]=h,g[3]=m,g[7]=v,g[11]=x,g[15]=_,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 xt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/Lc.setFromMatrixColumn(e,0).length(),s=1/Lc.setFromMatrixColumn(e,1).length(),o=1/Lc.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),u=Math.sin(r),c=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=o*c,m=o*f,v=a*c,x=a*f;t[0]=l*c,t[4]=-l*f,t[8]=u,t[1]=m+v*u,t[5]=h-x*u,t[9]=-a*l,t[2]=x-h*u,t[6]=v+m*u,t[10]=o*l}else if(e.order==="YXZ"){const h=l*c,m=l*f,v=u*c,x=u*f;t[0]=h+x*a,t[4]=v*a-m,t[8]=o*u,t[1]=o*f,t[5]=o*c,t[9]=-a,t[2]=m*a-v,t[6]=x+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*c,m=l*f,v=u*c,x=u*f;t[0]=h-x*a,t[4]=-o*f,t[8]=v+m*a,t[1]=m+v*a,t[5]=o*c,t[9]=x-h*a,t[2]=-o*u,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*c,m=o*f,v=a*c,x=a*f;t[0]=l*c,t[4]=v*u-m,t[8]=h*u+x,t[1]=l*f,t[5]=x*u+h,t[9]=m*u-v,t[2]=-u,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,m=o*u,v=a*l,x=a*u;t[0]=l*c,t[4]=x-h*f,t[8]=v*f+m,t[1]=f,t[5]=o*c,t[9]=-a*c,t[2]=-u*c,t[6]=m*f+v,t[10]=h-x*f}else if(e.order==="XZY"){const h=o*l,m=o*u,v=a*l,x=a*u;t[0]=l*c,t[4]=-f,t[8]=u*c,t[1]=h*f+x,t[5]=o*c,t[9]=m*f-v,t[2]=v*f-m,t[6]=a*c,t[10]=x*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(fG,e,hG)}lookAt(e,t,i){const r=this.elements;return $r.subVectors(e,t),$r.lengthSq()===0&&($r.z=1),$r.normalize(),Ya.crossVectors(i,$r),Ya.lengthSq()===0&&(Math.abs(i.z)===1?$r.x+=1e-4:$r.z+=1e-4,$r.normalize(),Ya.crossVectors(i,$r)),Ya.normalize(),Wg.crossVectors($r,Ya),r[0]=Ya.x,r[4]=Wg.x,r[8]=$r.x,r[1]=Ya.y,r[5]=Wg.y,r[9]=$r.y,r[2]=Ya.z,r[6]=Wg.z,r[10]=$r.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],u=i[12],c=i[1],f=i[5],h=i[9],m=i[13],v=i[2],x=i[6],_=i[10],g=i[14],y=i[3],w=i[7],E=i[11],M=i[15],b=r[0],C=r[4],P=r[8],A=r[12],L=r[1],N=r[5],F=r[9],B=r[13],j=r[2],q=r[6],V=r[10],W=r[14],I=r[3],O=r[7],k=r[11],U=r[15];return s[0]=o*b+a*L+l*j+u*I,s[4]=o*C+a*N+l*q+u*O,s[8]=o*P+a*F+l*V+u*k,s[12]=o*A+a*B+l*W+u*U,s[1]=c*b+f*L+h*j+m*I,s[5]=c*C+f*N+h*q+m*O,s[9]=c*P+f*F+h*V+m*k,s[13]=c*A+f*B+h*W+m*U,s[2]=v*b+x*L+_*j+g*I,s[6]=v*C+x*N+_*q+g*O,s[10]=v*P+x*F+_*V+g*k,s[14]=v*A+x*B+_*W+g*U,s[3]=y*b+w*L+E*j+M*I,s[7]=y*C+w*N+E*q+M*O,s[11]=y*P+w*F+E*V+M*k,s[15]=y*A+w*B+E*W+M*U,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],u=e[13],c=e[2],f=e[6],h=e[10],m=e[14],v=e[3],x=e[7],_=e[11],g=e[15];return v*(+s*l*f-r*u*f-s*a*h+i*u*h+r*a*m-i*l*m)+x*(+t*l*m-t*u*h+s*o*h-r*o*m+r*u*c-s*l*c)+_*(+t*u*f-t*a*m-s*o*f+i*o*m+s*a*c-i*u*c)+g*(-r*a*c-t*l*f+t*a*h+r*o*f-i*o*h+i*l*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const 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]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],c=e[8],f=e[9],h=e[10],m=e[11],v=e[12],x=e[13],_=e[14],g=e[15],y=f*_*u-x*h*u+x*l*m-a*_*m-f*l*g+a*h*g,w=v*h*u-c*_*u-v*l*m+o*_*m+c*l*g-o*h*g,E=c*x*u-v*f*u+v*a*m-o*x*m-c*a*g+o*f*g,M=v*f*l-c*x*l-v*a*h+o*x*h+c*a*_-o*f*_,b=t*y+i*w+r*E+s*M;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/b;return e[0]=y*C,e[1]=(x*h*s-f*_*s-x*r*m+i*_*m+f*r*g-i*h*g)*C,e[2]=(a*_*s-x*l*s+x*r*u-i*_*u-a*r*g+i*l*g)*C,e[3]=(f*l*s-a*h*s-f*r*u+i*h*u+a*r*m-i*l*m)*C,e[4]=w*C,e[5]=(c*_*s-v*h*s+v*r*m-t*_*m-c*r*g+t*h*g)*C,e[6]=(v*l*s-o*_*s-v*r*u+t*_*u+o*r*g-t*l*g)*C,e[7]=(o*h*s-c*l*s+c*r*u-t*h*u-o*r*m+t*l*m)*C,e[8]=E*C,e[9]=(v*f*s-c*x*s-v*i*m+t*x*m+c*i*g-t*f*g)*C,e[10]=(o*x*s-v*a*s+v*i*u-t*x*u-o*i*g+t*a*g)*C,e[11]=(c*a*s-o*f*s-c*i*u+t*f*u+o*i*m-t*a*m)*C,e[12]=M*C,e[13]=(c*x*r-v*f*r+v*i*h-t*x*h-c*i*_+t*f*_)*C,e[14]=(v*a*r-o*x*r-v*i*l+t*x*l+o*i*_-t*a*_)*C,e[15]=(o*f*r-c*a*r+c*i*l-t*f*l-o*i*h+t*a*h)*C,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,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],i=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,i,r))}makeTranslation(e,t,i){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,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,u=s*o,c=s*a;return this.set(u*o+i,u*a-r*l,u*l+r*a,0,u*a+r*l,c*a+i,c*l-r*o,0,u*l-r*a,c*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,u=s+s,c=o+o,f=a+a,h=s*u,m=s*c,v=s*f,x=o*c,_=o*f,g=a*f,y=l*u,w=l*c,E=l*f,M=i.x,b=i.y,C=i.z;return r[0]=(1-(x+g))*M,r[1]=(m+E)*M,r[2]=(v-w)*M,r[3]=0,r[4]=(m-E)*b,r[5]=(1-(h+g))*b,r[6]=(_+y)*b,r[7]=0,r[8]=(v+w)*C,r[9]=(_-y)*C,r[10]=(1-(h+x))*C,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=Lc.set(r[0],r[1],r[2]).length();const o=Lc.set(r[4],r[5],r[6]).length(),a=Lc.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],Bs.copy(this);const u=1/s,c=1/o,f=1/a;return Bs.elements[0]*=u,Bs.elements[1]*=u,Bs.elements[2]*=u,Bs.elements[4]*=c,Bs.elements[5]*=c,Bs.elements[6]*=c,Bs.elements[8]*=f,Bs.elements[9]*=f,Bs.elements[10]*=f,t.setFromRotationMatrix(Bs),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Ro){const l=this.elements,u=2*s/(t-e),c=2*s/(i-r),f=(t+e)/(t-e),h=(i+r)/(i-r);let m,v;if(a===Ro)m=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(a===Up)m=-o/(o-s),v=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=c,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Ro){const l=this.elements,u=1/(t-e),c=1/(i-r),f=1/(o-s),h=(t+e)*u,m=(i+r)*c;let v,x;if(a===Ro)v=(o+s)*f,x=-2*f;else if(a===Up)v=s*f,x=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*c,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=x,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Lc=new $,Bs=new xt,fG=new $(0,0,0),hG=new $(1,1,1),Ya=new $,Wg=new $,$r=new $,yC=new xt,_C=new ki;class nc{constructor(e=0,t=0,i=0,r=nc.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,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,i,r=this._order){return this._x=e,this._y=t,this._z=i,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,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],u=r[5],c=r[9],f=r[2],h=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin($n(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,u),this._z=0);break;case"YXZ":this._x=Math.asin(-$n(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin($n(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-$n(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin($n(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-$n(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,u),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return yC.makeRotationFromQuaternion(e),this.setFromRotationMatrix(yC,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return _C.setFromEuler(this),this.setFromQuaternion(_C,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}}nc.DEFAULT_ORDER="XYZ";class Du{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kh,e,pG),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kh,mG,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i0&&(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()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let u=0,c=l.length;u0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),u.length>0&&(i.textures=u),c.length>0&&(i.images=c),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),m.length>0&&(i.animations=m),v.length>0&&(i.nodes=v)}return i.object=r,i;function o(a){const l=[];for(const u in a){const c=a[u];delete c.metadata,l.push(c)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){Gs.subVectors(r,t),ta.subVectors(i,t),vx.subVectors(e,t);const o=Gs.dot(Gs),a=Gs.dot(ta),l=Gs.dot(vx),u=ta.dot(ta),c=ta.dot(vx),f=o*u-a*a;if(f===0)return s.set(-2,-1,-1);const h=1/f,m=(u*l-a*c)*h,v=(o*c-a*l)*h;return s.set(1-m-v,v,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,na),na.x>=0&&na.y>=0&&na.x+na.y<=1}static getUV(e,t,i,r,s,o,a,l){return Xg===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Xg=!0),this.getInterpolation(e,t,i,r,s,o,a,l)}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,na),l.setScalar(0),l.addScaledVector(s,na.x),l.addScaledVector(o,na.y),l.addScaledVector(a,na.z),l}static isFrontFacing(e,t,i,r){return Gs.subVectors(i,t),ta.subVectors(e,t),Gs.cross(ta).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),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 Gs.subVectors(this.c,this.b),ta.subVectors(this.a,this.b),Gs.cross(ta).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Pr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Pr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return Xg===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Xg=!0),Pr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return Pr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Pr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Pr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;Dc.subVectors(r,i),Uc.subVectors(s,i),yx.subVectors(e,i);const l=Dc.dot(yx),u=Uc.dot(yx);if(l<=0&&u<=0)return t.copy(i);_x.subVectors(e,r);const c=Dc.dot(_x),f=Uc.dot(_x);if(c>=0&&f<=c)return t.copy(r);const h=l*f-c*u;if(h<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(i).addScaledVector(Dc,o);xx.subVectors(e,s);const m=Dc.dot(xx),v=Uc.dot(xx);if(v>=0&&m<=v)return t.copy(s);const x=m*u-l*v;if(x<=0&&u>=0&&v<=0)return a=u/(u-v),t.copy(i).addScaledVector(Uc,a);const _=c*v-m*f;if(_<=0&&f-c>=0&&m-v>=0)return TC.subVectors(s,r),a=(f-c)/(f-c+(m-v)),t.copy(r).addScaledVector(TC,a);const g=1/(_+x+h);return o=x*g,a=h*g,t.copy(i).addScaledVector(Dc,o).addScaledVector(Uc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let vG=0;class Fi extends Ca{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:vG++}),this.uuid=Jr(),this.name="",this.type="Material",this.blending=Lu,this.side=ko,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=UM,this.blendDst=OM,this.blendEquation=yu,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=$v,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=yU,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=pv,this.stencilZFail=pv,this.stencilZPass=pv,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const 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(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Lu&&(i.blending=this.blending),this.side!==ko&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=this.alphaHash),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.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++}}const RU={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},Vs={h:0,s:0,l:0},$g={h:0,s:0,l:0};function wx(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}let Ze=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===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,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=At){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,_s.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=_s.workingColorSpace){return this.r=e,this.g=t,this.b=i,_s.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=_s.workingColorSpace){if(e=YM(e,1),t=$n(t,0,1),i=$n(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=wx(o,s,e+1/3),this.g=wx(o,s,e),this.b=wx(o,s,e-1/3)}return _s.toWorkingColorSpace(this,r),this}setStyle(e,t=At){function i(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 o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(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(a))return i(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(a))return i(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],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===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=At){const i=RU[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=If(e.r),this.g=If(e.g),this.b=If(e.b),this}copyLinearToSRGB(e){return this.r=ux(e.r),this.g=ux(e.g),this.b=ux(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=At){return _s.fromWorkingColorSpace(qi.copy(this),e),Math.round($n(qi.r*255,0,255))*65536+Math.round($n(qi.g*255,0,255))*256+Math.round($n(qi.b*255,0,255))}getHexString(e=At){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=_s.workingColorSpace){_s.fromWorkingColorSpace(qi.copy(this),t);const i=qi.r,r=qi.g,s=qi.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,u;const c=(a+o)/2;if(a===o)l=0,u=0;else{const f=o-a;switch(u=c<=.5?f/(o+a):f/(2-o-a),o){case i:l=(r-s)/f+(r>-u-14,i[l|256]=1024>>-u-14|32768,r[l]=-u-1,r[l|256]=-u-1):u<=15?(i[l]=u+15<<10,i[l|256]=u+15<<10|32768,r[l]=13,r[l|256]=13):u<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let u=l<<13,c=0;for(;!(u&8388608);)u<<=1,c-=8388608;u&=-8388609,c+=947912704,s[l]=u|c}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Ar(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=$n(n,-65504,65504),da.floatView[0]=n;const e=da.uint32View[0],t=e>>23&511;return da.baseTable[t]+((e&8388607)>>da.shiftTable[t])}function kd(n){const e=n>>10;return da.uint32View[0]=da.mantissaTable[da.offsetTable[e]+(n&1023)]+da.exponentTable[e],da.floatView[0]}const _G={toHalfFloat:Ar,fromHalfFloat:kd},oi=new $,Yg=new Pe;class ln{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Dp,this.updateRange={offset:0,count:-1},this.gpuType=Co,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const u=i[l];e.data.attributes[l]=u.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const u=this.morphAttributes[l],c=[];for(let f=0,h=u.length;f0&&(r[l]=c,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const u in r){const c=r[u];this.setAttribute(u,c.clone(t))}const s=e.morphAttributes;for(const u in s){const c=[],f=s[u];for(let h=0,m=f.length;h0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(bC.copy(s).invert(),nu.copy(e.ray).applyMatrix4(bC),!(i.boundingBox!==null&&nu.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,nu)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,u=s.attributes.uv,c=s.attributes.uv1,f=s.attributes.normal,h=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,x=h.length;vt.far?null:{distance:u,point:t0.clone(),object:n}}function n0(n,e,t,i,r,s,o,a,l,u){n.getVertexPosition(a,kc),n.getVertexPosition(l,Nc),n.getVertexPosition(u,Fc);const c=CG(n,e,t,i,kc,Nc,Fc,e0);if(c){r&&(Zg.fromBufferAttribute(r,a),Qg.fromBufferAttribute(r,l),Jg.fromBufferAttribute(r,u),c.uv=Pr.getInterpolation(e0,kc,Nc,Fc,Zg,Qg,Jg,new Pe)),s&&(Zg.fromBufferAttribute(s,a),Qg.fromBufferAttribute(s,l),Jg.fromBufferAttribute(s,u),c.uv1=Pr.getInterpolation(e0,kc,Nc,Fc,Zg,Qg,Jg,new Pe),c.uv2=c.uv1),o&&(CC.fromBufferAttribute(o,a),RC.fromBufferAttribute(o,l),PC.fromBufferAttribute(o,u),c.normal=Pr.getInterpolation(e0,kc,Nc,Fc,CC,RC,PC,new $),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));const f={a,b:l,c:u,normal:new $,materialIndex:0};Pr.getNormal(kc,Nc,Fc,f.normal),c.face=f}return c}class Dl extends Ct{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],u=[],c=[],f=[];let h=0,m=0;v("z","y","x",-1,-1,i,t,e,o,s,0),v("z","y","x",1,-1,i,t,-e,o,s,1),v("x","z","y",1,1,e,i,t,r,o,2),v("x","z","y",1,-1,e,i,-t,r,o,3),v("x","y","z",1,-1,e,t,i,r,s,4),v("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new at(u,3)),this.setAttribute("normal",new at(c,3)),this.setAttribute("uv",new at(f,2));function v(x,_,g,y,w,E,M,b,C,P,A){const L=E/C,N=M/P,F=E/2,B=M/2,j=b/2,q=C+1,V=P+1;let W=0,I=0;const O=new $;for(let k=0;k0?1:-1,c.push(O.x,O.y,O.z),f.push(z/C),f.push(1-k/P),W+=1}}for(let k=0;k0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class cm extends Zt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new xt,this.projectionMatrix=new xt,this.projectionMatrixInverse=new xt,this.coordinateSystem=Ro}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){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class li extends cm{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,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=Xf*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Iu*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Xf*2*Math.atan(Math.tan(Iu*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Iu*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,u=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/u,r*=o.width/l,i*=o.height/u}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,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 zc=-90,Bc=1;class LU extends Zt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null;const r=new li(zc,Bc,e,t);r.layers=this.layers,this.add(r);const s=new li(zc,Bc,e,t);s.layers=this.layers,this.add(s);const o=new li(zc,Bc,e,t);o.layers=this.layers,this.add(o);const a=new li(zc,Bc,e,t);a.layers=this.layers,this.add(a);const l=new li(zc,Bc,e,t);l.layers=this.layers,this.add(l);const u=new li(zc,Bc,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const u of t)this.remove(u);if(e===Ro)i.up.set(0,1,0),i.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),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Up)i.up.set(0,-1,0),i.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),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const u of t)this.add(u),u.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,s,o,a,l,u]=this.children,c=e.getRenderTarget(),f=e.toneMapping,h=e.xr.enabled;e.toneMapping=io,e.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=m,e.setRenderTarget(i,5),e.render(t,u),e.setRenderTarget(c),e.toneMapping=f,e.xr.enabled=h,i.texture.needsPMREMUpdate=!0}}class fm extends Bn{constructor(e,t,i,r,s,o,a,l,u,c){e=e!==void 0?e:[],t=t!==void 0?t:Tl,super(e,t,i,r,s,o,a,l,u,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class IU extends oo{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];t.encoding!==void 0&&(Jd("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===_l?At:xl),this.texture=new fm(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:An}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `,fragmentShader:` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - `},r=new Dl(5,5,5),s=new No({name:"CubemapFromEquirect",uniforms:$f(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ji,blending:ya});s.uniforms.tEquirect.value=t;const o=new Nn(r,s),a=t.minFilter;return t.minFilter===Al&&(t.minFilter=An),new LU(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const Mx=new $,IG=new $,DG=new Pt;class ha{constructor(e=new $(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,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Mx.subVectors(i,t).cross(IG.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 i=e.delta(Mx),r=this.normal.dot(i);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(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<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 i=t||DG.getNormalMatrix(e),r=this.coplanarPoint(Mx).applyMatrix4(e),s=this.normal.applyMatrix3(i).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 iu=new ss,i0=new $;class hm{constructor(e=new ha,t=new ha,i=new ha,r=new ha,s=new ha,o=new ha){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ro){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],u=r[4],c=r[5],f=r[6],h=r[7],m=r[8],v=r[9],x=r[10],_=r[11],g=r[12],y=r[13],w=r[14],E=r[15];if(i[0].setComponents(l-s,h-u,_-m,E-g).normalize(),i[1].setComponents(l+s,h+u,_+m,E+g).normalize(),i[2].setComponents(l+o,h+c,_+v,E+y).normalize(),i[3].setComponents(l-o,h-c,_-v,E-y).normalize(),i[4].setComponents(l-a,h-f,_-x,E-w).normalize(),t===Ro)i[5].setComponents(l+a,h+f,_+x,E+w).normalize();else if(t===Up)i[5].setComponents(a,f,x,w).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(),iu.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),iu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(iu)}intersectsSprite(e){return iu.center.set(0,0,0),iu.radius=.7071067811865476,iu.applyMatrix4(e.matrixWorld),this.intersectsSphere(iu)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,i0.y=r.normal.y>0?e.max.y:e.min.y,i0.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(i0)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function DU(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function UG(n,e){const t=e.isWebGL2,i=new WeakMap;function r(u,c){const f=u.array,h=u.usage,m=n.createBuffer();n.bindBuffer(c,m),n.bufferData(c,f,h),u.onUploadCallback();let v;if(f instanceof Float32Array)v=n.FLOAT;else if(f instanceof Uint16Array)if(u.isFloat16BufferAttribute)if(t)v=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else v=n.UNSIGNED_SHORT;else if(f instanceof Int16Array)v=n.SHORT;else if(f instanceof Uint32Array)v=n.UNSIGNED_INT;else if(f instanceof Int32Array)v=n.INT;else if(f instanceof Int8Array)v=n.BYTE;else if(f instanceof Uint8Array)v=n.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)v=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:v,bytesPerElement:f.BYTES_PER_ELEMENT,version:u.version}}function s(u,c,f){const h=c.array,m=c.updateRange;n.bindBuffer(f,u),m.count===-1?n.bufferSubData(f,0,h):(t?n.bufferSubData(f,m.offset*h.BYTES_PER_ELEMENT,h,m.offset,m.count):n.bufferSubData(f,m.offset*h.BYTES_PER_ELEMENT,h.subarray(m.offset,m.offset+m.count)),m.count=-1),c.onUploadCallback()}function o(u){return u.isInterleavedBufferAttribute&&(u=u.data),i.get(u)}function a(u){u.isInterleavedBufferAttribute&&(u=u.data);const c=i.get(u);c&&(n.deleteBuffer(c.buffer),i.delete(u))}function l(u,c){if(u.isGLBufferAttribute){const h=i.get(u);(!h||h.version 0 - vec4 plane; - #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`,qG=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,KG=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,ZG=`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,QG=`#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`,JG=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`,eV=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - varying vec3 vColor; -#endif`,tV=`#if defined( USE_COLOR_ALPHA ) - vColor = vec4( 1.0 ); -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - vColor = vec3( 1.0 ); -#endif -#ifdef USE_COLOR - vColor *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.xyz *= instanceColor.xyz; -#endif`,nV=`#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; -}; -struct GeometricContext { - vec3 position; - vec3 normal; - vec3 viewDir; -#ifdef USE_CLEARCOAT - vec3 clearcoatNormal; -#endif -}; -#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; -} -float luminance( const in vec3 rgb ) { - const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); - return dot( weights, rgb ); -} -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`,iV=`#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_v0 0.339 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_v1 0.276 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_v4 0.046 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_v5 0.016 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_v6 0.0038 - #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`,rV=`vec3 transformedNormal = objectNormal; -#ifdef USE_INSTANCING - mat3 m = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); - transformedNormal = m * transformedNormal; -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`,sV=`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,oV=`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,aV=`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,lV=`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,uV="gl_FragColor = linearToOutputTexel( gl_FragColor );",cV=`vec4 LinearToLinear( in vec4 value ) { - return value; -} -vec4 LinearTosRGB( 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 ); -}`,fV=`#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, 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`,hV=`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`,dV=`#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`,pV=`#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`,mV=`#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`,gV=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,vV=`#ifdef USE_FOG - varying float vFogDepth; -#endif`,yV=`#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`,_V=`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,xV=`#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 -}`,wV=`#ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,SV=`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,EV=`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,MV=`varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, 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`,TV=`uniform bool receiveShadow; -uniform vec3 ambientLightColor; -uniform vec3 lightProbe[ 9 ]; -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 ) { - #if defined ( LEGACY_LIGHTS ) - if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { - return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); - } - return 1.0; - #else - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; - #endif -} -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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometry.position; - 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 GeometricContext geometry, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometry.position; - 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`,bV=`#ifdef USE_ENVMAP - vec3 getIBLIrradiance( const in vec3 normal ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, 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, 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`,AV=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,CV=`varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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`,RV=`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,PV=`varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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`,LV=`PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); -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_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 ); - 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`,IV=`struct PhysicalMaterial { - vec3 diffuseColor; - float roughness; - vec3 specularColor; - float specularF90; - #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 clearcoatSpecular = vec3( 0.0 ); -vec3 sheenSpecular = 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometry.normal; - vec3 viewDir = geometry.viewDir; - vec3 position = geometry.position; - 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometry.normal, geometry.viewDir, 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 ); -}`,DV=` -GeometricContext geometry; -geometry.position = - vViewPosition; -geometry.normal = normal; -geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -#ifdef USE_CLEARCOAT - geometry.clearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometry.viewDir ) ); - 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, geometry, 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.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometry, 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, geometry, 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.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometry, 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, geometry, 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.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometry, 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, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,UV=`#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( geometry.normal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`,OV=`#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); -#endif`,kV=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,NV=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,FV=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - varying float vFragDepth; - varying float vIsPerspective; - #else - uniform float logDepthBufFC; - #endif -#endif`,zV=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); - #else - if ( isPerspectiveMatrix( projectionMatrix ) ) { - gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; - gl_Position.z *= gl_Position.w; - } - #endif -#endif`,BV=`#ifdef USE_MAP - diffuseColor *= texture2D( map, vMapUv ); -#endif`,GV=`#ifdef USE_MAP - uniform sampler2D map; -#endif`,VV=`#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`,HV=`#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`,WV=`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,jV=`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,XV=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) - 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`,$V=`#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } - #else - objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; - objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; - objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; - objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; - #endif -#endif`,YV=`#ifdef USE_MORPHTARGETS - uniform float morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - 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 ); - } - #else - #ifndef USE_MORPHNORMALS - uniform float morphTargetInfluences[ 8 ]; - #else - uniform float morphTargetInfluences[ 4 ]; - #endif - #endif -#endif`,qV=`#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } - #else - transformed += morphTarget0 * morphTargetInfluences[ 0 ]; - transformed += morphTarget1 * morphTargetInfluences[ 1 ]; - transformed += morphTarget2 * morphTargetInfluences[ 2 ]; - transformed += morphTarget3 * morphTargetInfluences[ 3 ]; - #ifndef USE_MORPHNORMALS - transformed += morphTarget4 * morphTargetInfluences[ 4 ]; - transformed += morphTarget5 * morphTargetInfluences[ 5 ]; - transformed += morphTarget6 * morphTargetInfluences[ 6 ]; - transformed += morphTarget7 * morphTargetInfluences[ 7 ]; - #endif - #endif -#endif`,KV=`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 geometryNormal = normal;`,ZV=`#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`,QV=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,JV=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,eH=`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`,tH=`#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`,nH=`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = geometryNormal; -#endif`,iH=`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,rH=`#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`,sH=`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,oH=`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,aH=`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 vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); -const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); -const float ShiftRight8 = 1. / 256.; -vec4 packDepthToRGBA( const in float v ) { - vec4 r = vec4( fract( v * PackFactors ), v ); - r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors ); -} -vec2 packDepthToRG( in highp float v ) { - return packDepthToRGBA( v ).yx; -} -float unpackRGToDepth( const in highp vec2 v ) { - return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); -} -vec4 pack2HalfToRGBA( 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( 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 ); -}`,lH=`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,uH=`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,cH=`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,fH=`#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`,hH=`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,dH=`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,pH=`#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 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 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 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 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 shadow; - } - 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 shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); - vec3 lightToPosition = shadowCoord.xyz; - float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) - vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; - return ( - 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 - return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); - #endif - } -#endif`,mH=`#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 shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - struct SpotLightShadow { - 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 shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`,gH=`#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`,vH=`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.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.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.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`,yH=`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,_H=`#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - uniform int boneTextureSize; - mat4 getBoneMatrix( const in float i ) { - float j = i * 4.0; - float x = mod( j, float( boneTextureSize ) ); - float y = floor( j / float( boneTextureSize ) ); - float dx = 1.0 / float( boneTextureSize ); - float dy = 1.0 / float( boneTextureSize ); - y = dy * ( y + 0.5 ); - vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); - vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); - vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); - vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); - mat4 bone = mat4( v1, v2, v3, v4 ); - return bone; - } -#endif`,xH=`#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`,wH=`#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`,SH=`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,EH=`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,MH=`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,TH=`#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 OptimizedCineonToneMapping( 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 ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`,bH=`#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.ior, material.thickness, - material.attenuationColor, material.attenuationDistance ); - material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); - totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,AH=`#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 ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - 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; - vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); - 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`,CH=`#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`,RH=`#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`,PH=`#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`,LH=`#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_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`;const IH=`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,DH=`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,UH=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,OH=`#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; -varying vec3 vWorldDirection; -#include -void main() { - #ifdef ENVMAP_TYPE_CUBE - vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); - #else - vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,kH=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,NH=`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 - #include -}`,FH=`#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`,zH=`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - vec4 diffuseColor = vec4( 1.0 ); - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - #include - 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 ); - #endif -}`,BH=`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`,GH=`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main () { - #include - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`,VH=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,HH=`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,WH=`uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,jH=`uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,XH=`#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,$H=`uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - 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 - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`,YH=`#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,qH=`#define LAMBERT -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,KH=`#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`,ZH=`#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - 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 - #include - #include - #include - #include - #include -}`,QH=`#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - vViewPosition = - mvPosition.xyz; -#endif -}`,JH=`#define NORMAL -uniform float opacity; -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`,e8=`#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,t8=`#define PHONG -uniform vec3 diffuse; -uniform vec3 emissive; -uniform vec3 specular; -uniform float shininess; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,n8=`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`,i8=`#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_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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); - outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`,r8=`#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`,s8=`#define TOON -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`,o8=`uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -#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 - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`,a8=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,l8=`#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,u8=`uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include -}`,c8=`uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - #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 - #include - #include -}`,f8=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`,bt={alphahash_fragment:OG,alphahash_pars_fragment:kG,alphamap_fragment:NG,alphamap_pars_fragment:FG,alphatest_fragment:zG,alphatest_pars_fragment:BG,aomap_fragment:GG,aomap_pars_fragment:VG,begin_vertex:HG,beginnormal_vertex:WG,bsdfs:jG,iridescence_fragment:XG,bumpmap_pars_fragment:$G,clipping_planes_fragment:YG,clipping_planes_pars_fragment:qG,clipping_planes_pars_vertex:KG,clipping_planes_vertex:ZG,color_fragment:QG,color_pars_fragment:JG,color_pars_vertex:eV,color_vertex:tV,common:nV,cube_uv_reflection_fragment:iV,defaultnormal_vertex:rV,displacementmap_pars_vertex:sV,displacementmap_vertex:oV,emissivemap_fragment:aV,emissivemap_pars_fragment:lV,colorspace_fragment:uV,colorspace_pars_fragment:cV,envmap_fragment:fV,envmap_common_pars_fragment:hV,envmap_pars_fragment:dV,envmap_pars_vertex:pV,envmap_physical_pars_fragment:bV,envmap_vertex:mV,fog_vertex:gV,fog_pars_vertex:vV,fog_fragment:yV,fog_pars_fragment:_V,gradientmap_pars_fragment:xV,lightmap_fragment:wV,lightmap_pars_fragment:SV,lights_lambert_fragment:EV,lights_lambert_pars_fragment:MV,lights_pars_begin:TV,lights_toon_fragment:AV,lights_toon_pars_fragment:CV,lights_phong_fragment:RV,lights_phong_pars_fragment:PV,lights_physical_fragment:LV,lights_physical_pars_fragment:IV,lights_fragment_begin:DV,lights_fragment_maps:UV,lights_fragment_end:OV,logdepthbuf_fragment:kV,logdepthbuf_pars_fragment:NV,logdepthbuf_pars_vertex:FV,logdepthbuf_vertex:zV,map_fragment:BV,map_pars_fragment:GV,map_particle_fragment:VV,map_particle_pars_fragment:HV,metalnessmap_fragment:WV,metalnessmap_pars_fragment:jV,morphcolor_vertex:XV,morphnormal_vertex:$V,morphtarget_pars_vertex:YV,morphtarget_vertex:qV,normal_fragment_begin:KV,normal_fragment_maps:ZV,normal_pars_fragment:QV,normal_pars_vertex:JV,normal_vertex:eH,normalmap_pars_fragment:tH,clearcoat_normal_fragment_begin:nH,clearcoat_normal_fragment_maps:iH,clearcoat_pars_fragment:rH,iridescence_pars_fragment:sH,opaque_fragment:oH,packing:aH,premultiplied_alpha_fragment:lH,project_vertex:uH,dithering_fragment:cH,dithering_pars_fragment:fH,roughnessmap_fragment:hH,roughnessmap_pars_fragment:dH,shadowmap_pars_fragment:pH,shadowmap_pars_vertex:mH,shadowmap_vertex:gH,shadowmask_pars_fragment:vH,skinbase_vertex:yH,skinning_pars_vertex:_H,skinning_vertex:xH,skinnormal_vertex:wH,specularmap_fragment:SH,specularmap_pars_fragment:EH,tonemapping_fragment:MH,tonemapping_pars_fragment:TH,transmission_fragment:bH,transmission_pars_fragment:AH,uv_pars_fragment:CH,uv_pars_vertex:RH,uv_vertex:PH,worldpos_vertex:LH,background_vert:IH,background_frag:DH,backgroundCube_vert:UH,backgroundCube_frag:OH,cube_vert:kH,cube_frag:NH,depth_vert:FH,depth_frag:zH,distanceRGBA_vert:BH,distanceRGBA_frag:GH,equirect_vert:VH,equirect_frag:HH,linedashed_vert:WH,linedashed_frag:jH,meshbasic_vert:XH,meshbasic_frag:$H,meshlambert_vert:YH,meshlambert_frag:qH,meshmatcap_vert:KH,meshmatcap_frag:ZH,meshnormal_vert:QH,meshnormal_frag:JH,meshphong_vert:e8,meshphong_frag:t8,meshphysical_vert:n8,meshphysical_frag:i8,meshtoon_vert:r8,meshtoon_frag:s8,points_vert:o8,points_frag:a8,shadow_vert:l8,shadow_frag:u8,sprite_vert:c8,sprite_frag:f8},Qe={common:{diffuse:{value:new Ze(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Pt},alphaMap:{value:null},alphaMapTransform:{value:new Pt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Pt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Pt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Pt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Pt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Pt},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Pt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Pt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Pt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Pt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ze(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ze(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Pt},alphaTest:{value:0},uvTransform:{value:new Pt}},sprite:{diffuse:{value:new Ze(16777215)},opacity:{value:1},center:{value:new Pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Pt},alphaMap:{value:null},alphaMapTransform:{value:new Pt},alphaTest:{value:0}}},Zs={basic:{uniforms:hr([Qe.common,Qe.specularmap,Qe.envmap,Qe.aomap,Qe.lightmap,Qe.fog]),vertexShader:bt.meshbasic_vert,fragmentShader:bt.meshbasic_frag},lambert:{uniforms:hr([Qe.common,Qe.specularmap,Qe.envmap,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.fog,Qe.lights,{emissive:{value:new Ze(0)}}]),vertexShader:bt.meshlambert_vert,fragmentShader:bt.meshlambert_frag},phong:{uniforms:hr([Qe.common,Qe.specularmap,Qe.envmap,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.fog,Qe.lights,{emissive:{value:new Ze(0)},specular:{value:new Ze(1118481)},shininess:{value:30}}]),vertexShader:bt.meshphong_vert,fragmentShader:bt.meshphong_frag},standard:{uniforms:hr([Qe.common,Qe.envmap,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.roughnessmap,Qe.metalnessmap,Qe.fog,Qe.lights,{emissive:{value:new Ze(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:bt.meshphysical_vert,fragmentShader:bt.meshphysical_frag},toon:{uniforms:hr([Qe.common,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.gradientmap,Qe.fog,Qe.lights,{emissive:{value:new Ze(0)}}]),vertexShader:bt.meshtoon_vert,fragmentShader:bt.meshtoon_frag},matcap:{uniforms:hr([Qe.common,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.fog,{matcap:{value:null}}]),vertexShader:bt.meshmatcap_vert,fragmentShader:bt.meshmatcap_frag},points:{uniforms:hr([Qe.points,Qe.fog]),vertexShader:bt.points_vert,fragmentShader:bt.points_frag},dashed:{uniforms:hr([Qe.common,Qe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:bt.linedashed_vert,fragmentShader:bt.linedashed_frag},depth:{uniforms:hr([Qe.common,Qe.displacementmap]),vertexShader:bt.depth_vert,fragmentShader:bt.depth_frag},normal:{uniforms:hr([Qe.common,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,{opacity:{value:1}}]),vertexShader:bt.meshnormal_vert,fragmentShader:bt.meshnormal_frag},sprite:{uniforms:hr([Qe.sprite,Qe.fog]),vertexShader:bt.sprite_vert,fragmentShader:bt.sprite_frag},background:{uniforms:{uvTransform:{value:new Pt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:bt.background_vert,fragmentShader:bt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:bt.backgroundCube_vert,fragmentShader:bt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:bt.cube_vert,fragmentShader:bt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:bt.equirect_vert,fragmentShader:bt.equirect_frag},distanceRGBA:{uniforms:hr([Qe.common,Qe.displacementmap,{referencePosition:{value:new $},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:bt.distanceRGBA_vert,fragmentShader:bt.distanceRGBA_frag},shadow:{uniforms:hr([Qe.lights,Qe.fog,{color:{value:new Ze(0)},opacity:{value:1}}]),vertexShader:bt.shadow_vert,fragmentShader:bt.shadow_frag}};Zs.physical={uniforms:hr([Zs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Pt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Pt},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Pt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Pt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Pt},sheen:{value:0},sheenColor:{value:new Ze(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Pt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Pt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Pt},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Pt},attenuationDistance:{value:0},attenuationColor:{value:new Ze(0)},specularColor:{value:new Ze(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Pt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Pt},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Pt}}]),vertexShader:bt.meshphysical_vert,fragmentShader:bt.meshphysical_frag};const r0={r:0,b:0,g:0};function h8(n,e,t,i,r,s,o){const a=new Ze(0);let l=s===!0?0:1,u,c,f=null,h=0,m=null;function v(_,g){let y=!1,w=g.isScene===!0?g.background:null;switch(w&&w.isTexture&&(w=(g.backgroundBlurriness>0?t:e).get(w)),w===null?x(a,l):w&&w.isColor&&(x(w,1),y=!0),n.xr.getEnvironmentBlendMode()){case"opaque":y=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,o),y=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,o),y=!0;break}(n.autoClear||y)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),w&&(w.isCubeTexture||w.mapping===oh)?(c===void 0&&(c=new Nn(new Dl(1,1,1),new No({name:"BackgroundCubeMaterial",uniforms:$f(Zs.backgroundCube.uniforms),vertexShader:Zs.backgroundCube.vertexShader,fragmentShader:Zs.backgroundCube.fragmentShader,side:Ji,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(b,C,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),c.material.uniforms.envMap.value=w,c.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=w.colorSpace!==At,(f!==w||h!==w.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,f=w,h=w.version,m=n.toneMapping),c.layers.enableAll(),_.unshift(c,c.geometry,c.material,0,0,null)):w&&w.isTexture&&(u===void 0&&(u=new Nn(new Ul(2,2),new No({name:"BackgroundMaterial",uniforms:$f(Zs.background.uniforms),vertexShader:Zs.background.vertexShader,fragmentShader:Zs.background.fragmentShader,side:ko,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(u)),u.material.uniforms.t2D.value=w,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.toneMapped=w.colorSpace!==At,w.matrixAutoUpdate===!0&&w.updateMatrix(),u.material.uniforms.uvTransform.value.copy(w.matrix),(f!==w||h!==w.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,f=w,h=w.version,m=n.toneMapping),u.layers.enableAll(),_.unshift(u,u.geometry,u.material,0,0,null))}function x(_,g){_.getRGB(r0,PU(n)),i.buffers.color.setClear(r0.r,r0.g,r0.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(_,g=1){a.set(_),l=g,x(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(_){l=_,x(a,l)},render:v}}function d8(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},l=_(null);let u=l,c=!1;function f(j,q,V,W,I){let O=!1;if(o){const k=x(W,V,q);u!==k&&(u=k,m(u.object)),O=g(j,W,V,I),O&&y(j,W,V,I)}else{const k=q.wireframe===!0;(u.geometry!==W.id||u.program!==V.id||u.wireframe!==k)&&(u.geometry=W.id,u.program=V.id,u.wireframe=k,O=!0)}I!==null&&t.update(I,n.ELEMENT_ARRAY_BUFFER),(O||c)&&(c=!1,P(j,q,V,W),I!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(I).buffer))}function h(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(j){return i.isWebGL2?n.bindVertexArray(j):s.bindVertexArrayOES(j)}function v(j){return i.isWebGL2?n.deleteVertexArray(j):s.deleteVertexArrayOES(j)}function x(j,q,V){const W=V.wireframe===!0;let I=a[j.id];I===void 0&&(I={},a[j.id]=I);let O=I[q.id];O===void 0&&(O={},I[q.id]=O);let k=O[W];return k===void 0&&(k=_(h()),O[W]=k),k}function _(j){const q=[],V=[],W=[];for(let I=0;I=0){const J=I[z];let te=O[z];if(te===void 0&&(z==="instanceMatrix"&&j.instanceMatrix&&(te=j.instanceMatrix),z==="instanceColor"&&j.instanceColor&&(te=j.instanceColor)),J===void 0||J.attribute!==te||te&&J.data!==te.data)return!0;k++}return u.attributesNum!==k||u.index!==W}function y(j,q,V,W){const I={},O=q.attributes;let k=0;const U=V.getAttributes();for(const z in U)if(U[z].location>=0){let J=O[z];J===void 0&&(z==="instanceMatrix"&&j.instanceMatrix&&(J=j.instanceMatrix),z==="instanceColor"&&j.instanceColor&&(J=j.instanceColor));const te={};te.attribute=J,J&&J.data&&(te.data=J.data),I[z]=te,k++}u.attributes=I,u.attributesNum=k,u.index=W}function w(){const j=u.newAttributes;for(let q=0,V=j.length;q=0){let Q=I[U];if(Q===void 0&&(U==="instanceMatrix"&&j.instanceMatrix&&(Q=j.instanceMatrix),U==="instanceColor"&&j.instanceColor&&(Q=j.instanceColor)),Q!==void 0){const J=Q.normalized,te=Q.itemSize,se=t.get(Q);if(se===void 0)continue;const ne=se.buffer,fe=se.type,Ie=se.bytesPerElement,Ue=i.isWebGL2===!0&&(fe===n.INT||fe===n.UNSIGNED_INT||Q.gpuType===FM);if(Q.isInterleavedBufferAttribute){const he=Q.data,H=he.stride,ae=Q.offset;if(he.isInstancedInterleavedBuffer){for(let le=0;le0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const u=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,f=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),h=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),v=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),x=n.getParameter(n.MAX_VERTEX_ATTRIBS),_=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),g=n.getParameter(n.MAX_VARYING_VECTORS),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),w=h>0,E=o||e.has("OES_texture_float"),M=w&&E,b=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:u,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:c,maxTextures:f,maxVertexTextures:h,maxTextureSize:m,maxCubemapSize:v,maxAttributes:x,maxVertexUniforms:_,maxVaryings:g,maxFragmentUniforms:y,vertexTextures:w,floatFragmentTextures:E,floatVertexTextures:M,maxSamples:b}}function g8(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new ha,a=new Pt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const m=f.length!==0||h||i!==0||r;return r=h,i=f.length,m},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=c(f,h,0)},this.setState=function(f,h,m){const v=f.clippingPlanes,x=f.clipIntersection,_=f.clipShadows,g=n.get(f);if(!r||v===null||v.length===0||s&&!_)s?c(null):u();else{const y=s?0:i,w=y*4;let E=g.clippingState||null;l.value=E,E=c(v,h,w,m);for(let M=0;M!==w;++M)E[M]=t[M];g.clippingState=E,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=y}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function c(f,h,m,v){const x=f!==null?f.length:0;let _=null;if(x!==0){if(_=l.value,v!==!0||_===null){const g=m+x*4,y=h.matrixWorldInverse;a.getNormalMatrix(y),(_===null||_.length0){const u=new IU(l.height/2);return u.fromEquirectangularTexture(n,o),e.set(o,u),o.addEventListener("dispose",r),t(u.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class ic extends cm{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,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,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,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),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const u=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=u*this.view.offsetX,o=s+u*this.view.width,a-=c*this.view.offsetY,l=a-c*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const _f=4,LC=[.125,.215,.35,.446,.526,.582],_u=20,Tx=new ic,IC=new Ze;let bx=null;const gu=(1+Math.sqrt(5))/2,Gc=1/gu,DC=[new $(1,1,1),new $(-1,1,1),new $(1,1,-1),new $(-1,1,-1),new $(0,gu,Gc),new $(0,gu,-Gc),new $(Gc,0,gu),new $(-Gc,0,gu),new $(gu,Gc,0),new $(-gu,Gc,0)];class nE{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,i=.1,r=100){bx=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,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=kC(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=OC(),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;e2?w:0,w,w),c.setRenderTarget(r),x&&c.render(v,a),c.render(e,a)}v.geometry.dispose(),v.material.dispose(),c.toneMapping=h,c.autoClear=f,e.background=_}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Tl||e.mapping===bl;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=kC()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=OC());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Nn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;s0(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Tx)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r_u&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${_u}`);const g=[];let y=0;for(let C=0;C<_u;++C){const P=C/x,A=Math.exp(-P*P/2);g.push(A),C===0?y+=A:C<_&&(y+=2*A)}for(let C=0;Cw-_f?r-w+_f:0),b=4*(this._cubeSize-E);s0(t,M,b,3*E,2*E),l.setRenderTarget(t),l.render(f,Tx)}}function y8(n){const e=[],t=[],i=[];let r=n;const s=n-_f+1+LC.length;for(let o=0;on-_f?l=LC[o-n+_f-1]:o===0&&(l=0),i.push(l);const u=1/(a-2),c=-u,f=1+u,h=[c,c,f,c,f,f,c,c,f,f,c,f],m=6,v=6,x=3,_=2,g=1,y=new Float32Array(x*v*m),w=new Float32Array(_*v*m),E=new Float32Array(g*v*m);for(let b=0;b2?0:-1,A=[C,P,0,C+2/3,P,0,C+2/3,P+1,0,C,P,0,C+2/3,P+1,0,C,P+1,0];y.set(A,x*v*b),w.set(h,_*v*b);const L=[b,b,b,b,b,b];E.set(L,g*v*b)}const M=new Ct;M.setAttribute("position",new ln(y,x)),M.setAttribute("uv",new ln(w,_)),M.setAttribute("faceIndex",new ln(E,g)),e.push(M),r>_f&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function UC(n,e,t){const i=new oo(n,e,t);return i.texture.mapping=oh,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function s0(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function _8(n,e,t){const i=new Float32Array(_u),r=new $(0,1,0);return new No({name:"SphericalGaussianBlur",defines:{n:_u,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:eT(),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 - - 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:ya,depthTest:!1,depthWrite:!1})}function OC(){return new No({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:eT(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - `,blending:ya,depthTest:!1,depthWrite:!1})}function kC(){return new No({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:eT(),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:ya,depthTest:!1,depthWrite:!1})}function eT(){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 x8(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,u=l===bp||l===Ap,c=l===Tl||l===bl;if(u||c)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let f=e.get(a);return t===null&&(t=new nE(n)),f=u?t.fromEquirectangular(a,f):t.fromCubemap(a,f),e.set(a,f),f.texture}else{if(e.has(a))return e.get(a).texture;{const f=a.image;if(u&&f&&f.height>0||c&&f&&r(f)){t===null&&(t=new nE(n));const h=u?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,h),a.addEventListener("dispose",s),h.texture}else return null}}}return a}function r(a){let l=0;const u=6;for(let c=0;ce.maxTextureSize&&(N=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const F=new Float32Array(L*N*4*x),B=new jy(F,L,N,x);B.type=Co,B.needsUpdate=!0;const j=A*4;for(let V=0;V0)return n;const r=e*t;let s=NC[r];if(s===void 0&&(s=new Float32Array(r),NC[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function vi(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` -`)}function w6(n){switch(n){case so:return["Linear","( value )"];case At:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),["Linear","( value )"]}}function WC(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` - -`+r+` - -`+x6(n.getShaderSource(e),o)}else return r}function S6(n,e){const t=w6(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function E6(n,e){let t;switch(e){case eU:t="Linear";break;case tU:t="Reinhard";break;case nU:t="OptimizedCineon";break;case kM:t="ACESFilmic";break;case iU:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function M6(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Nd).join(` -`)}function T6(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` -`)}function b6(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function iE(n){return n.replace(A6,R6)}const C6=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function R6(n,e){let t=bt[e];if(t===void 0){const i=C6.get(e);if(i!==void 0)t=bt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return iE(t)}const P6=/#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 $C(n){return n.replace(P6,L6)}function L6(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(_+=` -`),g=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(Nd).join(` -`),g.length>0&&(g+=` -`)):(_=[YC(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",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 "+c:"",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.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&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(Nd).join(` -`),g=[m,YC(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+c:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==io?"#define TONE_MAPPING":"",t.toneMapping!==io?bt.tonemapping_pars_fragment:"",t.toneMapping!==io?E6("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",bt.colorspace_pars_fragment,S6("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(Nd).join(` -`)),o=iE(o),o=jC(o,t),o=XC(o,t),a=iE(a),a=jC(a,t),a=XC(a,t),o=$C(o),a=$C(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es -`,_=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` -`)+` -`+_,g=["#define varying in",t.glslVersion===eE?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===eE?"":"#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(` -`)+` -`+g);const w=y+_+o,E=y+g+a,M=HC(r,r.VERTEX_SHADER,w),b=HC(r,r.FRAGMENT_SHADER,E);if(r.attachShader(x,M),r.attachShader(x,b),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x),n.debug.checkShaderErrors){const A=r.getProgramInfoLog(x).trim(),L=r.getShaderInfoLog(M).trim(),N=r.getShaderInfoLog(b).trim();let F=!0,B=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(F=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,x,M,b);else{const j=WC(r,M,"vertex"),q=WC(r,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+` - -Program Info Log: `+A+` -`+j+` -`+q)}else A!==""?console.warn("THREE.WebGLProgram: Program Info Log:",A):(L===""||N==="")&&(B=!1);B&&(this.diagnostics={runnable:F,programLog:A,vertexShader:{log:L,prefix:_},fragmentShader:{log:N,prefix:g}})}r.deleteShader(M),r.deleteShader(b);let C;this.getUniforms=function(){return C===void 0&&(C=new mv(r,x)),C};let P;return this.getAttributes=function(){return P===void 0&&(P=b6(r,x)),P},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=_6++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=M,this.fragmentShader=b,this}let F6=0;class z6{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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 i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new B6(e),t.set(e,i)),i}}class B6{constructor(e){this.id=F6++,this.code=e,this.usedTimes=0}}function G6(n,e,t,i,r,s,o){const a=new Du,l=new z6,u=[],c=r.isWebGL2,f=r.logarithmicDepthBuffer,h=r.vertexTextures;let m=r.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(A){return A===0?"uv":`uv${A}`}function _(A,L,N,F,B){const j=F.fog,q=B.geometry,V=A.isMeshStandardMaterial?F.environment:null,W=(A.isMeshStandardMaterial?t:e).get(A.envMap||V),I=W&&W.mapping===oh?W.image.height:null,O=v[A.type];A.precision!==null&&(m=r.getMaxPrecision(A.precision),m!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const k=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,U=k!==void 0?k.length:0;let z=0;q.morphAttributes.position!==void 0&&(z=1),q.morphAttributes.normal!==void 0&&(z=2),q.morphAttributes.color!==void 0&&(z=3);let Q,J,te,se;if(O){const zt=Zs[O];Q=zt.vertexShader,J=zt.fragmentShader}else Q=A.vertexShader,J=A.fragmentShader,l.update(A),te=l.getVertexShaderID(A),se=l.getFragmentShaderID(A);const ne=n.getRenderTarget(),fe=B.isInstancedMesh===!0,Ie=!!A.map,Ue=!!A.matcap,he=!!W,H=!!A.aoMap,ae=!!A.lightMap,le=!!A.bumpMap,me=!!A.normalMap,ce=!!A.displacementMap,De=!!A.emissiveMap,pe=!!A.metalnessMap,Ce=!!A.roughnessMap,ge=A.anisotropy>0,de=A.clearcoat>0,je=A.iridescence>0,X=A.sheen>0,G=A.transmission>0,ie=ge&&!!A.anisotropyMap,Re=de&&!!A.clearcoatMap,Se=de&&!!A.clearcoatNormalMap,be=de&&!!A.clearcoatRoughnessMap,Ve=je&&!!A.iridescenceMap,ke=je&&!!A.iridescenceThicknessMap,xe=X&&!!A.sheenColorMap,Ne=X&&!!A.sheenRoughnessMap,Ye=!!A.specularMap,Be=!!A.specularColorMap,Le=!!A.specularIntensityMap,Fe=G&&!!A.transmissionMap,it=G&&!!A.thicknessMap,gt=!!A.gradientMap,ee=!!A.alphaMap,ze=A.alphaTest>0,ye=!!A.alphaHash,He=!!A.extensions,qe=!!q.attributes.uv1,wt=!!q.attributes.uv2,Ut=!!q.attributes.uv3;return{isWebGL2:c,shaderID:O,shaderType:A.type,shaderName:A.name,vertexShader:Q,fragmentShader:J,defines:A.defines,customVertexShaderID:te,customFragmentShaderID:se,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,instancing:fe,instancingColor:fe&&B.instanceColor!==null,supportsVertexTextures:h,outputColorSpace:ne===null?n.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:so,map:Ie,matcap:Ue,envMap:he,envMapMode:he&&W.mapping,envMapCubeUVHeight:I,aoMap:H,lightMap:ae,bumpMap:le,normalMap:me,displacementMap:h&&ce,emissiveMap:De,normalMapObjectSpace:me&&A.normalMapType===vU,normalMapTangentSpace:me&&A.normalMapType===Il,metalnessMap:pe,roughnessMap:Ce,anisotropy:ge,anisotropyMap:ie,clearcoat:de,clearcoatMap:Re,clearcoatNormalMap:Se,clearcoatRoughnessMap:be,iridescence:je,iridescenceMap:Ve,iridescenceThicknessMap:ke,sheen:X,sheenColorMap:xe,sheenRoughnessMap:Ne,specularMap:Ye,specularColorMap:Be,specularIntensityMap:Le,transmission:G,transmissionMap:Fe,thicknessMap:it,gradientMap:gt,opaque:A.transparent===!1&&A.blending===Lu,alphaMap:ee,alphaTest:ze,alphaHash:ye,combine:A.combine,mapUv:Ie&&x(A.map.channel),aoMapUv:H&&x(A.aoMap.channel),lightMapUv:ae&&x(A.lightMap.channel),bumpMapUv:le&&x(A.bumpMap.channel),normalMapUv:me&&x(A.normalMap.channel),displacementMapUv:ce&&x(A.displacementMap.channel),emissiveMapUv:De&&x(A.emissiveMap.channel),metalnessMapUv:pe&&x(A.metalnessMap.channel),roughnessMapUv:Ce&&x(A.roughnessMap.channel),anisotropyMapUv:ie&&x(A.anisotropyMap.channel),clearcoatMapUv:Re&&x(A.clearcoatMap.channel),clearcoatNormalMapUv:Se&&x(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:be&&x(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Ve&&x(A.iridescenceMap.channel),iridescenceThicknessMapUv:ke&&x(A.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&x(A.sheenColorMap.channel),sheenRoughnessMapUv:Ne&&x(A.sheenRoughnessMap.channel),specularMapUv:Ye&&x(A.specularMap.channel),specularColorMapUv:Be&&x(A.specularColorMap.channel),specularIntensityMapUv:Le&&x(A.specularIntensityMap.channel),transmissionMapUv:Fe&&x(A.transmissionMap.channel),thicknessMapUv:it&&x(A.thicknessMap.channel),alphaMapUv:ee&&x(A.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(me||ge),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,vertexUv1s:qe,vertexUv2s:wt,vertexUv3s:Ut,pointsUvs:B.isPoints===!0&&!!q.attributes.uv&&(Ie||ee),fog:!!j,useFog:A.fog===!0,fogExp2:j&&j.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:B.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:U,morphTextureStride:z,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:n.shadowMap.enabled&&N.length>0,shadowMapType:n.shadowMap.type,toneMapping:A.toneMapped?n.toneMapping:io,useLegacyLights:n.useLegacyLights,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===On,flipSided:A.side===Ji,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:He&&A.extensions.derivatives===!0,extensionFragDepth:He&&A.extensions.fragDepth===!0,extensionDrawBuffers:He&&A.extensions.drawBuffers===!0,extensionShaderTextureLOD:He&&A.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:c||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||i.has("EXT_shader_texture_lod"),customProgramCacheKey:A.customProgramCacheKey()}}function g(A){const L=[];if(A.shaderID?L.push(A.shaderID):(L.push(A.customVertexShaderID),L.push(A.customFragmentShaderID)),A.defines!==void 0)for(const N in A.defines)L.push(N),L.push(A.defines[N]);return A.isRawShaderMaterial===!1&&(y(L,A),w(L,A),L.push(n.outputColorSpace)),L.push(A.customProgramCacheKey),L.join()}function y(A,L){A.push(L.precision),A.push(L.outputColorSpace),A.push(L.envMapMode),A.push(L.envMapCubeUVHeight),A.push(L.mapUv),A.push(L.alphaMapUv),A.push(L.lightMapUv),A.push(L.aoMapUv),A.push(L.bumpMapUv),A.push(L.normalMapUv),A.push(L.displacementMapUv),A.push(L.emissiveMapUv),A.push(L.metalnessMapUv),A.push(L.roughnessMapUv),A.push(L.anisotropyMapUv),A.push(L.clearcoatMapUv),A.push(L.clearcoatNormalMapUv),A.push(L.clearcoatRoughnessMapUv),A.push(L.iridescenceMapUv),A.push(L.iridescenceThicknessMapUv),A.push(L.sheenColorMapUv),A.push(L.sheenRoughnessMapUv),A.push(L.specularMapUv),A.push(L.specularColorMapUv),A.push(L.specularIntensityMapUv),A.push(L.transmissionMapUv),A.push(L.thicknessMapUv),A.push(L.combine),A.push(L.fogExp2),A.push(L.sizeAttenuation),A.push(L.morphTargetsCount),A.push(L.morphAttributeCount),A.push(L.numDirLights),A.push(L.numPointLights),A.push(L.numSpotLights),A.push(L.numSpotLightMaps),A.push(L.numHemiLights),A.push(L.numRectAreaLights),A.push(L.numDirLightShadows),A.push(L.numPointLightShadows),A.push(L.numSpotLightShadows),A.push(L.numSpotLightShadowsWithMaps),A.push(L.shadowMapType),A.push(L.toneMapping),A.push(L.numClippingPlanes),A.push(L.numClipIntersection),A.push(L.depthPacking)}function w(A,L){a.disableAll(),L.isWebGL2&&a.enable(0),L.supportsVertexTextures&&a.enable(1),L.instancing&&a.enable(2),L.instancingColor&&a.enable(3),L.matcap&&a.enable(4),L.envMap&&a.enable(5),L.normalMapObjectSpace&&a.enable(6),L.normalMapTangentSpace&&a.enable(7),L.clearcoat&&a.enable(8),L.iridescence&&a.enable(9),L.alphaTest&&a.enable(10),L.vertexColors&&a.enable(11),L.vertexAlphas&&a.enable(12),L.vertexUv1s&&a.enable(13),L.vertexUv2s&&a.enable(14),L.vertexUv3s&&a.enable(15),L.vertexTangents&&a.enable(16),L.anisotropy&&a.enable(17),A.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.skinning&&a.enable(4),L.morphTargets&&a.enable(5),L.morphNormals&&a.enable(6),L.morphColors&&a.enable(7),L.premultipliedAlpha&&a.enable(8),L.shadowMapEnabled&&a.enable(9),L.useLegacyLights&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.opaque&&a.enable(17),L.pointsUvs&&a.enable(18),A.push(a.mask)}function E(A){const L=v[A.type];let N;if(L){const F=Zs[L];N=JM.clone(F.uniforms)}else N=A.uniforms;return N}function M(A,L){let N;for(let F=0,B=u.length;F0?i.push(g):m.transparent===!0?r.push(g):t.push(g)}function l(f,h,m,v,x,_){const g=o(f,h,m,v,x,_);m.transmission>0?i.unshift(g):m.transparent===!0?r.unshift(g):t.unshift(g)}function u(f,h){t.length>1&&t.sort(f||H6),i.length>1&&i.sort(h||qC),r.length>1&&r.sort(h||qC)}function c(){for(let f=e,h=n.length;f=s.length?(o=new KC,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function j6(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new $,color:new Ze};break;case"SpotLight":t={position:new $,direction:new $,color:new Ze,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new $,color:new Ze,distance:0,decay:0};break;case"HemisphereLight":t={direction:new $,skyColor:new Ze,groundColor:new Ze};break;case"RectAreaLight":t={color:new Ze,position:new $,halfWidth:new $,halfHeight:new $};break}return n[e.id]=t,t}}}function X6(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let $6=0;function Y6(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function q6(n,e){const t=new j6,i=X6(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let c=0;c<9;c++)r.probe.push(new $);const s=new $,o=new xt,a=new xt;function l(c,f){let h=0,m=0,v=0;for(let N=0;N<9;N++)r.probe[N].set(0,0,0);let x=0,_=0,g=0,y=0,w=0,E=0,M=0,b=0,C=0,P=0;c.sort(Y6);const A=f===!0?Math.PI:1;for(let N=0,F=c.length;N0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Qe.LTC_FLOAT_1,r.rectAreaLTC2=Qe.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=Qe.LTC_HALF_1,r.rectAreaLTC2=Qe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=h,r.ambient[1]=m,r.ambient[2]=v;const L=r.hash;(L.directionalLength!==x||L.pointLength!==_||L.spotLength!==g||L.rectAreaLength!==y||L.hemiLength!==w||L.numDirectionalShadows!==E||L.numPointShadows!==M||L.numSpotShadows!==b||L.numSpotMaps!==C)&&(r.directional.length=x,r.spot.length=g,r.rectArea.length=y,r.point.length=_,r.hemi.length=w,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=M,r.pointShadowMap.length=M,r.spotShadow.length=b,r.spotShadowMap.length=b,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=M,r.spotLightMatrix.length=b+C-P,r.spotLightMap.length=C,r.numSpotLightShadowsWithMaps=P,L.directionalLength=x,L.pointLength=_,L.spotLength=g,L.rectAreaLength=y,L.hemiLength=w,L.numDirectionalShadows=E,L.numPointShadows=M,L.numSpotShadows=b,L.numSpotMaps=C,r.version=$6++)}function u(c,f){let h=0,m=0,v=0,x=0,_=0;const g=f.matrixWorldInverse;for(let y=0,w=c.length;y=a.length?(l=new ZC(n,e),a.push(l)):l=a[o],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class $y extends Fi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=gU,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 Yy extends Fi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Z6=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,Q6=`uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -#include -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 J6(n,e,t){let i=new hm;const r=new Pe,s=new Pe,o=new Kt,a=new $y({depthPacking:XM}),l=new Yy,u={},c=t.maxTextureSize,f={[ko]:Ji,[Ji]:ko,[On]:On},h=new No({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:Z6,fragmentShader:Q6}),m=h.clone();m.defines.HORIZONTAL_PASS=1;const v=new Ct;v.setAttribute("position",new ln(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Nn(v,h),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Gy;let g=this.type;this.render=function(M,b,C){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||M.length===0)return;const P=n.getRenderTarget(),A=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),N=n.state;N.setBlending(ya),N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);const F=g!==Ys&&this.type===Ys,B=g===Ys&&this.type!==Ys;for(let j=0,q=M.length;jc||r.y>c)&&(r.x>c&&(s.x=Math.floor(c/I.x),r.x=s.x*I.x,W.mapSize.x=s.x),r.y>c&&(s.y=Math.floor(c/I.y),r.y=s.y*I.y,W.mapSize.y=s.y)),W.map===null||F===!0||B===!0){const k=this.type!==Ys?{minFilter:ei,magFilter:ei}:{};W.map!==null&&W.map.dispose(),W.map=new oo(r.x,r.y,k),W.map.texture.name=V.name+".shadowMap",W.camera.updateProjectionMatrix()}n.setRenderTarget(W.map),n.clear();const O=W.getViewportCount();for(let k=0;k0||b.map&&b.alphaTest>0){const N=A.uuid,F=b.uuid;let B=u[N];B===void 0&&(B={},u[N]=B);let j=B[F];j===void 0&&(j=A.clone(),B[F]=j),A=j}if(A.visible=b.visible,A.wireframe=b.wireframe,P===Ys?A.side=b.shadowSide!==null?b.shadowSide:b.side:A.side=b.shadowSide!==null?b.shadowSide:f[b.side],A.alphaMap=b.alphaMap,A.alphaTest=b.alphaTest,A.map=b.map,A.clipShadows=b.clipShadows,A.clippingPlanes=b.clippingPlanes,A.clipIntersection=b.clipIntersection,A.displacementMap=b.displacementMap,A.displacementScale=b.displacementScale,A.displacementBias=b.displacementBias,A.wireframeLinewidth=b.wireframeLinewidth,A.linewidth=b.linewidth,C.isPointLight===!0&&A.isMeshDistanceMaterial===!0){const N=n.properties.get(A);N.light=C}return A}function E(M,b,C,P,A){if(M.visible===!1)return;if(M.layers.test(b.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&A===Ys)&&(!M.frustumCulled||i.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,M.matrixWorld);const F=e.update(M),B=M.material;if(Array.isArray(B)){const j=F.groups;for(let q=0,V=j.length;q=1):I.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(I)[1]),V=W>=2);let O=null,k={};const U=n.getParameter(n.SCISSOR_BOX),z=n.getParameter(n.VIEWPORT),Q=new Kt().fromArray(U),J=new Kt().fromArray(z);function te(ee,ze,ye,He){const qe=new Uint8Array(4),wt=n.createTexture();n.bindTexture(ee,wt),n.texParameteri(ee,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(ee,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ut=0;Ut"u"?!1:/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap;let x;const _=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(X,G){return g?new OffscreenCanvas(X,G):Op("canvas")}function w(X,G,ie,Re){let Se=1;if((X.width>Re||X.height>Re)&&(Se=Re/Math.max(X.width,X.height)),Se<1||G===!0)if(typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&X instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&X instanceof ImageBitmap){const be=G?Kv:Math.floor,Ve=be(Se*X.width),ke=be(Se*X.height);x===void 0&&(x=y(Ve,ke));const xe=ie?y(Ve,ke):x;return xe.width=Ve,xe.height=ke,xe.getContext("2d").drawImage(X,0,0,Ve,ke),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+Ve+"x"+ke+")."),xe}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+X.width+"x"+X.height+")."),X;return X}function E(X){return tE(X.width)&&tE(X.height)}function M(X){return a?!1:X.wrapS!==Qi||X.wrapT!==Qi||X.minFilter!==ei&&X.minFilter!==An}function b(X,G){return X.generateMipmaps&&G&&X.minFilter!==ei&&X.minFilter!==An}function C(X){n.generateMipmap(X)}function P(X,G,ie,Re,Se=!1){if(a===!1)return G;if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}let be=G;return G===n.RED&&(ie===n.FLOAT&&(be=n.R32F),ie===n.HALF_FLOAT&&(be=n.R16F),ie===n.UNSIGNED_BYTE&&(be=n.R8)),G===n.RG&&(ie===n.FLOAT&&(be=n.RG32F),ie===n.HALF_FLOAT&&(be=n.RG16F),ie===n.UNSIGNED_BYTE&&(be=n.RG8)),G===n.RGBA&&(ie===n.FLOAT&&(be=n.RGBA32F),ie===n.HALF_FLOAT&&(be=n.RGBA16F),ie===n.UNSIGNED_BYTE&&(be=Re===At&&Se===!1?n.SRGB8_ALPHA8:n.RGBA8),ie===n.UNSIGNED_SHORT_4_4_4_4&&(be=n.RGBA4),ie===n.UNSIGNED_SHORT_5_5_5_1&&(be=n.RGB5_A1)),(be===n.R16F||be===n.R32F||be===n.RG16F||be===n.RG32F||be===n.RGBA16F||be===n.RGBA32F)&&e.get("EXT_color_buffer_float"),be}function A(X,G,ie){return b(X,ie)===!0||X.isFramebufferTexture&&X.minFilter!==ei&&X.minFilter!==An?Math.log2(Math.max(G.width,G.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?G.mipmaps.length:1}function L(X){return X===ei||X===Yv||X===Zd?n.NEAREST:n.LINEAR}function N(X){const G=X.target;G.removeEventListener("dispose",N),B(G),G.isVideoTexture&&v.delete(G)}function F(X){const G=X.target;G.removeEventListener("dispose",F),q(G)}function B(X){const G=i.get(X);if(G.__webglInit===void 0)return;const ie=X.source,Re=_.get(ie);if(Re){const Se=Re[G.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&j(X),Object.keys(Re).length===0&&_.delete(ie)}i.remove(X)}function j(X){const G=i.get(X);n.deleteTexture(G.__webglTexture);const ie=X.source,Re=_.get(ie);delete Re[G.__cacheKey],o.memory.textures--}function q(X){const G=X.texture,ie=i.get(X),Re=i.get(G);if(Re.__webglTexture!==void 0&&(n.deleteTexture(Re.__webglTexture),o.memory.textures--),X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++)n.deleteFramebuffer(ie.__webglFramebuffer[Se]),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer[Se]);else{if(n.deleteFramebuffer(ie.__webglFramebuffer),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer),ie.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ie.__webglMultisampledFramebuffer),ie.__webglColorRenderbuffer)for(let Se=0;Se=l&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+l),V+=1,X}function O(X){const G=[];return G.push(X.wrapS),G.push(X.wrapT),G.push(X.wrapR||0),G.push(X.magFilter),G.push(X.minFilter),G.push(X.anisotropy),G.push(X.internalFormat),G.push(X.format),G.push(X.type),G.push(X.generateMipmaps),G.push(X.premultiplyAlpha),G.push(X.flipY),G.push(X.unpackAlignment),G.push(X.colorSpace),G.join()}function k(X,G){const ie=i.get(X);if(X.isVideoTexture&&de(X),X.isRenderTargetTexture===!1&&X.version>0&&ie.__version!==X.version){const Re=X.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{Ie(ie,X,G);return}}t.bindTexture(n.TEXTURE_2D,ie.__webglTexture,n.TEXTURE0+G)}function U(X,G){const ie=i.get(X);if(X.version>0&&ie.__version!==X.version){Ie(ie,X,G);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ie.__webglTexture,n.TEXTURE0+G)}function z(X,G){const ie=i.get(X);if(X.version>0&&ie.__version!==X.version){Ie(ie,X,G);return}t.bindTexture(n.TEXTURE_3D,ie.__webglTexture,n.TEXTURE0+G)}function Q(X,G){const ie=i.get(X);if(X.version>0&&ie.__version!==X.version){Ue(ie,X,G);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ie.__webglTexture,n.TEXTURE0+G)}const J={[Cp]:n.REPEAT,[Qi]:n.CLAMP_TO_EDGE,[Rp]:n.MIRRORED_REPEAT},te={[ei]:n.NEAREST,[Yv]:n.NEAREST_MIPMAP_NEAREST,[Zd]:n.NEAREST_MIPMAP_LINEAR,[An]:n.LINEAR,[NM]:n.LINEAR_MIPMAP_NEAREST,[Al]:n.LINEAR_MIPMAP_LINEAR},se={[_U]:n.NEVER,[bU]:n.ALWAYS,[xU]:n.LESS,[SU]:n.LEQUAL,[wU]:n.EQUAL,[TU]:n.GEQUAL,[EU]:n.GREATER,[MU]:n.NOTEQUAL};function ne(X,G,ie){if(ie?(n.texParameteri(X,n.TEXTURE_WRAP_S,J[G.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,J[G.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,J[G.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,te[G.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,te[G.minFilter])):(n.texParameteri(X,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(X,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(G.wrapS!==Qi||G.wrapT!==Qi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(X,n.TEXTURE_MAG_FILTER,L(G.magFilter)),n.texParameteri(X,n.TEXTURE_MIN_FILTER,L(G.minFilter)),G.minFilter!==ei&&G.minFilter!==An&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),G.compareFunction&&(n.texParameteri(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,se[G.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const Re=e.get("EXT_texture_filter_anisotropic");if(G.magFilter===ei||G.minFilter!==Zd&&G.minFilter!==Al||G.type===Co&&e.has("OES_texture_float_linear")===!1||a===!1&&G.type===jf&&e.has("OES_texture_half_float_linear")===!1)return;(G.anisotropy>1||i.get(G).__currentAnisotropy)&&(n.texParameterf(X,Re.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(G.anisotropy,r.getMaxAnisotropy())),i.get(G).__currentAnisotropy=G.anisotropy)}}function fe(X,G){let ie=!1;X.__webglInit===void 0&&(X.__webglInit=!0,G.addEventListener("dispose",N));const Re=G.source;let Se=_.get(Re);Se===void 0&&(Se={},_.set(Re,Se));const be=O(G);if(be!==X.__cacheKey){Se[be]===void 0&&(Se[be]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ie=!0),Se[be].usedTimes++;const Ve=Se[X.__cacheKey];Ve!==void 0&&(Se[X.__cacheKey].usedTimes--,Ve.usedTimes===0&&j(G)),X.__cacheKey=be,X.__webglTexture=Se[be].texture}return ie}function Ie(X,G,ie){let Re=n.TEXTURE_2D;(G.isDataArrayTexture||G.isCompressedArrayTexture)&&(Re=n.TEXTURE_2D_ARRAY),G.isData3DTexture&&(Re=n.TEXTURE_3D);const Se=fe(X,G),be=G.source;t.bindTexture(Re,X.__webglTexture,n.TEXTURE0+ie);const Ve=i.get(be);if(be.version!==Ve.__version||Se===!0){t.activeTexture(n.TEXTURE0+ie),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,G.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,G.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const ke=M(G)&&E(G.image)===!1;let xe=w(G.image,ke,!1,c);xe=je(G,xe);const Ne=E(xe)||a,Ye=s.convert(G.format,G.colorSpace);let Be=s.convert(G.type),Le=P(G.internalFormat,Ye,Be,G.colorSpace);ne(Re,G,Ne);let Fe;const it=G.mipmaps,gt=a&&G.isVideoTexture!==!0,ee=Ve.__version===void 0||Se===!0,ze=A(G,xe,Ne);if(G.isDepthTexture)Le=n.DEPTH_COMPONENT,a?G.type===Co?Le=n.DEPTH_COMPONENT32F:G.type===ga?Le=n.DEPTH_COMPONENT24:G.type===vl?Le=n.DEPTH24_STENCIL8:Le=n.DEPTH_COMPONENT16:G.type===Co&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),G.format===yl&&Le===n.DEPTH_COMPONENT&&G.type!==Hy&&G.type!==ga&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),G.type=ga,Be=s.convert(G.type)),G.format===Hu&&Le===n.DEPTH_COMPONENT&&(Le=n.DEPTH_STENCIL,G.type!==vl&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),G.type=vl,Be=s.convert(G.type))),ee&&(gt?t.texStorage2D(n.TEXTURE_2D,1,Le,xe.width,xe.height):t.texImage2D(n.TEXTURE_2D,0,Le,xe.width,xe.height,0,Ye,Be,null));else if(G.isDataTexture)if(it.length>0&&Ne){gt&&ee&&t.texStorage2D(n.TEXTURE_2D,ze,Le,it[0].width,it[0].height);for(let ye=0,He=it.length;ye>=1,He>>=1}}else if(it.length>0&&Ne){gt&&ee&&t.texStorage2D(n.TEXTURE_2D,ze,Le,it[0].width,it[0].height);for(let ye=0,He=it.length;ye0&&ee++,t.texStorage2D(n.TEXTURE_CUBE_MAP,ee,Fe,xe[0].width,xe[0].height));for(let ye=0;ye<6;ye++)if(ke){it?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,0,0,xe[ye].width,xe[ye].height,Be,Le,xe[ye].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,Fe,xe[ye].width,xe[ye].height,0,Be,Le,xe[ye].data);for(let He=0;He=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Se<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Re,Se,i.get(ie).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function H(X,G,ie){if(n.bindRenderbuffer(n.RENDERBUFFER,X),G.depthBuffer&&!G.stencilBuffer){let Re=n.DEPTH_COMPONENT16;if(ie||ge(G)){const Se=G.depthTexture;Se&&Se.isDepthTexture&&(Se.type===Co?Re=n.DEPTH_COMPONENT32F:Se.type===ga&&(Re=n.DEPTH_COMPONENT24));const be=Ce(G);ge(G)?h.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,be,Re,G.width,G.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,be,Re,G.width,G.height)}else n.renderbufferStorage(n.RENDERBUFFER,Re,G.width,G.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,X)}else if(G.depthBuffer&&G.stencilBuffer){const Re=Ce(G);ie&&ge(G)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Re,n.DEPTH24_STENCIL8,G.width,G.height):ge(G)?h.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Re,n.DEPTH24_STENCIL8,G.width,G.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,G.width,G.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,X)}else{const Re=G.isWebGLMultipleRenderTargets===!0?G.texture:[G.texture];for(let Se=0;Se0&&ge(X)===!1){const ke=be?G:[G];ie.__webglMultisampledFramebuffer=n.createFramebuffer(),ie.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ie.__webglMultisampledFramebuffer);for(let xe=0;xe0&&ge(X)===!1){const G=X.isWebGLMultipleRenderTargets?X.texture:[X.texture],ie=X.width,Re=X.height;let Se=n.COLOR_BUFFER_BIT;const be=[],Ve=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ke=i.get(X),xe=X.isWebGLMultipleRenderTargets===!0;if(xe)for(let Ne=0;Ne0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&G.__useRenderToTexture!==!1}function de(X){const G=o.render.frame;v.get(X)!==G&&(v.set(X,G),X.update())}function je(X,G){const ie=X.colorSpace,Re=X.format,Se=X.type;return X.isCompressedTexture===!0||X.format===qv||ie!==so&&ie!==xl&&(ie===At?a===!1?e.has("EXT_sRGB")===!0&&Re===Lr?(X.format=qv,X.minFilter=An,X.generateMipmaps=!1):G=qM.sRGBToLinear(G):(Re!==Lr||Se!==Io)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ie)),G}this.allocateTextureUnit=I,this.resetTextureUnits=W,this.setTexture2D=k,this.setTexture2DArray=U,this.setTexture3D=z,this.setTextureCube=Q,this.rebindTextures=me,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=De,this.updateMultisampleRenderTarget=pe,this.setupDepthRenderbuffer=le,this.setupFrameBufferTexture=he,this.useMultisampledRTT=ge}function FU(n,e,t){const i=t.isWebGL2;function r(s,o=xl){let a;if(s===Io)return n.UNSIGNED_BYTE;if(s===zM)return n.UNSIGNED_SHORT_4_4_4_4;if(s===BM)return n.UNSIGNED_SHORT_5_5_5_1;if(s===rU)return n.BYTE;if(s===sU)return n.SHORT;if(s===Hy)return n.UNSIGNED_SHORT;if(s===FM)return n.INT;if(s===ga)return n.UNSIGNED_INT;if(s===Co)return n.FLOAT;if(s===jf)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===oU)return n.ALPHA;if(s===Lr)return n.RGBA;if(s===aU)return n.LUMINANCE;if(s===lU)return n.LUMINANCE_ALPHA;if(s===yl)return n.DEPTH_COMPONENT;if(s===Hu)return n.DEPTH_STENCIL;if(s===qv)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===uU)return n.RED;if(s===GM)return n.RED_INTEGER;if(s===cU)return n.RG;if(s===VM)return n.RG_INTEGER;if(s===HM)return n.RGBA_INTEGER;if(s===lv||s===uv||s===cv||s===fv)if(o===At)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===lv)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===uv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===cv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===fv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===lv)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===uv)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===cv)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===fv)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===LS||s===IS||s===DS||s===US)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===LS)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===IS)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===DS)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===US)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===fU)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===OS||s===kS)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===OS)return o===At?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===kS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===NS||s===FS||s===zS||s===BS||s===GS||s===VS||s===HS||s===WS||s===jS||s===XS||s===$S||s===YS||s===qS||s===KS)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===NS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===FS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===zS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===BS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===GS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===VS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===HS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===WS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===jS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===XS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===$S)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===YS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===qS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===KS)return o===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===hv)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===hv)return o===At?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===hU||s===ZS||s===QS||s===JS)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===hv)return a.COMPRESSED_RED_RGTC1_EXT;if(s===ZS)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===QS)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===JS)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===vl?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class zU extends li{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class xf extends Zt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const nW={type:"move"};class Cx{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xf,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 xf,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new xf,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(const x of e.hand.values()){const _=t.getJointPose(x,i),g=this._getHandJoint(u,x);_!==null&&(g.matrix.fromArray(_.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=_.radius),g.visible=_!==null}const c=u.joints["index-finger-tip"],f=u.joints["thumb-tip"],h=c.position.distanceTo(f.position),m=.02,v=.005;u.inputState.pinching&&h>m+v?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&h<=m-v&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(nW)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new xf;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class BU extends Bn{constructor(e,t,i,r,s,o,a,l,u,c){if(c=c!==void 0?c:yl,c!==yl&&c!==Hu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&c===yl&&(i=ga),i===void 0&&c===Hu&&(i=vl),super(null,r,s,o,a,l,c,i,u),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:ei,this.minFilter=l!==void 0?l:ei,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 iW extends Ca{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,u=null,c=null,f=null,h=null,m=null,v=null;const x=t.getContextAttributes();let _=null,g=null;const y=[],w=[],E=new li;E.layers.enable(1),E.viewport=new Kt;const M=new li;M.layers.enable(2),M.viewport=new Kt;const b=[E,M],C=new zU;C.layers.enable(1),C.layers.enable(2);let P=null,A=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(U){let z=y[U];return z===void 0&&(z=new Cx,y[U]=z),z.getTargetRaySpace()},this.getControllerGrip=function(U){let z=y[U];return z===void 0&&(z=new Cx,y[U]=z),z.getGripSpace()},this.getHand=function(U){let z=y[U];return z===void 0&&(z=new Cx,y[U]=z),z.getHandSpace()};function L(U){const z=w.indexOf(U.inputSource);if(z===-1)return;const Q=y[z];Q!==void 0&&(Q.update(U.inputSource,U.frame,u||o),Q.dispatchEvent({type:U.type,data:U.inputSource}))}function N(){r.removeEventListener("select",L),r.removeEventListener("selectstart",L),r.removeEventListener("selectend",L),r.removeEventListener("squeeze",L),r.removeEventListener("squeezestart",L),r.removeEventListener("squeezeend",L),r.removeEventListener("end",N),r.removeEventListener("inputsourceschange",F);for(let U=0;U=0&&(w[J]=null,y[J].disconnect(Q))}for(let z=0;z=w.length){w.push(Q),J=se;break}else if(w[se]===null){w[se]=Q,J=se;break}if(J===-1)break}const te=y[J];te&&te.connect(Q)}}const B=new $,j=new $;function q(U,z,Q){B.setFromMatrixPosition(z.matrixWorld),j.setFromMatrixPosition(Q.matrixWorld);const J=B.distanceTo(j),te=z.projectionMatrix.elements,se=Q.projectionMatrix.elements,ne=te[14]/(te[10]-1),fe=te[14]/(te[10]+1),Ie=(te[9]+1)/te[5],Ue=(te[9]-1)/te[5],he=(te[8]-1)/te[0],H=(se[8]+1)/se[0],ae=ne*he,le=ne*H,me=J/(-he+H),ce=me*-he;z.matrixWorld.decompose(U.position,U.quaternion,U.scale),U.translateX(ce),U.translateZ(me),U.matrixWorld.compose(U.position,U.quaternion,U.scale),U.matrixWorldInverse.copy(U.matrixWorld).invert();const De=ne+me,pe=fe+me,Ce=ae-ce,ge=le+(J-ce),de=Ie*fe/pe*De,je=Ue*fe/pe*De;U.projectionMatrix.makePerspective(Ce,ge,de,je,De,pe),U.projectionMatrixInverse.copy(U.projectionMatrix).invert()}function V(U,z){z===null?U.matrixWorld.copy(U.matrix):U.matrixWorld.multiplyMatrices(z.matrixWorld,U.matrix),U.matrixWorldInverse.copy(U.matrixWorld).invert()}this.updateCamera=function(U){if(r===null)return;C.near=M.near=E.near=U.near,C.far=M.far=E.far=U.far,(P!==C.near||A!==C.far)&&(r.updateRenderState({depthNear:C.near,depthFar:C.far}),P=C.near,A=C.far);const z=U.parent,Q=C.cameras;V(C,z);for(let J=0;J0&&(_.alphaTest.value=g.alphaTest);const y=e.get(g).envMap;if(y&&(_.envMap.value=y,_.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=g.reflectivity,_.ior.value=g.ior,_.refractionRatio.value=g.refractionRatio),g.lightMap){_.lightMap.value=g.lightMap;const w=n.useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=g.lightMapIntensity*w,t(g.lightMap,_.lightMapTransform)}g.aoMap&&(_.aoMap.value=g.aoMap,_.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,_.aoMapTransform))}function o(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform))}function a(_,g){_.dashSize.value=g.dashSize,_.totalSize.value=g.dashSize+g.gapSize,_.scale.value=g.scale}function l(_,g,y,w){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.size.value=g.size*y,_.scale.value=w*.5,g.map&&(_.map.value=g.map,t(g.map,_.uvTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function u(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.rotation.value=g.rotation,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function c(_,g){_.specular.value.copy(g.specular),_.shininess.value=Math.max(g.shininess,1e-4)}function f(_,g){g.gradientMap&&(_.gradientMap.value=g.gradientMap)}function h(_,g){_.metalness.value=g.metalness,g.metalnessMap&&(_.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,_.metalnessMapTransform)),_.roughness.value=g.roughness,g.roughnessMap&&(_.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,_.roughnessMapTransform)),e.get(g).envMap&&(_.envMapIntensity.value=g.envMapIntensity)}function m(_,g,y){_.ior.value=g.ior,g.sheen>0&&(_.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),_.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(_.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,_.sheenColorMapTransform)),g.sheenRoughnessMap&&(_.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,_.sheenRoughnessMapTransform))),g.clearcoat>0&&(_.clearcoat.value=g.clearcoat,_.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(_.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,_.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(_.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Ji&&_.clearcoatNormalScale.value.negate())),g.iridescence>0&&(_.iridescence.value=g.iridescence,_.iridescenceIOR.value=g.iridescenceIOR,_.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(_.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,_.iridescenceMapTransform)),g.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),g.transmission>0&&(_.transmission.value=g.transmission,_.transmissionSamplerMap.value=y.texture,_.transmissionSamplerSize.value.set(y.width,y.height),g.transmissionMap&&(_.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,_.transmissionMapTransform)),_.thickness.value=g.thickness,g.thicknessMap&&(_.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=g.attenuationDistance,_.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(_.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(_.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=g.specularIntensity,_.specularColor.value.copy(g.specularColor),g.specularColorMap&&(_.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,_.specularColorMapTransform)),g.specularIntensityMap&&(_.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,_.specularIntensityMapTransform))}function v(_,g){g.matcap&&(_.matcap.value=g.matcap)}function x(_,g){const y=e.get(g).light;_.referencePosition.value.setFromMatrixPosition(y.matrixWorld),_.nearDistance.value=y.shadow.camera.near,_.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function sW(n,e,t,i){let r={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(y,w){const E=w.program;i.uniformBlockBinding(y,E)}function u(y,w){let E=r[y.id];E===void 0&&(v(y),E=c(y),r[y.id]=E,y.addEventListener("dispose",_));const M=w.program;i.updateUBOMapping(y,M);const b=e.render.frame;s[y.id]!==b&&(h(y),s[y.id]=b)}function c(y){const w=f();y.__bindingPointIndex=w;const E=n.createBuffer(),M=y.__size,b=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,M,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,E),E}function f(){for(let y=0;y0){b=E%M;const F=M-b;b!==0&&F-L.boundary<0&&(E+=M-b,A.__offset=E)}E+=L.storage}return b=E%M,b>0&&(E+=M-b),y.__size=E,y.__cache={},this}function x(y){const w={boundary:0,storage:0};return typeof y=="number"?(w.boundary=4,w.storage=4):y.isVector2?(w.boundary=8,w.storage=8):y.isVector3||y.isColor?(w.boundary=16,w.storage=12):y.isVector4?(w.boundary=16,w.storage=16):y.isMatrix3?(w.boundary=48,w.storage=48):y.isMatrix4?(w.boundary=64,w.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),w}function _(y){const w=y.target;w.removeEventListener("dispose",_);const E=o.indexOf(w.__bindingPointIndex);o.splice(E,1),n.deleteBuffer(r[w.id]),delete r[w.id],delete s[w.id]}function g(){for(const y in r)n.deleteBuffer(r[y]);o=[],r={},s={}}return{bind:l,update:u,dispose:g}}function oW(){const n=Op("canvas");return n.style.display="block",n}class tT{constructor(e={}){const{canvas:t=oW(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;i!==null?h=i.getContextAttributes().alpha:h=o;const m=new Uint32Array(4),v=new Int32Array(4);let x=null,_=null;const g=[],y=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputColorSpace=At,this.useLegacyLights=!0,this.toneMapping=io,this.toneMappingExposure=1;const w=this;let E=!1,M=0,b=0,C=null,P=-1,A=null;const L=new Kt,N=new Kt;let F=null;const B=new Ze(0);let j=0,q=t.width,V=t.height,W=1,I=null,O=null;const k=new Kt(0,0,q,V),U=new Kt(0,0,q,V);let z=!1;const Q=new hm;let J=!1,te=!1,se=null;const ne=new xt,fe=new Pe,Ie=new $,Ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function he(){return C===null?W:1}let H=i;function ae(K,ve){for(let Me=0;Me0?_=y[y.length-1]:_=null,g.pop(),g.length>0?x=g[g.length-1]:x=null};function zi(K,ve,Me,ue){if(K.visible===!1)return;if(K.layers.test(ve.layers)){if(K.isGroup)Me=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(ve);else if(K.isLight)_.pushLight(K),K.castShadow&&_.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||Q.intersectsSprite(K)){ue&&Ie.setFromMatrixPosition(K.matrixWorld).applyMatrix4(ne);const ct=G.update(K),ft=K.material;ft.visible&&x.push(K,ct,ft,Me,Ie.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||Q.intersectsObject(K))){const ct=G.update(K),ft=K.material;if(ue&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),Ie.copy(K.boundingSphere.center)):(ct.boundingSphere===null&&ct.computeBoundingSphere(),Ie.copy(ct.boundingSphere.center)),Ie.applyMatrix4(K.matrixWorld).applyMatrix4(ne)),Array.isArray(ft)){const mt=ct.groups;for(let Et=0,Oe=mt.length;Et0&&jt(Te,rt,ve,Me),ue&&ce.viewport(L.copy(ue)),Te.length>0&&vn(Te,ve,Me),rt.length>0&&vn(rt,ve,Me),ct.length>0&&vn(ct,ve,Me),ce.buffers.depth.setTest(!0),ce.buffers.depth.setMask(!0),ce.buffers.color.setMask(!0),ce.setPolygonOffset(!1)}function jt(K,ve,Me,ue){const Te=me.isWebGL2;se===null&&(se=new oo(1,1,{generateMipmaps:!0,type:le.has("EXT_color_buffer_half_float")?jf:Io,minFilter:Al,samples:Te?4:0})),w.getDrawingBufferSize(fe),Te?se.setSize(fe.x,fe.y):se.setSize(Kv(fe.x),Kv(fe.y));const rt=w.getRenderTarget();w.setRenderTarget(se),w.getClearColor(B),j=w.getClearAlpha(),j<1&&w.setClearColor(16777215,.5),w.clear();const ct=w.toneMapping;w.toneMapping=io,vn(K,Me,ue),Ce.updateMultisampleRenderTarget(se),Ce.updateRenderTargetMipmap(se);let ft=!1;for(let mt=0,Et=ve.length;mt0),ht=!!Me.morphAttributes.position,cn=!!Me.morphAttributes.normal,Xt=!!Me.morphAttributes.color,xi=ue.toneMapped?w.toneMapping:io,Bi=Me.morphAttributes.position||Me.morphAttributes.normal||Me.morphAttributes.color,Jt=Bi!==void 0?Bi.length:0,yt=pe.get(ue),Vt=_.state.lights;if(J===!0&&(te===!0||K!==A)){const ii=K===A&&ue.id===P;Ve.setState(ue,K,ii)}let _t=!1;ue.version===yt.__version?(yt.needsLights&&yt.lightsStateVersion!==Vt.state.version||yt.outputColorSpace!==ft||Te.isInstancedMesh&&yt.instancing===!1||!Te.isInstancedMesh&&yt.instancing===!0||Te.isSkinnedMesh&&yt.skinning===!1||!Te.isSkinnedMesh&&yt.skinning===!0||yt.envMap!==mt||ue.fog===!0&&yt.fog!==rt||yt.numClippingPlanes!==void 0&&(yt.numClippingPlanes!==Ve.numPlanes||yt.numIntersection!==Ve.numIntersection)||yt.vertexAlphas!==Et||yt.vertexTangents!==Oe||yt.morphTargets!==ht||yt.morphNormals!==cn||yt.morphColors!==Xt||yt.toneMapping!==xi||me.isWebGL2===!0&&yt.morphTargetsCount!==Jt)&&(_t=!0):(_t=!0,yt.__version=ue.version);let qn=yt.currentProgram;_t===!0&&(qn=pn(ue,ve,Te));let Vn=!1,En=!1,xr=!1;const fn=qn.getUniforms(),yn=yt.uniforms;if(ce.useProgram(qn.program)&&(Vn=!0,En=!0,xr=!0),ue.id!==P&&(P=ue.id,En=!0),Vn||A!==K){if(fn.setValue(H,"projectionMatrix",K.projectionMatrix),me.logarithmicDepthBuffer&&fn.setValue(H,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),A!==K&&(A=K,En=!0,xr=!0),ue.isShaderMaterial||ue.isMeshPhongMaterial||ue.isMeshToonMaterial||ue.isMeshStandardMaterial||ue.envMap){const ii=fn.map.cameraPosition;ii!==void 0&&ii.setValue(H,Ie.setFromMatrixPosition(K.matrixWorld))}(ue.isMeshPhongMaterial||ue.isMeshToonMaterial||ue.isMeshLambertMaterial||ue.isMeshBasicMaterial||ue.isMeshStandardMaterial||ue.isShaderMaterial)&&fn.setValue(H,"isOrthographic",K.isOrthographicCamera===!0),(ue.isMeshPhongMaterial||ue.isMeshToonMaterial||ue.isMeshLambertMaterial||ue.isMeshBasicMaterial||ue.isMeshStandardMaterial||ue.isShaderMaterial||ue.isShadowMaterial||Te.isSkinnedMesh)&&fn.setValue(H,"viewMatrix",K.matrixWorldInverse)}if(Te.isSkinnedMesh){fn.setOptional(H,Te,"bindMatrix"),fn.setOptional(H,Te,"bindMatrixInverse");const ii=Te.skeleton;ii&&(me.floatVertexTextures?(ii.boneTexture===null&&ii.computeBoneTexture(),fn.setValue(H,"boneTexture",ii.boneTexture,Ce),fn.setValue(H,"boneTextureSize",ii.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const ir=Me.morphAttributes;if((ir.position!==void 0||ir.normal!==void 0||ir.color!==void 0&&me.isWebGL2===!0)&&Ne.update(Te,Me,qn),(En||yt.receiveShadow!==Te.receiveShadow)&&(yt.receiveShadow=Te.receiveShadow,fn.setValue(H,"receiveShadow",Te.receiveShadow)),ue.isMeshGouraudMaterial&&ue.envMap!==null&&(yn.envMap.value=mt,yn.flipEnvMap.value=mt.isCubeTexture&&mt.isRenderTargetTexture===!1?-1:1),En&&(fn.setValue(H,"toneMappingExposure",w.toneMappingExposure),yt.needsLights&&os(yn,xr),rt&&ue.fog===!0&&Re.refreshFogUniforms(yn,rt),Re.refreshMaterialUniforms(yn,ue,W,V,se),mv.upload(H,yt.uniformsList,yn,Ce)),ue.isShaderMaterial&&ue.uniformsNeedUpdate===!0&&(mv.upload(H,yt.uniformsList,yn,Ce),ue.uniformsNeedUpdate=!1),ue.isSpriteMaterial&&fn.setValue(H,"center",Te.center),fn.setValue(H,"modelViewMatrix",Te.modelViewMatrix),fn.setValue(H,"normalMatrix",Te.normalMatrix),fn.setValue(H,"modelMatrix",Te.matrixWorld),ue.isShaderMaterial||ue.isRawShaderMaterial){const ii=ue.uniformsGroups;for(let uo=0,co=ii.length;uo0&&Ce.useMultisampledRTT(K)===!1?Te=pe.get(K).__webglMultisampledFramebuffer:Te=Oe,L.copy(K.viewport),N.copy(K.scissor),F=K.scissorTest}else L.copy(k).multiplyScalar(W).floor(),N.copy(U).multiplyScalar(W).floor(),F=z;if(ce.bindFramebuffer(H.FRAMEBUFFER,Te)&&me.drawBuffers&&ue&&ce.drawBuffers(K,Te),ce.viewport(L),ce.scissor(N),ce.setScissorTest(F),rt){const mt=pe.get(K.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+ve,mt.__webglTexture,Me)}else if(ct){const mt=pe.get(K.texture),Et=ve||0;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,mt.__webglTexture,Me||0,Et)}P=-1},this.readRenderTargetPixels=function(K,ve,Me,ue,Te,rt,ct){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ft=pe.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&ct!==void 0&&(ft=ft[ct]),ft){ce.bindFramebuffer(H.FRAMEBUFFER,ft);try{const mt=K.texture,Et=mt.format,Oe=mt.type;if(Et!==Lr&&Le.convert(Et)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ht=Oe===jf&&(le.has("EXT_color_buffer_half_float")||me.isWebGL2&&le.has("EXT_color_buffer_float"));if(Oe!==Io&&Le.convert(Oe)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Oe===Co&&(me.isWebGL2||le.has("OES_texture_float")||le.has("WEBGL_color_buffer_float")))&&!ht){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ve>=0&&ve<=K.width-ue&&Me>=0&&Me<=K.height-Te&&H.readPixels(ve,Me,ue,Te,Le.convert(Et),Le.convert(Oe),rt)}finally{const mt=C!==null?pe.get(C).__webglFramebuffer:null;ce.bindFramebuffer(H.FRAMEBUFFER,mt)}}},this.copyFramebufferToTexture=function(K,ve,Me=0){const ue=Math.pow(2,-Me),Te=Math.floor(ve.image.width*ue),rt=Math.floor(ve.image.height*ue);Ce.setTexture2D(ve,0),H.copyTexSubImage2D(H.TEXTURE_2D,Me,0,0,K.x,K.y,Te,rt),ce.unbindTexture()},this.copyTextureToTexture=function(K,ve,Me,ue=0){const Te=ve.image.width,rt=ve.image.height,ct=Le.convert(Me.format),ft=Le.convert(Me.type);Ce.setTexture2D(Me,0),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,Me.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Me.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,Me.unpackAlignment),ve.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,ue,K.x,K.y,Te,rt,ct,ft,ve.image.data):ve.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,ue,K.x,K.y,ve.mipmaps[0].width,ve.mipmaps[0].height,ct,ve.mipmaps[0].data):H.texSubImage2D(H.TEXTURE_2D,ue,K.x,K.y,ct,ft,ve.image),ue===0&&Me.generateMipmaps&&H.generateMipmap(H.TEXTURE_2D),ce.unbindTexture()},this.copyTextureToTexture3D=function(K,ve,Me,ue,Te=0){if(w.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const rt=K.max.x-K.min.x+1,ct=K.max.y-K.min.y+1,ft=K.max.z-K.min.z+1,mt=Le.convert(ue.format),Et=Le.convert(ue.type);let Oe;if(ue.isData3DTexture)Ce.setTexture3D(ue,0),Oe=H.TEXTURE_3D;else if(ue.isDataArrayTexture)Ce.setTexture2DArray(ue,0),Oe=H.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,ue.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ue.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,ue.unpackAlignment);const ht=H.getParameter(H.UNPACK_ROW_LENGTH),cn=H.getParameter(H.UNPACK_IMAGE_HEIGHT),Xt=H.getParameter(H.UNPACK_SKIP_PIXELS),xi=H.getParameter(H.UNPACK_SKIP_ROWS),Bi=H.getParameter(H.UNPACK_SKIP_IMAGES),Jt=Me.isCompressedTexture?Me.mipmaps[0]:Me.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,Jt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Jt.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,K.min.x),H.pixelStorei(H.UNPACK_SKIP_ROWS,K.min.y),H.pixelStorei(H.UNPACK_SKIP_IMAGES,K.min.z),Me.isDataTexture||Me.isData3DTexture?H.texSubImage3D(Oe,Te,ve.x,ve.y,ve.z,rt,ct,ft,mt,Et,Jt.data):Me.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),H.compressedTexSubImage3D(Oe,Te,ve.x,ve.y,ve.z,rt,ct,ft,mt,Jt.data)):H.texSubImage3D(Oe,Te,ve.x,ve.y,ve.z,rt,ct,ft,mt,Et,Jt),H.pixelStorei(H.UNPACK_ROW_LENGTH,ht),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,cn),H.pixelStorei(H.UNPACK_SKIP_PIXELS,Xt),H.pixelStorei(H.UNPACK_SKIP_ROWS,xi),H.pixelStorei(H.UNPACK_SKIP_IMAGES,Bi),Te===0&&ue.generateMipmaps&&H.generateMipmap(Oe),ce.unbindTexture()},this.initTexture=function(K){K.isCubeTexture?Ce.setTextureCube(K,0):K.isData3DTexture?Ce.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?Ce.setTexture2DArray(K,0):Ce.setTexture2D(K,0),ce.unbindTexture()},this.resetState=function(){M=0,b=0,C=null,ce.reset(),Fe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ro}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===At?_l:jM}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===_l?At:so}}class GU extends tT{}GU.prototype.isWebGL1Renderer=!0;class qy{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ze(e),this.density=t}clone(){return new qy(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class Ky{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Ze(e),this.near=t,this.far=i}clone(){return new Ky(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class kp extends Zt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Zy{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Dp,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Jr()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;re.far||t.push({distance:l,point:Qh.clone(),uv:Pr.getInterpolation(Qh,o0,ed,a0,QC,Rx,JC,new Pe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function l0(n,e,t,i,r,s){jc.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Jh.x=s*jc.x-r*jc.y,Jh.y=r*jc.x+s*jc.y):Jh.copy(jc),n.copy(e),n.x+=Jh.x,n.y+=Jh.y,n.applyMatrix4(VU)}const u0=new $,eR=new $;class WU extends Zt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i0){let i,r;for(i=1,r=t.length;i0){u0.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(u0);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){u0.setFromMatrixPosition(e.matrixWorld),eR.setFromMatrixPosition(this.matrixWorld);const i=u0.distanceTo(eR)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;rl)continue;h.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(h);Pe.far||t.push({distance:P,point:f.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),y=Math.min(_.count,o.start+o.count);for(let w=g,E=y-1;wl)continue;h.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(h);be.far||t.push({distance:b,point:f.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class cW extends Bn{constructor(e,t,i,r,s,o,a,l,u){super(e,t,i,r,s,o,a,l,u),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:An,this.magFilter=s!==void 0?s:An,this.generateMipmaps=!1;const c=this;function f(){c.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class fW extends Bn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=ei,this.minFilter=ei,this.generateMipmaps=!1,this.needsUpdate=!0}}class sT extends Bn{constructor(e,t,i,r,s,o,a,l,u,c,f,h){super(null,o,a,l,u,c,r,s,f,h),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class hW extends sT{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Qi}}class dW extends Bn{constructor(e,t,i,r,s,o,a,l,u){super(e,t,i,r,s,o,a,l,u),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ao{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,u;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),u=i[r]-o,u<0)a=r+1;else if(u>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const c=i[r],h=i[r+1]-c,m=(o-c)/h;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Pe:new $);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new $,r=[],s=[],o=[],a=new $,l=new xt;for(let m=0;m<=e;m++){const v=m/e;r[m]=this.getTangentAt(v,new $)}s[0]=new $,o[0]=new $;let u=Number.MAX_VALUE;const c=Math.abs(r[0].x),f=Math.abs(r[0].y),h=Math.abs(r[0].z);c<=u&&(u=c,i.set(1,0,0)),f<=u&&(u=f,i.set(0,1,0)),h<=u&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos($n(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,v))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos($n(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],m*v)),o[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:o}}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 Jy extends ao{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const i=t||new Pe,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)r;)s-=r;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let u,c;this.closed||a>0?u=r[(a-1)%s]:(p0.subVectors(r[0],r[1]).add(r[0]),u=p0);const f=r[a%s],h=r[(a+1)%s];if(this.closed||a+2r.length-2?r.length-1:o+1],f=r[o>r.length-3?r.length-1:o+2];return i.set(gR(a,l.x,u.x,c.x,f.x),gR(a,l.y,u.y,c.y,f.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),u=l===0?0:1-o/l;return a.getPointAt(u,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 i=0,r=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){const f=u.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(u);const c=u.getPoint(1);return this.currentPoint.copy(c),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 dm extends Ct{constructor(e=[new Pe(0,-.5),new Pe(.5,0),new Pe(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=$n(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],u=[],c=1/t,f=new $,h=new Pe,m=new $,v=new $,x=new $;let _=0,g=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:_=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,m.x=g*1,m.y=-_,m.z=g*0,x.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:_=e[y+1].x-e[y].x,g=e[y+1].y-e[y].y,m.x=g*1,m.y=-_,m.z=g*0,v.copy(m),m.x+=x.x,m.y+=x.y,m.z+=x.z,m.normalize(),l.push(m.x,m.y,m.z),x.copy(v)}for(let y=0;y<=t;y++){const w=i+y*c*r,E=Math.sin(w),M=Math.cos(w);for(let b=0;b<=e.length-1;b++){f.x=e[b].x*E,f.y=e[b].y,f.z=e[b].x*M,o.push(f.x,f.y,f.z),h.x=y/t,h.y=b/(e.length-1),a.push(h.x,h.y);const C=l[3*b+0]*E,P=l[3*b+1],A=l[3*b+0]*M;u.push(C,P,A)}}for(let y=0;y0&&w(!0),t>0&&w(!1)),this.setIndex(c),this.setAttribute("position",new at(f,3)),this.setAttribute("normal",new at(h,3)),this.setAttribute("uv",new at(m,2));function y(){const E=new $,M=new $;let b=0;const C=(t-e)/i;for(let P=0;P<=s;P++){const A=[],L=P/s,N=L*(t-e)+e;for(let F=0;F<=r;F++){const B=F/r,j=B*l+a,q=Math.sin(j),V=Math.cos(j);M.x=N*q,M.y=-L*i+_,M.z=N*V,f.push(M.x,M.y,M.z),E.set(q,C,V).normalize(),h.push(E.x,E.y,E.z),m.push(B,1-L),A.push(v++)}x.push(A)}for(let P=0;P.9&&C<.1&&(w<.2&&(o[y+0]+=1),E<.2&&(o[y+2]+=1),M<.2&&(o[y+4]+=1))}}function h(y){s.push(y.x,y.y,y.z)}function m(y,w){const E=y*3;w.x=e[E+0],w.y=e[E+1],w.z=e[E+2]}function v(){const y=new $,w=new $,E=new $,M=new $,b=new Pe,C=new Pe,P=new Pe;for(let A=0,L=0;A80*t){a=u=n[0],l=c=n[1];for(let v=t;vu&&(u=f),h>c&&(c=h);m=Math.max(u-a,c-l),m=m!==0?32767/m:0}return Fp(s,o,t,a,l,m,0),o}};function eO(n,e,t,i,r){let s,o;if(r===NW(n,e,t,i)>0)for(s=e;s=e;s-=i)o=vR(s,n[s],n[s+1],o);return o&&o_(o,o.next)&&(Bp(o),o=o.next),o}function Xu(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(o_(t,t.next)||kn(t.prev,t,t.next)===0)){if(Bp(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Fp(n,e,t,i,r,s,o){if(!n)return;!o&&s&&LW(n,i,r,s);let a=n,l,u;for(;n.prev!==n.next;){if(l=n.prev,u=n.next,s?EW(n,i,r,s):SW(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(u.i/t|0),Bp(n),n=u.next,a=u.next;continue}if(n=u,n===a){o?o===1?(n=MW(Xu(n),e,t),Fp(n,e,t,i,r,s,2)):o===2&&TW(n,e,t,i,r,s):Fp(Xu(n),e,t,i,r,s,1);break}}}function SW(n){const e=n.prev,t=n,i=n.next;if(kn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,u=i.y,c=rs?r>o?r:o:s>o?s:o,m=a>l?a>u?a:u:l>u?l:u;let v=i.next;for(;v!==e;){if(v.x>=c&&v.x<=h&&v.y>=f&&v.y<=m&&wf(r,a,s,l,o,u,v.x,v.y)&&kn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function EW(n,e,t,i){const r=n.prev,s=n,o=n.next;if(kn(r,s,o)>=0)return!1;const a=r.x,l=s.x,u=o.x,c=r.y,f=s.y,h=o.y,m=al?a>u?a:u:l>u?l:u,_=c>f?c>h?c:h:f>h?f:h,g=sE(m,v,e,t,i),y=sE(x,_,e,t,i);let w=n.prevZ,E=n.nextZ;for(;w&&w.z>=g&&E&&E.z<=y;){if(w.x>=m&&w.x<=x&&w.y>=v&&w.y<=_&&w!==r&&w!==o&&wf(a,c,l,f,u,h,w.x,w.y)&&kn(w.prev,w,w.next)>=0||(w=w.prevZ,E.x>=m&&E.x<=x&&E.y>=v&&E.y<=_&&E!==r&&E!==o&&wf(a,c,l,f,u,h,E.x,E.y)&&kn(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;w&&w.z>=g;){if(w.x>=m&&w.x<=x&&w.y>=v&&w.y<=_&&w!==r&&w!==o&&wf(a,c,l,f,u,h,w.x,w.y)&&kn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;E&&E.z<=y;){if(E.x>=m&&E.x<=x&&E.y>=v&&E.y<=_&&E!==r&&E!==o&&wf(a,c,l,f,u,h,E.x,E.y)&&kn(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function MW(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!o_(r,s)&&tO(r,i,i.next,s)&&zp(r,s)&&zp(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Bp(i),Bp(i.next),i=n=s),i=i.next}while(i!==n);return Xu(i)}function TW(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&UW(o,a)){let l=nO(o,a);o=Xu(o,o.next),l=Xu(l,l.next),Fp(o,e,t,i,r,s,0),Fp(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function bW(n,e,t,i){const r=[];let s,o,a,l,u;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const h=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=s&&h>i&&(i=h,r=t.x=t.x&&t.x>=l&&s!==t.x&&wf(or.x||t.x===r.x&&PW(r,t)))&&(r=t,c=f)),t=t.next;while(t!==a);return r}function PW(n,e){return kn(n.prev,n,e.prev)<0&&kn(e.next,n,n.next)<0}function LW(n,e,t,i){let r=n;do r.z===0&&(r.z=sE(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,IW(r)}function IW(n){let e,t,i,r,s,o,a,l,u=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,u*=2}while(o>1);return n}function sE(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function DW(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function UW(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!OW(n,e)&&(zp(n,e)&&zp(e,n)&&kW(n,e)&&(kn(n.prev,n,e.prev)||kn(n,e.prev,e))||o_(n,e)&&kn(n.prev,n,n.next)>0&&kn(e.prev,e,e.next)>0)}function kn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function o_(n,e){return n.x===e.x&&n.y===e.y}function tO(n,e,t,i){const r=_0(kn(n,e,t)),s=_0(kn(n,e,i)),o=_0(kn(t,i,n)),a=_0(kn(t,i,e));return!!(r!==s&&o!==a||r===0&&y0(n,t,e)||s===0&&y0(n,i,e)||o===0&&y0(t,n,i)||a===0&&y0(t,e,i))}function y0(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function _0(n){return n>0?1:n<0?-1:0}function OW(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&tO(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function zp(n,e){return kn(n.prev,n,n.next)<0?kn(n,e,n.next)>=0&&kn(n,n.prev,e)>=0:kn(n,e,n.prev)<0||kn(n,n.next,e)<0}function kW(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.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&&(i=!i),t=t.next;while(t!==n);return i}function nO(n,e){const t=new oE(n.i,n.x,n.y),i=new oE(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function vR(n,e,t,i){const r=new oE(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Bp(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function oE(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function NW(n,e,t,i){let r=0;for(let s=e,o=t-i;s2&&n[e-1].equals(n[0])&&n.pop()}function _R(n,e){for(let t=0;tNumber.EPSILON){const G=Math.sqrt(je),ie=Math.sqrt(ge*ge+de*de),Re=ae.x-Ce/G,Se=ae.y+pe/G,be=le.x-de/ie,Ve=le.y+ge/ie,ke=((be-Re)*de-(Ve-Se)*ge)/(pe*de-Ce*ge);me=Re+pe*ke-H.x,ce=Se+Ce*ke-H.y;const xe=me*me+ce*ce;if(xe<=2)return new Pe(me,ce);De=Math.sqrt(xe/2)}else{let G=!1;pe>Number.EPSILON?ge>Number.EPSILON&&(G=!0):pe<-Number.EPSILON?ge<-Number.EPSILON&&(G=!0):Math.sign(Ce)===Math.sign(de)&&(G=!0),G?(me=-Ce,ce=pe,De=Math.sqrt(je)):(me=pe,ce=Ce,De=Math.sqrt(je/2))}return new Pe(me/De,ce/De)}const O=[];for(let H=0,ae=j.length,le=ae-1,me=H+1;H=0;H--){const ae=H/_,le=m*Math.cos(ae*Math.PI/2),me=v*Math.sin(ae*Math.PI/2)+x;for(let ce=0,De=j.length;ce=0;){const me=le;let ce=le-1;ce<0&&(ce=H.length-1);for(let De=0,pe=c+_*2;De0)&&m.push(w,E,b),(g!==i-1||l0!=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 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.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 aO extends Fi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ze(16777215),this.specular=new Ze(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Il,this.normalScale=new Pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=um,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class lO extends Fi{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ze(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Il,this.normalScale=new Pe(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 uO extends Fi{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Il,this.normalScale=new Pe(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 cO extends Fi{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Il,this.normalScale=new Pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=um,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class fO extends Fi{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ze(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Il,this.normalScale=new Pe(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 hO extends yr{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function xs(n,e,t){return dT(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function Au(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function dT(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function dO(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function aE(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function pT(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function GW(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l=i)){f.push(u.times[m]);for(let x=0;xs.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[v]){const g=v*f+c,y=g+f-c;x=xs(a.values,g,y)}else{const g=a.createInterpolant(),y=c,w=f-c;g.evaluate(s),x=xs(g.resultBuffer,y,w)}l==="quaternion"&&new ki().fromArray(x).normalize().conjugate().toArray(x);const _=u.times.length;for(let g=0;g<_;++g){const y=g*m+h;if(l==="quaternion")ki.multiplyQuaternionsFlat(u.values,y,x,0,u.values,y);else{const w=m-h*2;for(let E=0;E=s)){const a=t[1];e=s)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=xs(i,s,o),this.values=xs(this.values,s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&dT(r))for(let a=0,l=r.length;a!==l;++a){const u=r[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){const e=xs(this.times),t=xs(this.values),i=this.getValueSize(),r=this.getInterpolation()===dv,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*i,l=o*i,u=0;u!==i;++u)t[l+u]=t[a+u];++o}return o!==e.length?(this.times=xs(e,0,o),this.values=xs(t,0,o*i)):(this.times=e,this.values=t),this}clone(){const e=xs(this.times,0),t=xs(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}lo.prototype.TimeBufferType=Float32Array;lo.prototype.ValueBufferType=Float32Array;lo.prototype.DefaultInterpolation=Lp;class sc extends lo{}sc.prototype.ValueTypeName="bool";sc.prototype.ValueBufferType=Array;sc.prototype.DefaultInterpolation=Pp;sc.prototype.InterpolantFactoryMethodLinear=void 0;sc.prototype.InterpolantFactoryMethodSmooth=void 0;class gT extends lo{}gT.prototype.ValueTypeName="color";class Gp extends lo{}Gp.prototype.ValueTypeName="number";class gO extends gm{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let u=e*a;for(let c=u+a;u!==c;u+=4)ki.slerpFlat(s,0,o,u-a,o,u,l);return s}}class uh extends lo{InterpolantFactoryMethodLinear(e){return new gO(this.times,this.values,this.getValueSize(),e)}}uh.prototype.ValueTypeName="quaternion";uh.prototype.DefaultInterpolation=Lp;uh.prototype.InterpolantFactoryMethodSmooth=void 0;class oc extends lo{}oc.prototype.ValueTypeName="string";oc.prototype.ValueBufferType=Array;oc.prototype.DefaultInterpolation=Pp;oc.prototype.InterpolantFactoryMethodLinear=void 0;oc.prototype.InterpolantFactoryMethodSmooth=void 0;class Vp extends lo{}Vp.prototype.ValueTypeName="vector";class Hp{constructor(e,t=-1,i,r=Wy){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Jr(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(jW(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(lo.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a1){const f=c[1];let h=r[f];h||(r[f]=h=[]),h.push(u)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(f,h,m,v,x){if(m.length!==0){const _=[],g=[];pT(m,_,g,v),_.length!==0&&x.push(new f(h,_,g))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const u=e.hierarchy||[];for(let f=0;f{t&&t(s),this.manager.itemEnd(e)},0),s;if(ia[e]!==void 0){ia[e].push({onLoad:t,onProgress:i,onError:r});return}ia[e]=[],ia[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||u.body===void 0||u.body.getReader===void 0)return u;const c=ia[e],f=u.body.getReader(),h=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),m=h?parseInt(h):0,v=m!==0;let x=0;const _=new ReadableStream({start(g){y();function y(){f.read().then(({done:w,value:E})=>{if(w)g.close();else{x+=E.byteLength;const M=new ProgressEvent("progress",{lengthComputable:v,loaded:x,total:m});for(let b=0,C=c.length;b{switch(l){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return u.json();default:if(a===void 0)return u.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),h=f&&f[1]?f[1].toLowerCase():void 0,m=new TextDecoder(h);return u.arrayBuffer().then(v=>m.decode(v))}}}).then(u=>{Yu.add(e,u);const c=ia[e];delete ia[e];for(let f=0,h=c.length;f{const c=ia[e];if(c===void 0)throw this.manager.itemError(e),u;delete ia[e];for(let f=0,h=c.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class $W extends Nr{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Ta(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new Ze().setHex(o.value);break;case"v2":r.uniforms[s].value=new Pe().fromArray(o.value);break;case"v3":r.uniforms[s].value=new $().fromArray(o.value);break;case"v4":r.uniforms[s].value=new Kt().fromArray(o.value);break;case"m3":r.uniforms[s].value=new Pt().fromArray(o.value);break;case"m4":r.uniforms[s].value=new xt().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new Pe().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Pe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:rO,SpriteMaterial:nT,RawShaderMaterial:sO,ShaderMaterial:No,PointsMaterial:rT,MeshPhysicalMaterial:oO,MeshStandardMaterial:hT,MeshPhongMaterial:aO,MeshToonMaterial:lO,MeshNormalMaterial:uO,MeshLambertMaterial:cO,MeshDepthMaterial:$y,MeshDistanceMaterial:Yy,MeshBasicMaterial:Ra,MeshMatcapMaterial:fO,LineDashedMaterial:hO,LineBasicMaterial:yr,Material:Fi};return new t[e]}}class lE{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i0){const l=new vT(t);s=new Wp(l),s.setCrossOrigin(this.crossOrigin);for(let u=0,c=e.length;u0){r=new Wp(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Yu.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Yu.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let x0;class xT{static getContext(){return x0===void 0&&(x0=new(window.AudioContext||window.webkitAudioContext)),x0}static setContext(e){x0=e}}class i7 extends Nr{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Ta(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const u=l.slice(0);xT.getContext().decodeAudioData(u,function(f){t(f)},a)}catch(u){a(u)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}class r7 extends p_{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const r=new Ze().set(e),s=new Ze().set(t),o=new $(r.r,r.g,r.b),a=new $(s.r,s.g,s.b),l=Math.sqrt(Math.PI),u=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(u)}}class s7 extends p_{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new Ze().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const AR=new xt,CR=new xt,ru=new xt;class o7{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new li,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new li,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,ru.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(Iu*t.fov*.5)/t.zoom;let a,l;CR.elements[12]=-r,AR.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,ru.elements[0]=2*t.near/(l-a),ru.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(ru),a=-o*t.aspect-s,l=o*t.aspect-s,ru.elements[0]=2*t.near/(l-a),ru.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(ru)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(CR),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(AR)}}class wT{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=RR(),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=RR();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function RR(){return(typeof performance>"u"?Date:performance).now()}const su=new $,PR=new ki,a7=new $,ou=new $;class l7 extends Zt{constructor(){super(),this.type="AudioListener",this.context=xT.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new wT}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(su,PR,a7),ou.set(0,0,-1).applyQuaternion(PR),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(su.x,r),t.positionY.linearRampToValueAtTime(su.y,r),t.positionZ.linearRampToValueAtTime(su.z,r),t.forwardX.linearRampToValueAtTime(ou.x,r),t.forwardY.linearRampToValueAtTime(ou.y,r),t.forwardZ.linearRampToValueAtTime(ou.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(su.x,su.y,su.z),t.setOrientation(ou.x,ou.y,ou.z,i.x,i.y,i.z)}}class AO extends Zt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,u=t+t;l!==u;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){ki.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;ki.multiplyQuaternionsFlat(e,o,e,t,e,i),ki.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const ST="\\[\\]\\.:\\/",h7=new RegExp("["+ST+"]","g"),ET="[^"+ST+"]",d7="[^"+ST.replace("\\.","")+"]",p7=/((?:WC+[\/:])*)/.source.replace("WC",ET),m7=/(WCOD+)?/.source.replace("WCOD",d7),g7=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ET),v7=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ET),y7=new RegExp("^"+p7+m7+g7+v7+"$"),_7=["material","materials","bones","map"];class x7{constructor(e,t,i){const r=i||Ht.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Ht{constructor(e,t,i){this.path=t,this.parsedPath=i||Ht.parseTrackName(t),this.node=Ht.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Ht.Composite(e,t,i):new Ht(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(h7,"")}static parseTrackName(e){const t=y7.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);_7.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o=s){const f=s++,h=e[f];t[h.uuid]=c,e[c]=h,t[u]=f,e[f]=l;for(let m=0,v=r;m!==v;++m){const x=i[m],_=x[f],g=x[c];x[c]=_,x[f]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const u=arguments[a],c=u.uuid,f=t[c];if(f!==void 0)if(delete t[c],f0&&(t[m.uuid]=f),e[f]=m,e.pop();for(let v=0,x=r;v!==x;++v){const _=i[v];_[f]=_[h],_.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,u=l.length,c=this.nCachedObjects_,f=new Array(u);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(f);for(let h=c,m=l.length;h!==m;++h){const v=l[h];f[h]=new Ht(v,e,t)}return f}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],u=e[a];t[u]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class RO{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Mu,endingEnd:Mu};for(let u=0;u!==o;++u){const c=s[u].createInterpolant(null);a[u]=c,c.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=pU,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,u=a.sampleValues;return l[0]=s,l[1]=s+i,u[0]=e/o,u[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case WM:for(let c=0,f=l.length;c!==f;++c)l[c].evaluate(o),u[c].accumulateAdditive(a);break;case Wy:default:for(let c=0,f=l.length;c!==f;++c)l[c].evaluate(o),u[c].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===mU;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===dU){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const u=e<0;this._setEndings(u,!u,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=Tu,r.endingEnd=Tu):(e?r.endingStart=this.zeroSlopeAtStart?Tu:Mu:r.endingStart=Ip,t?r.endingEnd=this.zeroSlopeAtEnd?Tu:Mu:r.endingEnd=Ip)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const S7=new Float32Array(1);class E7 extends Ca{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,u=this._bindingsByRootAndName;let c=u[l];c===void 0&&(c={},u[l]=c);for(let f=0;f!==s;++f){const h=r[f],m=h.name;let v=c[m];if(v!==void 0)++v.referenceCount,o[f]=v;else{if(v=o[f],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,m));continue}const x=t&&t._propertyBindings[f].binding.parsedPath;v=new CO(Ht.create(i,m,x),h.ValueTypeName,h.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,m),o[f]=v}a[f].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let u=0;u!==i;++u)t[u]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let u=0;u!==l;++u)a[u].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,DR).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const UR=new $,w0=new $;class P7{constructor(e=new $,t=new $){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){UR.subVectors(e,this.start),w0.subVectors(this.end,this.start);const i=w0.dot(w0);let s=w0.dot(UR)/i;return t&&(s=$n(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).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)}}const OR=new $;class L7 extends Zt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Ct,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{BR.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(BR,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class W7 extends Bo{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Ct;r.setAttribute("position",new at(t,3)),r.setAttribute("color",new at(i,3));const s=new yr({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new Ze,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class j7{constructor(){this.type="ShapePath",this.color=new Ze,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Np,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const y=[];for(let w=0,E=g.length;wNumber.EPSILON){if(L<0&&(C=y[b],A=-A,P=y[M],L=-L),g.yP.y)continue;if(g.y===C.y){if(g.x===C.x)return!0}else{const N=L*(g.x-C.x)-A*(g.y-C.y);if(N===0)return!0;if(N<0)continue;E=!E}}else{if(g.y!==C.y)continue;if(P.x<=g.x&&g.x<=C.x||C.x<=g.x&&g.x<=P.x)return!0}}return E}const r=Do.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const u=[];if(s.length===1)return a=s[0],l=new Uu,l.curves=a.curves,u.push(l),u;let c=!r(s[0].getPoints());c=e?!c:c;const f=[],h=[];let m=[],v=0,x;h[v]=void 0,m[v]=[];for(let g=0,y=s.length;g1){let g=!1,y=0;for(let w=0,E=h.length;w0&&g===!1&&(m=f)}let _;for(let g=0,y=h.length;g{const f=typeof u=="function"?u(e):u;if(f!==e){const h=e;e=c?f:Object.assign({},e,f),t.forEach(m=>m(e,h))}},r=()=>e,s=(u,c=r,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let h=c(e);function m(){const v=c(e);if(!f(h,v)){const x=h;u(h=v,x)}}return t.add(m),()=>t.delete(m)},l={setState:i,getState:r,subscribe:(u,c,f)=>c||f?s(u,c,f):(t.add(u),()=>t.delete(u)),destroy:()=>t.clear()};return e=n(i,r,l),l}const $7=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),GR=$7?Y.useEffect:Y.useLayoutEffect;function Y7(n){const e=typeof n=="function"?X7(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=Y.useReducer(_=>_+1,0),o=e.getState(),a=Y.useRef(o),l=Y.useRef(i),u=Y.useRef(r),c=Y.useRef(!1),f=Y.useRef();f.current===void 0&&(f.current=i(o));let h,m=!1;(a.current!==o||l.current!==i||u.current!==r||c.current)&&(h=i(o),m=!r(f.current,h)),GR(()=>{m&&(f.current=h),a.current=o,l.current=i,u.current=r,c.current=!1});const v=Y.useRef(o);GR(()=>{const _=()=>{try{const y=e.getState(),w=l.current(y);u.current(f.current,w)||(a.current=y,f.current=w,s())}catch{c.current=!0,s()}},g=e.subscribe(_);return e.getState()!==v.current&&_(),g},[]);const x=m?h:f.current;return Y.useDebugValue(x),x};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}var UO={exports:{}},Gx={exports:{}},Vx={};/** - * @license React - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var VR;function q7(){return VR||(VR=1,function(n){function e(I,O){var k=I.length;I.push(O);e:for(;0>>1,z=I[U];if(0>>1;Ur(te,k))ser(ne,te)?(I[U]=ne,I[se]=k,U=se):(I[U]=te,I[J]=k,U=J);else if(ser(ne,k))I[U]=ne,I[se]=k,U=se;else break e}}return O}function r(I,O){var k=I.sortIndex-O.sortIndex;return k!==0?k:I.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,f=null,h=3,m=!1,v=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(I){for(var O=t(u);O!==null;){if(O.callback===null)i(u);else if(O.startTime<=I)i(u),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(u)}}function E(I){if(x=!1,w(I),!v)if(t(l)!==null)v=!0,V(M);else{var O=t(u);O!==null&&W(E,O.startTime-I)}}function M(I,O){v=!1,x&&(x=!1,g(P),P=-1),m=!0;var k=h;try{for(w(O),f=t(l);f!==null&&(!(f.expirationTime>O)||I&&!N());){var U=f.callback;if(typeof U=="function"){f.callback=null,h=f.priorityLevel;var z=U(f.expirationTime<=O);O=n.unstable_now(),typeof z=="function"?f.callback=z:f===t(l)&&i(l),w(O)}else i(l);f=t(l)}if(f!==null)var Q=!0;else{var J=t(u);J!==null&&W(E,J.startTime-O),Q=!1}return Q}finally{f=null,h=k,m=!1}}var b=!1,C=null,P=-1,A=5,L=-1;function N(){return!(n.unstable_now()-LI||125U?(I.sortIndex=k,e(u,I),t(l)===null&&I===t(u)&&(x?(g(P),P=-1):x=!0,W(E,k-U))):(I.sortIndex=z,e(l,I),v||m||(v=!0,V(M))),I},n.unstable_shouldYield=N,n.unstable_wrapCallback=function(I){var O=h;return function(){var k=h;h=O;try{return I.apply(this,arguments)}finally{h=k}}}}(Vx)),Vx}var HR;function K7(){return HR||(HR=1,Gx.exports=q7()),Gx.exports}/** - * @license React - * react-reconciler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Z7=function(e){var t={},i=Y,r=K7(),s=Object.assign;function o(d){for(var p="https://reactjs.org/docs/error-decoder.html?invariant="+d,S=1;Sre||R[Z]!==D[re]){var Ee=` -`+R[Z].replace(" at new "," at ");return d.displayName&&Ee.includes("")&&(Ee=Ee.replace("",d.displayName)),Ee}while(1<=Z&&0<=re);break}}}finally{cn=!1,Error.prepareStackTrace=S}return(d=d?d.displayName||d.name:"")?ht(d):""}var xi=Object.prototype.hasOwnProperty,Bi=[],Jt=-1;function yt(d){return{current:d}}function Vt(d){0>Jt||(d.current=Bi[Jt],Bi[Jt]=null,Jt--)}function _t(d,p){Jt++,Bi[Jt]=d.current,d.current=p}var qn={},Vn=yt(qn),En=yt(!1),xr=qn;function fn(d,p){var S=d.type.contextTypes;if(!S)return qn;var T=d.stateNode;if(T&&T.__reactInternalMemoizedUnmaskedChildContext===p)return T.__reactInternalMemoizedMaskedChildContext;var R={},D;for(D in S)R[D]=p[D];return T&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=p,d.__reactInternalMemoizedMaskedChildContext=R),R}function yn(d){return d=d.childContextTypes,d!=null}function ir(){Vt(En),Vt(Vn)}function ii(d,p,S){if(Vn.current!==qn)throw Error(o(168));_t(Vn,p),_t(En,S)}function uo(d,p,S){var T=d.stateNode;if(p=p.childContextTypes,typeof T.getChildContext!="function")return S;T=T.getChildContext();for(var R in T)if(!(R in p))throw Error(o(108,P(d)||"Unknown",R));return s({},S,T)}function co(d){return d=(d=d.stateNode)&&d.__reactInternalMemoizedMergedChildContext||qn,xr=Vn.current,_t(Vn,d),_t(En,En.current),!0}function Gi(d,p,S){var T=d.stateNode;if(!T)throw Error(o(169));S?(d=uo(d,p,xr),T.__reactInternalMemoizedMergedChildContext=d,Vt(En),Vt(Vn),_t(Vn,d)):Vt(En),_t(En,S)}var zr=Math.clz32?Math.clz32:Dm,cc=Math.log,Fl=Math.LN2;function Dm(d){return d>>>=0,d===0?32:31-(cc(d)/Fl|0)|0}var Go=64,Vo=4194304;function Ho(d){switch(d&-d){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return d&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return d}}function zl(d,p){var S=d.pendingLanes;if(S===0)return 0;var T=0,R=d.suspendedLanes,D=d.pingedLanes,Z=S&268435455;if(Z!==0){var re=Z&~R;re!==0?T=Ho(re):(D&=Z,D!==0&&(T=Ho(D)))}else Z=S&~R,Z!==0?T=Ho(Z):D!==0&&(T=Ho(D));if(T===0)return 0;if(p!==0&&p!==T&&!(p&R)&&(R=T&-T,D=p&-p,R>=D||R===16&&(D&4194240)!==0))return p;if(T&4&&(T|=S&16),p=d.entangledLanes,p!==0)for(d=d.entanglements,p&=T;0S;S++)p.push(d);return p}function fo(d,p,S){d.pendingLanes|=p,p!==536870912&&(d.suspendedLanes=0,d.pingedLanes=0),d=d.eventTimes,p=31-zr(p),d[p]=S}function Da(d,p){var S=d.pendingLanes&~p;d.pendingLanes=p,d.suspendedLanes=0,d.pingedLanes=0,d.expiredLanes&=p,d.mutableReadLanes&=p,d.entangledLanes&=p,p=d.entanglements;var T=d.eventTimes;for(d=d.expirationTimes;0>=Z,R-=Z,$o=1<<32-zr(p)+R|S<$t?(Mi=Tt,Tt=null):Mi=Tt.sibling;var Yt=dt(_e,Tt,we[$t],et);if(Yt===null){Tt===null&&(Tt=Mi);break}d&&Tt&&Yt.alternate===null&&p(_e,Tt),oe=D(Yt,oe,$t),It===null?lt=Yt:It.sibling=Yt,It=Yt,Tt=Mi}if($t===we.length)return S(_e,Tt),Mn&&Xl(_e,$t),lt;if(Tt===null){for(;$t$t?(Mi=Tt,Tt=null):Mi=Tt.sibling;var Va=dt(_e,Tt,Yt.value,et);if(Va===null){Tt===null&&(Tt=Mi);break}d&&Tt&&Va.alternate===null&&p(_e,Tt),oe=D(Va,oe,$t),It===null?lt=Va:It.sibling=Va,It=Va,Tt=Mi}if(Yt.done)return S(_e,Tt),Mn&&Xl(_e,$t),lt;if(Tt===null){for(;!Yt.done;$t++,Yt=we.next())Yt=Mt(_e,Yt.value,et),Yt!==null&&(oe=D(Yt,oe,$t),It===null?lt=Yt:It.sibling=Yt,It=Yt);return Mn&&Xl(_e,$t),lt}for(Tt=T(_e,Tt);!Yt.done;$t++,Yt=we.next())Yt=mn(Tt,_e,$t,Yt.value,et),Yt!==null&&(d&&Yt.alternate!==null&&Tt.delete(Yt.key===null?$t:Yt.key),oe=D(Yt,oe,$t),It===null?lt=Yt:It.sibling=Yt,It=Yt);return d&&Tt.forEach(function(Lz){return p(_e,Lz)}),Mn&&Xl(_e,$t),lt}function ps(_e,oe,we,et){if(typeof we=="object"&&we!==null&&we.type===c&&we.key===null&&(we=we.props.children),typeof we=="object"&&we!==null){switch(we.$$typeof){case l:e:{for(var lt=we.key,It=oe;It!==null;){if(It.key===lt){if(lt=we.type,lt===c){if(It.tag===7){S(_e,It.sibling),oe=R(It,we.props.children),oe.return=_e,_e=oe;break e}}else if(It.elementType===lt||typeof lt=="object"&<!==null&<.$$typeof===w&&W2(lt)===It.type){S(_e,It.sibling),oe=R(It,we.props),oe.ref=Th(_e,It,we),oe.return=_e,_e=oe;break e}S(_e,It);break}else p(_e,It);It=It.sibling}we.type===c?(oe=Jl(we.props.children,_e.mode,et,we.key),oe.return=_e,_e=oe):(et=wg(we.type,we.key,we.props,null,_e.mode,et),et.ref=Th(_e,oe,we),et.return=_e,_e=et)}return Z(_e);case u:e:{for(It=we.key;oe!==null;){if(oe.key===It)if(oe.tag===4&&oe.stateNode.containerInfo===we.containerInfo&&oe.stateNode.implementation===we.implementation){S(_e,oe.sibling),oe=R(oe,we.children||[]),oe.return=_e,_e=oe;break e}else{S(_e,oe);break}else p(_e,oe);oe=oe.sibling}oe=U1(we,_e.mode,et),oe.return=_e,_e=oe}return Z(_e);case w:return It=we._init,ps(_e,oe,It(we._payload),et)}if(q(we))return ut(_e,oe,we,et);if(b(we))return ji(_e,oe,we,et);Wm(_e,we)}return typeof we=="string"&&we!==""||typeof we=="number"?(we=""+we,oe!==null&&oe.tag===6?(S(_e,oe.sibling),oe=R(oe,we),oe.return=_e,_e=oe):(S(_e,oe),oe=D1(we,_e.mode,et),oe.return=_e,_e=oe),Z(_e)):S(_e,oe)}return ps}var yc=j2(!0),X2=j2(!1),bh={},cs=yt(bh),Ah=yt(bh),_c=yt(bh);function mo(d){if(d===bh)throw Error(o(174));return d}function Z_(d,p){_t(_c,p),_t(Ah,d),_t(cs,bh),d=W(p),Vt(cs),_t(cs,d)}function xc(){Vt(cs),Vt(Ah),Vt(_c)}function $2(d){var p=mo(_c.current),S=mo(cs.current);p=I(S,d.type,p),S!==p&&(_t(Ah,d),_t(cs,p))}function Q_(d){Ah.current===d&&(Vt(cs),Vt(Ah))}var Pn=yt(0);function jm(d){for(var p=d;p!==null;){if(p.tag===13){var S=p.memoizedState;if(S!==null&&(S=S.dehydrated,S===null||jt(S)||vn(S)))return p}else if(p.tag===19&&p.memoizedProps.revealOrder!==void 0){if(p.flags&128)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}var J_=[];function e1(){for(var d=0;dS?S:4,d(!0);var T=fs.transition;fs.transition={};try{d(!1),p()}finally{kt=S,fs.transition=T}}function ab(){return go().memoizedState}function rz(d,p,S){var T=za(d);S={lane:T,action:S,hasEagerState:!1,eagerState:null,next:null},lb(d)?ub(p,S):(cb(d,p,S),S=ur(),d=hs(d,T,S),d!==null&&fb(d,p,T))}function sz(d,p,S){var T=za(d),R={lane:T,action:S,hasEagerState:!1,eagerState:null,next:null};if(lb(d))ub(p,R);else{cb(d,p,R);var D=d.alternate;if(d.lanes===0&&(D===null||D.lanes===0)&&(D=p.lastRenderedReducer,D!==null))try{var Z=p.lastRenderedState,re=D(Z,S);if(R.hasEagerState=!0,R.eagerState=re,Gr(re,Z))return}catch{}finally{}S=ur(),d=hs(d,T,S),d!==null&&fb(d,p,T)}}function lb(d){var p=d.alternate;return d===Hn||p!==null&&p===Hn}function ub(d,p){Ch=$m=!0;var S=d.pending;S===null?p.next=p:(p.next=S.next,S.next=p),d.pending=p}function cb(d,p,S){ri!==null&&d.mode&1&&!(Ot&2)?(d=p.interleaved,d===null?(S.next=S,Vr===null?Vr=[p]:Vr.push(p)):(S.next=d.next,d.next=S),p.interleaved=S):(d=p.pending,d===null?S.next=S:(S.next=d.next,d.next=S),p.pending=S)}function fb(d,p,S){if(S&4194240){var T=p.lanes;T&=d.pendingLanes,S|=T,p.lanes=S,ho(d,S)}}var Qm={readContext:Zn,useCallback:Hi,useContext:Hi,useEffect:Hi,useImperativeHandle:Hi,useInsertionEffect:Hi,useLayoutEffect:Hi,useMemo:Hi,useReducer:Hi,useRef:Hi,useState:Hi,useDebugValue:Hi,useDeferredValue:Hi,useTransition:Hi,useMutableSource:Hi,useSyncExternalStore:Hi,useId:Hi,unstable_isNewReconciler:!1},oz={readContext:Zn,useCallback:function(d,p){return qo().memoizedState=[d,p===void 0?null:p],d},useContext:Zn,useEffect:s1,useImperativeHandle:function(d,p,S){return S=S!=null?S.concat([d]):null,Km(4194308,4,ib.bind(null,p,d),S)},useLayoutEffect:function(d,p){return Km(4194308,4,d,p)},useInsertionEffect:function(d,p){return Km(4,2,d,p)},useMemo:function(d,p){var S=qo();return p=p===void 0?null:p,d=d(),S.memoizedState=[d,p],d},useReducer:function(d,p,S){var T=qo();return p=S!==void 0?S(p):p,T.memoizedState=T.baseState=p,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:p},T.queue=d,d=d.dispatch=rz.bind(null,Hn,d),[T.memoizedState,d]},useRef:function(d){var p=qo();return d={current:d},p.memoizedState=d},useState:r1,useDebugValue:o1,useDeferredValue:function(d){var p=r1(d),S=p[0],T=p[1];return s1(function(){var R=fs.transition;fs.transition={};try{T(d)}finally{fs.transition=R}},[d]),S},useTransition:function(){var d=r1(!1),p=d[0];return d=iz.bind(null,d[1]),qo().memoizedState=d,[p,d]},useMutableSource:function(){},useSyncExternalStore:function(d,p,S){var T=Hn,R=qo();if(Mn){if(S===void 0)throw Error(o(407));S=S()}else{if(S=p(),ri===null)throw Error(o(349));wc&30||K2(T,p,S)}R.memoizedState=S;var D={value:S,getSnapshot:p};return R.queue=D,s1(Q2.bind(null,T,D,d),[d]),T.flags|=2048,Ph(9,Z2.bind(null,T,D,S,p),void 0,null),S},useId:function(){var d=qo(),p=ri.identifierPrefix;if(Mn){var S=Yo,T=$o;S=(T&~(1<<32-zr(T)-1)).toString(32)+S,p=":"+p+"R"+S,S=Rh++,0T1&&(p.flags|=128,T=!0,Uh(R,!1),p.lanes=4194304)}else{if(!T)if(d=jm(D),d!==null){if(p.flags|=128,T=!0,d=d.updateQueue,d!==null&&(p.updateQueue=d,p.flags|=4),Uh(R,!0),R.tail===null&&R.tailMode==="hidden"&&!D.alternate&&!Mn)return Wi(p),null}else 2*Rn()-R.renderingStartTime>T1&&S!==1073741824&&(p.flags|=128,T=!0,Uh(R,!1),p.lanes=4194304);R.isBackwards?(D.sibling=p.child,p.child=D):(d=R.last,d!==null?d.sibling=D:p.child=D,R.last=D)}return R.tail!==null?(p=R.tail,R.rendering=p,R.tail=p.sibling,R.renderingStartTime=Rn(),p.sibling=null,d=Pn.current,_t(Pn,T?d&1|2:d&1),p):(Wi(p),null);case 22:case 23:return P1(),T=p.memoizedState!==null,d!==null&&d.memoizedState!==null!==T&&(p.flags|=8192),T&&p.mode&1?Xr&1073741824&&(Wi(p),he&&p.subtreeFlags&6&&(p.flags|=8192)):Wi(p),null;case 24:return null;case 25:return null}throw Error(o(156,p.tag))}var fz=a.ReactCurrentOwner,jr=!1;function lr(d,p,S,T){p.child=d===null?X2(p,null,S,T):yc(p,d.child,S,T)}function _b(d,p,S,T,R){S=S.render;var D=p.ref;return Kn(p,R),T=n1(d,p,S,T,D,R),S=i1(),d!==null&&!jr?(p.updateQueue=d.updateQueue,p.flags&=-2053,d.lanes&=~R,Ko(d,p,R)):(Mn&&S&&X_(p),p.flags|=1,lr(d,p,T,R),p.child)}function xb(d,p,S,T,R){if(d===null){var D=S.type;return typeof D=="function"&&!I1(D)&&D.defaultProps===void 0&&S.compare===null&&S.defaultProps===void 0?(p.tag=15,p.type=D,wb(d,p,D,T,R)):(d=wg(S.type,null,T,p,p.mode,R),d.ref=p.ref,d.return=p,p.child=d)}if(D=d.child,!(d.lanes&R)){var Z=D.memoizedProps;if(S=S.compare,S=S!==null?S:Hl,S(Z,T)&&d.ref===p.ref)return Ko(d,p,R)}return p.flags|=1,d=Ga(D,T),d.ref=p.ref,d.return=p,p.child=d}function wb(d,p,S,T,R){if(d!==null&&Hl(d.memoizedProps,T)&&d.ref===p.ref)if(jr=!1,(d.lanes&R)!==0)d.flags&131072&&(jr=!0);else return p.lanes=d.lanes,Ko(d,p,R);return u1(d,p,S,T,R)}function Sb(d,p,S){var T=p.pendingProps,R=T.children,D=d!==null?d.memoizedState:null;if(T.mode==="hidden")if(!(p.mode&1))p.memoizedState={baseLanes:0,cachePool:null},_t(Sc,Xr),Xr|=S;else if(S&1073741824)p.memoizedState={baseLanes:0,cachePool:null},T=D!==null?D.baseLanes:S,_t(Sc,Xr),Xr|=T;else return d=D!==null?D.baseLanes|S:S,p.lanes=p.childLanes=1073741824,p.memoizedState={baseLanes:d,cachePool:null},p.updateQueue=null,_t(Sc,Xr),Xr|=d,null;else D!==null?(T=D.baseLanes|S,p.memoizedState=null):T=S,_t(Sc,Xr),Xr|=T;return lr(d,p,R,S),p.child}function Eb(d,p){var S=p.ref;(d===null&&S!==null||d!==null&&d.ref!==S)&&(p.flags|=512,p.flags|=2097152)}function u1(d,p,S,T,R){var D=yn(S)?xr:Vn.current;return D=fn(p,D),Kn(p,R),S=n1(d,p,S,T,D,R),T=i1(),d!==null&&!jr?(p.updateQueue=d.updateQueue,p.flags&=-2053,d.lanes&=~R,Ko(d,p,R)):(Mn&&T&&X_(p),p.flags|=1,lr(d,p,S,R),p.child)}function Mb(d,p,S,T,R){if(yn(S)){var D=!0;co(p)}else D=!1;if(Kn(p,R),p.stateNode===null)d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),F2(p,S,T),j_(p,S,T,R),T=!0;else if(d===null){var Z=p.stateNode,re=p.memoizedProps;Z.props=re;var Ee=Z.context,Xe=S.contextType;typeof Xe=="object"&&Xe!==null?Xe=Zn(Xe):(Xe=yn(S)?xr:Vn.current,Xe=fn(p,Xe));var ot=S.getDerivedStateFromProps,Mt=typeof ot=="function"||typeof Z.getSnapshotBeforeUpdate=="function";Mt||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(re!==T||Ee!==Xe)&&z2(p,Z,T,Xe),Oa=!1;var dt=p.memoizedState;Z.state=dt,Bm(p,T,Z,R),Ee=p.memoizedState,re!==T||dt!==Ee||En.current||Oa?(typeof ot=="function"&&(W_(p,S,ot,T),Ee=p.memoizedState),(re=Oa||N2(p,S,re,T,dt,Ee,Xe))?(Mt||typeof Z.UNSAFE_componentWillMount!="function"&&typeof Z.componentWillMount!="function"||(typeof Z.componentWillMount=="function"&&Z.componentWillMount(),typeof Z.UNSAFE_componentWillMount=="function"&&Z.UNSAFE_componentWillMount()),typeof Z.componentDidMount=="function"&&(p.flags|=4194308)):(typeof Z.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=T,p.memoizedState=Ee),Z.props=T,Z.state=Ee,Z.context=Xe,T=re):(typeof Z.componentDidMount=="function"&&(p.flags|=4194308),T=!1)}else{Z=p.stateNode,D2(d,p),re=p.memoizedProps,Xe=p.type===p.elementType?re:or(p.type,re),Z.props=Xe,Mt=p.pendingProps,dt=Z.context,Ee=S.contextType,typeof Ee=="object"&&Ee!==null?Ee=Zn(Ee):(Ee=yn(S)?xr:Vn.current,Ee=fn(p,Ee));var mn=S.getDerivedStateFromProps;(ot=typeof mn=="function"||typeof Z.getSnapshotBeforeUpdate=="function")||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(re!==Mt||dt!==Ee)&&z2(p,Z,T,Ee),Oa=!1,dt=p.memoizedState,Z.state=dt,Bm(p,T,Z,R);var ut=p.memoizedState;re!==Mt||dt!==ut||En.current||Oa?(typeof mn=="function"&&(W_(p,S,mn,T),ut=p.memoizedState),(Xe=Oa||N2(p,S,Xe,T,dt,ut,Ee)||!1)?(ot||typeof Z.UNSAFE_componentWillUpdate!="function"&&typeof Z.componentWillUpdate!="function"||(typeof Z.componentWillUpdate=="function"&&Z.componentWillUpdate(T,ut,Ee),typeof Z.UNSAFE_componentWillUpdate=="function"&&Z.UNSAFE_componentWillUpdate(T,ut,Ee)),typeof Z.componentDidUpdate=="function"&&(p.flags|=4),typeof Z.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof Z.componentDidUpdate!="function"||re===d.memoizedProps&&dt===d.memoizedState||(p.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||re===d.memoizedProps&&dt===d.memoizedState||(p.flags|=1024),p.memoizedProps=T,p.memoizedState=ut),Z.props=T,Z.state=ut,Z.context=Ee,T=Xe):(typeof Z.componentDidUpdate!="function"||re===d.memoizedProps&&dt===d.memoizedState||(p.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||re===d.memoizedProps&&dt===d.memoizedState||(p.flags|=1024),T=!1)}return c1(d,p,S,T,D,R)}function c1(d,p,S,T,R,D){Eb(d,p);var Z=(p.flags&128)!==0;if(!T&&!Z)return R&&Gi(p,S,!1),Ko(d,p,D);T=p.stateNode,fz.current=p;var re=Z&&typeof S.getDerivedStateFromError!="function"?null:T.render();return p.flags|=1,d!==null&&Z?(p.child=yc(p,d.child,null,D),p.child=yc(p,null,re,D)):lr(d,p,re,D),p.memoizedState=T.state,R&&Gi(p,S,!0),p.child}function Tb(d){var p=d.stateNode;p.pendingContext?ii(d,p.pendingContext,p.pendingContext!==p.context):p.context&&ii(d,p.context,!1),Z_(d,p.containerInfo)}function bb(d,p,S,T,R){return vc(),K_(R),p.flags|=256,lr(d,p,S,T),p.child}var tg={dehydrated:null,treeContext:null,retryLane:0};function ng(d){return{baseLanes:d,cachePool:null}}function Ab(d,p,S){var T=p.pendingProps,R=Pn.current,D=!1,Z=(p.flags&128)!==0,re;if((re=Z)||(re=d!==null&&d.memoizedState===null?!1:(R&2)!==0),re?(D=!0,p.flags&=-129):(d===null||d.memoizedState!==null)&&(R|=1),_t(Pn,R&1),d===null)return q_(p),d=p.memoizedState,d!==null&&(d=d.dehydrated,d!==null)?(p.mode&1?vn(d)?p.lanes=8:p.lanes=1073741824:p.lanes=1,null):(R=T.children,d=T.fallback,D?(T=p.mode,D=p.child,R={mode:"hidden",children:R},!(T&1)&&D!==null?(D.childLanes=0,D.pendingProps=R):D=Sg(R,T,0,null),d=Jl(d,T,S,null),D.return=p,d.return=p,D.sibling=d,p.child=D,p.child.memoizedState=ng(S),p.memoizedState=tg,d):f1(p,R));if(R=d.memoizedState,R!==null){if(re=R.dehydrated,re!==null){if(Z)return p.flags&256?(p.flags&=-257,ig(d,p,S,Error(o(422)))):p.memoizedState!==null?(p.child=d.child,p.flags|=128,null):(D=T.fallback,R=p.mode,T=Sg({mode:"visible",children:T.children},R,0,null),D=Jl(D,R,S,null),D.flags|=2,T.return=p,D.return=p,T.sibling=D,p.child=T,p.mode&1&&yc(p,d.child,null,S),p.child.memoizedState=ng(S),p.memoizedState=tg,D);if(!(p.mode&1))p=ig(d,p,S,null);else if(vn(re))p=ig(d,p,S,Error(o(419)));else if(T=(S&d.childLanes)!==0,jr||T){if(T=ri,T!==null){switch(S&-S){case 4:D=2;break;case 16:D=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:D=32;break;case 536870912:D=268435456;break;default:D=0}T=D&(T.suspendedLanes|S)?0:D,T!==0&&T!==R.retryLane&&(R.retryLane=T,hs(d,T,-1))}L1(),p=ig(d,p,S,Error(o(421)))}else jt(re)?(p.flags|=128,p.child=d.child,p=Mz.bind(null,d),Pi(re,p),p=null):(S=R.treeContext,ae&&(Wr=os(re),Hr=p,Mn=!0,Fs=null,Eh=!1,S!==null&&(ls[us++]=$o,ls[us++]=Yo,ls[us++]=jl,$o=S.id,Yo=S.overflow,jl=p)),p=f1(p,p.pendingProps.children),p.flags|=4096);return p}return D?(T=Rb(d,p,T.children,T.fallback,S),D=p.child,R=d.child.memoizedState,D.memoizedState=R===null?ng(S):{baseLanes:R.baseLanes|S,cachePool:null},D.childLanes=d.childLanes&~S,p.memoizedState=tg,T):(S=Cb(d,p,T.children,S),p.memoizedState=null,S)}return D?(T=Rb(d,p,T.children,T.fallback,S),D=p.child,R=d.child.memoizedState,D.memoizedState=R===null?ng(S):{baseLanes:R.baseLanes|S,cachePool:null},D.childLanes=d.childLanes&~S,p.memoizedState=tg,T):(S=Cb(d,p,T.children,S),p.memoizedState=null,S)}function f1(d,p){return p=Sg({mode:"visible",children:p},d.mode,0,null),p.return=d,d.child=p}function Cb(d,p,S,T){var R=d.child;return d=R.sibling,S=Ga(R,{mode:"visible",children:S}),!(p.mode&1)&&(S.lanes=T),S.return=p,S.sibling=null,d!==null&&(T=p.deletions,T===null?(p.deletions=[d],p.flags|=16):T.push(d)),p.child=S}function Rb(d,p,S,T,R){var D=p.mode;d=d.child;var Z=d.sibling,re={mode:"hidden",children:S};return!(D&1)&&p.child!==d?(S=p.child,S.childLanes=0,S.pendingProps=re,p.deletions=null):(S=Ga(d,re),S.subtreeFlags=d.subtreeFlags&14680064),Z!==null?T=Ga(Z,T):(T=Jl(T,D,R,null),T.flags|=2),T.return=p,S.return=p,S.sibling=T,p.child=S,T}function ig(d,p,S,T){return T!==null&&K_(T),yc(p,d.child,null,S),d=f1(p,p.pendingProps.children),d.flags|=2,p.memoizedState=null,d}function Pb(d,p,S){d.lanes|=p;var T=d.alternate;T!==null&&(T.lanes|=p),ar(d.return,p,S)}function h1(d,p,S,T,R){var D=d.memoizedState;D===null?d.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:T,tail:S,tailMode:R}:(D.isBackwards=p,D.rendering=null,D.renderingStartTime=0,D.last=T,D.tail=S,D.tailMode=R)}function Lb(d,p,S){var T=p.pendingProps,R=T.revealOrder,D=T.tail;if(lr(d,p,T.children,S),T=Pn.current,T&2)T=T&1|2,p.flags|=128;else{if(d!==null&&d.flags&128)e:for(d=p.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&Pb(d,S,p);else if(d.tag===19)Pb(d,S,p);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===p)break e;for(;d.sibling===null;){if(d.return===null||d.return===p)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}T&=1}if(_t(Pn,T),!(p.mode&1))p.memoizedState=null;else switch(R){case"forwards":for(S=p.child,R=null;S!==null;)d=S.alternate,d!==null&&jm(d)===null&&(R=S),S=S.sibling;S=R,S===null?(R=p.child,p.child=null):(R=S.sibling,S.sibling=null),h1(p,!1,R,S,D);break;case"backwards":for(S=null,R=p.child,p.child=null;R!==null;){if(d=R.alternate,d!==null&&jm(d)===null){p.child=R;break}d=R.sibling,R.sibling=S,S=R,R=d}h1(p,!0,S,null,D);break;case"together":h1(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function Ko(d,p,S){if(d!==null&&(p.dependencies=d.dependencies),Ec|=p.lanes,!(S&p.childLanes))return null;if(d!==null&&p.child!==d.child)throw Error(o(153));if(p.child!==null){for(d=p.child,S=Ga(d,d.pendingProps),p.child=S,S.return=p;d.sibling!==null;)d=d.sibling,S=S.sibling=Ga(d,d.pendingProps),S.return=p;S.sibling=null}return p.child}function hz(d,p,S){switch(p.tag){case 3:Tb(p),vc();break;case 5:$2(p);break;case 1:yn(p.type)&&co(p);break;case 4:Z_(p,p.stateNode.containerInfo);break;case 10:Fm(p,p.type._context,p.memoizedProps.value);break;case 13:var T=p.memoizedState;if(T!==null)return T.dehydrated!==null?(_t(Pn,Pn.current&1),p.flags|=128,null):S&p.child.childLanes?Ab(d,p,S):(_t(Pn,Pn.current&1),d=Ko(d,p,S),d!==null?d.sibling:null);_t(Pn,Pn.current&1);break;case 19:if(T=(S&p.childLanes)!==0,d.flags&128){if(T)return Lb(d,p,S);p.flags|=128}var R=p.memoizedState;if(R!==null&&(R.rendering=null,R.tail=null,R.lastEffect=null),_t(Pn,Pn.current),T)break;return null;case 22:case 23:return p.lanes=0,Sb(d,p,S)}return Ko(d,p,S)}function dz(d,p){switch($_(p),p.tag){case 1:return yn(p.type)&&ir(),d=p.flags,d&65536?(p.flags=d&-65537|128,p):null;case 3:return xc(),Vt(En),Vt(Vn),e1(),d=p.flags,d&65536&&!(d&128)?(p.flags=d&-65537|128,p):null;case 5:return Q_(p),null;case 13:if(Vt(Pn),d=p.memoizedState,d!==null&&d.dehydrated!==null){if(p.alternate===null)throw Error(o(340));vc()}return d=p.flags,d&65536?(p.flags=d&-65537|128,p):null;case 19:return Vt(Pn),null;case 4:return xc(),null;case 10:return Si(p.type._context),null;case 22:case 23:return P1(),null;case 24:return null;default:return null}}var rg=!1,Yl=!1,pz=typeof WeakSet=="function"?WeakSet:Set,Je=null;function sg(d,p){var S=d.ref;if(S!==null)if(typeof S=="function")try{S(null)}catch(T){Mr(d,p,T)}else S.current=null}function d1(d,p,S){try{S()}catch(T){Mr(d,p,T)}}var Ib=!1;function mz(d,p){for(O(d.containerInfo),Je=p;Je!==null;)if(d=Je,p=d.child,(d.subtreeFlags&1028)!==0&&p!==null)p.return=d,Je=p;else for(;Je!==null;){d=Je;try{var S=d.alternate;if(d.flags&1024)switch(d.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var T=S.memoizedProps,R=S.memoizedState,D=d.stateNode,Z=D.getSnapshotBeforeUpdate(d.elementType===d.type?T:or(d.type,T),R);D.__reactInternalSnapshotBeforeUpdate=Z}break;case 3:he&&He(d.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(re){Mr(d,d.return,re)}if(p=d.sibling,p!==null){p.return=d.return,Je=p;break}Je=d.return}return S=Ib,Ib=!1,S}function ql(d,p,S){var T=p.updateQueue;if(T=T!==null?T.lastEffect:null,T!==null){var R=T=T.next;do{if((R.tag&d)===d){var D=R.destroy;R.destroy=void 0,D!==void 0&&d1(p,S,D)}R=R.next}while(R!==T)}}function Oh(d,p){if(p=p.updateQueue,p=p!==null?p.lastEffect:null,p!==null){var S=p=p.next;do{if((S.tag&d)===d){var T=S.create;S.destroy=T()}S=S.next}while(S!==p)}}function p1(d){var p=d.ref;if(p!==null){var S=d.stateNode;switch(d.tag){case 5:d=V(S);break;default:d=S}typeof p=="function"?p(d):p.current=d}}function Db(d,p,S){if(Br&&typeof Br.onCommitFiberUnmount=="function")try{Br.onCommitFiberUnmount(Gl,p)}catch{}switch(p.tag){case 0:case 11:case 14:case 15:if(d=p.updateQueue,d!==null&&(d=d.lastEffect,d!==null)){var T=d=d.next;do{var R=T,D=R.destroy;R=R.tag,D!==void 0&&(R&2||R&4)&&d1(p,S,D),T=T.next}while(T!==d)}break;case 1:if(sg(p,S),d=p.stateNode,typeof d.componentWillUnmount=="function")try{d.props=p.memoizedProps,d.state=p.memoizedState,d.componentWillUnmount()}catch(Z){Mr(p,S,Z)}break;case 5:sg(p,S);break;case 4:he?zb(d,p,S):H&&H&&(p=p.stateNode.containerInfo,S=wt(p),zt(p,S))}}function Ub(d,p,S){for(var T=p;;)if(Db(d,T,S),T.child===null||he&&T.tag===4){if(T===p)break;for(;T.sibling===null;){if(T.return===null||T.return===p)return;T=T.return}T.sibling.return=T.return,T=T.sibling}else T.child.return=T,T=T.child}function Ob(d){var p=d.alternate;p!==null&&(d.alternate=null,Ob(p)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(p=d.stateNode,p!==null&&De(p)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}function kb(d){return d.tag===5||d.tag===3||d.tag===4}function Nb(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||kb(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==18;){if(d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function Fb(d){if(he){e:{for(var p=d.return;p!==null;){if(kb(p))break e;p=p.return}throw Error(o(160))}var S=p;switch(S.tag){case 5:p=S.stateNode,S.flags&32&&(it(p),S.flags&=-33),S=Nb(d),g1(d,S,p);break;case 3:case 4:p=S.stateNode.containerInfo,S=Nb(d),m1(d,S,p);break;default:throw Error(o(161))}}}function m1(d,p,S){var T=d.tag;if(T===5||T===6)d=d.stateNode,p?Be(S,d,p):Ve(S,d);else if(T!==4&&(d=d.child,d!==null))for(m1(d,p,S),d=d.sibling;d!==null;)m1(d,p,S),d=d.sibling}function g1(d,p,S){var T=d.tag;if(T===5||T===6)d=d.stateNode,p?Ye(S,d,p):be(S,d);else if(T!==4&&(d=d.child,d!==null))for(g1(d,p,S),d=d.sibling;d!==null;)g1(d,p,S),d=d.sibling}function zb(d,p,S){for(var T=p,R=!1,D,Z;;){if(!R){R=T.return;e:for(;;){if(R===null)throw Error(o(160));switch(D=R.stateNode,R.tag){case 5:Z=!1;break e;case 3:D=D.containerInfo,Z=!0;break e;case 4:D=D.containerInfo,Z=!0;break e}R=R.return}R=!0}if(T.tag===5||T.tag===6)Ub(d,T,S),Z?Fe(D,T.stateNode):Le(D,T.stateNode);else if(T.tag===18)Z?ct(D,T.stateNode):rt(D,T.stateNode);else if(T.tag===4){if(T.child!==null){D=T.stateNode.containerInfo,Z=!0,T.child.return=T,T=T.child;continue}}else if(Db(d,T,S),T.child!==null){T.child.return=T,T=T.child;continue}if(T===p)break;for(;T.sibling===null;){if(T.return===null||T.return===p)return;T=T.return,T.tag===4&&(R=!1)}T.sibling.return=T.return,T=T.sibling}}function v1(d,p){if(he){switch(p.tag){case 0:case 11:case 14:case 15:ql(3,p,p.return),Oh(3,p),ql(5,p,p.return);return;case 1:return;case 5:var S=p.stateNode;if(S!=null){var T=p.memoizedProps;d=d!==null?d.memoizedProps:T;var R=p.type,D=p.updateQueue;p.updateQueue=null,D!==null&&Ne(S,D,R,d,T,p)}return;case 6:if(p.stateNode===null)throw Error(o(162));S=p.memoizedProps,ke(p.stateNode,d!==null?d.memoizedProps:S,S);return;case 3:ae&&d!==null&&d.memoizedState.isDehydrated&&ue(p.stateNode.containerInfo);return;case 12:return;case 13:og(p);return;case 19:og(p);return;case 17:return}throw Error(o(163))}switch(p.tag){case 0:case 11:case 14:case 15:ql(3,p,p.return),Oh(3,p),ql(5,p,p.return);return;case 12:return;case 13:og(p);return;case 19:og(p);return;case 3:ae&&d!==null&&d.memoizedState.isDehydrated&&ue(p.stateNode.containerInfo);break;case 22:case 23:return}e:if(H){switch(p.tag){case 1:case 5:case 6:break e;case 3:case 4:p=p.stateNode,zt(p.containerInfo,p.pendingChildren);break e}throw Error(o(163))}}function og(d){var p=d.updateQueue;if(p!==null){d.updateQueue=null;var S=d.stateNode;S===null&&(S=d.stateNode=new pz),p.forEach(function(T){var R=Tz.bind(null,d,T);S.has(T)||(S.add(T),T.then(R,R))})}}function gz(d,p){for(Je=p;Je!==null;){p=Je;var S=p.deletions;if(S!==null)for(var T=0;T";case lg:return":has("+(x1(d)||"")+")";case ug:return'[role="'+d.value+'"]';case fg:return'"'+d.value+'"';case cg:return'[data-testname="'+d.value+'"]';default:throw Error(o(365))}}function Wb(d,p){var S=[];d=[d,0];for(var T=0;TR&&(R=Z),T&=~D}if(T=R,T=Rn()-T,T=(120>T?120:480>T?480:1080>T?1080:1920>T?1920:3e3>T?3e3:4320>T?4320:1960*yz(T/1960))-T,10d?16:d,Fa===null)var T=!1;else{if(d=Fa,Fa=null,gg=0,Ot&6)throw Error(o(331));var R=Ot;for(Ot|=4,Je=d.current;Je!==null;){var D=Je,Z=D.child;if(Je.flags&16){var re=D.deletions;if(re!==null){for(var Ee=0;EeRn()-M1?Kl(d,0):E1|=S),Er(d,p)}function Jb(d,p){p===0&&(d.mode&1?(p=Vo,Vo<<=1,!(Vo&130023424)&&(Vo=4194304)):p=1);var S=ur();d=_g(d,p),d!==null&&(fo(d,p,S),Er(d,S))}function Mz(d){var p=d.memoizedState,S=0;p!==null&&(S=p.retryLane),Jb(d,S)}function Tz(d,p){var S=0;switch(d.tag){case 13:var T=d.stateNode,R=d.memoizedState;R!==null&&(S=R.retryLane);break;case 19:T=d.stateNode;break;default:throw Error(o(314))}T!==null&&T.delete(p),Jb(d,S)}var eA;eA=function(d,p,S){if(d!==null)if(d.memoizedProps!==p.pendingProps||En.current)jr=!0;else{if(!(d.lanes&S)&&!(p.flags&128))return jr=!1,hz(d,p,S);jr=!!(d.flags&131072)}else jr=!1,Mn&&p.flags&1048576&&B2(p,Hm,p.index);switch(p.lanes=0,p.tag){case 2:var T=p.type;d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),d=p.pendingProps;var R=fn(p,Vn.current);Kn(p,S),R=n1(null,p,T,d,R,S);var D=i1();return p.flags|=1,typeof R=="object"&&R!==null&&typeof R.render=="function"&&R.$$typeof===void 0?(p.tag=1,p.memoizedState=null,p.updateQueue=null,yn(T)?(D=!0,co(p)):D=!1,p.memoizedState=R.state!==null&&R.state!==void 0?R.state:null,H_(p),R.updater=Gm,p.stateNode=R,R._reactInternals=p,j_(p,T,d,S),p=c1(null,p,T,!0,D,S)):(p.tag=0,Mn&&D&&X_(p),lr(null,p,R,S),p=p.child),p;case 16:T=p.elementType;e:{switch(d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),d=p.pendingProps,R=T._init,T=R(T._payload),p.type=T,R=p.tag=Az(T),d=or(T,d),R){case 0:p=u1(null,p,T,d,S);break e;case 1:p=Mb(null,p,T,d,S);break e;case 11:p=_b(null,p,T,d,S);break e;case 14:p=xb(null,p,T,or(T.type,d),S);break e}throw Error(o(306,T,""))}return p;case 0:return T=p.type,R=p.pendingProps,R=p.elementType===T?R:or(T,R),u1(d,p,T,R,S);case 1:return T=p.type,R=p.pendingProps,R=p.elementType===T?R:or(T,R),Mb(d,p,T,R,S);case 3:e:{if(Tb(p),d===null)throw Error(o(387));T=p.pendingProps,D=p.memoizedState,R=D.element,D2(d,p),Bm(p,T,null,S);var Z=p.memoizedState;if(T=Z.element,ae&&D.isDehydrated)if(D={element:T,isDehydrated:!1,cache:Z.cache,transitions:Z.transitions},p.updateQueue.baseState=D,p.memoizedState=D,p.flags&256){R=Error(o(423)),p=bb(d,p,T,S,R);break e}else if(T!==R){R=Error(o(424)),p=bb(d,p,T,S,R);break e}else for(ae&&(Wr=fi(p.stateNode.containerInfo),Hr=p,Mn=!0,Fs=null,Eh=!1),S=X2(p,null,T,S),p.child=S;S;)S.flags=S.flags&-3|4096,S=S.sibling;else{if(vc(),T===R){p=Ko(d,p,S);break e}lr(d,p,T,S)}p=p.child}return p;case 5:return $2(p),d===null&&q_(p),T=p.type,R=p.pendingProps,D=d!==null?d.memoizedProps:null,Z=R.children,te(T,R)?Z=null:D!==null&&te(T,D)&&(p.flags|=32),Eb(d,p),lr(d,p,Z,S),p.child;case 6:return d===null&&q_(p),null;case 13:return Ab(d,p,S);case 4:return Z_(p,p.stateNode.containerInfo),T=p.pendingProps,d===null?p.child=yc(p,null,T,S):lr(d,p,T,S),p.child;case 11:return T=p.type,R=p.pendingProps,R=p.elementType===T?R:or(T,R),_b(d,p,T,R,S);case 7:return lr(d,p,p.pendingProps,S),p.child;case 8:return lr(d,p,p.pendingProps.children,S),p.child;case 12:return lr(d,p,p.pendingProps.children,S),p.child;case 10:e:{if(T=p.type._context,R=p.pendingProps,D=p.memoizedProps,Z=R.value,Fm(p,T,Z),D!==null)if(Gr(D.value,Z)){if(D.children===R.children&&!En.current){p=Ko(d,p,S);break e}}else for(D=p.child,D!==null&&(D.return=p);D!==null;){var re=D.dependencies;if(re!==null){Z=D.child;for(var Ee=re.firstContext;Ee!==null;){if(Ee.context===T){if(D.tag===1){Ee=Xo(-1,S&-S),Ee.tag=2;var Xe=D.updateQueue;if(Xe!==null){Xe=Xe.shared;var ot=Xe.pending;ot===null?Ee.next=Ee:(Ee.next=ot.next,ot.next=Ee),Xe.pending=Ee}}D.lanes|=S,Ee=D.alternate,Ee!==null&&(Ee.lanes|=S),ar(D.return,S,p),re.lanes|=S;break}Ee=Ee.next}}else if(D.tag===10)Z=D.type===p.type?null:D.child;else if(D.tag===18){if(Z=D.return,Z===null)throw Error(o(341));Z.lanes|=S,re=Z.alternate,re!==null&&(re.lanes|=S),ar(Z,S,p),Z=D.sibling}else Z=D.child;if(Z!==null)Z.return=D;else for(Z=D;Z!==null;){if(Z===p){Z=null;break}if(D=Z.sibling,D!==null){D.return=Z.return,Z=D;break}Z=Z.return}D=Z}lr(d,p,R.children,S),p=p.child}return p;case 9:return R=p.type,T=p.pendingProps.children,Kn(p,S),R=Zn(R),T=T(R),p.flags|=1,lr(d,p,T,S),p.child;case 14:return T=p.type,R=or(T,p.pendingProps),R=or(T.type,R),xb(d,p,T,R,S);case 15:return wb(d,p,p.type,p.pendingProps,S);case 17:return T=p.type,R=p.pendingProps,R=p.elementType===T?R:or(T,R),d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),p.tag=1,yn(T)?(d=!0,co(p)):d=!1,Kn(p,S),F2(p,T,R),j_(p,T,R,S),c1(null,p,T,!0,d,S);case 19:return Lb(d,p,S);case 22:return Sb(d,p,S)}throw Error(o(156,p.tag))};function tA(d,p){return jo(d,p)}function bz(d,p,S,T){this.tag=d,this.key=S,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=p,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=T,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ds(d,p,S,T){return new bz(d,p,S,T)}function I1(d){return d=d.prototype,!(!d||!d.isReactComponent)}function Az(d){if(typeof d=="function")return I1(d)?1:0;if(d!=null){if(d=d.$$typeof,d===x)return 11;if(d===y)return 14}return 2}function Ga(d,p){var S=d.alternate;return S===null?(S=ds(d.tag,p,d.key,d.mode),S.elementType=d.elementType,S.type=d.type,S.stateNode=d.stateNode,S.alternate=d,d.alternate=S):(S.pendingProps=p,S.type=d.type,S.flags=0,S.subtreeFlags=0,S.deletions=null),S.flags=d.flags&14680064,S.childLanes=d.childLanes,S.lanes=d.lanes,S.child=d.child,S.memoizedProps=d.memoizedProps,S.memoizedState=d.memoizedState,S.updateQueue=d.updateQueue,p=d.dependencies,S.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},S.sibling=d.sibling,S.index=d.index,S.ref=d.ref,S}function wg(d,p,S,T,R,D){var Z=2;if(T=d,typeof d=="function")I1(d)&&(Z=1);else if(typeof d=="string")Z=5;else e:switch(d){case c:return Jl(S.children,R,D,p);case f:Z=8,R|=8;break;case h:return d=ds(12,S,p,R|2),d.elementType=h,d.lanes=D,d;case _:return d=ds(13,S,p,R),d.elementType=_,d.lanes=D,d;case g:return d=ds(19,S,p,R),d.elementType=g,d.lanes=D,d;case E:return Sg(S,R,D,p);default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case m:Z=10;break e;case v:Z=9;break e;case x:Z=11;break e;case y:Z=14;break e;case w:Z=16,T=null;break e}throw Error(o(130,d==null?d:typeof d,""))}return p=ds(Z,S,p,R),p.elementType=d,p.type=T,p.lanes=D,p}function Jl(d,p,S,T){return d=ds(7,d,T,p),d.lanes=S,d}function Sg(d,p,S,T){return d=ds(22,d,T,p),d.elementType=E,d.lanes=S,d.stateNode={},d}function D1(d,p,S){return d=ds(6,d,null,p),d.lanes=S,d}function U1(d,p,S){return p=ds(4,d.children!==null?d.children:[],d.key,p),p.lanes=S,p.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},p}function Cz(d,p,S,T,R){this.tag=p,this.containerInfo=d,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ie,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=fc(0),this.expirationTimes=fc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fc(0),this.identifierPrefix=T,this.onRecoverableError=R,ae&&(this.mutableSourceEagerHydrationData=null)}function nA(d,p,S,T,R,D,Z,re,Ee){return d=new Cz(d,p,S,re,Ee),p===1?(p=1,D===!0&&(p|=8)):p=0,D=ds(3,null,null,p),d.current=D,D.stateNode=d,D.memoizedState={element:T,isDehydrated:S,cache:null,transitions:null},H_(D),d}function iA(d){if(!d)return qn;d=d._reactInternals;e:{if(A(d)!==d||d.tag!==1)throw Error(o(170));var p=d;do{switch(p.tag){case 3:p=p.stateNode.context;break e;case 1:if(yn(p.type)){p=p.stateNode.__reactInternalMemoizedMergedChildContext;break e}}p=p.return}while(p!==null);throw Error(o(171))}if(d.tag===1){var S=d.type;if(yn(S))return uo(d,S,p)}return p}function rA(d){var p=d._reactInternals;if(p===void 0)throw typeof d.render=="function"?Error(o(188)):(d=Object.keys(d).join(","),Error(o(268,d)));return d=F(p),d===null?null:d.stateNode}function sA(d,p){if(d=d.memoizedState,d!==null&&d.dehydrated!==null){var S=d.retryLane;d.retryLane=S!==0&&S=Xe&&D>=Mt&&R<=ot&&Z<=dt){d.splice(p,1);break}else if(T!==Xe||S.width!==Ee.width||dtZ){if(!(D!==Mt||S.height!==Ee.height||otR)){Xe>T&&(Ee.width+=Xe-T,Ee.x=T),otD&&(Ee.height+=Mt-D,Ee.y=D),dtS&&(S=Z)),Z ")+` - -No matching component was found for: - `)+d.join(" > ")}return null},t.getPublicRootInstance=function(d){if(d=d.current,!d.child)return null;switch(d.child.tag){case 5:return V(d.child.stateNode);default:return d.child.stateNode}},t.injectIntoDevTools=function(d){if(d={bundleType:d.bundleType,version:d.version,rendererPackageName:d.rendererPackageName,rendererConfig:d.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:Rz,findFiberByHostInstance:d.findFiberByHostInstance||Pz,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")d=!1;else{var p=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(p.isDisabled||!p.supportsFiber)d=!0;else{try{Gl=p.inject(d),Br=p}catch{}d=!!p.checkDCE}}return d},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(d,p,S,T){if(!ge)throw Error(o(363));d=w1(d,p);var R=Se(d,S,T).disconnect;return{disconnect:function(){R()}}},t.registerMutableSourceForHydration=function(d,p){var S=p._getVersion;S=S(p._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[p,S]:d.mutableSourceEagerHydrationData.push(p,S)},t.runWithPriority=function(d,p){var S=kt;try{return kt=d,p()}finally{kt=S}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(d,p,S,T){var R=p.current,D=ur(),Z=za(R);return S=iA(S),p.context===null?p.context=S:p.pendingContext=S,p=Xo(D,Z),p.payload={element:d},T=T===void 0?null:T,T!==null&&(p.callback=T),ka(R,p),d=hs(R,Z,D),d!==null&&zm(d,R,Z),Z},t};UO.exports=Z7;var Q7=UO.exports;const J7=ts(Q7);var OO={exports:{}},kO={};/** - * @license React - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */(function(n){function e(I,O){var k=I.length;I.push(O);e:for(;0>>1,z=I[U];if(0>>1;Ur(te,k))ser(ne,te)?(I[U]=ne,I[se]=k,U=se):(I[U]=te,I[J]=k,U=J);else if(ser(ne,k))I[U]=ne,I[se]=k,U=se;else break e}}return O}function r(I,O){var k=I.sortIndex-O.sortIndex;return k!==0?k:I.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,f=null,h=3,m=!1,v=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(I){for(var O=t(u);O!==null;){if(O.callback===null)i(u);else if(O.startTime<=I)i(u),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(u)}}function E(I){if(x=!1,w(I),!v)if(t(l)!==null)v=!0,V(M);else{var O=t(u);O!==null&&W(E,O.startTime-I)}}function M(I,O){v=!1,x&&(x=!1,g(P),P=-1),m=!0;var k=h;try{for(w(O),f=t(l);f!==null&&(!(f.expirationTime>O)||I&&!N());){var U=f.callback;if(typeof U=="function"){f.callback=null,h=f.priorityLevel;var z=U(f.expirationTime<=O);O=n.unstable_now(),typeof z=="function"?f.callback=z:f===t(l)&&i(l),w(O)}else i(l);f=t(l)}if(f!==null)var Q=!0;else{var J=t(u);J!==null&&W(E,J.startTime-O),Q=!1}return Q}finally{f=null,h=k,m=!1}}var b=!1,C=null,P=-1,A=5,L=-1;function N(){return!(n.unstable_now()-LI||125U?(I.sortIndex=k,e(u,I),t(l)===null&&I===t(u)&&(x?(g(P),P=-1):x=!0,W(E,k-U))):(I.sortIndex=z,e(l,I),v||m||(v=!0,V(M))),I},n.unstable_shouldYield=N,n.unstable_wrapCallback=function(I){var O=h;return function(){var k=h;h=O;try{return I.apply(this,arguments)}finally{h=k}}}})(kO);OO.exports=kO;var WR=OO.exports;const e9=n=>typeof n=="object"&&typeof n.then=="function",A0=[];function t9(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let r=0;r0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=A0.indexOf(r);s!==-1&&A0.splice(s,1)},promise:(e9(n)?n:n(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(A0.push(r),!t)throw r.promise}const i9=(n,e,t)=>n9(n,e,!1,t),bT={},NO=n=>void Object.assign(bT,n);function r9(n,e){function t(c,{args:f=[],attach:h,...m},v){let x=`${c[0].toUpperCase()}${c.slice(1)}`,_;if(c==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=m.object;_=rf(g,{type:c,root:v,attach:h,primitive:!0})}else{const g=bT[x];if(!g)throw new Error(`R3F: ${x} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(f))throw new Error("R3F: The args prop must be an array!");_=rf(new g(...f),{type:c,root:v,attach:h,memoizedProps:{args:f}})}return _.__r3f.attach===void 0&&(_ instanceof Ct?_.__r3f.attach="geometry":_ instanceof Fi&&(_.__r3f.attach="material")),x!=="inject"&&jx(_,m),_}function i(c,f){let h=!1;if(f){var m,v;(m=f.__r3f)!=null&&m.attach?Wx(c,f,f.__r3f.attach):f.isObject3D&&c.isObject3D&&(c.add(f),h=!0),h||(v=c.__r3f)==null||v.objects.push(f),f.__r3f||rf(f,{}),f.__r3f.parent=c,fE(f),sf(f)}}function r(c,f,h){let m=!1;if(f){var v,x;if((v=f.__r3f)!=null&&v.attach)Wx(c,f,f.__r3f.attach);else if(f.isObject3D&&c.isObject3D){f.parent=c,f.dispatchEvent({type:"added"});const _=c.children.filter(y=>y!==f),g=_.indexOf(h);c.children=[..._.slice(0,g),f,..._.slice(g)],m=!0}m||(x=c.__r3f)==null||x.objects.push(f),f.__r3f||rf(f,{}),f.__r3f.parent=c,fE(f),sf(f)}}function s(c,f,h=!1){c&&[...c].forEach(m=>o(f,m,h))}function o(c,f,h){if(f){var m,v,x;if(f.__r3f&&(f.__r3f.parent=null),(m=c.__r3f)!=null&&m.objects&&(c.__r3f.objects=c.__r3f.objects.filter(E=>E!==f)),(v=f.__r3f)!=null&&v.attach)qR(c,f,f.__r3f.attach);else if(f.isObject3D&&c.isObject3D){var _;c.remove(f),(_=f.__r3f)!=null&&_.root&&f9(f.__r3f.root,f)}const y=(x=f.__r3f)==null?void 0:x.primitive,w=h===void 0?f.dispose!==null&&!y:h;if(!y){var g;s((g=f.__r3f)==null?void 0:g.objects,f,w),s(f.children,f,w)}delete f.__r3f,w&&f.dispose&&f.type!=="Scene"&&WR.unstable_scheduleCallback(WR.unstable_IdlePriority,()=>{try{f.dispose()}catch{}}),sf(c)}}function a(c,f,h,m){var v;const x=(v=c.__r3f)==null?void 0:v.parent;if(!x)return;const _=t(f,h,c.__r3f.root);if(c.children){for(const g of c.children)g.__r3f&&i(_,g);c.children=c.children.filter(g=>!g.__r3f)}c.__r3f.objects.forEach(g=>i(_,g)),c.__r3f.objects=[],c.__r3f.autoRemovedBeforeAppend||o(x,c),_.parent&&(_.__r3f.autoRemovedBeforeAppend=!0),i(x,_),_.raycast&&_.__r3f.eventCount&&_.__r3f.root.getState().internal.interaction.push(_),[m,m.alternate].forEach(g=>{g!==null&&(g.stateNode=_,g.ref&&(typeof g.ref=="function"?g.ref(_):g.ref.current=_))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:J7({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(c,f)=>{if(!f)return;const h=c.getState().scene;h.__r3f&&(h.__r3f.root=c,i(h,f))},removeChildFromContainer:(c,f)=>{f&&o(c.getState().scene,f)},insertInContainerBefore:(c,f,h)=>{if(!f||!h)return;const m=c.getState().scene;m.__r3f&&r(m,f,h)},getRootHostContext:()=>null,getChildHostContext:c=>c,finalizeInitialChildren(c){var f;return!!((f=c==null?void 0:c.__r3f)!=null?f:{}).handlers},prepareUpdate(c,f,h,m){var v;if(((v=c==null?void 0:c.__r3f)!=null?v:{}).primitive&&m.object&&m.object!==c)return[!0];{const{args:_=[],children:g,...y}=m,{args:w=[],children:E,...M}=h;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((C,P)=>C!==w[P]))return[!0];const b=WO(c,y,M,!0);return b.changes.length?[!1,b]:null}},commitUpdate(c,[f,h],m,v,x,_){f?a(c,m,x,_):jx(c,h)},commitMount(c,f,h,m){var v;const x=(v=c.__r3f)!=null?v:{};c.raycast&&x.handlers&&x.eventCount&&c.__r3f.root.getState().internal.interaction.push(c)},getPublicInstance:c=>c,prepareForCommit:()=>null,preparePortalMount:c=>rf(c.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(c){var f;const{attach:h,parent:m}=(f=c.__r3f)!=null?f:{};h&&m&&qR(m,c,h),c.isObject3D&&(c.visible=!1),sf(c)},unhideInstance(c,f){var h;const{attach:m,parent:v}=(h=c.__r3f)!=null?h:{};m&&v&&Wx(v,c,m),(c.isObject3D&&f.visible==null||f.visible)&&(c.visible=!0),sf(c)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Sf.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Tn.fun(performance.now)?performance.now:Tn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Tn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Tn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:jx}}var jR,XR;const Hx=n=>"colorSpace"in n||"outputColorSpace"in n,FO=()=>{var n;return(n=bT.ColorManagement)!=null?n:null},zO=n=>n&&n.isOrthographicCamera,s9=n=>n&&n.hasOwnProperty("current"),vm=typeof window<"u"&&((jR=window.document)!=null&&jR.createElement||((XR=window.navigator)==null?void 0:XR.product)==="ReactNative")?Y.useLayoutEffect:Y.useEffect;function BO(n){const e=Y.useRef(n);return vm(()=>void(e.current=n),[n]),e}function o9({set:n}){return vm(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class GO extends Y.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}GO.getDerivedStateFromError=()=>({error:!0});const VO="__default",$R=new Map,a9=n=>n&&!!n.memoized&&!!n.changes;function HO(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const rd=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},Tn={obj:n=>n===Object(n)&&!Tn.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(Tn.str(n)||Tn.num(n))return n===e;const s=Tn.obj(n);if(s&&i==="reference")return n===e;const o=Tn.arr(n);if(o&&t==="reference")return n===e;if((o||s)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(a in r?e:n)if(!Tn.equ(n[a],e[a],{strict:r,objects:"reference"}))return!1}else for(a in r?e:n)if(n[a]!==e[a])return!1;if(Tn.und(a)){if(o&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function l9(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function rf(n,e){const t=n;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},n}function cE(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,o)=>s[o],n),{target:t,key:r}}else return{target:t,key:e}}const YR=/-\d+$/;function Wx(n,e,t){if(Tn.str(t)){if(YR.test(t)){const s=t.replace(YR,""),{target:o,key:a}=cE(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=cE(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function qR(n,e,t){var i,r;if(Tn.str(t)){const{target:s,key:o}=cE(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function WO(n,{children:e,key:t,ref:i,...r},{children:s,key:o,ref:a,...l}={},u=!1){var c;const f=(c=n==null?void 0:n.__r3f)!=null?c:{},h=Object.entries(r),m=[];if(u){const x=Object.keys(l);for(let _=0;_{var g;if((g=n.__r3f)!=null&&g.primitive&&x==="object"||Tn.equ(_,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,_,!0,[]]);let y=[];x.includes("-")&&(y=x.split("-")),m.push([x,_,!1,y]);for(const w in r){const E=r[w];w.startsWith(`${x}-`)&&m.push([w,E,!1,w.split("-")])}});const v={...r};return f.memoizedProps&&f.memoizedProps.args&&(v.args=f.memoizedProps.args),f.memoizedProps&&f.memoizedProps.attach&&(v.attach=f.memoizedProps.attach),{memoized:v,changes:m}}function jx(n,e){var t,i,r;const s=(t=n.__r3f)!=null?t:{},o=s.root,a=(i=o==null||o.getState==null?void 0:o.getState())!=null?i:{},{memoized:l,changes:u}=a9(e)?e:WO(n,e),c=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let h=0;hw[E],n),!(y&&y.set))){const[w,...E]=_.reverse();g=E.reverse().reduce((M,b)=>M[b],n),m=w}if(v===VO+"remove")if(g.constructor){let w=$R.get(g.constructor);w||(w=new g.constructor,$R.set(g.constructor,w)),v=w[m]}else v=0;if(x)v?s.handlers[m]=v:delete s.handlers[m],s.eventCount=Object.keys(s.handlers).length;else if(y&&y.set&&(y.copy||y instanceof Du)){if(Array.isArray(v))y.fromArray?y.fromArray(v):y.set(...v);else if(y.copy&&v&&v.constructor&&y.constructor===v.constructor)y.copy(v);else if(v!==void 0){const w=y instanceof Ze;!w&&y.setScalar?y.setScalar(v):y instanceof Du&&v instanceof Du?y.mask=v.mask:y.set(v),!FO()&&!a.linear&&w&&y.convertSRGBToLinear()}}else if(g[m]=v,g[m]instanceof Bn&&g[m].format===Lr&&g[m].type===Io){const w=g[m];Hx(w)&&Hx(a.gl)?w.colorSpace=a.gl.outputColorSpace:w.encoding=a.gl.outputEncoding}sf(n)}if(s.parent&&a.internal&&n.raycast&&c!==s.eventCount){const h=a.internal.interaction.indexOf(n);h>-1&&a.internal.interaction.splice(h,1),s.eventCount&&a.internal.interaction.push(n)}return!(u.length===1&&u[0][0]==="onUpdate")&&u.length&&(r=n.__r3f)!=null&&r.parent&&fE(n),n}function sf(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function fE(n){n.onUpdate==null||n.onUpdate(n)}function u9(n,e){n.manual||(zO(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function C0(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function c9(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Sf.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Sf.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Sf.ContinuousEventPriority;default:return Sf.DefaultEventPriority}}function jO(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function f9(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{jO(t.capturedMap,e,i,r)})}function h9(n){function e(l){const{internal:u}=n.getState(),c=l.offsetX-u.initialClick[0],f=l.offsetY-u.initialClick[1];return Math.round(Math.sqrt(c*c+f*f))}function t(l){return l.filter(u=>["Move","Over","Enter","Out","Leave"].some(c=>{var f;return(f=u.__r3f)==null?void 0:f.handlers["onPointer"+c]}))}function i(l,u){const c=n.getState(),f=new Set,h=[],m=u?u(c.internal.interaction):c.internal.interaction;for(let g=0;g{const w=rd(g.object),E=rd(y.object);return!w||!E?g.distance-y.distance:E.events.priority-w.events.priority||g.distance-y.distance}).filter(g=>{const y=C0(g);return f.has(y)?!1:(f.add(y),!0)});c.events.filter&&(x=c.events.filter(x,c));for(const g of x){let y=g.object;for(;y;){var _;(_=y.__r3f)!=null&&_.eventCount&&h.push({...g,eventObject:y}),y=y.parent}}if("pointerId"in l&&c.internal.capturedMap.has(l.pointerId))for(let g of c.internal.capturedMap.get(l.pointerId).values())f.has(C0(g.intersection))||h.push(g.intersection);return h}function r(l,u,c,f){const h=n.getState();if(l.length){const m={stopped:!1};for(const v of l){const x=rd(v.object)||h,{raycaster:_,pointer:g,camera:y,internal:w}=x,E=new $(g.x,g.y,0).unproject(y),M=L=>{var N,F;return(N=(F=w.capturedMap.get(L))==null?void 0:F.has(v.eventObject))!=null?N:!1},b=L=>{const N={intersection:v,target:u.target};w.capturedMap.has(L)?w.capturedMap.get(L).set(v.eventObject,N):w.capturedMap.set(L,new Map([[v.eventObject,N]])),u.target.setPointerCapture(L)},C=L=>{const N=w.capturedMap.get(L);N&&jO(w.capturedMap,v.eventObject,N,L)};let P={};for(let L in u){let N=u[L];typeof N!="function"&&(P[L]=N)}let A={...v,...P,pointer:g,intersections:l,stopped:m.stopped,delta:c,unprojectedPoint:E,ray:_.ray,camera:y,stopPropagation(){const L="pointerId"in u&&w.capturedMap.get(u.pointerId);if((!L||L.has(v.eventObject))&&(A.stopped=m.stopped=!0,w.hovered.size&&Array.from(w.hovered.values()).find(N=>N.eventObject===v.eventObject))){const N=l.slice(0,l.indexOf(v));s([...N,v])}},target:{hasPointerCapture:M,setPointerCapture:b,releasePointerCapture:C},currentTarget:{hasPointerCapture:M,setPointerCapture:b,releasePointerCapture:C},nativeEvent:u};if(f(A),m.stopped===!0)break}}return l}function s(l){const{internal:u}=n.getState();for(const c of u.hovered.values())if(!l.length||!l.find(f=>f.object===c.object&&f.index===c.index&&f.instanceId===c.instanceId)){const h=c.eventObject.__r3f,m=h==null?void 0:h.handlers;if(u.hovered.delete(C0(c)),h!=null&&h.eventCount){const v={...c,intersections:l};m.onPointerOut==null||m.onPointerOut(v),m.onPointerLeave==null||m.onPointerLeave(v)}}}function o(l,u){for(let c=0;cs([]);case"onLostPointerCapture":return u=>{const{internal:c}=n.getState();"pointerId"in u&&c.capturedMap.has(u.pointerId)&&requestAnimationFrame(()=>{c.capturedMap.has(u.pointerId)&&(c.capturedMap.delete(u.pointerId),s([]))})}}return function(c){const{onPointerMissed:f,internal:h}=n.getState();h.lastEvent.current=c;const m=l==="onPointerMove",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",_=i(c,m?t:void 0),g=v?e(c):0;l==="onPointerDown"&&(h.initialClick=[c.offsetX,c.offsetY],h.initialHits=_.map(w=>w.eventObject)),v&&!_.length&&g<=2&&(o(c,h.interaction),f&&f(c)),m&&s(_);function y(w){const E=w.eventObject,M=E.__r3f,b=M==null?void 0:M.handlers;if(M!=null&&M.eventCount)if(m){if(b.onPointerOver||b.onPointerEnter||b.onPointerOut||b.onPointerLeave){const C=C0(w),P=h.hovered.get(C);P?P.stopped&&w.stopPropagation():(h.hovered.set(C,w),b.onPointerOver==null||b.onPointerOver(w),b.onPointerEnter==null||b.onPointerEnter(w))}b.onPointerMove==null||b.onPointerMove(w)}else{const C=b[l];C?(!v||h.initialHits.includes(E))&&(o(c,h.interaction.filter(P=>!h.initialHits.includes(P))),C(w)):v&&h.initialHits.includes(E)&&o(c,h.interaction.filter(P=>!h.initialHits.includes(P)))}}r(_,c,g,y)}}return{handlePointer:a}}const XO=n=>!!(n!=null&&n.render),$O=Y.createContext(null),d9=(n,e)=>{const t=Y7((a,l)=>{const u=new $,c=new $,f=new $;function h(g=l().camera,y=c,w=l().size){const{width:E,height:M,top:b,left:C}=w,P=E/M;y instanceof $?f.copy(y):f.set(...y);const A=g.getWorldPosition(u).distanceTo(f);if(zO(g))return{width:E/g.zoom,height:M/g.zoom,top:b,left:C,factor:1,distance:A,aspect:P};{const L=g.fov*Math.PI/180,N=2*Math.tan(L/2)*A,F=N*(E/M);return{width:F,height:N,top:b,left:C,factor:E/F,distance:A,aspect:P}}}let m;const v=g=>a(y=>({performance:{...y.performance,current:g}})),x=new Pe;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(g=1)=>n(l(),g),advance:(g,y)=>e(g,y,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new wT,pointer:x,mouse:x,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=l();m&&clearTimeout(m),g.performance.current!==g.performance.min&&v(g.performance.min),m=setTimeout(()=>v(l().performance.max),g.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:h},setEvents:g=>a(y=>({...y,events:{...y.events,...g}})),setSize:(g,y,w,E,M)=>{const b=l().camera,C={width:g,height:y,top:E||0,left:M||0,updateStyle:w};a(P=>({size:C,viewport:{...P.viewport,...h(b,c,C)}}))},setDpr:g=>a(y=>{const w=HO(g);return{viewport:{...y.viewport,dpr:w,initialDpr:y.viewport.initialDpr||w}}}),setFrameloop:(g="always")=>{const y=l().clock;y.stop(),y.elapsedTime=0,g!=="never"&&(y.start(),y.elapsedTime=0),a(()=>({frameloop:g}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:Y.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(g,y,w)=>{const E=l().internal;return E.priority=E.priority+(y>0?1:0),E.subscribers.push({ref:g,priority:y,store:w}),E.subscribers=E.subscribers.sort((M,b)=>M.priority-b.priority),()=>{const M=l().internal;M!=null&&M.subscribers&&(M.priority=M.priority-(y>0?1:0),M.subscribers=M.subscribers.filter(b=>b.ref!==g))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:u,gl:c,set:f}=t.getState();if(l!==r||u.dpr!==s){var h;r=l,s=u.dpr,u9(a,l),c.setPixelRatio(u.dpr);const m=(h=l.updateStyle)!=null?h:typeof HTMLCanvasElement<"u"&&c.domElement instanceof HTMLCanvasElement;c.setSize(l.width,l.height,m)}a!==o&&(o=a,f(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};function p9(n,e){const t={callback:n};return e.add(t),()=>void e.delete(t)}let R0,YO=new Set,m9=new Set,g9=new Set;const v9=n=>p9(n,YO);function Xx(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function sd(n,e){switch(n){case"before":return Xx(YO,e);case"after":return Xx(m9,e);case"tail":return Xx(g9,e)}}let $x,Yx;function qx(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),$x=e.internal.subscribers,R0=0;R0<$x.length;R0++)Yx=$x[R0],Yx.ref.current(Yx.store.getState(),i,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function y9(n){let e=!1,t,i,r;function s(l){i=requestAnimationFrame(s),e=!0,t=0,sd("before",l);for(const c of n.values()){var u;r=c.store.getState(),r.internal.active&&(r.frameloop==="always"||r.internal.frames>0)&&!((u=r.gl.xr)!=null&&u.isPresenting)&&(t+=qx(l,r))}if(sd("after",l),t===0)return sd("tail",l),e=!1,cancelAnimationFrame(i)}function o(l,u=1){var c;if(!l)return n.forEach(f=>o(f.store.getState()),u);(c=l.gl.xr)!=null&&c.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+u),e||(e=!0,requestAnimationFrame(s)))}function a(l,u=!0,c,f){if(u&&sd("before",l),c)qx(l,c,f);else for(const h of n.values())qx(l,h.store.getState());u&&sd("after",l)}return{loop:s,invalidate:o,advance:a}}function qO(){const n=Y.useContext($O);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function ui(n=t=>t,e){return qO()(n,e)}function g_(n,e=0){const t=qO(),i=t.getState().internal.subscribe,r=BO(n);return vm(()=>i(r,e,t),[e,i,t]),null}const Yf=new Map,{invalidate:KR,advance:ZR}=y9(Yf),{reconciler:Qv,applyProps:vu}=r9(Yf,c9),Yc={objects:"shallow",strict:!1},_9=(n,e)=>{const t=typeof n=="function"?n(e):n;return XO(t)?t:new tT({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function x9(n,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:i,top:r,left:s}=n.parentElement.getBoundingClientRect();return{width:t,height:i,top:r,left:s}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function w9(n){const e=Yf.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||d9(KR,ZR),o=t||Qv.createContainer(s,Sf.ConcurrentRoot,null,!1,null,"",r,null);e||Yf.set(n,{fiber:o,store:s});let a,l=!1,u;return{configure(c={}){let{gl:f,size:h,scene:m,events:v,onCreated:x,shadows:_=!1,linear:g=!1,flat:y=!1,legacy:w=!1,orthographic:E=!1,frameloop:M="always",dpr:b=[1,2],performance:C,raycaster:P,camera:A,onPointerMissed:L}=c,N=s.getState(),F=N.gl;N.gl||N.set({gl:F=_9(f,n)});let B=N.raycaster;B||N.set({raycaster:B=new TT});const{params:j,...q}=P||{};if(Tn.equ(q,B,Yc)||vu(B,{...q}),Tn.equ(j,B.params,Yc)||vu(B,{params:{...B.params,...j}}),!N.camera||N.camera===u&&!Tn.equ(u,A,Yc)){u=A;const U=A instanceof cm,z=U?A:E?new ic(0,0,0,0,.1,1e3):new li(75,0,.1,1e3);U||(z.position.z=5,A&&vu(z,A),!N.camera&&!(A!=null&&A.rotation)&&z.lookAt(0,0,0)),N.set({camera:z})}if(!N.scene){let U;m instanceof kp?U=m:(U=new kp,m&&vu(U,m)),N.set({scene:rf(U)})}if(!N.xr){const U=(J,te)=>{const se=s.getState();se.frameloop!=="never"&&ZR(J,!0,se,te)},z=()=>{const J=s.getState();J.gl.xr.enabled=J.gl.xr.isPresenting,J.gl.xr.setAnimationLoop(J.gl.xr.isPresenting?U:null),J.gl.xr.isPresenting||KR(J)},Q={connect(){const J=s.getState().gl;J.xr.addEventListener("sessionstart",z),J.xr.addEventListener("sessionend",z)},disconnect(){const J=s.getState().gl;J.xr.removeEventListener("sessionstart",z),J.xr.removeEventListener("sessionend",z)}};F.xr&&Q.connect(),N.set({xr:Q})}if(F.shadowMap){const U=F.shadowMap.enabled,z=F.shadowMap.type;if(F.shadowMap.enabled=!!_,Tn.boo(_))F.shadowMap.type=Kd;else if(Tn.str(_)){var V;const Q={basic:ID,percentage:Gy,soft:Kd,variance:Ys};F.shadowMap.type=(V=Q[_])!=null?V:Kd}else Tn.obj(_)&&Object.assign(F.shadowMap,_);(U!==F.shadowMap.enabled||z!==F.shadowMap.type)&&(F.shadowMap.needsUpdate=!0)}const W=FO();W&&("enabled"in W?W.enabled=!w:"legacyMode"in W&&(W.legacyMode=w)),vu(F,{outputEncoding:g?3e3:3001,toneMapping:y?io:kM}),N.legacy!==w&&N.set(()=>({legacy:w})),N.linear!==g&&N.set(()=>({linear:g})),N.flat!==y&&N.set(()=>({flat:y})),f&&!Tn.fun(f)&&!XO(f)&&!Tn.equ(f,F,Yc)&&vu(F,f),v&&!N.events.handlers&&N.set({events:v(s)});const k=x9(n,h);return Tn.equ(k,N.size,Yc)||N.setSize(k.width,k.height,k.updateStyle,k.top,k.left),b&&N.viewport.dpr!==HO(b)&&N.setDpr(b),N.frameloop!==M&&N.setFrameloop(M),N.onPointerMissed||N.set({onPointerMissed:L}),C&&!Tn.equ(C,N.performance,Yc)&&N.set(U=>({performance:{...U.performance,...C}})),a=x,l=!0,this},render(c){return l||this.configure(),Qv.updateContainer(Y.createElement(S9,{store:s,children:c,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){KO(n)}}}function S9({store:n,children:e,onCreated:t,rootElement:i}){return vm(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),Y.createElement($O.Provider,{value:n},e)}function KO(n,e){const t=Yf.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),Qv.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,a,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=r.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),l9(r),Yf.delete(n)}catch{}},500)})}}Qv.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:Y.version});function qu(){return qu=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?i=setTimeout(l,e-c):(i=null,t||(a=n.apply(s,r),s=r=null))}var u=function(){s=this,r=arguments,o=Date.now();var c=t&&!i;return i||(i=setTimeout(l,e)),c&&(a=n.apply(s,r),s=r=null),a};return u.clear=function(){i&&(clearTimeout(i),i=null)},u.flush=function(){i&&(a=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},u}hE.debounce=hE;var E9=hE;const QR=ts(E9);function M9(n){let{debounce:e,scroll:t,polyfill:i,offsetSize:r}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const s=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,a]=Y.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=Y.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),u=e?typeof e=="number"?e:e.scroll:null,c=e?typeof e=="number"?e:e.resize:null,f=Y.useRef(!1);Y.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[h,m,v]=Y.useMemo(()=>{const y=()=>{if(!l.current.element)return;const{left:w,top:E,width:M,height:b,bottom:C,right:P,x:A,y:L}=l.current.element.getBoundingClientRect(),N={left:w,top:E,width:M,height:b,bottom:C,right:P,x:A,y:L};l.current.element instanceof HTMLElement&&r&&(N.height=l.current.element.offsetHeight,N.width=l.current.element.offsetWidth),Object.freeze(N),f.current&&!C9(l.current.lastBounds,N)&&a(l.current.lastBounds=N)};return[y,c?QR(y,c):y,u?QR(y,u):y]},[a,r,u,c]);function x(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",v,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function _(){l.current.element&&(l.current.resizeObserver=new s(v),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(y=>y.addEventListener("scroll",v,{capture:!0,passive:!0})))}const g=y=>{!y||y===l.current.element||(x(),l.current.element=y,l.current.scrollContainers=ZO(y),_())};return b9(v,!!t),T9(m),Y.useEffect(()=>{x(),_()},[t,v,m]),Y.useEffect(()=>x,[]),[g,o,h]}function T9(n){Y.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function b9(n,e){Y.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function ZO(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...ZO(n.parentElement)]}const A9=["x","y","top","bottom","left","right","width","height"],C9=(n,e)=>A9.every(t=>n[t]===e[t]);var R9=Object.defineProperty,P9=Object.defineProperties,L9=Object.getOwnPropertyDescriptors,JR=Object.getOwnPropertySymbols,I9=Object.prototype.hasOwnProperty,D9=Object.prototype.propertyIsEnumerable,eP=(n,e,t)=>e in n?R9(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,tP=(n,e)=>{for(var t in e||(e={}))I9.call(e,t)&&eP(n,t,e[t]);if(JR)for(var t of JR(e))D9.call(e,t)&&eP(n,t,e[t]);return n},U9=(n,e)=>P9(n,L9(e)),nP,iP;typeof window<"u"&&((nP=window.document)!=null&&nP.createElement||((iP=window.navigator)==null?void 0:iP.product)==="ReactNative")?Y.useLayoutEffect:Y.useEffect;function QO(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=n.child;for(;i;){const r=QO(i,e,t);if(r)return r;i=i.sibling}}function JO(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const rP=console.error;console.error=function(){const n=[...arguments].join("");if(n!=null&&n.startsWith("Warning:")&&n.includes("useContext")){console.error=rP;return}return rP.apply(this,arguments)};const AT=JO(Y.createContext(null));class ek extends Y.Component{render(){return Y.createElement(AT.Provider,{value:this._reactInternals},this.props.children)}}function O9(){const n=Y.useContext(AT);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=Y.useId();return Y.useMemo(()=>{for(const i of[n,n==null?void 0:n.alternate]){if(!i)continue;const r=QO(i,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(r)return r}},[n,e])}function k9(){const n=O9(),[e]=Y.useState(()=>new Map);e.clear();let t=n;for(;t;){if(t.type&&typeof t.type=="object"){const r=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;r&&r!==AT&&!e.has(r)&&e.set(r,Y.useContext(JO(r)))}t=t.return}return e}function N9(){const n=k9();return Y.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>Y.createElement(e,null,Y.createElement(t.Provider,U9(tP({},i),{value:n.get(t)}))),e=>Y.createElement(ek,tP({},e))),[n])}const Kx={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function F9(n){const{handlePointer:e}=h9(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(Kx).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=n.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(o=>({events:{...o.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,u]=Kx[o];t.addEventListener(l,a,{passive:u})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=Kx[s];i.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const z9=Y.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:o=F9,eventSource:a,eventPrefix:l,shadows:u,linear:c,flat:f,legacy:h,orthographic:m,frameloop:v,dpr:x,performance:_,raycaster:g,camera:y,onPointerMissed:w,onCreated:E,...M},b){Y.useMemo(()=>NO(IO),[]);const C=N9(),[P,A]=M9({scroll:!0,debounce:{scroll:50,resize:0},...i}),L=Y.useRef(null),N=Y.useRef(null);Y.useImperativeHandle(b,()=>L.current);const F=BO(w),[B,j]=Y.useState(!1),[q,V]=Y.useState(!1);if(B)throw B;if(q)throw q;const W=Y.useRef(null);vm(()=>{const O=L.current;A.width>0&&A.height>0&&O&&(W.current||(W.current=w9(O)),W.current.configure({gl:s,events:o,shadows:u,linear:c,flat:f,legacy:h,orthographic:m,frameloop:v,dpr:x,performance:_,raycaster:g,camera:y,size:A,onPointerMissed:(...k)=>F.current==null?void 0:F.current(...k),onCreated:k=>{k.events.connect==null||k.events.connect(a?s9(a)?a.current:a:N.current),l&&k.setEvents({compute:(U,z)=>{const Q=U[l+"X"],J=U[l+"Y"];z.pointer.set(Q/z.size.width*2-1,-(J/z.size.height)*2+1),z.raycaster.setFromCamera(z.pointer,z.camera)}}),E==null||E(k)}}),W.current.render(Y.createElement(C,null,Y.createElement(GO,{set:V},Y.createElement(Y.Suspense,{fallback:Y.createElement(o9,{set:j})},e)))))}),Y.useEffect(()=>{const O=L.current;if(O)return()=>KO(O)},[]);const I=a?"none":"auto";return Y.createElement("div",qu({ref:N,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:I,...r}},M),Y.createElement("div",{ref:P,style:{width:"100%",height:"100%"}},Y.createElement("canvas",{ref:L,style:{display:"block"}},t)))}),B9=Y.forwardRef(function(e,t){return Y.createElement(ek,null,Y.createElement(z9,qu({},e,{ref:t})))});function G9(n,e,t){var i,r=1;n==null&&(n=0),e==null&&(e=0),t==null&&(t=0);function s(){var o,a=i.length,l,u=0,c=0,f=0;for(o=0;o=(l=(o+a)/2))?o=l:a=l,i=r,!(r=r[f=+c]))return i[f]=s,n;if(u=+n._x.call(null,r.data),e===u)return s.next=r,i?i[f]=s:n._root=s,n;do i=i?i[f]=new Array(2):n._root=new Array(2),(c=e>=(l=(o+a)/2))?o=l:a=l;while((f=+c)==(h=+(u>=l)));return i[h]=r,i[f]=s,n}function H9(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e);let i=1/0,r=-1/0;for(let s=0,o;sr&&(r=o));if(i>r)return this;this.cover(i).cover(r);for(let s=0;sn||n>=t;)switch(o=+(no||(s=u.x1)=f))&&(u=a[a.length-1],a[a.length-1]=a[a.length-1-c],a[a.length-1-c]=u)}else{var h=Math.abs(n-+this._x.call(null,l.data));h=(u=(o+a)/2))?o=u:a=u,e=t,!(t=t[f=+c]))return this;if(!t.length)break;e[f+1&1]&&(i=e,h=f)}for(;t.data!==n;)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[f]=s:delete e[f],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(i?i[h]=t:this._root=t),this):(this._root=s,this)}function q9(n){for(var e=0,t=n.length;e=(f=(a+u)/2))?a=f:u=f,(_=t>=(h=(l+c)/2))?l=h:c=h,r=s,!(s=s[g=_<<1|x]))return r[g]=o,n;if(m=+n._x.call(null,s.data),v=+n._y.call(null,s.data),e===m&&t===v)return o.next=s,r?r[g]=o:n._root=o,n;do r=r?r[g]=new Array(4):n._root=new Array(4),(x=e>=(f=(a+u)/2))?a=f:u=f,(_=t>=(h=(l+c)/2))?l=h:c=h;while((g=_<<1|x)===(y=(v>=h)<<1|m>=f));return r[y]=s,r[g]=o,n}function ij(n){var e,t,i=n.length,r,s,o=new Array(i),a=new Array(i),l=1/0,u=1/0,c=-1/0,f=-1/0;for(t=0;tc&&(c=r),sf&&(f=s));if(l>c||u>f)return this;for(this.cover(l,u).cover(c,f),t=0;tn||n>=r||i>e||e>=s;)switch(u=(ec||(a=v.y0)>f||(l=v.x1)=g)<<1|n>=_)&&(v=h[h.length-1],h[h.length-1]=h[h.length-1-x],h[h.length-1-x]=v)}else{var y=n-+this._x.call(null,m.data),w=e-+this._y.call(null,m.data),E=y*y+w*w;if(E=(h=(o+l)/2))?o=h:l=h,(x=f>=(m=(a+u)/2))?a=m:u=m,e=t,!(t=t[_=x<<1|v]))return this;if(!t.length)break;(e[_+1&3]||e[_+2&3]||e[_+3&3])&&(i=e,g=_)}for(;t.data!==n;)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[_]=s:delete e[_],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[g]=t:this._root=t),this):(this._root=s,this)}function uj(n){for(var e=0,t=n.length;e=(v=(l+f)/2))?l=v:f=v,(M=t>=(x=(u+h)/2))?u=x:h=x,(b=i>=(_=(c+m)/2))?c=_:m=_,s=o,!(o=o[C=b<<2|M<<1|E]))return s[C]=a,n;if(g=+n._x.call(null,o.data),y=+n._y.call(null,o.data),w=+n._z.call(null,o.data),e===g&&t===y&&i===w)return a.next=o,s?s[C]=a:n._root=a,n;do s=s?s[C]=new Array(8):n._root=new Array(8),(E=e>=(v=(l+f)/2))?l=v:f=v,(M=t>=(x=(u+h)/2))?u=x:h=x,(b=i>=(_=(c+m)/2))?c=_:m=_;while((C=b<<2|M<<1|E)===(P=(w>=_)<<2|(y>=x)<<1|g>=v));return s[P]=o,s[C]=a,n}function _j(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e),i=new Float64Array(e),r=new Float64Array(e);let s=1/0,o=1/0,a=1/0,l=-1/0,u=-1/0,c=-1/0;for(let f=0,h,m,v,x;fl&&(l=m),vu&&(u=v),xc&&(c=x));if(s>l||o>u||a>c)return this;this.cover(s,o,a).cover(l,u,c);for(let f=0;fn||n>=o||r>e||e>=a||s>t||t>=l;)switch(h=(tv||(u=w.y0)>x||(c=w.z0)>_||(f=w.x1)=C)<<2|(e>=b)<<1|n>=M)&&(w=g[g.length-1],g[g.length-1]=g[g.length-1-E],g[g.length-1-E]=w)}else{var P=n-+this._x.call(null,y.data),A=e-+this._y.call(null,y.data),L=t-+this._z.call(null,y.data),N=P*P+A*A+L*L;if(N=(x=(o+u)/2))?o=x:u=x,(w=m>=(_=(a+c)/2))?a=_:c=_,(E=v>=(g=(l+f)/2))?l=g:f=g,e=t,!(t=t[M=E<<2|w<<1|y]))return this;if(!t.length)break;(e[M+1&7]||e[M+2&7]||e[M+3&7]||e[M+4&7]||e[M+5&7]||e[M+6&7]||e[M+7&7])&&(i=e,b=M)}for(;t.data!==n;)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[M]=s:delete e[M],(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&&(i?i[b]=t:this._root=t),this):(this._root=s,this)}function Tj(n){for(var e=0,t=n.length;e1&&(x=m.y+m.vy),t>2&&(_=m.z+m.vz),h.visit(E);function E(M,b,C,P,A,L,N){var F=[b,C,P,A,L,N],B=F[0],j=F[1],q=F[2],V=F[t],W=F[t+1],I=F[t+2],O=M.data,k=M.r,U=g+k;if(O){if(O.index>m.index){var z=v-O.x-O.vx,Q=t>1?x-O.y-O.vy:0,J=t>2?_-O.z-O.vz:0,te=z*z+Q*Q+J*J;te1&&Q===0&&(Q=Ms(r),te+=Q*Q),t>2&&J===0&&(J=Ms(r),te+=J*J),te=(U-(te=Math.sqrt(te)))/te*s,m.vx+=(z*=te)*(U=(k*=k)/(y+k)),t>1&&(m.vy+=(Q*=te)*U),t>2&&(m.vz+=(J*=te)*U),O.vx-=z*(U=1-U),t>1&&(O.vy-=Q*U),t>2&&(O.vz-=J*U))}return}return B>v+U||V1&&(j>x+U||W2&&(q>_+U||I<_-U)}}function l(c){if(c.data)return c.r=i[c.data.index];for(var f=c.r=0;fc.r&&(c.r=c[f].r)}function u(){if(e){var c,f=e.length,h;for(i=new Array(f),c=0;ctypeof h=="function")||Math.random,t=f.find(h=>[1,2,3].includes(h))||2,u()},a.iterations=function(c){return arguments.length?(o=+c,a):o},a.strength=function(c){return arguments.length?(s=+c,a):s},a.radius=function(c){return arguments.length?(n=typeof c=="function"?c:Fn(+c),u(),a):n},a}function Nj(n){return n.index}function uP(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function sk(n){var e=Nj,t=h,i,r=Fn(30),s,o,a,l,u,c,f=1;n==null&&(n=[]);function h(g){return 1/Math.min(l[g.source.index],l[g.target.index])}function m(g){for(var y=0,w=n.length;y1&&(A=C.y+C.vy-b.y-b.vy||Ms(c)),a>2&&(L=C.z+C.vz-b.z-b.vz||Ms(c)),N=Math.sqrt(P*P+A*A+L*L),N=(N-s[E])/N*g*i[E],P*=N,A*=N,L*=N,C.vx-=P*(F=u[E]),a>1&&(C.vy-=A*F),a>2&&(C.vz-=L*F),b.vx+=P*(F=1-F),a>1&&(b.vy+=A*F),a>2&&(b.vz+=L*F)}function v(){if(o){var g,y=o.length,w=n.length,E=new Map(o.map((b,C)=>[e(b,C,o),b])),M;for(g=0,l=new Array(y);gtypeof w=="function")||Math.random,a=y.find(w=>[1,2,3].includes(w))||2,v()},m.links=function(g){return arguments.length?(n=g,v(),m):n},m.id=function(g){return arguments.length?(e=g,m):e},m.iterations=function(g){return arguments.length?(f=+g,m):f},m.strength=function(g){return arguments.length?(t=typeof g=="function"?g:Fn(+g),x(),m):t},m.distance=function(g){return arguments.length?(r=typeof g=="function"?g:Fn(+g),_(),m):r},m}var Fj={value:()=>{}};function ok(){for(var n=0,e=arguments.length,t={},i;n=0&&(i=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}})}gv.prototype=ok.prototype={constructor:gv,on:function(n,e){var t=this._,i=zj(n+"",t),r,s=-1,o=i.length;if(arguments.length<2){for(;++s0)for(var t=new Array(r),i=0,r,s;i=0&&n._call.call(void 0,e),n=n._next;--qf}function fP(){Ku=(ey=jp.now())+v_,qf=Fd=0;try{Vj()}finally{qf=0,Wj(),Ku=0}}function Hj(){var n=jp.now(),e=n-ey;e>ak&&(v_-=e,ey=n)}function Wj(){for(var n,e=Jv,t,i=1/0;e;)e._call?(i>e._time&&(i=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:Jv=t);zd=n,pE(i)}function pE(n){if(!qf){Fd&&(Fd=clearTimeout(Fd));var e=n-Ku;e>24?(n<1/0&&(Fd=setTimeout(fP,n-jp.now()-v_)),od&&(od=clearInterval(od))):(od||(ey=jp.now(),od=setInterval(Hj,ak)),qf=1,lk(fP))}}const jj=1664525,Xj=1013904223,hP=4294967296;function $j(){let n=1;return()=>(n=(jj*n+Xj)%hP)/hP}var dP=3;function Qx(n){return n.x}function pP(n){return n.y}function Yj(n){return n.z}var qj=10,Kj=Math.PI*(3-Math.sqrt(5)),Zj=Math.PI*20/(9+Math.sqrt(221));function fk(n,e){e=e||2;var t=Math.min(dP,Math.max(1,Math.round(e))),i,r=1,s=.001,o=1-Math.pow(s,1/300),a=0,l=.6,u=new Map,c=ck(m),f=ok("tick","end"),h=$j();n==null&&(n=[]);function m(){v(),f.call("tick",i),r1&&(E.fy==null?E.y+=E.vy*=l:(E.y=E.fy,E.vy=0)),t>2&&(E.fz==null?E.z+=E.vz*=l:(E.z=E.fz,E.vz=0));return i}function x(){for(var g=0,y=n.length,w;g1&&isNaN(w.y)||t>2&&isNaN(w.z)){var E=qj*(t>2?Math.cbrt(.5+g):t>1?Math.sqrt(.5+g):g),M=g*Kj,b=g*Zj;t===1?w.x=E:t===2?(w.x=E*Math.cos(M),w.y=E*Math.sin(M)):(w.x=E*Math.sin(M)*Math.cos(b),w.y=E*Math.cos(M),w.z=E*Math.sin(M)*Math.sin(b))}(isNaN(w.vx)||t>1&&isNaN(w.vy)||t>2&&isNaN(w.vz))&&(w.vx=0,t>1&&(w.vy=0),t>2&&(w.vz=0))}}function _(g){return g.initialize&&g.initialize(n,h,t),g}return x(),i={tick:v,restart:function(){return c.restart(m),i},stop:function(){return c.stop(),i},numDimensions:function(g){return arguments.length?(t=Math.min(dP,Math.max(1,Math.round(g))),u.forEach(_),i):t},nodes:function(g){return arguments.length?(n=g,x(),u.forEach(_),i):n},alpha:function(g){return arguments.length?(r=+g,i):r},alphaMin:function(g){return arguments.length?(s=+g,i):s},alphaDecay:function(g){return arguments.length?(o=+g,i):+o},alphaTarget:function(g){return arguments.length?(a=+g,i):a},velocityDecay:function(g){return arguments.length?(l=1-g,i):1-l},randomSource:function(g){return arguments.length?(h=g,u.forEach(_),i):h},force:function(g,y){return arguments.length>1?(y==null?u.delete(g):u.set(g,_(y)),i):u.get(g)},find:function(){var g=Array.prototype.slice.call(arguments),y=g.shift()||0,w=(t>1?g.shift():null)||0,E=(t>2?g.shift():null)||0,M=g.shift()||1/0,b=0,C=n.length,P,A,L,N,F,B;for(M*=M,b=0;b1?(f.on(g,y),i):f.on(g)}}}function hk(){var n,e,t,i,r,s=Fn(-30),o,a=1,l=1/0,u=.81;function c(v){var x,_=n.length,g=(e===1?CT(n,Qx):e===2?PT(n,Qx,pP):e===3?IT(n,Qx,pP,Yj):null).visitAfter(h);for(r=v,x=0;x<_;++x)t=n[x],g.visit(m)}function f(){if(n){var v,x=n.length,_;for(o=new Array(x),v=0;v1&&(v.y=E/y),e>2&&(v.z=M/y)}else{_=v,_.x=_.data.x,e>1&&(_.y=_.data.y),e>2&&(_.z=_.data.z);do x+=o[_.data.index];while(_=_.next)}v.value=x}function m(v,x,_,g,y){if(!v.value)return!0;var w=[_,g,y][e-1],E=v.x-t.x,M=e>1?v.y-t.y:0,b=e>2?v.z-t.z:0,C=w-x,P=E*E+M*M+b*b;if(C*C/u1&&M===0&&(M=Ms(i),P+=M*M),e>2&&b===0&&(b=Ms(i),P+=b*b),P1&&(t.vy+=M*v.value*r/P),e>2&&(t.vz+=b*v.value*r/P)),!0;if(v.length||P>=l)return;(v.data!==t||v.next)&&(E===0&&(E=Ms(i),P+=E*E),e>1&&M===0&&(M=Ms(i),P+=M*M),e>2&&b===0&&(b=Ms(i),P+=b*b),P1&&(t.vy+=M*C),e>2&&(t.vz+=b*C));while(v=v.next)}return c.initialize=function(v,...x){n=v,i=x.find(_=>typeof _=="function")||Math.random,e=x.find(_=>[1,2,3].includes(_))||2,f()},c.strength=function(v){return arguments.length?(s=typeof v=="function"?v:Fn(+v),f(),c):s},c.distanceMin=function(v){return arguments.length?(a=v*v,c):Math.sqrt(a)},c.distanceMax=function(v){return arguments.length?(l=v*v,c):Math.sqrt(l)},c.theta=function(v){return arguments.length?(u=v*v,c):Math.sqrt(u)},c}function Qj(n,e,t,i){var r,s,o=Fn(.1),a,l;typeof n!="function"&&(n=Fn(+n)),e==null&&(e=0),t==null&&(t=0),i==null&&(i=0);function u(f){for(var h=0,m=r.length;h1&&(v.vy+=_*w),s>2&&(v.vz+=g*w)}}function c(){if(r){var f,h=r.length;for(a=new Array(h),l=new Array(h),f=0;f[1,2,3].includes(m))||2,c()},u.strength=function(f){return arguments.length?(o=typeof f=="function"?f:Fn(+f),c(),u):o},u.radius=function(f){return arguments.length?(n=typeof f=="function"?f:Fn(+f),c(),u):n},u.x=function(f){return arguments.length?(e=+f,u):e},u.y=function(f){return arguments.length?(t=+f,u):t},u.z=function(f){return arguments.length?(i=+f,u):i},u}function mE(n){var e=Fn(.1),t,i,r;typeof n!="function"&&(n=Fn(n==null?0:+n));function s(a){for(var l=0,u=t.length,c;l=0;)e+=t[i].value;n.value=e}function tX(){return this.eachAfter(eX)}function nX(n,e){let t=-1;for(const i of this)n.call(e,i,++t,this);return this}function iX(n,e){for(var t=this,i=[t],r,s,o=-1;t=i.pop();)if(n.call(e,t,++o,this),r=t.children)for(s=r.length-1;s>=0;--s)i.push(r[s]);return this}function rX(n,e){for(var t=this,i=[t],r=[],s,o,a,l=-1;t=i.pop();)if(r.push(t),s=t.children)for(o=0,a=s.length;o=0;)t+=i[r].value;e.value=t})}function aX(n){return this.eachBefore(function(e){e.children&&e.children.sort(n)})}function lX(n){for(var e=this,t=uX(e,n),i=[e];e!==t;)e=e.parent,i.push(e);for(var r=i.length;n!==t;)i.splice(r,0,n),n=n.parent;return i}function uX(n,e){if(n===e)return n;var t=n.ancestors(),i=e.ancestors(),r=null;for(n=t.pop(),e=i.pop();n===e;)r=n,n=t.pop(),e=i.pop();return r}function cX(){for(var n=this,e=[n];n=n.parent;)e.push(n);return e}function fX(){return Array.from(this)}function hX(){var n=[];return this.eachBefore(function(e){e.children||n.push(e)}),n}function dX(){var n=this,e=[];return n.each(function(t){t!==n&&e.push({source:t.parent,target:t})}),e}function*pX(){var n=this,e,t=[n],i,r,s;do for(e=t.reverse(),t=[];n=e.pop();)if(yield n,i=n.children)for(r=0,s=i.length;r=0;--a)r.push(s=o[a]=new Kf(o[a])),s.parent=i,s.depth=i.depth+1;return t.eachBefore(dk)}function mX(){return y_(this).eachBefore(yX)}function gX(n){return n.children}function vX(n){return Array.isArray(n)?n[1]:null}function yX(n){n.data.value!==void 0&&(n.value=n.data.value),n.data=n.data.data}function dk(n){var e=0;do n.height=e;while((n=n.parent)&&n.height<++e)}function Kf(n){this.data=n,this.depth=this.height=0,this.parent=null}Kf.prototype=y_.prototype={constructor:Kf,count:tX,each:nX,eachAfter:rX,eachBefore:iX,find:sX,sum:oX,sort:aX,path:lX,ancestors:cX,descendants:fX,leaves:hX,links:dX,copy:mX,[Symbol.iterator]:pX};function Jx(n){return n==null?null:pk(n)}function pk(n){if(typeof n!="function")throw new Error;return n}function ad(){return 0}function ld(n){return function(){return n}}function _X(n){n.x0=Math.round(n.x0),n.y0=Math.round(n.y0),n.x1=Math.round(n.x1),n.y1=Math.round(n.y1)}function xX(n,e,t,i,r){for(var s=n.children,o,a=-1,l=s.length,u=n.value&&(i-e)/n.value;++aTX(t(E,M,r))),y=g.map(gP),w=new Set(g).add("");for(const E of y)w.has(E)||(w.add(E),g.push(E),y.push(gP(E)),s.push(ew));o=(E,M)=>g[M],a=(E,M)=>y[M]}for(c=0,l=s.length;c=0&&(m=s[g],m.data===ew);--g)m.data=null}if(f.parent=wX,f.eachBefore(function(g){g.depth=g.parent.depth+1,--l}).eachBefore(dk),f.parent=null,l>0)throw new Error("cycle");return f}return i.id=function(r){return arguments.length?(n=Jx(r),i):n},i.parentId=function(r){return arguments.length?(e=Jx(r),i):e},i.path=function(r){return arguments.length?(t=Jx(r),i):t},i}function TX(n){n=`${n}`;let e=n.length;return vE(n,e-1)&&!vE(n,e-2)&&(n=n.slice(0,-1)),n[0]==="/"?n:`/${n}`}function gP(n){let e=n.length;if(e<2)return"";for(;--e>1&&!vE(n,e););return n.slice(0,e)}function vE(n,e){if(n[e]==="/"){let t=0;for(;e>0&&n[--e]==="\\";)++t;if(!(t&1))return!0}return!1}function bX(n,e){return n.parent===e.parent?1:2}function tw(n){var e=n.children;return e?e[0]:n.t}function nw(n){var e=n.children;return e?e[e.length-1]:n.t}function AX(n,e,t){var i=t/(e.i-n.i);e.c-=i,e.s+=t,n.c+=i,e.z+=t,e.m+=t}function CX(n){for(var e=0,t=0,i=n.children,r=i.length,s;--r>=0;)s=i[r],s.z+=e,s.m+=e,e+=s.s+(t+=s.c)}function RX(n,e,t){return n.a.parent===e.parent?n.a:t}function vv(n,e){this._=n,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}vv.prototype=Object.create(Kf.prototype);function PX(n){for(var e=new vv(n,0),t,i=[e],r,s,o,a;t=i.pop();)if(s=t._.children)for(t.children=new Array(a=s.length),o=a-1;o>=0;--o)i.push(r=t.children[o]=new vv(s[o],o)),r.parent=t;return(e.parent=new vv(null,0)).children=[e],e}function LX(){var n=bX,e=1,t=1,i=null;function r(u){var c=PX(u);if(c.eachAfter(s),c.parent.m=-c.z,c.eachBefore(o),i)u.eachBefore(l);else{var f=u,h=u,m=u;u.eachBefore(function(y){y.xh.x&&(h=y),y.depth>m.depth&&(m=y)});var v=f===h?1:n(f,h)/2,x=v-f.x,_=e/(h.x+v+x),g=t/(m.depth||1);u.eachBefore(function(y){y.x=(y.x+x)*_,y.y=y.depth*g})}return u}function s(u){var c=u.children,f=u.parent.children,h=u.i?f[u.i-1]:null;if(c){CX(u);var m=(c[0].z+c[c.length-1].z)/2;h?(u.z=h.z+n(u._,h._),u.m=u.z-m):u.z=m}else h&&(u.z=h.z+n(u._,h._));u.parent.A=a(u,h,u.parent.A||f[0])}function o(u){u._.x=u.z+u.parent.m,u.m+=u.parent.m}function a(u,c,f){if(c){for(var h=u,m=u,v=c,x=h.parent.children[0],_=h.m,g=m.m,y=v.m,w=x.m,E;v=nw(v),h=tw(h),v&&h;)x=tw(x),m=nw(m),m.a=u,E=v.z+y-h.z-_+n(v._,h._),E>0&&(AX(RX(v,u,f),u,E),_+=E,g+=E),y+=v.m,_+=h.m,w+=x.m,g+=m.m;v&&!nw(m)&&(m.t=v,m.m+=y-g),h&&!tw(x)&&(x.t=h,x.m+=_-w,f=u)}return f}function l(u){u.x*=e,u.y=u.depth*t}return r.separation=function(u){return arguments.length?(n=u,r):n},r.size=function(u){return arguments.length?(i=!1,e=+u[0],t=+u[1],r):i?null:[e,t]},r.nodeSize=function(u){return arguments.length?(i=!0,e=+u[0],t=+u[1],r):i?[e,t]:null},r}function IX(n,e,t,i,r){for(var s=n.children,o,a=-1,l=s.length,u=n.value&&(r-t)/n.value;++ay&&(y=u),b=_*_*M,w=Math.max(y/b,b/g),w>E){_-=u;break}E=w}o.push(l={value:_,dice:m1?i:1)},t}(DX);function kX(){var n=OX,e=!1,t=1,i=1,r=[0],s=ad,o=ad,a=ad,l=ad,u=ad;function c(h){return h.x0=h.y0=0,h.x1=t,h.y1=i,h.eachBefore(f),r=[0],e&&h.eachBefore(_X),h}function f(h){var m=r[h.depth],v=h.x0+m,x=h.y0+m,_=h.x1-m,g=h.y1-m;_1&&te.has(le))&&(F>1&&te.add(le),Ie=t[ne+ud],he=t[ne+cd],ae=t[ne+P0],me=Ie-fe,ce=he-Ue,De=Math.sqrt(me*me+ce*ce),pe=De0?(g[ne]+=me/De*(1+H),y[ne]+=ce/De*(1+H)):(g[ne]+=C*vP(),y[ne]+=P*vP())));for(l=0,u=0;l"u"?e:o};typeof e=="function"&&(i=e);var r=function(o){return i(o[n])},s=function(){return i(void 0)};return typeof n=="string"?(t.fromAttributes=r,t.fromGraph=function(o,a){return r(o.getNodeAttributes(a))},t.fromEntry=function(o,a){return r(a)}):typeof n=="function"?(t.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},t.fromGraph=function(o,a){return i(n(a,o.getNodeAttributes(a)))},t.fromEntry=function(o,a){return i(n(o,a))}):(t.fromAttributes=s,t.fromGraph=s,t.fromEntry=s),t}function xk(n,e){var t={},i=function(o){return typeof o>"u"?e:o};typeof e=="function"&&(i=e);var r=function(o){return i(o[n])},s=function(){return i(void 0)};return typeof n=="string"?(t.fromAttributes=r,t.fromGraph=function(o,a){return r(o.getEdgeAttributes(a))},t.fromEntry=function(o,a){return r(a)},t.fromPartialEntry=t.fromEntry,t.fromMinimalEntry=t.fromEntry):typeof n=="function"?(t.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},t.fromGraph=function(o,a){var l=o.extremities(a);return i(n(a,o.getEdgeAttributes(a),l[0],l[1],o.getNodeAttributes(l[0]),o.getNodeAttributes(l[1]),o.isUndirected(a)))},t.fromEntry=function(o,a,l,u,c,f,h){return i(n(o,a,l,u,c,f,h))},t.fromPartialEntry=function(o,a,l,u){return i(n(o,a,l,u))},t.fromMinimalEntry=function(o,a){return i(n(o,a))}):(t.fromAttributes=s,t.fromGraph=s,t.fromEntry=s,t.fromMinimalEntry=s),t}lc.createNodeValueGetter=JX;lc.createEdgeValueGetter=xk;lc.createEdgeWeightGetter=function(n){return xk(n,QX)};var ai=0,Ln=1,en=2,tn=3,ra=4,sa=5,rn=6,yP=7,I0=8,_P=9,e$=0,t$=1,n$=2,bi=0,gs=1,fr=2,uu=3,Ka=4,jn=5,Tr=6,_o=7,xo=8,xP=3,Hs=10,i$=3,Ki=9,iw=10,r$=function(e,t,i){var r,s,o,a,l,u,c,f,h,m,v=t.length,x=i.length,_=e.adjustSizes,g=e.barnesHutTheta*e.barnesHutTheta,y,w,E,M,b,C,P,A=[];for(o=0;oI?(F-=(W-I)/2,B=F+W):(L-=(I-W)/2,N=L+I),A[0+bi]=-1,A[0+gs]=(L+N)/2,A[0+fr]=(F+B)/2,A[0+uu]=Math.max(N-L,B-F),A[0+Ka]=-1,A[0+jn]=-1,A[0+Tr]=0,A[0+_o]=0,A[0+xo]=0,r=1,o=0;o=0){t[o+ai]=0)if(C=Math.pow(t[o+ai]-A[s+_o],2)+Math.pow(t[o+Ln]-A[s+xo],2),m=A[s+uu],4*m*m/C0?(P=w*t[o+rn]*A[s+Tr]/C,t[o+en]+=E*P,t[o+tn]+=M*P):C<0&&(P=-w*t[o+rn]*A[s+Tr]/Math.sqrt(C),t[o+en]+=E*P,t[o+tn]+=M*P):C>0&&(P=w*t[o+rn]*A[s+Tr]/C,t[o+en]+=E*P,t[o+tn]+=M*P),s=A[s+Ka],s<0)break;continue}else{s=A[s+jn];continue}else{if(u=A[s+bi],u>=0&&u!==o&&(E=t[o+ai]-t[u+ai],M=t[o+Ln]-t[u+Ln],C=E*E+M*M,_===!0?C>0?(P=w*t[o+rn]*t[u+rn]/C,t[o+en]+=E*P,t[o+tn]+=M*P):C<0&&(P=-w*t[o+rn]*t[u+rn]/Math.sqrt(C),t[o+en]+=E*P,t[o+tn]+=M*P):C>0&&(P=w*t[o+rn]*t[u+rn]/C,t[o+en]+=E*P,t[o+tn]+=M*P)),s=A[s+Ka],s<0)break;continue}else for(w=e.scalingRatio,a=0;a0?(P=w*t[a+rn]*t[l+rn]/C/C,t[a+en]+=E*P,t[a+tn]+=M*P,t[l+en]-=E*P,t[l+tn]-=M*P):C<0&&(P=100*w*t[a+rn]*t[l+rn],t[a+en]+=E*P,t[a+tn]+=M*P,t[l+en]-=E*P,t[l+tn]-=M*P)):(C=Math.sqrt(E*E+M*M),C>0&&(P=w*t[a+rn]*t[l+rn]/C/C,t[a+en]+=E*P,t[a+tn]+=M*P,t[l+en]-=E*P,t[l+tn]-=M*P));for(h=e.gravity/e.scalingRatio,w=e.scalingRatio,o=0;o0&&(P=w*t[o+rn]*h):C>0&&(P=w*t[o+rn]*h/C),t[o+en]-=E*P,t[o+tn]-=M*P;for(w=1*(e.outboundAttractionDistribution?y:1),c=0;c0&&(P=-w*b*Math.log(1+C)/C/t[a+rn]):C>0&&(P=-w*b*Math.log(1+C)/C):e.outboundAttractionDistribution?C>0&&(P=-w*b/t[a+rn]):C>0&&(P=-w*b)):(C=Math.sqrt(Math.pow(E,2)+Math.pow(M,2)),e.linLogMode?e.outboundAttractionDistribution?C>0&&(P=-w*b*Math.log(1+C)/C/t[a+rn]):C>0&&(P=-w*b*Math.log(1+C)/C):e.outboundAttractionDistribution?(C=1,P=-w*b/t[a+rn]):(C=1,P=-w*b)),C>0&&(t[a+en]+=E*P,t[a+tn]+=M*P,t[l+en]-=E*P,t[l+tn]-=M*P);var O,k,U,z,Q,J;if(_===!0)for(o=0;oiw&&(t[o+en]=t[o+en]*iw/O,t[o+tn]=t[o+tn]*iw/O),k=t[o+rn]*Math.sqrt((t[o+ra]-t[o+en])*(t[o+ra]-t[o+en])+(t[o+sa]-t[o+tn])*(t[o+sa]-t[o+tn])),U=Math.sqrt((t[o+ra]+t[o+en])*(t[o+ra]+t[o+en])+(t[o+sa]+t[o+tn])*(t[o+sa]+t[o+tn]))/2,z=.1*Math.log(1+U)/(1+Math.sqrt(k)),Q=t[o+ai]+t[o+en]*(z/e.slowDown),t[o+ai]=Q,J=t[o+Ln]+t[o+tn]*(z/e.slowDown),t[o+Ln]=J);else for(o=0;o=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null};Nl.graphToByteArrays=function(n,e){var t=n.order,i=n.size,r={},s,o=new Float32Array(t*Xp),a=new Float32Array(i*wP);return s=0,n.forEachNode(function(l,u){r[l]=s,o[s]=u.x,o[s+1]=u.y,o[s+2]=0,o[s+3]=0,o[s+4]=0,o[s+5]=0,o[s+6]=1,o[s+7]=1,o[s+8]=u.size||1,o[s+9]=u.fixed?1:0,s+=Xp}),s=0,n.forEachEdge(function(l,u,c,f,h,m,v){var x=r[c],_=r[f],g=e(l,u,c,f,h,m,v);o[x+6]+=g,o[_+6]+=g,a[s]=x,a[s+1]=_,a[s+2]=g,s+=wP}),{nodes:o,edges:a}};Nl.assignLayoutChanges=function(n,e,t){var i=0;n.updateEachNodeAttributes(function(r,s){return s.x=e[i],s.y=e[i+1],i+=Xp,t?t(r,s):s})};Nl.readGraphPositions=function(n,e){var t=0;n.forEachNode(function(i,r){e[t]=r.x,e[t+1]=r.y,t+=Xp})};Nl.collectLayoutChanges=function(n,e,t){for(var i=n.nodes(),r={},s=0,o=0,a=e.length;s2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}}var OT=wk.bind(null,!1);OT.assign=wk.bind(null,!0);OT.inferSettings=c$;var f$=OT;const h$=ts(f$);var d$=UT,p$=Pa,m$={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function Sk(n,e,t){if(!p$(e))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");t=d$(t,m$);var i=t.dimensions;if(!Array.isArray(i)||i.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var r=i.length,s=t.center,o=t.rng,a=t.scale,l=(s-.5)*a;function u(f){for(var h=0;h 4294967295 is not supported.")},n.getSignedPointerArray=function(l){var u=l-1;return u<=r?Int8Array:u<=s?Int16Array:u<=o?Int32Array:Float64Array},n.getNumberType=function(l){return l===(l|0)?Math.sign(l)===-1?l<=127&&l>=-128?Int8Array:l<=32767&&l>=-32768?Int16Array:Int32Array:l<=255?Uint8Array:l<=65535?Uint16Array:Uint32Array:Float64Array};var a={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};n.getMinimalRepresentation=function(l,u){var c=null,f=0,h,m,v,x,_;for(x=0,_=l.length;x<_;x++)v=u?u(l[x]):l[x],m=n.getNumberType(v),h=a[m.name],h>f&&(f=h,c=m);return c},n.isTypedArray=function(l){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(l)},n.concat=function(){var l=0,u,c,f;for(u=0,f=arguments.length;ue?1:n>=e?0:NaN}function R$(n,e){return n==null||e==null?NaN:en?1:e>=n?0:NaN}function Ck(n){let e,t,i;n.length!==2?(e=yv,t=(a,l)=>yv(n(a),l),i=(a,l)=>n(a)-l):(e=n===yv||n===R$?n:P$,t=n,i=n);function r(a,l,u=0,c=a.length){if(u>>1;t(a[f],l)<0?u=f+1:c=f}while(u>>1;t(a[f],l)<=0?u=f+1:c=f}while(uu&&i(a[f-1],l)>-i(a[f],l)?f-1:f}return{left:r,center:o,right:s}}function P$(){return 0}function L$(n){return n===null?NaN:+n}const I$=Ck(yv),D$=I$.right;Ck(L$).center;const U$=Math.sqrt(50),O$=Math.sqrt(10),k$=Math.sqrt(2);function iy(n,e,t){const i=(e-n)/Math.max(0,t),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=U$?10:s>=O$?5:s>=k$?2:1;let a,l,u;return r<0?(u=Math.pow(10,-r)/o,a=Math.round(n*u),l=Math.round(e*u),a/ue&&--l,u=-u):(u=Math.pow(10,r)*o,a=Math.round(n/u),l=Math.round(e/u),a*ue&&--l),l0))return[];if(n===e)return[n];const i=e=r))return[];const a=s-r+1,l=new Array(a);if(i)if(o<0)for(let u=0;u>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?D0(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?D0(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=G$.exec(n))?new Dr(e[1],e[2],e[3],1):(e=V$.exec(n))?new Dr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=H$.exec(n))?D0(e[1],e[2],e[3],e[4]):(e=W$.exec(n))?D0(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=j$.exec(n))?CP(e[1],e[2]/100,e[3]/100,1):(e=X$.exec(n))?CP(e[1],e[2]/100,e[3]/100,e[4]):SP.hasOwnProperty(n)?TP(SP[n]):n==="transparent"?new Dr(NaN,NaN,NaN,0):null}function TP(n){return new Dr(n>>16&255,n>>8&255,n&255,1)}function D0(n,e,t,i){return i<=0&&(n=e=t=NaN),new Dr(n,e,t,i)}function q$(n){return n instanceof _m||(n=qp(n)),n?(n=n.rgb(),new Dr(n.r,n.g,n.b,n.opacity)):new Dr}function _E(n,e,t,i){return arguments.length===1?q$(n):new Dr(n,e,t,i??1)}function Dr(n,e,t,i){this.r=+n,this.g=+e,this.b=+t,this.opacity=+i}FT(Dr,_E,Rk(_m,{brighter(n){return n=n==null?ry:Math.pow(ry,n),new Dr(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?$p:Math.pow($p,n),new Dr(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Dr(Ou(this.r),Ou(this.g),Ou(this.b),sy(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:bP,formatHex:bP,formatHex8:K$,formatRgb:AP,toString:AP}));function bP(){return`#${Cu(this.r)}${Cu(this.g)}${Cu(this.b)}`}function K$(){return`#${Cu(this.r)}${Cu(this.g)}${Cu(this.b)}${Cu((isNaN(this.opacity)?1:this.opacity)*255)}`}function AP(){const n=sy(this.opacity);return`${n===1?"rgb(":"rgba("}${Ou(this.r)}, ${Ou(this.g)}, ${Ou(this.b)}${n===1?")":`, ${n})`}`}function sy(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function Ou(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function Cu(n){return n=Ou(n),(n<16?"0":"")+n.toString(16)}function CP(n,e,t,i){return i<=0?n=e=t=NaN:t<=0||t>=1?n=e=NaN:e<=0&&(n=NaN),new Js(n,e,t,i)}function Pk(n){if(n instanceof Js)return new Js(n.h,n.s,n.l,n.opacity);if(n instanceof _m||(n=qp(n)),!n)return new Js;if(n instanceof Js)return n;n=n.rgb();var e=n.r/255,t=n.g/255,i=n.b/255,r=Math.min(e,t,i),s=Math.max(e,t,i),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-i)/a+(t0&&l<1?0:o,new Js(o,a,l,n.opacity)}function Z$(n,e,t,i){return arguments.length===1?Pk(n):new Js(n,e,t,i??1)}function Js(n,e,t,i){this.h=+n,this.s=+e,this.l=+t,this.opacity=+i}FT(Js,Z$,Rk(_m,{brighter(n){return n=n==null?ry:Math.pow(ry,n),new Js(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?$p:Math.pow($p,n),new Js(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,e=isNaN(n)||isNaN(this.s)?0:this.s,t=this.l,i=t+(t<.5?t:1-t)*e,r=2*t-i;return new Dr(rw(n>=240?n-240:n+120,r,i),rw(n,r,i),rw(n<120?n+240:n-120,r,i),this.opacity)},clamp(){return new Js(RP(this.h),U0(this.s),U0(this.l),sy(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 n=sy(this.opacity);return`${n===1?"hsl(":"hsla("}${RP(this.h)}, ${U0(this.s)*100}%, ${U0(this.l)*100}%${n===1?")":`, ${n})`}`}}));function RP(n){return n=(n||0)%360,n<0?n+360:n}function U0(n){return Math.max(0,Math.min(1,n||0))}function rw(n,e,t){return(n<60?e+(t-e)*n/60:n<180?t:n<240?e+(t-e)*(240-n)/60:e)*255}const zT=n=>()=>n;function Q$(n,e){return function(t){return n+t*e}}function J$(n,e,t){return n=Math.pow(n,t),e=Math.pow(e,t)-n,t=1/t,function(i){return Math.pow(n+i*e,t)}}function eY(n){return(n=+n)==1?Lk:function(e,t){return t-e?J$(e,t,n):zT(isNaN(e)?t:e)}}function Lk(n,e){var t=e-n;return t?Q$(n,t):zT(isNaN(n)?e:n)}const PP=function n(e){var t=eY(e);function i(r,s){var o=t((r=_E(r)).r,(s=_E(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),u=Lk(r.opacity,s.opacity);return function(c){return r.r=o(c),r.g=a(c),r.b=l(c),r.opacity=u(c),r+""}}return i.gamma=n,i}(1);function tY(n,e){e||(e=[]);var t=n?Math.min(e.length,n.length):0,i=e.slice(),r;return function(s){for(r=0;rt&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(i=i[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:oy(i,r)})),t=sw.lastIndex;return te&&(t=n,n=e,e=t),function(i){return Math.max(n,Math.min(e,i))}}function dY(n,e,t){var i=n[0],r=n[1],s=e[0],o=e[1];return r2?pY:dY,l=u=null,f}function f(h){return h==null||isNaN(h=+h)?s:(l||(l=a(n.map(i),e,t)))(i(o(h)))}return f.invert=function(h){return o(r((u||(u=a(e,n.map(i),oy)))(h)))},f.domain=function(h){return arguments.length?(n=Array.from(h,fY),c()):n.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),c()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),t=uY,c()},f.clamp=function(h){return arguments.length?(o=h?!0:Ef,c()):o!==Ef},f.interpolate=function(h){return arguments.length?(t=h,c()):t},f.unknown=function(h){return arguments.length?(s=h,f):s},function(h,m){return i=h,r=m,c()}}function vY(){return gY()(Ef,Ef)}function yY(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function ay(n,e){if((t=(n=e?n.toExponential(e-1):n.toExponential()).indexOf("e"))<0)return null;var t,i=n.slice(0,t);return[i.length>1?i[0]+i.slice(2):i,+n.slice(t+1)]}function Zf(n){return n=ay(Math.abs(n)),n?n[1]:NaN}function _Y(n,e){return function(t,i){for(var r=t.length,s=[],o=0,a=n[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>i));)a=n[o=(o+1)%n.length];return s.reverse().join(e)}}function xY(n){return function(e){return e.replace(/[0-9]/g,function(t){return n[+t]})}}var wY=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ly(n){if(!(e=wY.exec(n)))throw new Error("invalid format: "+n);var e;return new GT({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]})}ly.prototype=GT.prototype;function GT(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}GT.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 SY(n){e:for(var e=n.length,t=1,i=-1,r;t0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(r+1):n}var Ik;function EY(n,e){var t=ay(n,e);if(!t)return n+"";var i=t[0],r=t[1],s=r-(Ik=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+ay(n,Math.max(0,e+s-1))[0]}function IP(n,e){var t=ay(n,e);if(!t)return n+"";var i=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const DP={"%":(n,e)=>(n*100).toFixed(e),b:n=>Math.round(n).toString(2),c:n=>n+"",d:yY,e:(n,e)=>n.toExponential(e),f:(n,e)=>n.toFixed(e),g:(n,e)=>n.toPrecision(e),o:n=>Math.round(n).toString(8),p:(n,e)=>IP(n*100,e),r:IP,s:EY,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function UP(n){return n}var OP=Array.prototype.map,kP=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function MY(n){var e=n.grouping===void 0||n.thousands===void 0?UP:_Y(OP.call(n.grouping,Number),n.thousands+""),t=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",r=n.decimal===void 0?".":n.decimal+"",s=n.numerals===void 0?UP:xY(OP.call(n.numerals,String)),o=n.percent===void 0?"%":n.percent+"",a=n.minus===void 0?"−":n.minus+"",l=n.nan===void 0?"NaN":n.nan+"";function u(f){f=ly(f);var h=f.fill,m=f.align,v=f.sign,x=f.symbol,_=f.zero,g=f.width,y=f.comma,w=f.precision,E=f.trim,M=f.type;M==="n"?(y=!0,M="g"):DP[M]||(w===void 0&&(w=12),E=!0,M="g"),(_||h==="0"&&m==="=")&&(_=!0,h="0",m="=");var b=x==="$"?t:x==="#"&&/[boxX]/.test(M)?"0"+M.toLowerCase():"",C=x==="$"?i:/[%p]/.test(M)?o:"",P=DP[M],A=/[defgprs%]/.test(M);w=w===void 0?6:/[gprs]/.test(M)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function L(N){var F=b,B=C,j,q,V;if(M==="c")B=P(N)+B,N="";else{N=+N;var W=N<0||1/N<0;if(N=isNaN(N)?l:P(Math.abs(N),w),E&&(N=SY(N)),W&&+N==0&&v!=="+"&&(W=!1),F=(W?v==="("?v:a:v==="-"||v==="("?"":v)+F,B=(M==="s"?kP[8+Ik/3]:"")+B+(W&&v==="("?")":""),A){for(j=-1,q=N.length;++jV||V>57){B=(V===46?r+N.slice(j+1):N.slice(j))+B,N=N.slice(0,j);break}}}y&&!_&&(N=e(N,1/0));var I=F.length+N.length+B.length,O=I>1)+F+N+B+O.slice(I);break;default:N=O+F+N+B;break}return s(N)}return L.toString=function(){return f+""},L}function c(f,h){var m=u((f=ly(f),f.type="f",f)),v=Math.max(-8,Math.min(8,Math.floor(Zf(h)/3)))*3,x=Math.pow(10,-v),_=kP[8+v/3];return function(g){return m(x*g)+_}}return{format:u,formatPrefix:c}}var O0,Dk,Uk;TY({thousands:",",grouping:[3],currency:["$",""]});function TY(n){return O0=MY(n),Dk=O0.format,Uk=O0.formatPrefix,O0}function bY(n){return Math.max(0,-Zf(Math.abs(n)))}function AY(n,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Zf(e)/3)))*3-Zf(Math.abs(n)))}function CY(n,e){return n=Math.abs(n),e=Math.abs(e)-n,Math.max(0,Zf(e)-Zf(n))+1}function RY(n,e,t,i){var r=F$(n,e,t),s;switch(i=ly(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(n),Math.abs(e));return i.precision==null&&!isNaN(s=AY(r,o))&&(i.precision=s),Uk(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=CY(r,Math.max(Math.abs(n),Math.abs(e))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=bY(r))&&(i.precision=s-(i.type==="%")*2);break}}return Dk(i)}function PY(n){var e=n.domain;return n.ticks=function(t){var i=e();return N$(i[0],i[i.length-1],t??10)},n.tickFormat=function(t,i){var r=e();return RY(r[0],r[r.length-1],t??10,i)},n.nice=function(t){t==null&&(t=10);var i=e(),r=0,s=i.length-1,o=i[r],a=i[s],l,u,c=10;for(a0;){if(u=yE(o,a,t),u===l)return i[r]=o,i[s]=a,e(i);if(u>0)o=Math.floor(o/u)*u,a=Math.ceil(a/u)*u;else if(u<0)o=Math.ceil(o*u)/u,a=Math.floor(a*u)/u;else break;l=u}return n},n}function Ok(){var n=vY();return n.copy=function(){return mY(n,Ok())},z$.apply(n,arguments),PY(n)}var LY={BASE_URL:"/kanjiorder-v2/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const NP=n=>{let e;const t=new Set,i=(l,u)=>{const c=typeof l=="function"?l(e):l;if(!Object.is(c,e)){const f=e;e=u??typeof c!="object"?c:Object.assign({},e,c),t.forEach(h=>h(e,f))}},r=()=>e,a={setState:i,getState:r,subscribe:l=>(t.add(l),()=>t.delete(l)),destroy:()=>{(LY?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}};return e=n(i,r,a),a},IY=n=>n?NP(n):NP;var kk={exports:{}},Nk={},Fk={exports:{}},zk={};/** - * @license React - * use-sync-external-store-shim.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Qf=Y;function DY(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var UY=typeof Object.is=="function"?Object.is:DY,OY=Qf.useState,kY=Qf.useEffect,NY=Qf.useLayoutEffect,FY=Qf.useDebugValue;function zY(n,e){var t=e(),i=OY({inst:{value:t,getSnapshot:e}}),r=i[0].inst,s=i[1];return NY(function(){r.value=t,r.getSnapshot=e,ow(r)&&s({inst:r})},[n,t,e]),kY(function(){return ow(r)&&s({inst:r}),n(function(){ow(r)&&s({inst:r})})},[n]),FY(t),t}function ow(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!UY(n,t)}catch{return!0}}function BY(n,e){return e()}var GY=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?BY:zY;zk.useSyncExternalStore=Qf.useSyncExternalStore!==void 0?Qf.useSyncExternalStore:GY;Fk.exports=zk;var VY=Fk.exports;/** - * @license React - * use-sync-external-store-shim/with-selector.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var __=Y,HY=VY;function WY(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var jY=typeof Object.is=="function"?Object.is:WY,XY=HY.useSyncExternalStore,$Y=__.useRef,YY=__.useEffect,qY=__.useMemo,KY=__.useDebugValue;Nk.useSyncExternalStoreWithSelector=function(n,e,t,i,r){var s=$Y(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=qY(function(){function l(m){if(!u){if(u=!0,c=m,m=i(m),r!==void 0&&o.hasValue){var v=o.value;if(r(v,m))return f=v}return f=m}if(v=f,jY(c,m))return v;var x=i(m);return r!==void 0&&r(v,x)?v:(c=m,f=x)}var u=!1,c,f,h=t===void 0?null:t;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,t,i,r]);var a=XY(n,s[0],s[1]);return YY(function(){o.hasValue=!0,o.value=a},[a]),KY(a),a};kk.exports=Nk;var ZY=kk.exports;const QY=ts(ZY);var JY={BASE_URL:"/kanjiorder-v2/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useSyncExternalStoreWithSelector:eq}=QY;function Bk(n,e=n.getState,t){const i=eq(n.subscribe,n.getState,n.getServerState||n.getState,e,t);return Y.useDebugValue(i),i}const FP=n=>{(JY?"production":void 0)!=="production"&&typeof n!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof n=="function"?IY(n):n,t=(i,r)=>Bk(e,i,r);return Object.assign(t,e),t},tq=n=>n?FP(n):FP;var nq={BASE_URL:"/kanjiorder-v2/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function iq(){(nq?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `context` will be removed in a future version. Instead use `import { createStore, useStore } from 'zustand'`. See: https://github.com/pmndrs/zustand/discussions/1180.");const n=Y.createContext(void 0);return{Provider:({createStore:r,children:s})=>{const o=Y.useRef();return o.current||(o.current=r()),Y.createElement(n.Provider,{value:o.current},s)},useStore:(r,s)=>{const o=Y.useContext(n);if(!o)throw new Error("Seems like you have not used zustand provider as an ancestor.");return Bk(o,r,s)},useStoreApi:()=>{const r=Y.useContext(n);if(!r)throw new Error("Seems like you have not used zustand provider as an ancestor.");return Y.useMemo(()=>({...r}),[r])}}}function uy(n,e){return n.map(function(t,i){return t+e[i]})}function x_(n,e){return n.map(function(t,i){return t-e[i]})}function Kp(n){return Math.hypot.apply(Math,n)}function Gk(n,e){e===void 0&&(e=n);var t=Kp(e),i=t===0?0:1/t,r=e.map(function(o){return i*o}),s=Kp(n);return{distance:s,direction:r}}function Vk(n,e,t){var i=Kp(e),r=i===0?0:1/i,s=t===0?0:1/t,o=s*i,a=e.map(function(c){return s*c}),l=e.map(function(c){return r*c}),u=Kp(n);return{velocities:a,velocity:o,distance:u,direction:l}}function cy(n){return Math.sign?Math.sign(n):+(n>0)-+(n<0)||+n}function rq(n,e,t){return Math.max(e,Math.min(n,t))}function sq(n,e){return Math.pow(n,e*5)}function zP(n,e,t){return e===0||Math.abs(e)===1/0?sq(n,t):n*e*t/(e+t*n)}function BP(n,e,t,i){return i===void 0&&(i=.15),i===0?rq(n,e,t):nt?+zP(n-t,t-e,i)+t:n}function oq(n,e){for(var t=0;t=0)&&(t[r]=n[r]);return t}function nn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function uq(n,e){if(n){if(typeof n=="string")return GP(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return GP(n,e)}}function GP(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t"u"||n[Symbol.iterator]==null){if(Array.isArray(n)||(t=uq(n))||e){t&&(n=t);var i=0;return function(){return i>=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return t=n[Symbol.iterator](),t.next.bind(t)}function Hk(){}function Wk(){for(var n=arguments.length,e=new Array(n),t=0;t1?e-1:0),i=1;i2?l-2:0),c=2;c0||l>0,c=Nt({},r.controller.state.shared,r.state,r.mapStateValues(r.state),{locked:!!document.pointerLockElement,touches:l,down:u}),f=r.handler(c);return r.state.memo=f!==void 0?f:r.state.memo,c},this.controller=t,this.args=i}var e=n.prototype;return e.updateSharedState=function(i){Object.assign(this.controller.state.shared,i)},e.updateGestureState=function(i){Object.assign(this.state,i)},e.checkIntentionality=function(i,r){return{_intentional:i,_blocked:!1}},e.getMovement=function(i){var r=this.config.rubberband,s=this.state,o=s._bounds,a=s._initial,l=s._active,u=s._intentional,c=s.lastOffset,f=s.movement,h=s._threshold,m=this.getInternalMovement(i,this.state),v=u[0]===!1?$P(m[0],h[0]):u[0],x=u[1]===!1?$P(m[1],h[1]):u[1],_=this.checkIntentionality([v,x],m);if(_._blocked)return Nt({},_,{_movement:m,delta:[0,0]});var g=_._intentional,y=m,w=[g[0]!==!1?m[0]-g[0]:0,g[1]!==!1?m[1]-g[1]:0],E=uy(w,c),M=l?r:[0,0];return w=YP(o,uy(w,a),M),Nt({},_,{intentional:g[0]!==!1||g[1]!==!1,_initial:a,_movement:y,movement:w,values:i,offset:YP(o,E,M),delta:x_(w,f)})},e.clean=function(){this.clearTimeout()},aq(n,[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||bq}}]),n}();function $P(n,e){return Math.abs(n)>=e?cy(n)*e:!1}function YP(n,e,t){var i=e[0],r=e[1],s=t[0],o=t[1],a=n[0],l=a[0],u=a[1],c=n[1],f=c[0],h=c[1];return[BP(i,l,u,s),BP(r,f,h,o)]}function pi(n,e,t){var i=n.state,r=e.timeStamp,s=e.type,o=i.values,a=t?0:r-i.startTime;return{_lastEventType:s,event:e,timeStamp:r,elapsedTime:a,previous:o}}function ku(n,e,t,i){var r=n.state,s=n.config,o=n.stateKey,a=n.args,l=n.transform,u=r.offset,c=t.timeStamp,f=s.initial,h=s.bounds,m=s.threshold,v=x_(l(m),l([0,0])).map(Math.abs),x=Nt({},qk()[o],{_active:!0,args:a,values:e,initial:i??e,_threshold:v,offset:u,lastOffset:u,startTime:c});return Nt({},x,{_initial:fy(f,x),_bounds:fy(h,x)})}var Aq=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=jk(),this.supportsGestureEvents=cq(),this.bind=function(){for(var i=arguments.length,r=new Array(i),s=0;sl?"x":a0?i.setUpDelayedDragTrigger(r):i.startDrag(r,!0))},i.onDragChange=function(r){if(!(i.state.canceled||!i.state._active||!i.isValidEvent(r)||i.state._lastEventType===r.type&&r.timeStamp===i.state.timeStamp)){var s;if(document.pointerLockElement){var o=r.movementX,a=r.movementY;s=uy(i.transform([o,a]),i.state.values)}else s=Mf(r,i.transform);var l=i.getKinematics(s,r);if(!i.state._dragStarted){if(i.state._dragDelayed){i.startDrag(r);return}if(i.shouldPreventWindowScrollY)if(!i.state._dragPreventScroll&&l.axis)if(l.axis==="x")i.startDrag(r);else{i.state._active=!1;return}else return;else return}var u=Ts(r);i.updateSharedState(u);var c=pi(nn(i),r),f=Kp(l._movement),h=i.state._dragIsTap;h&&f>=kq&&(h=!1),i.updateGestureState(Nt({},c,l,{_dragIsTap:h})),i.fireGestureHandler()}},i.onDragEnd=function(r){if(Qk(i.controller,r),!!i.isValidEvent(r)&&(i.clean(),!!i.state._active)){i.state._active=!1;var s=i.state._dragIsTap,o=i.state.velocities,a=o[0],l=o[1],u=i.state.movement,c=u[0],f=u[1],h=i.state._intentional,m=h[0],v=h[1],x=i.config.swipeVelocity,_=x[0],g=x[1],y=i.config.swipeDistance,w=y[0],E=y[1],M=i.config.swipeDuration,b=Nt({},pi(nn(i),r),i.getMovement(i.state.values)),C=[0,0];b.elapsedTime_&&Math.abs(c)>w&&(C[0]=cy(a)),v!==!1&&Math.abs(l)>g&&Math.abs(f)>E&&(C[1]=cy(l))),i.updateSharedState({buttons:0}),i.updateGestureState(Nt({},b,{tap:s,swipe:C})),i.fireGestureHandler(i.config.filterTaps&&s===!0)}},i.clean=function(){n.prototype.clean.call(nn(i)),i.state._dragStarted=!1,i.releasePointerCapture(),Rq(i.controller,i.stateKey)},i.onCancel=function(){i.state.canceled||(i.updateGestureState({canceled:!0,_active:!1}),i.updateSharedState({buttons:0}),setTimeout(function(){return i.fireGestureHandler()},0))},i.onClick=function(r){i.state._dragIsTap||r.stopPropagation()},i}var t=e.prototype;return t.startDrag=function(r,s){s===void 0&&(s=!1),!(!this.state._active||this.state._dragStarted)&&(s||this.setStartState(r),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},t.addBindings=function(r){if(this.config.useTouch?(Dn(r,"onTouchStart",this.onDragStart),Dn(r,"onTouchMove",this.onDragChange),Dn(r,"onTouchEnd",this.onDragEnd),Dn(r,"onTouchCancel",this.onDragEnd)):(Dn(r,"onPointerDown",this.onDragStart),Dn(r,"onPointerMove",this.onDragChange),Dn(r,"onPointerUp",this.onDragEnd),Dn(r,"onPointerCancel",this.onDragEnd)),this.config.filterTaps){var s=this.controller.config.eventOptions.capture?"onClick":"onClickCapture";Dn(r,s,this.onClick)}},e}(S_),Fq=function(n){uc(e,n);function e(){return n.apply(this,arguments)||this}var t=e.prototype;return t.getInternalMovement=function(r,s){var o=s.values[1],a=r[0],l=r[1],u=l===void 0?o:l,c=u-o,f=s.turns;return Math.abs(c)>270&&(f+=cy(c)),x_([a,u-360*f],s.initial)},t.getKinematics=function(r,s){var o=this.getMovement(r),a=(r[1]-o._movement[1]-this.state.initial[1])/360,l=s.timeStamp-this.state.timeStamp,u=Vk(o.movement,o.delta,l),c=lq(u,["distance","velocity"]);return Nt({turns:a},o,c)},t.mapStateValues=function(r){return{da:r.values,vdva:r.velocities}},e}(Kk),zq=7,Bq=260,Gq=function(n){uc(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="pinching",i.stateKey="pinch",i.onPinchStart=function(r){Zk(i.controller,r);var s=i.controller.touchIds;if(i.enabled&&!(i.state._active&&i.state._pointerIds.every(function(c){return s.has(c)}))&&!(s.size<2)){var o=Array.from(s).slice(0,2),a=HP(r,o,i.transform),l=a.values,u=a.origin;i.updateSharedState(Ts(r)),i.updateGestureState(Nt({},ku(nn(i),l,r),pi(nn(i),r,!0),{_pointerIds:o,cancel:i.onCancel,origin:u})),i.updateGestureState(i.getMovement(l)),i.fireGestureHandler()}},i.onPinchChange=function(r){var s=i.state,o=s.canceled,a=s._active;if(!(o||!a||r.timeStamp===i.state.timeStamp)){var l=Ts(r);i.updateSharedState(l);try{var u=HP(r,i.state._pointerIds,i.transform),c=u.values,f=u.origin,h=i.getKinematics(c,r);i.updateGestureState(Nt({},pi(nn(i),r),h,{origin:f})),i.fireGestureHandler()}catch{i.onPinchEnd(r)}}},i.onPinchEnd=function(r){Qk(i.controller,r);var s=VT(r);i.state._pointerIds.every(function(o){return!s.includes(o)})||(i.clean(),i.state._active&&(i.updateGestureState(Nt({},pi(nn(i),r),i.getMovement(i.state.values),{_active:!1})),i.fireGestureHandler()))},i.onCancel=function(){i.state.canceled||(i.updateGestureState({_active:!1,canceled:!0}),setTimeout(function(){return i.fireGestureHandler()},0))},i.onGestureStart=function(r){if(i.enabled){r.preventDefault();var s=XP(r,i.transform);i.updateSharedState(Ts(r)),i.updateGestureState(Nt({},ku(nn(i),s,r),pi(nn(i),r,!0),{origin:[r.clientX,r.clientY],cancel:i.onCancel})),i.updateGestureState(i.getMovement(s)),i.fireGestureHandler()}},i.onGestureChange=function(r){var s=i.state,o=s.canceled,a=s._active;if(!(o||!a)){r.preventDefault();var l=Ts(r);i.updateSharedState(l);var u=XP(r,i.transform);u[0]=(u[0]-i.state.event.scale)*Bq+i.state.values[0];var c=i.getKinematics(u,r);i.updateGestureState(Nt({},pi(nn(i),r),c,{origin:[r.clientX,r.clientY]})),i.fireGestureHandler()}},i.onGestureEnd=function(r){i.clean(),i.state._active&&(i.updateGestureState(Nt({},pi(nn(i),r),i.getMovement(i.state.values),{_active:!1,origin:[r.clientX,r.clientY]})),i.fireGestureHandler())},i.wheelShouldRun=function(r){return i.enabled&&r.ctrlKey},i.getWheelValuesFromEvent=function(r){var s=$k(r,i.transform),o=s[1],a=i.state.values,l=a[0],u=a[1],c=-o*zq,f=l+c,h=u!==void 0?u:0;return{values:[f,h],origin:[r.clientX,r.clientY],delta:[c,h]}},i.onWheel=function(r){i.wheelShouldRun(r)&&(i.setTimeout(i.onWheelEnd),i.state._active?i.onWheelChange(r):i.onWheelStart(r))},i.onWheelStart=function(r){var s=i.getWheelValuesFromEvent(r),o=s.values,a=s.delta,l=s.origin;r.cancelable&&r.preventDefault(),i.updateSharedState(Ts(r)),i.updateGestureState(Nt({},ku(nn(i),o,r,i.state.values),pi(nn(i),r,!0),{offset:o,delta:a,origin:l})),i.updateGestureState(i.getMovement(o)),i.fireGestureHandler()},i.onWheelChange=function(r){r.cancelable&&r.preventDefault(),i.updateSharedState(Ts(r));var s=i.getWheelValuesFromEvent(r),o=s.values,a=s.origin,l=s.delta;i.updateGestureState(Nt({},pi(nn(i),r),i.getKinematics(o,r),{origin:a,delta:l})),i.fireGestureHandler()},i.onWheelEnd=function(){i.clean(),i.state._active&&(i.state._active=!1,i.updateGestureState(i.getMovement(i.state.values)),i.fireGestureHandler())},i}var t=e.prototype;return t.addBindings=function(r){this.controller.config.domTarget&&!this.controller.supportsTouchEvents&&this.controller.supportsGestureEvents?(Dn(r,"onGestureStart",this.onGestureStart),Dn(r,"onGestureChange",this.onGestureChange),Dn(r,"onGestureEnd",this.onGestureEnd)):(Dn(r,"onTouchStart",this.onPinchStart),Dn(r,"onTouchMove",this.onPinchChange),Dn(r,"onTouchEnd",this.onPinchEnd),Dn(r,"onTouchCancel",this.onPinchEnd),Dn(r,"onWheel",this.onWheel))},e}(Fq),Vq=function(n){uc(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="wheeling",i.stateKey="wheel",i.debounced=!0,i.handleEvent=function(r){if(!(r.ctrlKey&&"pinch"in i.controller.handlers)&&i.enabled){i.setTimeout(i.onEnd),i.updateSharedState(Ts(r));var s=uy($k(r,i.transform),i.state.values);if(i.state._active)i.updateGestureState(Nt({},pi(nn(i),r),i.getKinematics(s,r)));else{i.updateGestureState(Nt({},ku(nn(i),s,r,i.state.values),pi(nn(i),r,!0)));var o=i.getMovement(s),a=Gk(o.delta);i.updateGestureState(o),i.updateGestureState(a)}i.fireGestureHandler()}},i.onEnd=function(){if(i.clean(),!!i.state._active){var r=i.getMovement(i.state.values);i.updateGestureState(r),i.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),i.fireGestureHandler()}},i}var t=e.prototype;return t.addBindings=function(r){Dn(r,"onWheel",this.handleEvent)},e}(S_),KP=function(n){uc(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="moving",i.stateKey="move",i.debounced=!0,i.onMove=function(r){i.enabled&&(i.setTimeout(i.onMoveEnd),i.state._active?i.onMoveChange(r):i.onMoveStart(r))},i.onMoveStart=function(r){i.updateSharedState(Ts(r));var s=Mf(r,i.transform);i.updateGestureState(Nt({},ku(nn(i),s,r),pi(nn(i),r,!0))),i.updateGestureState(i.getMovement(s)),i.fireGestureHandler()},i.onMoveChange=function(r){i.updateSharedState(Ts(r));var s=Mf(r,i.transform);i.updateGestureState(Nt({},pi(nn(i),r),i.getKinematics(s,r))),i.fireGestureHandler()},i.onMoveEnd=function(){if(i.clean(),!!i.state._active){var r=i.state.values;i.updateGestureState(i.getMovement(r)),i.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),i.fireGestureHandler()}},i.hoverTransform=function(){return i.controller.config.hover.transform||i.controller.config.transform},i.onPointerEnter=function(r){if(i.controller.state.shared.hovering=!0,!!i.controller.config.enabled){if(i.controller.config.hover.enabled){var s=Mf(r,i.hoverTransform()),o=Nt({},i.controller.state.shared,i.state,pi(nn(i),r,!0),{args:i.args,values:s,active:!0,hovering:!0});i.controller.handlers.hover(Nt({},o,i.mapStateValues(o)))}"move"in i.controller.handlers&&i.onMoveStart(r)}},i.onPointerLeave=function(r){if(i.controller.state.shared.hovering=!1,"move"in i.controller.handlers&&i.onMoveEnd(),!!i.controller.config.hover.enabled){var s=Mf(r,i.hoverTransform()),o=Nt({},i.controller.state.shared,i.state,pi(nn(i),r),{args:i.args,values:s,active:!1});i.controller.handlers.hover(Nt({},o,i.mapStateValues(o)))}},i}var t=e.prototype;return t.addBindings=function(r){"move"in this.controller.handlers&&Dn(r,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(Dn(r,"onPointerEnter",this.onPointerEnter),Dn(r,"onPointerLeave",this.onPointerLeave))},e}(S_),Hq=function(n){uc(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="scrolling",i.stateKey="scroll",i.debounced=!0,i.handleEvent=function(r){if(i.enabled){i.clearTimeout(),i.setTimeout(i.onEnd);var s=hq(r,i.transform);if(i.updateSharedState(Ts(r)),i.state._active)i.updateGestureState(Nt({},pi(nn(i),r),i.getKinematics(s,r)));else{i.updateGestureState(Nt({},ku(nn(i),s,r,i.state.values),pi(nn(i),r,!0)));var o=i.getMovement(s),a=Gk(o.delta);i.updateGestureState(o),i.updateGestureState(a)}i.fireGestureHandler()}},i.onEnd=function(){i.clean(),i.state._active&&(i.updateGestureState(Nt({},i.getMovement(i.state.values),{_active:!1,velocities:[0,0],velocity:0})),i.fireGestureHandler())},i}var t=e.prototype;return t.addBindings=function(r){Dn(r,"onScroll",this.handleEvent)},e}(S_),Wq=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function jq(n){var e={},t={},i=new Set;for(var r in n)Wq.test(r)?(i.add(RegExp.lastMatch),t[r]=n[r]):e[r]=n[r];return[t,e,i]}function Xq(n,e){e===void 0&&(e={});var t=jq(n),i=t[0],r=t[1],s=t[2];bs.set("drag",Nq),bs.set("hover",KP),bs.set("move",KP),bs.set("pinch",Gq),bs.set("scroll",Hq),bs.set("wheel",Vq);var o=Tq(e,s),a={};return s.has("onDrag")&&(a.drag=pd(i,"onDrag")),s.has("onWheel")&&(a.wheel=pd(i,"onWheel")),s.has("onScroll")&&(a.scroll=pd(i,"onScroll")),s.has("onMove")&&(a.move=pd(i,"onMove")),s.has("onPinch")&&(a.pinch=pd(i,"onPinch")),s.has("onHover")&&(a.hover=i.onHover),Dq(a,o,r)}function pd(n,e){var t=e+"Start",i=e+"End",r=function(o){var a=void 0;return o.first&&t in n&&n[t](o),e in n&&(a=n[e](o)),o.last&&i in n&&n[i](o),a};return r}var hh={};function Fo(n){if(typeof n!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=n}typeof Symbol<"u"&&(Fo.prototype[Symbol.iterator]=function(){return this});Fo.of=function(){var n=arguments,e=n.length,t=0;return new Fo(function(){return t>=e?{done:!0}:{done:!1,value:n[t++]}})};Fo.empty=function(){var n=new Fo(function(){return{done:!0}});return n};Fo.fromSequence=function(n){var e=0,t=n.length;return new Fo(function(){return e>=t?{done:!0}:{done:!1,value:n[e++]}})};Fo.is=function(n){return n instanceof Fo?!0:typeof n=="object"&&n!==null&&typeof n.next=="function"};var E_=Fo;const Us=ts(E_);var M_={};M_.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u";M_.SYMBOL_SUPPORT=typeof Symbol<"u";var nN=M_,$q=nN.ARRAY_BUFFER_SUPPORT,Yq=nN.SYMBOL_SUPPORT,WT=function(e,t){var i,r,s,o,a;if(!e)throw new Error("obliterator/forEach: invalid iterable.");if(typeof t!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(e)||$q&&ArrayBuffer.isView(e)||typeof e=="string"||e.toString()==="[object Arguments]"){for(s=0,o=e.length;s=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,n}};ni.prototype.peek=function(){if(this.size)return this.items[this.offset]};ni.prototype.forEach=function(n,e){e=arguments.length>1?e:this;for(var t=this.offset,i=0,r=this.items.length;t=n.length)return{done:!0};var t=n[e];return e++,{value:t,done:!1}})};ni.prototype.entries=function(){var n=this.items,e=this.offset,t=0;return new iN(function(){if(e>=n.length)return{done:!0};var i=n[e];return e++,{value:[t++,i],done:!1}})};typeof Symbol<"u"&&(ni.prototype[Symbol.iterator]=ni.prototype.values);ni.prototype.toString=function(){return this.toArray().join(",")};ni.prototype.toJSON=function(){return this.toArray()};ni.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:ni,enumerable:!1}),n};typeof Symbol<"u"&&(ni.prototype[Symbol.for("nodejs.util.inspect.custom")]=ni.prototype.inspect);ni.from=function(n){var e=new ni;return qq(n,function(t){e.enqueue(t)}),e};ni.of=function(){return ni.from(arguments)};var Kq=ni,Zq=function(e,t){var i=t.length;if(i!==0){var r=e.length;e.length+=i;for(var s=0;se?1:0},oK=function(n,e){return ne?-1:0};function aK(n){return function(e,t){return n(t,e)}}function lK(n){return n===2?function(e,t){return e[0]t[0]?1:e[1]t[1]?1:0}:function(e,t){for(var i=0;it[i])return 1;i++}return 0}}Em.DEFAULT_COMPARATOR=sK;Em.DEFAULT_REVERSE_COMPARATOR=oK;Em.reverseComparator=aK;Em.createTupleComparator=lK;var Mm={},sN=WT,oN=NT;function uK(n){return Array.isArray(n)||oN.isTypedArray(n)}function $T(n){if(typeof n.length=="number")return n.length;if(typeof n.size=="number")return n.size}function cK(n){var e=$T(n),t=typeof e=="number"?new Array(e):[],i=0;return sN(n,function(r){t[i++]=r}),t}function fK(n){var e=$T(n),t=typeof e=="number"?oN.getPointerArray(e):Array,i=typeof e=="number"?new Array(e):[],r=typeof e=="number"?new t(e):[],s=0;return sN(n,function(o){i[s]=o,r[s]=s++}),[i,r]}Mm.isArrayLike=uK;Mm.guessLength=$T;Mm.toArray=cK;Mm.toArrayWithIndices=fK;var hy=WT,aN=Em,Oo=Mm,T_=aN.DEFAULT_COMPARATOR,YT=aN.reverseComparator;function qT(n,e,t,i){for(var r=e[i],s,o;i>t;){if(s=i-1>>1,o=e[s],n(r,o)<0){e[i]=o,i=s;continue}break}e[i]=r}function Tm(n,e,t){for(var i=e.length,r=t,s=e[t],o=2*t+1,a;o=0&&(o=a),e[t]=e[o],t=o,o=2*t+1;e[t]=s,qT(n,e,r,t)}function lN(n,e,t){e.push(t),qT(n,e,0,e.length-1)}function KT(n,e){var t=e.pop();if(e.length!==0){var i=e[0];return e[0]=t,Tm(n,e,0),i}return t}function Jf(n,e,t){if(e.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var i=e[0];return e[0]=t,Tm(n,e,0),i}function uN(n,e,t){var i;return e.length!==0&&n(e[0],t)<0&&(i=e[0],e[0]=t,t=i,Tm(n,e,0)),t}function Zu(n,e){for(var t=e.length,i=t>>1,r=i;--r>=0;)Tm(n,e,r)}function ZT(n,e){for(var t=e.length,i=0,r=new Array(t);i=t.length)return t.slice().sort(n);for(l=t.slice(0,e),Zu(i,l),r=e,s=t.length;r0&&Jf(i,l,t[r]);return l.sort(n)}var u=Oo.guessLength(t);return u!==null&&u0&&Jf(i,l,c)),r++}),l.length>r&&(l.length=r),l.sort(n)}function dK(n,e,t){arguments.length===2&&(t=e,e=n,n=T_);var i=YT(n),r,s,o,a=-1/0,l;if(e===1){if(Oo.isArrayLike(t)){for(r=0,s=t.length;r0)&&(a=o);return l=new t.constructor(1),l[0]=a,l}return hy(t,function(c){(a===-1/0||n(c,a)>0)&&(a=c)}),[a]}if(Oo.isArrayLike(t)){if(e>=t.length)return t.slice().sort(i);for(l=t.slice(0,e),Zu(n,l),r=e,s=t.length;r0&&Jf(n,l,t[r]);return l.sort(i)}var u=Oo.guessLength(t);return u!==null&&u0&&Jf(n,l,c)),r++}),l.length>r&&(l.length=r),l.sort(i)}function un(n){if(this.clear(),this.comparator=n||T_,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}un.prototype.clear=function(){this.items=[],this.size=0};un.prototype.push=function(n){return lN(this.comparator,this.items,n),++this.size};un.prototype.peek=function(){return this.items[0]};un.prototype.pop=function(){return this.size!==0&&this.size--,KT(this.comparator,this.items)};un.prototype.replace=function(n){return Jf(this.comparator,this.items,n)};un.prototype.pushpop=function(n){return uN(this.comparator,this.items,n)};un.prototype.consume=function(){return this.size=0,ZT(this.comparator,this.items)};un.prototype.toArray=function(){return ZT(this.comparator,this.items.slice())};un.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:un,enumerable:!1}),n};typeof Symbol<"u"&&(un.prototype[Symbol.for("nodejs.util.inspect.custom")]=un.prototype.inspect);function dy(n){if(this.clear(),this.comparator=n||T_,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=YT(this.comparator)}dy.prototype=un.prototype;un.from=function(n,e){var t=new un(e),i;return Oo.isArrayLike(n)?i=n.slice():i=Oo.toArray(n),Zu(t.comparator,i),t.items=i,t.size=i.length,t};dy.from=function(n,e){var t=new dy(e),i;return Oo.isArrayLike(n)?i=n.slice():i=Oo.toArray(n),Zu(t.comparator,i),t.items=i,t.size=i.length,t};un.siftUp=Tm;un.siftDown=qT;un.push=lN;un.pop=KT;un.replace=Jf;un.pushpop=uN;un.heapify=Zu;un.consume=ZT;un.nsmallest=hK;un.nlargest=dK;un.MinHeap=un;un.MaxHeap=dy;var cN=un,fN=Pa,QT=lc.createEdgeWeightGetter,py=cN,JT="weight";function SE(n,e){return n[0]>e[0]?1:n[0]e[1]?1:n[1]e[2]?1:n[2]e[0]?1:n[0]e[1]?1:n[1]e[2]?1:n[2]e[3]?1:n[3]x)&&(u=x,l=s[0][g].concat(s[1][g].slice(0,-1).reverse()))))}}return[1/0,null]}function gK(n,e,t,i,r,s){if(!fN(n))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");t=QT(t||JT).fromMinimalEntry;var o={},a={},l=new py(SE),u=0,c,f,h,m,v,x,_,g,y,w,E;for(g=0,w=e.length;ge[0]?1:n[0]e[1]?1:n[1]s.cutoff||(l[M]=[E,y],a.push([E+y,o++,M,E,f]))}}for(;a.size!==0;){if(c=a.pop(),f=c[2],m=c[3],v=c[4],f===t){for(x=[f],_=v;_!==null;)x.push(_),_=u[_];return x.reverse(),x}u.hasOwnProperty(f)&&(u[f]===null||(g=l[f][0],g0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")ZP(l,this,t);else for(var u=l.length,c=yN(l,u),i=0;i0&&o.length>r&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,CK(a)}return n}hn.prototype.addListener=function(e,t){return pN(this,e,t,!1)};hn.prototype.on=hn.prototype.addListener;hn.prototype.prependListener=function(e,t){return pN(this,e,t,!0)};function RK(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function mN(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},r=RK.bind(i);return r.listener=t,i.wrapFn=r,r}hn.prototype.once=function(e,t){return b_(t),this.on(e,mN(this,e,t)),this};hn.prototype.prependOnceListener=function(e,t){return b_(t),this.prependListener(e,mN(this,e,t)),this};hn.prototype.removeListener=function(e,t){var i,r,s,o,a;if(b_(t),r=this._events,r===void 0)return this;if(i=r[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():PK(i,s),i.length===1&&(r[e]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};hn.prototype.off=hn.prototype.removeListener;hn.prototype.removeAllListeners=function(e){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(r=0;r=0;r--)this.removeListener(e,t[r]);return this};function gN(n,e,t){var i=n._events;if(i===void 0)return[];var r=i[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?LK(r):yN(r,r.length)}hn.prototype.listeners=function(e){return gN(this,e,!0)};hn.prototype.rawListeners=function(e){return gN(this,e,!1)};hn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):vN.call(n,e)};hn.prototype.listenerCount=vN;function vN(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}hn.prototype.eventNames=function(){return this._eventsCount>0?_v(this._events):[]};function yN(n,e){for(var t=new Array(e),i=0;i1?t:1/0,r=i!==1/0?new Array(i):[],s,o=0,a=zK(e);;){if(o===i)return r;if(s=a.next(),s.done)return o!==t&&(r.length=o),r;r[o++]=s.value}};const SN=ts(BK);var GK=E_,VK=wN,HK=function(){var e=arguments,t=null,i=-1;return new GK(function(){var s=null;do{if(t===null){if(i++,i>=e.length)return{done:!0};t=VK(e[i])}if(s=t.next(),s.done===!0){t=null;continue}break}while(!0);return s})};const xa=ts(HK);function WK(){const n=arguments[0];for(let e=1,t=arguments.length;en++}class t2 extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class tt extends t2{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,tt.prototype.constructor)}}class $e extends t2{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$e.prototype.constructor)}}class pt extends t2{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,pt.prototype.constructor)}}function MN(n,e){this.key=n,this.attributes=e,this.clear()}MN.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function TN(n,e){this.key=n,this.attributes=e,this.clear()}TN.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function bN(n,e){this.key=n,this.attributes=e,this.clear()}bN.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function dh(n,e,t,i,r){this.key=e,this.attributes=r,this.undirected=n,this.source=t,this.target=i}dh.prototype.attach=function(){let n="out",e="in";this.undirected&&(n=e="undirected");const t=this.source.key,i=this.target.key;this.source[n][i]=this,!(this.undirected&&t===i)&&(this.target[e][t]=this)};dh.prototype.attachMulti=function(){let n="out",e="in";const t=this.source.key,i=this.target.key;this.undirected&&(n=e="undirected");const r=this.source[n],s=r[i];if(typeof s>"u"){r[i]=this,this.undirected&&t===i||(this.target[e][t]=this);return}s.previous=this,this.next=s,r[i]=this,this.target[e][t]=this};dh.prototype.detach=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),delete this.source[t][e],delete this.target[i][n]};dh.prototype.detachMulti=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[i][n]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[i][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const AN=0,CN=1,XK=2,RN=3;function Ia(n,e,t,i,r,s,o){let a,l,u,c;if(i=""+i,t===AN){if(a=n._nodes.get(i),!a)throw new $e(`Graph.${e}: could not find the "${i}" node in the graph.`);u=r,c=s}else if(t===RN){if(r=""+r,l=n._edges.get(r),!l)throw new $e(`Graph.${e}: could not find the "${r}" edge in the graph.`);const f=l.source.key,h=l.target.key;if(i===f)a=l.target;else if(i===h)a=l.source;else throw new $e(`Graph.${e}: the "${i}" node is not attached to the "${r}" edge (${f}, ${h}).`);u=s,c=o}else{if(l=n._edges.get(i),!l)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`);t===CN?a=l.source:a=l.target,u=r,c=s}return[a,u,c]}function $K(n,e,t){n.prototype[e]=function(i,r,s){const[o,a]=Ia(this,e,t,i,r,s);return o.attributes[a]}}function YK(n,e,t){n.prototype[e]=function(i,r){const[s]=Ia(this,e,t,i,r);return s.attributes}}function qK(n,e,t){n.prototype[e]=function(i,r,s){const[o,a]=Ia(this,e,t,i,r,s);return o.attributes.hasOwnProperty(a)}}function KK(n,e,t){n.prototype[e]=function(i,r,s,o){const[a,l,u]=Ia(this,e,t,i,r,s,o);return a.attributes[l]=u,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}function ZK(n,e,t){n.prototype[e]=function(i,r,s,o){const[a,l,u]=Ia(this,e,t,i,r,s,o);if(typeof u!="function")throw new tt(`Graph.${e}: updater should be a function.`);const c=a.attributes,f=u(c[l]);return c[l]=f,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}function QK(n,e,t){n.prototype[e]=function(i,r,s){const[o,a]=Ia(this,e,t,i,r,s);return delete o.attributes[a],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:a}),this}}function JK(n,e,t){n.prototype[e]=function(i,r,s){const[o,a]=Ia(this,e,t,i,r,s);if(!Ui(a))throw new tt(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=a,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function eZ(n,e,t){n.prototype[e]=function(i,r,s){const[o,a]=Ia(this,e,t,i,r,s);if(!Ui(a))throw new tt(`Graph.${e}: provided attributes are not a plain object.`);return mi(o.attributes,a),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:a}),this}}function tZ(n,e,t){n.prototype[e]=function(i,r,s){const[o,a]=Ia(this,e,t,i,r,s);if(typeof a!="function")throw new tt(`Graph.${e}: provided updater is not a function.`);return o.attributes=a(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const nZ=[{name:n=>`get${n}Attribute`,attacher:$K},{name:n=>`get${n}Attributes`,attacher:YK},{name:n=>`has${n}Attribute`,attacher:qK},{name:n=>`set${n}Attribute`,attacher:KK},{name:n=>`update${n}Attribute`,attacher:ZK},{name:n=>`remove${n}Attribute`,attacher:QK},{name:n=>`replace${n}Attributes`,attacher:JK},{name:n=>`merge${n}Attributes`,attacher:eZ},{name:n=>`update${n}Attributes`,attacher:tZ}];function iZ(n){nZ.forEach(function({name:e,attacher:t}){t(n,e("Node"),AN),t(n,e("Source"),CN),t(n,e("Target"),XK),t(n,e("Opposite"),RN)})}function rZ(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new pt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new pt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,a=""+r;if(r=arguments[2],s=Ls(this,o,a,t),!s)throw new $e(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new pt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return s.attributes[r]}}function sZ(n,e,t){n.prototype[e]=function(i){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new pt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new pt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+i,o=""+arguments[1];if(r=Ls(this,s,o,t),!r)throw new $e(`Graph.${e}: could not find an edge for the given path ("${s}" - "${o}").`)}else{if(t!=="mixed")throw new pt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,r=this._edges.get(i),!r)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return r.attributes}}function oZ(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new pt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new pt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,a=""+r;if(r=arguments[2],s=Ls(this,o,a,t),!s)throw new $e(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new pt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return s.attributes.hasOwnProperty(r)}}function aZ(n,e,t){n.prototype[e]=function(i,r,s){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new pt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new pt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+i,l=""+r;if(r=arguments[2],s=arguments[3],o=Ls(this,a,l,t),!o)throw new $e(`Graph.${e}: could not find an edge for the given path ("${a}" - "${l}").`)}else{if(t!=="mixed")throw new pt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,o=this._edges.get(i),!o)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return o.attributes[r]=s,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function lZ(n,e,t){n.prototype[e]=function(i,r,s){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new pt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new pt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+i,l=""+r;if(r=arguments[2],s=arguments[3],o=Ls(this,a,l,t),!o)throw new $e(`Graph.${e}: could not find an edge for the given path ("${a}" - "${l}").`)}else{if(t!=="mixed")throw new pt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,o=this._edges.get(i),!o)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof s!="function")throw new tt(`Graph.${e}: updater should be a function.`);return o.attributes[r]=s(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function uZ(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new pt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new pt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,a=""+r;if(r=arguments[2],s=Ls(this,o,a,t),!s)throw new $e(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new pt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return delete s.attributes[r],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:r}),this}}function cZ(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new pt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new pt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,a=""+r;if(r=arguments[2],s=Ls(this,o,a,t),!s)throw new $e(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new pt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!Ui(r))throw new tt(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=r,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function fZ(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new pt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new pt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,a=""+r;if(r=arguments[2],s=Ls(this,o,a,t),!s)throw new $e(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new pt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!Ui(r))throw new tt(`Graph.${e}: provided attributes are not a plain object.`);return mi(s.attributes,r),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:r}),this}}function hZ(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new pt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new pt(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+i,a=""+r;if(r=arguments[2],s=Ls(this,o,a,t),!s)throw new $e(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new pt(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(i=""+i,s=this._edges.get(i),!s)throw new $e(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof r!="function")throw new tt(`Graph.${e}: provided updater is not a function.`);return s.attributes=r(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const dZ=[{name:n=>`get${n}Attribute`,attacher:rZ},{name:n=>`get${n}Attributes`,attacher:sZ},{name:n=>`has${n}Attribute`,attacher:oZ},{name:n=>`set${n}Attribute`,attacher:aZ},{name:n=>`update${n}Attribute`,attacher:lZ},{name:n=>`remove${n}Attribute`,attacher:uZ},{name:n=>`replace${n}Attributes`,attacher:cZ},{name:n=>`merge${n}Attributes`,attacher:fZ},{name:n=>`update${n}Attributes`,attacher:hZ}];function pZ(n){dZ.forEach(function({name:e,attacher:t}){t(n,e("Edge"),"mixed"),t(n,e("DirectedEdge"),"directed"),t(n,e("UndirectedEdge"),"undirected")})}const mZ=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function gZ(n,e,t,i){let r=!1;for(const s in e){if(s===i)continue;const o=e[s];if(r=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&r)return o.key}}function vZ(n,e,t,i){let r,s,o,a=!1;for(const l in e)if(l!==i){r=e[l];do{if(s=r.source,o=r.target,a=t(r.key,r.attributes,s.key,o.key,s.attributes,o.attributes,r.undirected),n&&a)return r.key;r=r.next}while(r!==void 0)}}function lw(n,e){const t=Object.keys(n),i=t.length;let r,s=0;return new Us(function(){do if(r)r=r.next;else{if(s>=i)return{done:!0};const a=t[s++];if(a===e){r=void 0;continue}r=n[a]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}})}function yZ(n,e,t,i){const r=e[t];if(!r)return;const s=r.source,o=r.target;if(i(r.key,r.attributes,s.key,o.key,s.attributes,o.attributes,r.undirected)&&n)return r.key}function _Z(n,e,t,i){let r=e[t];if(!r)return;let s=!1;do{if(s=i(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}function uw(n,e){let t=n[e];return t.next!==void 0?new Us(function(){if(!t)return{done:!0};const i={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:i}}):Us.of({edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected})}function xZ(n,e){if(n.size===0)return[];if(e==="mixed"||e===n.type)return typeof Array.from=="function"?Array.from(n._edges.keys()):SN(n._edges.keys(),n._edges.size);const t=e==="undirected"?n.undirectedSize:n.directedSize,i=new Array(t),r=e==="undirected",s=n._edges.values();let o=0,a,l;for(;a=s.next(),a.done!==!0;)l=a.value,l.undirected===r&&(i[o++]=l.key);return i}function PN(n,e,t,i){if(e.size===0)return;const r=t!=="mixed"&&t!==e.type,s=t==="undirected";let o,a,l=!1;const u=e._edges.values();for(;o=u.next(),o.done!==!0;){if(a=o.value,r&&a.undirected!==s)continue;const{key:c,attributes:f,source:h,target:m}=a;if(l=i(c,f,h.key,m.key,h.attributes,m.attributes,a.undirected),n&&l)return c}}function wZ(n,e){if(n.size===0)return Us.empty();const t=e!=="mixed"&&e!==n.type,i=e==="undirected",r=n._edges.values();return new Us(function(){let o,a;for(;;){if(o=r.next(),o.done)return o;if(a=o.value,!(t&&a.undirected!==i))break}return{value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected},done:!1}})}function n2(n,e,t,i,r,s){const o=e?vZ:gZ;let a;if(t!=="undirected"&&(i!=="out"&&(a=o(n,r.in,s),n&&a)||i!=="in"&&(a=o(n,r.out,s,i?void 0:r.key),n&&a))||t!=="directed"&&(a=o(n,r.undirected,s),n&&a))return a}function SZ(n,e,t,i){const r=[];return n2(!1,n,e,t,i,function(s){r.push(s)}),r}function EZ(n,e,t){let i=Us.empty();return n!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(i=xa(i,lw(t.in))),e!=="in"&&typeof t.out<"u"&&(i=xa(i,lw(t.out,e?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(i=xa(i,lw(t.undirected))),i}function i2(n,e,t,i,r,s,o){const a=t?_Z:yZ;let l;if(e!=="undirected"&&(typeof r.in<"u"&&i!=="out"&&(l=a(n,r.in,s,o),n&&l)||typeof r.out<"u"&&i!=="in"&&(i||r.key!==s)&&(l=a(n,r.out,s,o),n&&l))||e!=="directed"&&typeof r.undirected<"u"&&(l=a(n,r.undirected,s,o),n&&l))return l}function MZ(n,e,t,i,r){const s=[];return i2(!1,n,e,t,i,r,function(o){s.push(o)}),s}function TZ(n,e,t,i){let r=Us.empty();return n!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&i in t.in&&(r=xa(r,uw(t.in,i))),typeof t.out<"u"&&e!=="in"&&i in t.out&&(e||t.key!==i)&&(r=xa(r,uw(t.out,i)))),n!=="directed"&&typeof t.undirected<"u"&&i in t.undirected&&(r=xa(r,uw(t.undirected,i))),r}function bZ(n,e){const{name:t,type:i,direction:r}=e;n.prototype[t]=function(s,o){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];if(!arguments.length)return xZ(this,i);if(arguments.length===1){s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new $e(`Graph.${t}: could not find the "${s}" node in the graph.`);return SZ(this.multi,i==="mixed"?this.type:i,r,a)}if(arguments.length===2){s=""+s,o=""+o;const a=this._nodes.get(s);if(!a)throw new $e(`Graph.${t}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(o))throw new $e(`Graph.${t}: could not find the "${o}" target node in the graph.`);return MZ(i,this.multi,r,a,o)}throw new tt(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function AZ(n,e){const{name:t,type:i,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(u,c,f){if(!(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)){if(arguments.length===1)return f=u,PN(!1,this,i,f);if(arguments.length===2){u=""+u,f=c;const h=this._nodes.get(u);if(typeof h>"u")throw new $e(`Graph.${s}: could not find the "${u}" node in the graph.`);return n2(!1,this.multi,i==="mixed"?this.type:i,r,h,f)}if(arguments.length===3){u=""+u,c=""+c;const h=this._nodes.get(u);if(!h)throw new $e(`Graph.${s}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(c))throw new $e(`Graph.${s}: could not find the "${c}" target node in the graph.`);return i2(!1,i,this.multi,r,h,c,f)}throw new tt(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),c=u.pop();let f;if(u.length===0){let h=0;i!=="directed"&&(h+=this.undirectedSize),i!=="undirected"&&(h+=this.directedSize),f=new Array(h);let m=0;u.push((v,x,_,g,y,w,E)=>{f[m++]=c(v,x,_,g,y,w,E)})}else f=[],u.push((h,m,v,x,_,g,y)=>{f.push(c(h,m,v,x,_,g,y))});return this[s].apply(this,u),f};const a="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(){const u=Array.prototype.slice.call(arguments),c=u.pop(),f=[];return u.push((h,m,v,x,_,g,y)=>{c(h,m,v,x,_,g,y)&&f.push(h)}),this[s].apply(this,u),f};const l="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[l]=function(){let u=Array.prototype.slice.call(arguments);if(u.length<2||u.length>4)throw new tt(`Graph.${l}: invalid number of arguments (expecting 2, 3 or 4 and got ${u.length}).`);if(typeof u[u.length-1]=="function"&&typeof u[u.length-2]!="function")throw new tt(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let c,f;u.length===2?(c=u[0],f=u[1],u=[]):u.length===3?(c=u[1],f=u[2],u=[u[0]]):u.length===4&&(c=u[2],f=u[3],u=[u[0],u[1]]);let h=f;return u.push((m,v,x,_,g,y,w)=>{h=c(h,m,v,x,_,g,y,w)}),this[s].apply(this,u),h}}function CZ(n,e){const{name:t,type:i,direction:r}=e,s="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(l,u,c){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return!1;if(arguments.length===1)return c=l,PN(!0,this,i,c);if(arguments.length===2){l=""+l,c=u;const f=this._nodes.get(l);if(typeof f>"u")throw new $e(`Graph.${s}: could not find the "${l}" node in the graph.`);return n2(!0,this.multi,i==="mixed"?this.type:i,r,f,c)}if(arguments.length===3){l=""+l,u=""+u;const f=this._nodes.get(l);if(!f)throw new $e(`Graph.${s}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(u))throw new $e(`Graph.${s}: could not find the "${u}" target node in the graph.`);return i2(!0,i,this.multi,r,f,u,c)}throw new tt(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),u=l.pop();return l.push((f,h,m,v,x,_,g)=>u(f,h,m,v,x,_,g)),!!this[s].apply(this,l)};const a="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),u=l.pop();return l.push((f,h,m,v,x,_,g)=>!u(f,h,m,v,x,_,g)),!this[s].apply(this,l)}}function RZ(n,e){const{name:t,type:i,direction:r}=e,s=t.slice(0,-1)+"Entries";n.prototype[s]=function(o,a){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Us.empty();if(!arguments.length)return wZ(this,i);if(arguments.length===1){o=""+o;const l=this._nodes.get(o);if(!l)throw new $e(`Graph.${s}: could not find the "${o}" node in the graph.`);return EZ(i,r,l)}if(arguments.length===2){o=""+o,a=""+a;const l=this._nodes.get(o);if(!l)throw new $e(`Graph.${s}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(a))throw new $e(`Graph.${s}: could not find the "${a}" target node in the graph.`);return TZ(i,r,l,a)}throw new tt(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function PZ(n){mZ.forEach(e=>{bZ(n,e),AZ(n,e),CZ(n,e),RZ(n,e)})}const LZ=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function A_(){this.A=null,this.B=null}A_.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};A_.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function md(n,e,t,i,r){for(const s in i){const o=i[s],a=o.source,l=o.target,u=a===t?l:a;if(e&&e.has(u.key))continue;const c=r(u.key,u.attributes);if(n&&c)return u.key}}function r2(n,e,t,i,r){if(e!=="mixed"){if(e==="undirected")return md(n,null,i,i.undirected,r);if(typeof t=="string")return md(n,null,i,i[t],r)}const s=new A_;let o;if(e!=="undirected"){if(t!=="out"){if(o=md(n,null,i,i.in,r),n&&o)return o;s.wrap(i.in)}if(t!=="in"){if(o=md(n,s,i,i.out,r),n&&o)return o;s.wrap(i.out)}}if(e!=="directed"&&(o=md(n,s,i,i.undirected,r),n&&o))return o}function IZ(n,e,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const i=[];return r2(!1,n,e,t,function(r){i.push(r)}),i}function gd(n,e,t){const i=Object.keys(t),r=i.length;let s=0;return new Us(function(){let a=null;do{if(s>=r)return n&&n.wrap(t),{done:!0};const l=t[i[s++]],u=l.source,c=l.target;if(a=u===e?c:u,n&&n.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}})}function DZ(n,e,t){if(n!=="mixed"){if(n==="undirected")return gd(null,t,t.undirected);if(typeof e=="string")return gd(null,t,t[e])}let i=Us.empty();const r=new A_;return n!=="undirected"&&(e!=="out"&&(i=xa(i,gd(r,t,t.in))),e!=="in"&&(i=xa(i,gd(r,t,t.out)))),n!=="directed"&&(i=xa(i,gd(r,t,t.undirected))),i}function UZ(n,e){const{name:t,type:i,direction:r}=e;n.prototype[t]=function(s){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new $e(`Graph.${t}: could not find the "${s}" node in the graph.`);return IZ(i==="mixed"?this.type:i,r,o)}}function OZ(n,e){const{name:t,type:i,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(u,c){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;u=""+u;const f=this._nodes.get(u);if(typeof f>"u")throw new $e(`Graph.${s}: could not find the "${u}" node in the graph.`);r2(!1,i==="mixed"?this.type:i,r,f,c)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(u,c){const f=[];return this[s](u,(h,m)=>{f.push(c(h,m))}),f};const a="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(u,c){const f=[];return this[s](u,(h,m)=>{c(h,m)&&f.push(h)}),f};const l="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[l]=function(u,c,f){if(arguments.length<3)throw new tt(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let h=f;return this[s](u,(m,v)=>{h=c(h,m,v)}),h}}function kZ(n,e){const{name:t,type:i,direction:r}=e,s=t[0].toUpperCase()+t.slice(1,-1),o="find"+s;n.prototype[o]=function(u,c){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;u=""+u;const f=this._nodes.get(u);if(typeof f>"u")throw new $e(`Graph.${o}: could not find the "${u}" node in the graph.`);return r2(!0,i==="mixed"?this.type:i,r,f,c)};const a="some"+s;n.prototype[a]=function(u,c){return!!this[o](u,c)};const l="every"+s;n.prototype[l]=function(u,c){return!this[o](u,(h,m)=>!c(h,m))}}function NZ(n,e){const{name:t,type:i,direction:r}=e,s=t.slice(0,-1)+"Entries";n.prototype[s]=function(o){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Us.empty();o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new $e(`Graph.${s}: could not find the "${o}" node in the graph.`);return DZ(i==="mixed"?this.type:i,r,a)}}function FZ(n){LZ.forEach(e=>{UZ(n,e),OZ(n,e),kZ(n,e),NZ(n,e)})}function k0(n,e,t,i,r){const s=i._nodes.values(),o=i.type;let a,l,u,c,f,h;for(;a=s.next(),a.done!==!0;){let m=!1;if(l=a.value,o!=="undirected"){c=l.out;for(u in c){f=c[u];do h=f.target,m=!0,r(l.key,h.key,l.attributes,h.attributes,f.key,f.attributes,f.undirected),f=f.next;while(f)}}if(o!=="directed"){c=l.undirected;for(u in c)if(!(e&&l.key>u)){f=c[u];do h=f.target,h.key!==u&&(h=f.source),m=!0,r(l.key,h.key,l.attributes,h.attributes,f.key,f.attributes,f.undirected),f=f.next;while(f)}}t&&!m&&r(l.key,null,l.attributes,null,null,null,null)}}function zZ(n,e){const t={key:n};return EN(e.attributes)||(t.attributes=mi({},e.attributes)),t}function BZ(n,e,t){const i={key:e,source:t.source.key,target:t.target.key};return EN(t.attributes)||(i.attributes=mi({},t.attributes)),n==="mixed"&&t.undirected&&(i.undirected=!0),i}function GZ(n){if(!Ui(n))throw new tt('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new tt("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!Ui(n.attributes)||n.attributes===null))throw new tt("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function VZ(n){if(!Ui(n))throw new tt('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new tt("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new tt("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!Ui(n.attributes)||n.attributes===null))throw new tt("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new tt("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const HZ=jK(),WZ=new Set(["directed","undirected","mixed"]),eL=new Set(["domain","_events","_eventsCount","_maxListeners"]),jZ=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],XZ={allowSelfLoops:!0,multi:!1,type:"mixed"};function $Z(n,e,t){if(t&&!Ui(t))throw new tt(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},n._nodes.has(e))throw new pt(`Graph.addNode: the "${e}" node already exist in the graph.`);const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function tL(n,e,t){const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function LN(n,e,t,i,r,s,o,a){if(!i&&n.type==="undirected")throw new pt(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new pt(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!Ui(a))throw new tt(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(s=""+s,o=""+o,a=a||{},!n.allowSelfLoops&&s===o)throw new pt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const l=n._nodes.get(s),u=n._nodes.get(o);if(!l)throw new $e(`Graph.${e}: source node "${s}" not found.`);if(!u)throw new $e(`Graph.${e}: target node "${o}" not found.`);const c={key:null,undirected:i,source:s,target:o,attributes:a};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new pt(`Graph.${e}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(i?typeof l.undirected[o]<"u":typeof l.out[o]<"u"))throw new pt(`Graph.${e}: an edge linking "${s}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const f=new dh(i,r,l,u,a);n._edges.set(r,f);const h=s===o;return i?(l.undirectedDegree++,u.undirectedDegree++,h&&(l.undirectedLoops++,n._undirectedSelfLoopCount++)):(l.outDegree++,u.inDegree++,h&&(l.directedLoops++,n._directedSelfLoopCount++)),n.multi?f.attachMulti():f.attach(),i?n._undirectedSize++:n._directedSize++,c.key=r,n.emit("edgeAdded",c),r}function YZ(n,e,t,i,r,s,o,a,l){if(!i&&n.type==="undirected")throw new pt(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new pt(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a){if(l){if(typeof a!="function")throw new tt(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!Ui(a))throw new tt(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`)}s=""+s,o=""+o;let u;if(l&&(u=a,a=void 0),!n.allowSelfLoops&&s===o)throw new pt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=n._nodes.get(s),f=n._nodes.get(o),h,m;if(!t&&(h=n._edges.get(r),h)){if((h.source.key!==s||h.target.key!==o)&&(!i||h.source.key!==o||h.target.key!==s))throw new pt(`Graph.${e}: inconsistency detected when attempting to merge the "${r}" edge with "${s}" source & "${o}" target vs. ("${h.source.key}", "${h.target.key}").`);m=h}if(!m&&!n.multi&&c&&(m=i?c.undirected[o]:c.out[o]),m){const y=[m.key,!1,!1,!1];if(l?!u:!a)return y;if(l){const w=m.attributes;m.attributes=u(w),n.emit("edgeAttributesUpdated",{type:"replace",key:m.key,attributes:m.attributes})}else mi(m.attributes,a),n.emit("edgeAttributesUpdated",{type:"merge",key:m.key,attributes:m.attributes,data:a});return y}a=a||{},l&&u&&(a=u(a));const v={key:null,undirected:i,source:s,target:o,attributes:a};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new pt(`Graph.${e}: the "${r}" edge already exists in the graph.`);let x=!1,_=!1;c||(c=tL(n,s,{}),x=!0,s===o&&(f=c,_=!0)),f||(f=tL(n,o,{}),_=!0),h=new dh(i,r,c,f,a),n._edges.set(r,h);const g=s===o;return i?(c.undirectedDegree++,f.undirectedDegree++,g&&(c.undirectedLoops++,n._undirectedSelfLoopCount++)):(c.outDegree++,f.inDegree++,g&&(c.directedLoops++,n._directedSelfLoopCount++)),n.multi?h.attachMulti():h.attach(),i?n._undirectedSize++:n._directedSize++,v.key=r,n.emit("edgeAdded",v),[r,!0,x,_]}function qc(n,e){n._edges.delete(e.key);const{source:t,target:i,attributes:r}=e,s=e.undirected,o=t===i;s?(t.undirectedDegree--,i.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,i.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?e.detachMulti():e.detach(),s?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:e.key,attributes:r,source:t.key,target:i.key,undirected:s})}class dn extends UK.EventEmitter{constructor(e){if(super(),e=mi({},XZ,e),typeof e.multi!="boolean")throw new tt(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!WZ.has(e.type))throw new tt(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new tt(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?MN:e.type==="directed"?TN:bN;vs(this,"NodeDataClass",t);const i="geid_"+HZ()+"_";let r=0;const s=()=>{let o;do o=i+r++;while(this._edges.has(o));return o};vs(this,"_attributes",{}),vs(this,"_nodes",new Map),vs(this,"_edges",new Map),vs(this,"_directedSize",0),vs(this,"_undirectedSize",0),vs(this,"_directedSelfLoopCount",0),vs(this,"_undirectedSelfLoopCount",0),vs(this,"_edgeKeyGenerator",s),vs(this,"_options",e),eL.forEach(o=>vs(this,o,this[o])),Ws(this,"order",()=>this._nodes.size),Ws(this,"size",()=>this._edges.size),Ws(this,"directedSize",()=>this._directedSize),Ws(this,"undirectedSize",()=>this._undirectedSize),Ws(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Ws(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Ws(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Ws(this,"multi",this._options.multi),Ws(this,"type",this._options.type),Ws(this,"allowSelfLoops",this._options.allowSelfLoops),Ws(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const i=""+e,r=this._edges.get(i);return!!r&&!r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.out.hasOwnProperty(t):!1}throw new tt(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const i=""+e,r=this._edges.get(i);return!!r&&r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.undirected.hasOwnProperty(t):!1}throw new tt(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const i=""+e;return this._edges.has(i)}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?typeof i.out<"u"&&i.out.hasOwnProperty(t)||typeof i.undirected<"u"&&i.undirected.hasOwnProperty(t):!1}throw new tt(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new pt("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const i=this._nodes.get(e);if(!i)throw new $e(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new $e(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=i.out&&i.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new pt("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const i=this._nodes.get(e);if(!i)throw new $e(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new $e(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=i.undirected&&i.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new pt("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new $e(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new $e(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=i.out&&i.out[t]||i.undirected&&i.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new $e(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in||t in i.out}areOutNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new $e(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.out}areInNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new $e(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new $e(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in i.undirected}areNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new $e(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in i.in||t in i.out)||this.type!=="directed"&&t in i.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new $e(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.in||this.type!=="directed"&&t in i.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new $e(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.out||this.type!=="directed"&&t in i.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree),i}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.outDegree),i}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.degree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree),i}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return this.type!=="directed"&&(i+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree,r+=t.directedLoops),i-r}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return this.type!=="directed"&&(i+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.outDegree,r+=t.directedLoops),i-r}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return this.type!=="directed"&&(i+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree,r+=t.directedLoops*2),i-r}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new $e(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new $e(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new $e(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const i=this._edges.get(t);if(!i)throw new $e(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=i.source.key,s=i.target.key;if(e===r)return s;if(e===s)return r;throw new $e(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${s}).`)}hasExtremity(e,t){e=""+e,t=""+t;const i=this._edges.get(e);if(!i)throw new $e(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return i.source.key===t||i.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new $e(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new $e(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new $e(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return $Z(this,e,t).key}mergeNode(e,t){if(t&&!Ui(t))throw new tt(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let i=this._nodes.get(e);return i?(t&&(mi(i.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:i.attributes,data:t})),[e,!1]):(i=new this.NodeDataClass(e,t),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new tt(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let i=this._nodes.get(e);if(i){if(t){const s=i.attributes;i.attributes=t(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:i.attributes})}return[e,!1]}const r=t?t({}):{};return i=new this.NodeDataClass(e,r),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new $e(`Graph.dropNode: could not find the "${e}" node in the graph.`);let i;if(this.type!=="undirected"){for(const r in t.out){i=t.out[r];do qc(this,i),i=i.next;while(i)}for(const r in t.in){i=t.in[r];do qc(this,i),i=i.next;while(i)}}if(this.type!=="directed")for(const r in t.undirected){i=t.undirected[r];do qc(this,i),i=i.next;while(i)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const i=""+arguments[0],r=""+arguments[1];if(t=Ls(this,i,r,this.type),!t)throw new $e(`Graph.dropEdge: could not find the "${i}" -> "${r}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new $e(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return qc(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new pt("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new pt("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const i=Ls(this,e,t,"directed");if(!i)throw new $e(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return qc(this,i),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new pt("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new pt("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const i=Ls(this,e,t,"undirected");if(!i)throw new $e(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return qc(this,i),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new tt("Graph.updateAttribute: updater should be a function.");const i=this._attributes[e];return this._attributes[e]=t(i),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!Ui(e))throw new tt("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!Ui(e))throw new tt("Graph.mergeAttributes: provided attributes are not a plain object.");return mi(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new tt("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new tt("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!JP(t))throw new tt("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._nodes.values();let r,s;for(;r=i.next(),r.done!==!0;)s=r.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new tt("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!JP(t))throw new tt("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._edges.values();let r,s,o,a;for(;r=i.next(),r.done!==!0;)s=r.value,o=s.source,a=s.target,s.attributes=e(s.key,s.attributes,o.key,a.key,o.attributes,a.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new tt("Graph.forEachAdjacencyEntry: expecting a callback.");k0(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new tt("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");k0(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new tt("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");k0(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new tt("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");k0(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):SN(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new tt("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)r=i.value,e(r.key,r.attributes)}findNode(e){if(typeof e!="function")throw new tt("Graph.findNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)if(r=i.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!="function")throw new tt("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let i,r;const s=new Array(this.order);let o=0;for(;i=t.next(),i.done!==!0;)r=i.value,s[o++]=e(r.key,r.attributes);return s}someNode(e){if(typeof e!="function")throw new tt("Graph.someNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)if(r=i.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new tt("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)if(r=i.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new tt("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let i,r;const s=[];for(;i=t.next(),i.done!==!0;)r=i.value,e(r.key,r.attributes)&&s.push(r.key);return s}reduceNodes(e,t){if(typeof e!="function")throw new tt("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new tt("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let i=t;const r=this._nodes.values();let s,o;for(;s=r.next(),s.done!==!0;)o=s.value,i=e(i,o.key,o.attributes);return i}nodeEntries(){const e=this._nodes.values();return new Us(()=>{const t=e.next();if(t.done)return t;const i=t.value;return{value:{node:i.key,attributes:i.attributes},done:!1}})}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,s)=>{e[t++]=zZ(s,r)});const i=new Array(this._edges.size);return t=0,this._edges.forEach((r,s)=>{i[t++]=BZ(this.type,s,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}}import(e,t=!1){if(e instanceof dn)return e.forEachNode((l,u)=>{t?this.mergeNode(l,u):this.addNode(l,u)}),e.forEachEdge((l,u,c,f,h,m,v)=>{t?v?this.mergeUndirectedEdgeWithKey(l,c,f,u):this.mergeDirectedEdgeWithKey(l,c,f,u):v?this.addUndirectedEdgeWithKey(l,c,f,u):this.addDirectedEdgeWithKey(l,c,f,u)}),this;if(!Ui(e))throw new tt("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!Ui(e.attributes))throw new tt("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let i,r,s,o,a;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new tt("Graph.import: invalid nodes. Expecting an array.");for(i=0,r=s.length;i{const s=mi({},i.attributes);i=new t.NodeDataClass(r,s),t._nodes.set(r,i)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new pt(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new pt("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new pt("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),i=this._edges.values();let r,s;for(;r=i.next(),r.done!==!0;)s=r.value,LN(t,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,mi({},s.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,o)=>{e[o]=s.attributes});const t={},i={};this._edges.forEach((s,o)=>{const a=s.undirected?"--":"->";let l="",u=s.source.key,c=s.target.key,f;s.undirected&&u>c&&(f=u,u=c,c=f);const h=`(${u})${a}(${c})`;o.startsWith("geid_")?this.multi&&(typeof i[h]>"u"?i[h]=0:i[h]++,l+=`${i[h]}. `):l+=`[${o}]: `,l+=h,t[l]=s.attributes});const r={};for(const s in this)this.hasOwnProperty(s)&&!eL.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(r[s]=this[s]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,vs(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(dn.prototype[Symbol.for("nodejs.util.inspect.custom")]=dn.prototype.inspect);jZ.forEach(n=>{["add","merge","update"].forEach(e=>{const t=n.name(e),i=e==="add"?LN:YZ;n.generateKey?dn.prototype[t]=function(r,s,o){return i(this,t,!0,(n.type||this.type)==="undirected",null,r,s,o,e==="update")}:dn.prototype[t]=function(r,s,o,a){return i(this,t,!1,(n.type||this.type)==="undirected",r,s,o,a,e==="update")}})});iZ(dn);pZ(dn);PZ(dn);FZ(dn);class IN extends dn{constructor(e){const t=mi({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new tt("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new tt('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class DN extends dn{constructor(e){const t=mi({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new tt("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new tt('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class UN extends dn{constructor(e){const t=mi({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new tt("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class ON extends dn{constructor(e){const t=mi({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new tt("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new tt('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class kN extends dn{constructor(e){const t=mi({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new tt("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new tt('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function ph(n){n.from=function(e,t){const i=mi({},e.options,t),r=new n(i);return r.import(e),r}}ph(dn);ph(IN);ph(DN);ph(UN);ph(ON);ph(kN);dn.Graph=dn;dn.DirectedGraph=IN;dn.UndirectedGraph=DN;dn.MultiGraph=UN;dn.MultiDirectedGraph=ON;dn.MultiUndirectedGraph=kN;dn.InvalidArgumentsGraphError=tt;dn.NotFoundGraphError=$e;dn.UsageGraphError=pt;const Am=new $,s2=new $,qZ=new $;function KZ(n,e,t){const i=Am.setFromMatrixPosition(n.matrixWorld);i.project(e);const r=t.width/2,s=t.height/2;return[i.x*r+r,-(i.y*s)+s]}function ZZ(n,e){const t=Am.setFromMatrixPosition(n.matrixWorld),i=s2.setFromMatrixPosition(e.matrixWorld),r=t.sub(i),s=e.getWorldDirection(qZ);return r.angleTo(s)>Math.PI/2}function QZ(n,e,t,i){const r=Am.setFromMatrixPosition(n.matrixWorld),s=r.clone();s.project(e),t.setFromCamera(s,e);const o=t.intersectObjects(i,!0);if(o.length){const a=o[0].distance;return r.distanceTo(t.ray.origin)Math.abs(n)<1e-10?0:n;function NN(n,e,t=""){let i="matrix3d(";for(let r=0;r!==16;r++)i+=EE(e[r]*n.elements[r])+(r!==15?",":")");return t+i}const tQ=(n=>e=>NN(e,n))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),nQ=(n=>(e,t)=>NN(e,n(t),"translate(-50%,-50%)"))(n=>[1/n,1/n,1/n,1,-1/n,-1/n,-1/n,-1,1/n,1/n,1/n,1,1,1,1,1]);function iQ(n){return n&&typeof n=="object"&&"current"in n}const o2=Y.forwardRef(({children:n,eps:e=.001,style:t,className:i,prepend:r,center:s,fullscreen:o,portal:a,distanceFactor:l,sprite:u=!1,transform:c=!1,occlude:f,onOcclude:h,castShadow:m,receiveShadow:v,material:x,geometry:_,zIndexRange:g=[16777271,0],calculatePosition:y=KZ,as:w="div",wrapperClass:E,pointerEvents:M="auto",...b},C)=>{const{gl:P,camera:A,scene:L,size:N,raycaster:F,events:B,viewport:j}=ui(),[q]=Y.useState(()=>document.createElement(w)),V=Y.useRef(),W=Y.useRef(null),I=Y.useRef(0),O=Y.useRef([0,0]),k=Y.useRef(null),U=Y.useRef(null),z=(a==null?void 0:a.current)||B.connected||P.domElement.parentNode,Q=Y.useRef(null),J=Y.useRef(!1),te=Y.useMemo(()=>f&&f!=="blending"||Array.isArray(f)&&f.length&&iQ(f[0]),[f]);Y.useLayoutEffect(()=>{const Ue=P.domElement;f&&f==="blending"?(Ue.style.zIndex=`${Math.floor(g[0]/2)}`,Ue.style.position="absolute",Ue.style.pointerEvents="none"):(Ue.style.zIndex=null,Ue.style.position=null,Ue.style.pointerEvents=null)},[f]),Y.useLayoutEffect(()=>{if(W.current){const Ue=V.current=CD(q);if(L.updateMatrixWorld(),c)q.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const he=y(W.current,A,N);q.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${he[0]}px,${he[1]}px,0);transform-origin:0 0;`}return z&&(r?z.prepend(q):z.appendChild(q)),()=>{z&&z.removeChild(q),Ue.unmount()}}},[z,c]),Y.useLayoutEffect(()=>{E&&(q.className=E)},[E]);const se=Y.useMemo(()=>c?{position:"absolute",top:0,left:0,width:N.width,height:N.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-N.height/2,left:-N.width/2,width:N.width,height:N.height},...t},[t,s,o,N,c]),ne=Y.useMemo(()=>({position:"absolute",pointerEvents:M}),[M]);Y.useLayoutEffect(()=>{if(J.current=!1,c){var Ue;(Ue=V.current)==null||Ue.render(Y.createElement("div",{ref:k,style:se},Y.createElement("div",{ref:U,style:ne},Y.createElement("div",{ref:C,className:i,style:t,children:n}))))}else{var he;(he=V.current)==null||he.render(Y.createElement("div",{ref:C,style:se,className:i,children:n}))}});const fe=Y.useRef(!0);g_(Ue=>{if(W.current){A.updateMatrixWorld(),W.current.updateWorldMatrix(!0,!1);const he=c?O.current:y(W.current,A,N);if(c||Math.abs(I.current-A.zoom)>e||Math.abs(O.current[0]-he[0])>e||Math.abs(O.current[1]-he[1])>e){const H=ZZ(W.current,A);let ae=!1;te&&(Array.isArray(f)?ae=f.map(De=>De.current):f!=="blending"&&(ae=[L]));const le=fe.current;if(ae){const De=QZ(W.current,A,F,ae);fe.current=De&&!H}else fe.current=!H;le!==fe.current&&(h?h(!fe.current):q.style.display=fe.current?"block":"none");const me=Math.floor(g[0]/2),ce=f?te?[g[0],me]:[me-1,0]:g;if(q.style.zIndex=`${eQ(W.current,A,ce)}`,c){const[De,pe]=[N.width/2,N.height/2],Ce=A.projectionMatrix.elements[5]*pe,{isOrthographicCamera:ge,top:de,left:je,bottom:X,right:G}=A,ie=tQ(A.matrixWorldInverse),Re=ge?`scale(${Ce})translate(${EE(-(G+je)/2)}px,${EE((de+X)/2)}px)`:`translateZ(${Ce}px)`;let Se=W.current.matrixWorld;u&&(Se=A.matrixWorldInverse.clone().transpose().copyPosition(Se).scale(W.current.scale),Se.elements[3]=Se.elements[7]=Se.elements[11]=0,Se.elements[15]=1),q.style.width=N.width+"px",q.style.height=N.height+"px",q.style.perspective=ge?"":`${Ce}px`,k.current&&U.current&&(k.current.style.transform=`${Re}${ie}translate(${De}px,${pe}px)`,U.current.style.transform=nQ(Se,1/((l||10)/400)))}else{const De=l===void 0?1:JZ(W.current,A)*l;q.style.transform=`translate3d(${he[0]}px,${he[1]}px,0) scale(${De})`}O.current=he,I.current=A.zoom}}if(!te&&Q.current&&!J.current)if(c){if(k.current){const he=k.current.children[0];if(he!=null&&he.clientWidth&&he!=null&&he.clientHeight){const{isOrthographicCamera:H}=A;if(H||_)b.scale&&(Array.isArray(b.scale)?b.scale instanceof $?Q.current.scale.copy(b.scale.clone().divideScalar(1)):Q.current.scale.set(1/b.scale[0],1/b.scale[1],1/b.scale[2]):Q.current.scale.setScalar(1/b.scale));else{const ae=(l||10)/400,le=he.clientWidth*ae,me=he.clientHeight*ae;Q.current.scale.set(le,me,1)}J.current=!0}}}else{const he=q.children[0];if(he!=null&&he.clientWidth&&he!=null&&he.clientHeight){const H=1/j.factor,ae=he.clientWidth*H,le=he.clientHeight*H;Q.current.scale.set(ae,le,1),J.current=!0}Q.current.lookAt(Ue.camera.position)}});const Ie=Y.useMemo(()=>({vertexShader:c?void 0:` - /* - This shader is from the THREE's SpriteMaterial. - We need to turn the backing plane into a Sprite - (make it always face the camera) if "transfrom" - is false. - */ - #include - - void main() { - vec2 center = vec2(0., 1.); - float rotation = 0.0; - - // This is somewhat arbitrary, but it seems to work well - // Need to figure out how to derive this dynamically if it even matters - float size = 0.03; - - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; - 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; - } - `,fragmentShader:` - void main() { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); - } - `}),[c]);return Y.createElement("group",qu({},b,{ref:W}),f&&!te&&Y.createElement("mesh",{castShadow:m,receiveShadow:v,ref:Q},_||Y.createElement("planeGeometry",null),x||Y.createElement("shaderMaterial",{side:On,vertexShader:Ie.vertexShader,fragmentShader:Ie.fragmentShader})))});function np(n,e="pointer",t="auto",i=document.body){Y.useEffect(()=>{if(n)return i.style.cursor=e,()=>void(i.style.cursor=t)},[n])}let a2=Rm();const St=n=>Cm(n,a2);let l2=Rm();St.write=n=>Cm(n,l2);let C_=Rm();St.onStart=n=>Cm(n,C_);let u2=Rm();St.onFrame=n=>Cm(n,u2);let c2=Rm();St.onFinish=n=>Cm(n,c2);let kf=[];St.setTimeout=(n,e)=>{let t=St.now()+e,i=()=>{let s=kf.findIndex(o=>o.cancel==i);~s&&kf.splice(s,1),ll-=~s?1:0},r={time:t,handler:n,cancel:i};return kf.splice(FN(t),0,r),ll+=1,zN(),r};let FN=n=>~(~kf.findIndex(e=>e.time>n)||~kf.length);St.cancel=n=>{C_.delete(n),u2.delete(n),c2.delete(n),a2.delete(n),l2.delete(n)};St.sync=n=>{ME=!0,St.batchedUpdates(n),ME=!1};St.throttle=n=>{let e;function t(){try{n(...e)}finally{e=null}}function i(...r){e=r,St.onStart(t)}return i.handler=n,i.cancel=()=>{C_.delete(t),e=null},i};let f2=typeof window<"u"?window.requestAnimationFrame:()=>{};St.use=n=>f2=n;St.now=typeof performance<"u"?()=>performance.now():Date.now;St.batchedUpdates=n=>n();St.catch=console.error;St.frameLoop="always";St.advance=()=>{St.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):GN()};let al=-1,ll=0,ME=!1;function Cm(n,e){ME?(e.delete(n),n(0)):(e.add(n),zN())}function zN(){al<0&&(al=0,St.frameLoop!=="demand"&&f2(BN))}function rQ(){al=-1}function BN(){~al&&(f2(BN),St.batchedUpdates(GN))}function GN(){let n=al;al=St.now();let e=FN(al);if(e&&(VN(kf.splice(0,e),t=>t.handler()),ll-=e),!ll){rQ();return}C_.flush(),a2.flush(n?Math.min(64,al-n):16.667),u2.flush(),l2.flush(),c2.flush()}function Rm(){let n=new Set,e=n;return{add(t){ll+=e==n&&!n.has(t)?1:0,n.add(t)},delete(t){return ll-=e==n&&n.has(t)?1:0,n.delete(t)},flush(t){e.size&&(n=new Set,ll-=e.size,VN(e,i=>i(t)&&n.add(i)),ll+=n.size,e=n)}}}function VN(n,e){n.forEach(t=>{try{e(t)}catch(i){St.catch(i)}})}function TE(){}const sQ=(n,e,t)=>Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0}),Ke={arr:Array.isArray,obj:n=>!!n&&n.constructor.name==="Object",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",und:n=>n===void 0};function ca(n,e){if(Ke.arr(n)){if(!Ke.arr(e)||n.length!==e.length)return!1;for(let t=0;tn.forEach(e);function ba(n,e,t){if(Ke.arr(n)){for(let i=0;iKe.und(n)?[]:Ke.arr(n)?n:[n];function ip(n,e){if(n.size){const t=Array.from(n);n.clear(),on(t,e)}}const Bd=(n,...e)=>ip(n,t=>t(...e)),h2=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);let d2,HN,wl=null,WN=!1,p2=TE;const oQ=n=>{n.to&&(HN=n.to),n.now&&(St.now=n.now),n.colors!==void 0&&(wl=n.colors),n.skipAnimation!=null&&(WN=n.skipAnimation),n.createStringInterpolator&&(d2=n.createStringInterpolator),n.requestAnimationFrame&&St.use(n.requestAnimationFrame),n.batchedUpdates&&(St.batchedUpdates=n.batchedUpdates),n.willAdvance&&(p2=n.willAdvance),n.frameLoop&&(St.frameLoop=n.frameLoop)};var zo=Object.freeze({__proto__:null,get createStringInterpolator(){return d2},get to(){return HN},get colors(){return wl},get skipAnimation(){return WN},get willAdvance(){return p2},assign:oQ});const rp=new Set;let As=[],cw=[],my=0;const R_={get idle(){return!rp.size&&!As.length},start(n){my>n.priority?(rp.add(n),St.onStart(aQ)):(jN(n),St(bE))},advance:bE,sort(n){if(my)St.onFrame(()=>R_.sort(n));else{const e=As.indexOf(n);~e&&(As.splice(e,1),XN(n))}},clear(){As=[],rp.clear()}};function aQ(){rp.forEach(jN),rp.clear(),St(bE)}function jN(n){As.includes(n)||XN(n)}function XN(n){As.splice(lQ(As,e=>e.priority>n.priority),0,n)}function bE(n){const e=cw;for(let t=0;t0}function lQ(n,e){const t=n.findIndex(e);return t<0?n.length:t}const uQ=(n,e,t)=>Math.min(Math.max(t,n),e),cQ={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},eo="[-+]?\\d*\\.?\\d+",gy=eo+"%";function P_(...n){return"\\(\\s*("+n.join(")\\s*,\\s*(")+")\\s*\\)"}const fQ=new RegExp("rgb"+P_(eo,eo,eo)),hQ=new RegExp("rgba"+P_(eo,eo,eo,eo)),dQ=new RegExp("hsl"+P_(eo,gy,gy)),pQ=new RegExp("hsla"+P_(eo,gy,gy,eo)),mQ=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,gQ=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,vQ=/^#([0-9a-fA-F]{6})$/,yQ=/^#([0-9a-fA-F]{8})$/;function _Q(n){let e;return typeof n=="number"?n>>>0===n&&n>=0&&n<=4294967295?n:null:(e=vQ.exec(n))?parseInt(e[1]+"ff",16)>>>0:wl&&wl[n]!==void 0?wl[n]:(e=fQ.exec(n))?(Kc(e[1])<<24|Kc(e[2])<<16|Kc(e[3])<<8|255)>>>0:(e=hQ.exec(n))?(Kc(e[1])<<24|Kc(e[2])<<16|Kc(e[3])<<8|rL(e[4]))>>>0:(e=mQ.exec(n))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=yQ.exec(n))?parseInt(e[1],16)>>>0:(e=gQ.exec(n))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=dQ.exec(n))?(nL(iL(e[1]),N0(e[2]),N0(e[3]))|255)>>>0:(e=pQ.exec(n))?(nL(iL(e[1]),N0(e[2]),N0(e[3]))|rL(e[4]))>>>0:null}function fw(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function nL(n,e,t){const i=t<.5?t*(1+e):t+e-t*e,r=2*t-i,s=fw(r,i,n+1/3),o=fw(r,i,n),a=fw(r,i,n-1/3);return Math.round(s*255)<<24|Math.round(o*255)<<16|Math.round(a*255)<<8}function Kc(n){const e=parseInt(n,10);return e<0?0:e>255?255:e}function iL(n){return(parseFloat(n)%360+360)%360/360}function rL(n){const e=parseFloat(n);return e<0?0:e>1?255:Math.round(e*255)}function N0(n){const e=parseFloat(n);return e<0?0:e>100?1:e/100}function sL(n){let e=_Q(n);if(e===null)return n;e=e||0;let t=(e&4278190080)>>>24,i=(e&16711680)>>>16,r=(e&65280)>>>8,s=(e&255)/255;return`rgba(${t}, ${i}, ${r}, ${s})`}const Zp=(n,e,t)=>{if(Ke.fun(n))return n;if(Ke.arr(n))return Zp({range:n,output:e,extrapolate:t});if(Ke.str(n.output[0]))return d2(n);const i=n,r=i.output,s=i.range||[0,1],o=i.extrapolateLeft||i.extrapolate||"extend",a=i.extrapolateRight||i.extrapolate||"extend",l=i.easing||(u=>u);return u=>{const c=wQ(u,s);return xQ(u,s[c],s[c+1],r[c],r[c+1],l,o,a,i.map)}};function xQ(n,e,t,i,r,s,o,a,l){let u=l?l(n):n;if(ut){if(a==="identity")return u;a==="clamp"&&(u=t)}return i===r?i:e===t?n<=e?i:r:(e===-1/0?u=-u:t===1/0?u=u-e:u=(u-e)/(t-e),u=s(u),i===-1/0?u=-u:r===1/0?u=u+i:u=u*(r-i)+i,u)}function wQ(n,e){for(var t=1;t=n);++t);return t-1}const SQ=(n,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const i=t*n,r=e==="end"?Math.floor(i):Math.ceil(i);return uQ(0,1,r/n)},vy=1.70158,F0=vy*1.525,oL=vy+1,aL=2*Math.PI/3,lL=2*Math.PI/4.5,z0=n=>n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375,EQ={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>1-(1-n)*(1-n),easeInOutQuad:n=>n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2,easeInCubic:n=>n*n*n,easeOutCubic:n=>1-Math.pow(1-n,3),easeInOutCubic:n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,easeInQuart:n=>n*n*n*n,easeOutQuart:n=>1-Math.pow(1-n,4),easeInOutQuart:n=>n<.5?8*n*n*n*n:1-Math.pow(-2*n+2,4)/2,easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>1-Math.pow(1-n,5),easeInOutQuint:n=>n<.5?16*n*n*n*n*n:1-Math.pow(-2*n+2,5)/2,easeInSine:n=>1-Math.cos(n*Math.PI/2),easeOutSine:n=>Math.sin(n*Math.PI/2),easeInOutSine:n=>-(Math.cos(Math.PI*n)-1)/2,easeInExpo:n=>n===0?0:Math.pow(2,10*n-10),easeOutExpo:n=>n===1?1:1-Math.pow(2,-10*n),easeInOutExpo:n=>n===0?0:n===1?1:n<.5?Math.pow(2,20*n-10)/2:(2-Math.pow(2,-20*n+10))/2,easeInCirc:n=>1-Math.sqrt(1-Math.pow(n,2)),easeOutCirc:n=>Math.sqrt(1-Math.pow(n-1,2)),easeInOutCirc:n=>n<.5?(1-Math.sqrt(1-Math.pow(2*n,2)))/2:(Math.sqrt(1-Math.pow(-2*n+2,2))+1)/2,easeInBack:n=>oL*n*n*n-vy*n*n,easeOutBack:n=>1+oL*Math.pow(n-1,3)+vy*Math.pow(n-1,2),easeInOutBack:n=>n<.5?Math.pow(2*n,2)*((F0+1)*2*n-F0)/2:(Math.pow(2*n-2,2)*((F0+1)*(n*2-2)+F0)+2)/2,easeInElastic:n=>n===0?0:n===1?1:-Math.pow(2,10*n-10)*Math.sin((n*10-10.75)*aL),easeOutElastic:n=>n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n*10-.75)*aL)+1,easeInOutElastic:n=>n===0?0:n===1?1:n<.5?-(Math.pow(2,20*n-10)*Math.sin((20*n-11.125)*lL))/2:Math.pow(2,-20*n+10)*Math.sin((20*n-11.125)*lL)/2+1,easeInBounce:n=>1-z0(1-n),easeOutBounce:z0,easeInOutBounce:n=>n<.5?(1-z0(1-2*n))/2:(1+z0(2*n-1))/2,steps:SQ};function AE(){return AE=Object.assign?Object.assign.bind():function(n){for(var e=1;e!!(n&&n[eh]),ws=n=>n&&n[eh]?n[eh]():n,uL=n=>n[Qu]||null;function MQ(n,e){n.eventObserved?n.eventObserved(e):n(e)}function yy(n,e){let t=n[Qu];t&&t.forEach(i=>{MQ(i,e)})}class TQ{constructor(e){if(this[eh]=void 0,this[Qu]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");bQ(this,e)}}const bQ=(n,e)=>$N(n,eh,e);function Pm(n,e){if(n[eh]){let t=n[Qu];t||$N(n,Qu,t=new Set),t.has(e)||(t.add(e),n.observerAdded&&n.observerAdded(t.size,e))}return e}function _y(n,e){let t=n[Qu];if(t&&t.has(e)){const i=t.size-1;i?t.delete(e):n[Qu]=null,n.observerRemoved&&n.observerRemoved(i,e)}}const $N=(n,e,t)=>Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0}),xv=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,AQ=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,cL=new RegExp(`(${xv.source})(%|[a-z]+)`,"i"),CQ=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,L_=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,YN=n=>{const[e,t]=RQ(n);if(!e||h2())return n;const i=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(i)return i.trim();if(t&&t.startsWith("--")){const r=window.getComputedStyle(document.documentElement).getPropertyValue(t);return r||n}else{if(t&&L_.test(t))return YN(t);if(t)return t}return n},RQ=n=>{const e=L_.exec(n);if(!e)return[,];const[,t,i]=e;return[t,i]};let hw;const PQ=(n,e,t,i,r)=>`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(i)}, ${r})`,qN=n=>{hw||(hw=wl?new RegExp(`(${Object.keys(wl).join("|")})(?!\\w)`,"g"):/^\b$/);const e=n.output.map(s=>ws(s).replace(L_,YN).replace(AQ,sL).replace(hw,sL)),t=e.map(s=>s.match(xv).map(Number)),r=t[0].map((s,o)=>t.map(a=>{if(!(o in a))throw Error('The arity of each "output" value must be equal');return a[o]})).map(s=>Zp(AE({},n,{output:s})));return s=>{var o;const a=!cL.test(e[0])&&((o=e.find(u=>cL.test(u)))==null?void 0:o.replace(xv,""));let l=0;return e[0].replace(xv,()=>`${r[l++](s)}${a||""}`).replace(CQ,PQ)}},m2="react-spring: ",KN=n=>{const e=n;let t=!1;if(typeof e!="function")throw new TypeError(`${m2}once requires a function parameter`);return(...i)=>{t||(e(...i),t=!0)}},LQ=KN(console.warn);function IQ(){LQ(`${m2}The "interpolate" function is deprecated in v9 (use "to" instead)`)}const DQ=KN(console.warn);function UQ(){DQ(`${m2}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function I_(n){return Ke.str(n)&&(n[0]=="#"||/\d/.test(n)||!h2()&&L_.test(n)||n in(wl||{}))}const g2=h2()?Y.useEffect:Y.useLayoutEffect,OQ=()=>{const n=Y.useRef(!1);return g2(()=>(n.current=!0,()=>{n.current=!1}),[]),n};function ZN(){const n=Y.useState()[1],e=OQ();return()=>{e.current&&n(Math.random())}}function kQ(n,e){const[t]=Y.useState(()=>({inputs:e,result:n()})),i=Y.useRef(),r=i.current;let s=r;return s?e&&s.inputs&&NQ(e,s.inputs)||(s={inputs:e,result:n()}):s=t,Y.useEffect(()=>{i.current=s,r==t&&(t.inputs=t.result=void 0)},[s]),s.result}function NQ(n,e){if(n.length!==e.length)return!1;for(let t=0;tY.useEffect(n,FQ),FQ=[];function fL(n){const e=Y.useRef();return Y.useEffect(()=>{e.current=n}),e.current}const Qp=Symbol.for("Animated:node"),zQ=n=>!!n&&n[Qp]===n,To=n=>n&&n[Qp],v2=(n,e)=>sQ(n,Qp,e),D_=n=>n&&n[Qp]&&n[Qp].getPayload();class JN{constructor(){this.payload=void 0,v2(this,this)}getPayload(){return this.payload||[]}}class mh extends JN{constructor(e){super(),this.done=!0,this.elapsedTime=void 0,this.lastPosition=void 0,this.lastVelocity=void 0,this.v0=void 0,this.durationProgress=0,this._value=e,Ke.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new mh(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Ke.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,Ke.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class th extends mh{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=Zp({output:[e,e]})}static create(e){return new th(e)}getValue(){let e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(Ke.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=Zp({output:[this.getValue(),e]})),this._value=0,super.reset()}}const xy={dependencies:null};class y2 extends JN{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return ba(this.source,(i,r)=>{zQ(i)?t[r]=i.getValue(e):bo(i)?t[r]=ws(i):e||(t[r]=i)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&on(this.payload,e=>e.reset())}_makePayload(e){if(e){const t=new Set;return ba(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){xy.dependencies&&bo(e)&&xy.dependencies.add(e);const t=D_(e);t&&on(t,i=>this.add(i))}}class _2 extends y2{constructor(e){super(e)}static create(e){return new _2(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((i,r)=>i.setValue(e[r])).some(Boolean):(super.setValue(e.map(BQ)),!0)}}function BQ(n){return(I_(n)?th:mh).create(n)}function CE(n){const e=To(n);return e?e.constructor:Ke.arr(n)?_2:I_(n)?th:mh}function wy(){return wy=Object.assign?Object.assign.bind():function(n){for(var e=1;e{const t=!Ke.fun(n)||n.prototype&&n.prototype.isReactComponent;return Y.forwardRef((i,r)=>{const s=Y.useRef(null),o=t&&Y.useCallback(v=>{s.current=HQ(r,v)},[r]),[a,l]=VQ(i,e),u=ZN(),c=()=>{const v=s.current;if(t&&!v)return;(v?e.applyAnimatedValues(v,a.getValue(!0)):!1)===!1&&u()},f=new GQ(c,l),h=Y.useRef();g2(()=>(h.current=f,on(l,v=>Pm(v,f)),()=>{h.current&&(on(h.current.deps,v=>_y(v,h.current)),St.cancel(h.current.update))})),Y.useEffect(c,[]),QN(()=>()=>{const v=h.current;on(v.deps,x=>_y(x,v))});const m=e.getComponentProps(a.getValue());return Y.createElement(n,wy({},m,{ref:o}))})};class GQ{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type=="change"&&St.write(this.update)}}function VQ(n,e){const t=new Set;return xy.dependencies=t,n.style&&(n=wy({},n,{style:e.createAnimatedStyle(n.style)})),n=new y2(n),xy.dependencies=null,[n,t]}function HQ(n,e){return n&&(Ke.fun(n)?n(e):n.current=e),e}const dL=Symbol.for("AnimatedComponent"),WQ=(n,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:t=r=>new y2(r),getComponentProps:i=r=>r}={})=>{const r={applyAnimatedValues:e,createAnimatedStyle:t,getComponentProps:i},s=o=>{const a=pL(o)||"Anonymous";return Ke.str(o)?o=s[o]||(s[o]=hL(o,r)):o=o[dL]||(o[dL]=hL(o,r)),o.displayName=`Animated(${a})`,o};return ba(n,(o,a)=>{Ke.arr(n)&&(a=pL(o)),s[a]=s(o)}),{animated:s}},pL=n=>Ke.str(n)?n:n&&Ke.str(n.displayName)?n.displayName:Ke.fun(n)&&n.name||null;function Ci(){return Ci=Object.assign?Object.assign.bind():function(n){for(var e=1;en===!0||!!(e&&n&&(Ke.fun(n)?n(e):Rs(n).includes(e))),eF=(n,e)=>Ke.obj(n)?e&&n[e]:n,tF=(n,e)=>n.default===!0?n[e]:n.default?n.default[e]:void 0,jQ=n=>n,x2=(n,e=jQ)=>{let t=XQ;n.default&&n.default!==!0&&(n=n.default,t=Object.keys(n));const i={};for(const r of t){const s=e(n[r],r);Ke.und(s)||(i[r]=s)}return i},XQ=["config","onProps","onStart","onChange","onPause","onResume","onRest"],$Q={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function YQ(n){const e={};let t=0;if(ba(n,(i,r)=>{$Q[r]||(e[r]=i,t++)}),t)return e}function nF(n){const e=YQ(n);if(e){const t={to:e};return ba(n,(i,r)=>r in e||(t[r]=i)),t}return Ci({},n)}function Jp(n){return n=ws(n),Ke.arr(n)?n.map(Jp):I_(n)?zo.createStringInterpolator({range:[0,1],output:[n,n]})(1):n}function qQ(n){for(const e in n)return!0;return!1}function RE(n){return Ke.fun(n)||Ke.arr(n)&&Ke.obj(n[0])}function KQ(n,e){var t;(t=n.ref)==null||t.delete(n),e==null||e.delete(n)}function ZQ(n,e){if(e&&n.ref!==e){var t;(t=n.ref)==null||t.delete(n),e.add(n),n.ref=e}}const QQ={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},PE=Ci({},QQ.default,{mass:1,damping:1,easing:EQ.linear,clamp:!1});class JQ{constructor(){this.tension=void 0,this.friction=void 0,this.frequency=void 0,this.damping=void 0,this.mass=void 0,this.velocity=0,this.restVelocity=void 0,this.precision=void 0,this.progress=void 0,this.duration=void 0,this.easing=void 0,this.clamp=void 0,this.bounce=void 0,this.decay=void 0,this.round=void 0,Object.assign(this,PE)}}function eJ(n,e,t){t&&(t=Ci({},t),mL(t,e),e=Ci({},t,e)),mL(n,e),Object.assign(n,e);for(const o in PE)n[o]==null&&(n[o]=PE[o]);let{mass:i,frequency:r,damping:s}=n;return Ke.und(r)||(r<.01&&(r=.01),s<0&&(s=0),n.tension=Math.pow(2*Math.PI/r,2)*i,n.friction=4*Math.PI*s*i/r),n}function mL(n,e){if(!Ke.und(e.decay))n.duration=void 0;else{const t=!Ke.und(e.tension)||!Ke.und(e.friction);(t||!Ke.und(e.frequency)||!Ke.und(e.damping)||!Ke.und(e.mass))&&(n.duration=void 0,n.decay=void 0),t&&(n.frequency=void 0)}}const gL=[];class tJ{constructor(){this.changed=!1,this.values=gL,this.toValues=null,this.fromValues=gL,this.to=void 0,this.from=void 0,this.config=new JQ,this.immediate=!1}}function iF(n,{key:e,props:t,defaultProps:i,state:r,actions:s}){return new Promise((o,a)=>{var l;let u,c,f=sp((l=t.cancel)!=null?l:i==null?void 0:i.cancel,e);if(f)v();else{Ke.und(t.pause)||(r.paused=sp(t.pause,e));let x=i==null?void 0:i.pause;x!==!0&&(x=r.paused||sp(x,e)),u=xu(t.delay||0,e),x?(r.resumeQueue.add(m),s.pause()):(s.resume(),m())}function h(){r.resumeQueue.add(m),r.timeouts.delete(c),c.cancel(),u=c.time-St.now()}function m(){u>0&&!zo.skipAnimation?(r.delayed=!0,c=St.setTimeout(v,u),r.pauseQueue.add(h),r.timeouts.add(c)):v()}function v(){r.delayed&&(r.delayed=!1),r.pauseQueue.delete(h),r.timeouts.delete(c),n<=(r.cancelId||0)&&(f=!0);try{s.start(Ci({},t,{callId:n,cancel:f}),o)}catch(x){a(x)}}})}const w2=(n,e)=>e.length==1?e[0]:e.some(t=>t.cancelled)?Nf(n.get()):e.every(t=>t.noop)?rF(n.get()):Qs(n.get(),e.every(t=>t.finished)),rF=n=>({value:n,noop:!0,finished:!0,cancelled:!1}),Qs=(n,e,t=!1)=>({value:n,finished:e,cancelled:t}),Nf=n=>({value:n,cancelled:!0,finished:!1});function sF(n,e,t,i){const{callId:r,parentId:s,onRest:o}=e,{asyncTo:a,promise:l}=t;return!s&&n===a&&!e.reset?l:t.promise=(async()=>{t.asyncId=r,t.asyncTo=n;const u=x2(e,(_,g)=>g==="onRest"?void 0:_);let c,f;const h=new Promise((_,g)=>(c=_,f=g)),m=_=>{const g=r<=(t.cancelId||0)&&Nf(i)||r!==t.asyncId&&Qs(i,!1);if(g)throw _.result=g,f(_),_},v=(_,g)=>{const y=new vL,w=new yL;return(async()=>{if(zo.skipAnimation)throw em(t),w.result=Qs(i,!1),f(w),w;m(y);const E=Ke.obj(_)?Ci({},_):Ci({},g,{to:_});E.parentId=r,ba(u,(b,C)=>{Ke.und(E[C])&&(E[C]=b)});const M=await i.start(E);return m(y),t.paused&&await new Promise(b=>{t.resumeQueue.add(b)}),M})()};let x;if(zo.skipAnimation)return em(t),Qs(i,!1);try{let _;Ke.arr(n)?_=(async g=>{for(const y of g)await v(y)})(n):_=Promise.resolve(n(v,i.stop.bind(i))),await Promise.all([_.then(c),h]),x=Qs(i.get(),!0,!1)}catch(_){if(_ instanceof vL)x=_.result;else if(_ instanceof yL)x=_.result;else throw _}finally{r==t.asyncId&&(t.asyncId=s,t.asyncTo=s?a:void 0,t.promise=s?l:void 0)}return Ke.fun(o)&&St.batchedUpdates(()=>{o(x,i,i.item)}),x})()}function em(n,e){ip(n.timeouts,t=>t.cancel()),n.pauseQueue.clear(),n.resumeQueue.clear(),n.asyncId=n.asyncTo=n.promise=void 0,e&&(n.cancelId=e)}class vL extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."),this.result=void 0}}class yL extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const LE=n=>n instanceof S2;let nJ=1;class S2 extends TQ{constructor(...e){super(...e),this.id=nJ++,this.key=void 0,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=To(this);return e&&e.getValue()}to(...e){return zo.to(this,e)}interpolate(...e){return IQ(),zo.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){yy(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||R_.sort(this),yy(this,{type:"priority",parent:this,priority:e})}}const Ju=Symbol.for("SpringPhase"),oF=1,IE=2,DE=4,dw=n=>(n[Ju]&oF)>0,Za=n=>(n[Ju]&IE)>0,vd=n=>(n[Ju]&DE)>0,_L=(n,e)=>e?n[Ju]|=IE|oF:n[Ju]&=~IE,xL=(n,e)=>e?n[Ju]|=DE:n[Ju]&=~DE;class iJ extends S2{constructor(e,t){if(super(),this.key=void 0,this.animation=new tJ,this.queue=void 0,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Ke.und(e)||!Ke.und(t)){const i=Ke.obj(e)?Ci({},e):Ci({},t,{from:e});Ke.und(i.default)&&(i.default=!0),this.start(i)}}get idle(){return!(Za(this)||this._state.asyncTo)||vd(this)}get goal(){return ws(this.animation.to)}get velocity(){const e=To(this);return e instanceof mh?e.lastVelocity||0:e.getPayload().map(t=>t.lastVelocity||0)}get hasAnimated(){return dw(this)}get isAnimating(){return Za(this)}get isPaused(){return vd(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,i=!1;const r=this.animation;let{config:s,toValues:o}=r;const a=D_(r.to);!a&&bo(r.to)&&(o=Rs(ws(r.to))),r.values.forEach((c,f)=>{if(c.done)return;const h=c.constructor==th?1:a?a[f].lastPosition:o[f];let m=r.immediate,v=h;if(!m){if(v=c.lastPosition,s.tension<=0){c.done=!0;return}let x=c.elapsedTime+=e;const _=r.fromValues[f],g=c.v0!=null?c.v0:c.v0=Ke.arr(s.velocity)?s.velocity[f]:s.velocity;let y;const w=s.precision||(_==h?.005:Math.min(1,Math.abs(h-_)*.001));if(Ke.und(s.duration))if(s.decay){const E=s.decay===!0?.998:s.decay,M=Math.exp(-(1-E)*x);v=_+g/(1-E)*(1-M),m=Math.abs(c.lastPosition-v)<=w,y=g*M}else{y=c.lastVelocity==null?g:c.lastVelocity;const E=s.restVelocity||w/10,M=s.clamp?0:s.bounce,b=!Ke.und(M),C=_==h?c.v0>0:_E,!(!P&&(m=Math.abs(h-v)<=w,m)));++F){b&&(A=v==h||v>h==C,A&&(y=-y*M,v=h));const B=-s.tension*1e-6*(v-h),j=-s.friction*.001*y,q=(B+j)/s.mass;y=y+q*L,v=v+y*L}}else{let E=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,c.durationProgress>0&&(c.elapsedTime=s.duration*c.durationProgress,x=c.elapsedTime+=e)),E=(s.progress||0)+x/this._memoizedDuration,E=E>1?1:E<0?0:E,c.durationProgress=E),v=_+s.easing(E)*(h-_),y=(v-c.lastPosition)/e,m=E==1}c.lastVelocity=y,Number.isNaN(v)&&(console.warn("Got NaN while animating:",this),m=!0)}a&&!a[f].done&&(m=!1),m?c.done=!0:t=!1,c.setValue(v,s.round)&&(i=!0)});const l=To(this),u=l.getValue();if(t){const c=ws(r.to);(u!==c||i)&&!s.decay?(l.setValue(c),this._onChange(c)):i&&s.decay&&this._onChange(u),this._stop()}else i&&this._onChange(u)}set(e){return St.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(Za(this)){const{to:e,config:t}=this.animation;St.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let i;return Ke.und(e)?(i=this.queue||[],this.queue=[]):i=[Ke.obj(e)?e:Ci({},t,{to:e})],Promise.all(i.map(r=>this._update(r))).then(r=>w2(this,r))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),em(this._state,e&&this._lastCallId),St.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:i,from:r}=e;i=Ke.obj(i)?i[t]:i,(i==null||RE(i))&&(i=void 0),r=Ke.obj(r)?r[t]:r,r==null&&(r=void 0);const s={to:i,from:r};return dw(this)||(e.reverse&&([i,r]=[r,i]),r=ws(r),Ke.und(r)?To(this)||this._set(i):this._set(r)),s}_update(e,t){let i=Ci({},e);const{key:r,defaultProps:s}=this;i.default&&Object.assign(s,x2(i,(l,u)=>/^on/.test(u)?eF(l,r):l)),SL(this,i,"onProps"),_d(this,"onProps",i,this);const o=this._prepareNode(i);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const a=this._state;return iF(++this._lastCallId,{key:r,props:i,defaultProps:s,state:a,actions:{pause:()=>{vd(this)||(xL(this,!0),Bd(a.pauseQueue),_d(this,"onPause",Qs(this,yd(this,this.animation.to)),this))},resume:()=>{vd(this)&&(xL(this,!1),Za(this)&&this._resume(),Bd(a.resumeQueue),_d(this,"onResume",Qs(this,yd(this,this.animation.to)),this))},start:this._merge.bind(this,o)}}).then(l=>{if(i.loop&&l.finished&&!(t&&l.noop)){const u=aF(i);if(u)return this._update(u,!0)}return l})}_merge(e,t,i){if(t.cancel)return this.stop(!0),i(Nf(this));const r=!Ke.und(e.to),s=!Ke.und(e.from);if(r||s)if(t.callId>this._lastToId)this._lastToId=t.callId;else return i(Nf(this));const{key:o,defaultProps:a,animation:l}=this,{to:u,from:c}=l;let{to:f=u,from:h=c}=e;s&&!r&&(!t.default||Ke.und(f))&&(f=h),t.reverse&&([f,h]=[h,f]);const m=!ca(h,c);m&&(l.from=h),h=ws(h);const v=!ca(f,u);v&&this._focus(f);const x=RE(t.to),{config:_}=l,{decay:g,velocity:y}=_;(r||s)&&(_.velocity=0),t.config&&!x&&eJ(_,xu(t.config,o),t.config!==a.config?xu(a.config,o):void 0);let w=To(this);if(!w||Ke.und(f))return i(Qs(this,!0));const E=Ke.und(t.reset)?s&&!t.default:!Ke.und(h)&&sp(t.reset,o),M=E?h:this.get(),b=Jp(f),C=Ke.num(b)||Ke.arr(b)||I_(b),P=!x&&(!C||sp(a.immediate||t.immediate,o));if(v){const F=CE(f);if(F!==w.constructor)if(P)w=this._set(b);else throw Error(`Cannot animate between ${w.constructor.name} and ${F.name}, as the "to" prop suggests`)}const A=w.constructor;let L=bo(f),N=!1;if(!L){const F=E||!dw(this)&&m;(v||F)&&(N=ca(Jp(M),b),L=!N),(!ca(l.immediate,P)&&!P||!ca(_.decay,g)||!ca(_.velocity,y))&&(L=!0)}if(N&&Za(this)&&(l.changed&&!E?L=!0:L||this._stop(u)),!x&&((L||bo(u))&&(l.values=w.getPayload(),l.toValues=bo(f)?null:A==th?[1]:Rs(b)),l.immediate!=P&&(l.immediate=P,!P&&!E&&this._set(u)),L)){const{onRest:F}=l;on(sJ,j=>SL(this,t,j));const B=Qs(this,yd(this,u));Bd(this._pendingCalls,B),this._pendingCalls.add(i),l.changed&&St.batchedUpdates(()=>{l.changed=!E,F==null||F(B,this),E?xu(a.onRest,B):l.onStart==null||l.onStart(B,this)})}E&&this._set(M),x?i(sF(t.to,t,this._state,this)):L?this._start():Za(this)&&!v?this._pendingCalls.add(i):i(rF(M))}_focus(e){const t=this.animation;e!==t.to&&(uL(this)&&this._detach(),t.to=e,uL(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;bo(t)&&(Pm(t,this),LE(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;bo(e)&&_y(e,this)}_set(e,t=!0){const i=ws(e);if(!Ke.und(i)){const r=To(this);if(!r||!ca(i,r.getValue())){const s=CE(i);!r||r.constructor!=s?v2(this,s.create(i)):r.setValue(i),r&&St.batchedUpdates(()=>{this._onChange(i,t)})}}return To(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,_d(this,"onStart",Qs(this,yd(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),xu(this.animation.onChange,e,this)),xu(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;To(this).reset(ws(e.to)),e.immediate||(e.fromValues=e.values.map(t=>t.lastPosition)),Za(this)||(_L(this,!0),vd(this)||this._resume())}_resume(){zo.skipAnimation?this.finish():R_.start(this)}_stop(e,t){if(Za(this)){_L(this,!1);const i=this.animation;on(i.values,s=>{s.done=!0}),i.toValues&&(i.onChange=i.onPause=i.onResume=void 0),yy(this,{type:"idle",parent:this});const r=t?Nf(this.get()):Qs(this.get(),yd(this,e??i.to));Bd(this._pendingCalls,r),i.changed&&(i.changed=!1,_d(this,"onRest",r,this))}}}function yd(n,e){const t=Jp(e),i=Jp(n.get());return ca(i,t)}function aF(n,e=n.loop,t=n.to){let i=xu(e);if(i){const r=i!==!0&&nF(i),s=(r||n).reverse,o=!r||r.reset;return tm(Ci({},n,{loop:e,default:!1,pause:void 0,to:!s||RE(t)?t:void 0,from:o?n.from:void 0,reset:o},r))}}function tm(n){const{to:e,from:t}=n=nF(n),i=new Set;return Ke.obj(e)&&wL(e,i),Ke.obj(t)&&wL(t,i),n.keys=i.size?Array.from(i):null,n}function rJ(n){const e=tm(n);return Ke.und(e.default)&&(e.default=x2(e)),e}function wL(n,e){ba(n,(t,i)=>t!=null&&e.add(i))}const sJ=["onStart","onRest","onChange","onPause","onResume"];function SL(n,e,t){n.animation[t]=e[t]!==tF(e,t)?eF(e[t],n.key):void 0}function _d(n,e,...t){var i,r,s,o;(i=(r=n.animation)[e])==null||i.call(r,...t),(s=(o=n.defaultProps)[e])==null||s.call(o,...t)}const oJ=["onStart","onChange","onRest"];let aJ=1;class lJ{constructor(e,t){this.id=aJ++,this.springs={},this.queue=[],this.ref=void 0,this._flush=void 0,this._initialProps=void 0,this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._item=void 0,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(Ci({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,i)=>e[i]=t.get()),e}set(e){for(const t in e){const i=e[t];Ke.und(i)||this.springs[t].set(i)}}update(e){return e&&this.queue.push(tm(e)),this}start(e){let{queue:t}=this;return e?t=Rs(e).map(tm):this.queue=[],this._flush?this._flush(this,t):(hF(this,t),UE(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const i=this.springs;on(Rs(t),r=>i[r].stop(!!e))}else em(this._state,this._lastAsyncId),this.each(i=>i.stop(!!e));return this}pause(e){if(Ke.und(e))this.start({pause:!0});else{const t=this.springs;on(Rs(e),i=>t[i].pause())}return this}resume(e){if(Ke.und(e))this.start({pause:!1});else{const t=this.springs;on(Rs(e),i=>t[i].resume())}return this}each(e){ba(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:i}=this._events,r=this._active.size>0,s=this._changed.size>0;(r&&!this._started||s&&!this._started)&&(this._started=!0,ip(e,([l,u])=>{u.value=this.get(),l(u,this,this._item)}));const o=!r&&this._started,a=s||o&&i.size?this.get():null;s&&t.size&&ip(t,([l,u])=>{u.value=a,l(u,this,this._item)}),o&&(this._started=!1,ip(i,([l,u])=>{u.value=a,l(u,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;St.onFrame(this._onFrame)}}function UE(n,e){return Promise.all(e.map(t=>lF(n,t))).then(t=>w2(n,t))}async function lF(n,e,t){const{keys:i,to:r,from:s,loop:o,onRest:a,onResolve:l}=e,u=Ke.obj(e.default)&&e.default;o&&(e.loop=!1),r===!1&&(e.to=null),s===!1&&(e.from=null);const c=Ke.arr(r)||Ke.fun(r)?r:void 0;c?(e.to=void 0,e.onRest=void 0,u&&(u.onRest=void 0)):on(oJ,x=>{const _=e[x];if(Ke.fun(_)){const g=n._events[x];e[x]=({finished:y,cancelled:w})=>{const E=g.get(_);E?(y||(E.finished=!1),w&&(E.cancelled=!0)):g.set(_,{value:null,finished:y||!1,cancelled:w||!1})},u&&(u[x]=e[x])}});const f=n._state;e.pause===!f.paused?(f.paused=e.pause,Bd(e.pause?f.pauseQueue:f.resumeQueue)):f.paused&&(e.pause=!0);const h=(i||Object.keys(n.springs)).map(x=>n.springs[x].start(e)),m=e.cancel===!0||tF(e,"cancel")===!0;(c||m&&f.asyncId)&&h.push(iF(++n._lastAsyncId,{props:e,state:f,actions:{pause:TE,resume:TE,start(x,_){m?(em(f,n._lastAsyncId),_(Nf(n))):(x.onRest=a,_(sF(c,x,f,n)))}}})),f.paused&&await new Promise(x=>{f.resumeQueue.add(x)});const v=w2(n,await Promise.all(h));if(o&&v.finished&&!(t&&v.noop)){const x=aF(e,o,r);if(x)return hF(n,[x]),lF(n,x,!0)}return l&&St.batchedUpdates(()=>l(v,n,n.item)),v}function EL(n,e){const t=Ci({},n.springs);return e&&on(Rs(e),i=>{Ke.und(i.keys)&&(i=tm(i)),Ke.obj(i.to)||(i=Ci({},i,{to:void 0})),fF(t,i,r=>cF(r))}),uF(n,t),t}function uF(n,e){ba(e,(t,i)=>{n.springs[i]||(n.springs[i]=t,Pm(t,n))})}function cF(n,e){const t=new iJ;return t.key=n,e&&Pm(t,e),t}function fF(n,e,t){e.keys&&on(e.keys,i=>{(n[i]||(n[i]=t(i)))._prepareNode(e)})}function hF(n,e){on(e,t=>{fF(n.springs,t,i=>cF(i,n))})}function uJ(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}const cJ=["children"],U_=n=>{let{children:e}=n,t=uJ(n,cJ);const i=Y.useContext(Sy),r=t.pause||!!i.pause,s=t.immediate||!!i.immediate;t=kQ(()=>({pause:r,immediate:s}),[r,s]);const{Provider:o}=Sy;return Y.createElement(o,{value:t},e)},Sy=fJ(U_,{});U_.Provider=Sy.Provider;U_.Consumer=Sy.Consumer;function fJ(n,e){return Object.assign(n,Y.createContext(e)),n.Provider._context=n,n.Consumer._context=n,n}const hJ=()=>{const n=[],e=function(r){UQ();const s=[];return on(n,(o,a)=>{if(Ke.und(r))s.push(o.start());else{const l=t(r,o,a);l&&s.push(o.start(l))}}),s};e.current=n,e.add=function(i){n.includes(i)||n.push(i)},e.delete=function(i){const r=n.indexOf(i);~r&&n.splice(r,1)},e.pause=function(){return on(n,i=>i.pause(...arguments)),this},e.resume=function(){return on(n,i=>i.resume(...arguments)),this},e.set=function(i){on(n,r=>r.set(i))},e.start=function(i){const r=[];return on(n,(s,o)=>{if(Ke.und(i))r.push(s.start());else{const a=this._getProps(i,s,o);a&&r.push(s.start(a))}}),r},e.stop=function(){return on(n,i=>i.stop(...arguments)),this},e.update=function(i){return on(n,(r,s)=>r.update(this._getProps(i,r,s))),this};const t=function(r,s,o){return Ke.fun(r)?r(o,s):r};return e._getProps=t,e};function dJ(n,e,t){const i=Ke.fun(e)&&e;i&&!t&&(t=[]);const r=Y.useMemo(()=>i||arguments.length==3?hJ():void 0,[]),s=Y.useRef(0),o=ZN(),a=Y.useMemo(()=>({ctrls:[],queue:[],flush(g,y){const w=EL(g,y);return s.current>0&&!a.queue.length&&!Object.keys(w).some(M=>!g.springs[M])?UE(g,y):new Promise(M=>{uF(g,w),a.queue.push(()=>{M(UE(g,y))}),o()})}}),[]),l=Y.useRef([...a.ctrls]),u=[],c=fL(n)||0;Y.useMemo(()=>{on(l.current.slice(n,c),g=>{KQ(g,r),g.stop(!0)}),l.current.length=n,f(c,n)},[n]),Y.useMemo(()=>{f(0,Math.min(c,n))},t);function f(g,y){for(let w=g;wEL(g,u[y])),m=Y.useContext(U_),v=fL(m),x=m!==v&&qQ(m);g2(()=>{s.current++,a.ctrls=l.current;const{queue:g}=a;g.length&&(a.queue=[],on(g,y=>y())),on(l.current,(y,w)=>{r==null||r.add(y),x&&y.start({default:m});const E=u[w];E&&(ZQ(y,E.ref),y.ref?y.queue.push(E):y.start(E))})}),QN(()=>()=>{on(a.ctrls,g=>g.stop(!0))});const _=h.map(g=>Ci({},g));return r?[_,r]:_}function Os(n,e){const t=Ke.fun(n),[[i],r]=dJ(1,t?n:[n],t?e||[]:e);return t||arguments.length==2?[i,r]:i}let ML;(function(n){n.MOUNT="mount",n.ENTER="enter",n.UPDATE="update",n.LEAVE="leave"})(ML||(ML={}));class pJ extends S2{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=Zp(...t);const i=this._get(),r=CE(i);v2(this,r.create(i))}advance(e){const t=this._get(),i=this.get();ca(t,i)||(To(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&TL(this._active)&&pw(this)}_get(){const e=Ke.arr(this.source)?this.source.map(ws):Rs(ws(this.source));return this.calc(...e)}_start(){this.idle&&!TL(this._active)&&(this.idle=!1,on(D_(this),e=>{e.done=!1}),zo.skipAnimation?(St.batchedUpdates(()=>this.advance()),pw(this)):R_.start(this))}_attach(){let e=1;on(Rs(this.source),t=>{bo(t)&&Pm(t,this),LE(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){on(Rs(this.source),e=>{bo(e)&&_y(e,this)}),this._active.clear(),pw(this)}eventObserved(e){e.type=="change"?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type=="idle"?this._active.delete(e.parent):e.type=="priority"&&(this.priority=Rs(this.source).reduce((t,i)=>Math.max(t,(LE(i)?i.priority:0)+1),0))}}function mJ(n){return n.idle!==!1}function TL(n){return!n.size||Array.from(n).every(mJ)}function pw(n){n.idle||(n.idle=!0,on(D_(n),e=>{e.done=!0}),yy(n,{type:"idle",parent:n}))}zo.assign({createStringInterpolator:qN,to:(n,e)=>new pJ(n,e)});const gJ=["primitive"].concat(Object.keys(IO).filter(n=>/^[A-Z]/.test(n)).map(n=>n[0].toLowerCase()+n.slice(1)));zo.assign({createStringInterpolator:qN,colors:cQ,frameLoop:"demand"});v9(()=>{St.advance()});const vJ=WQ(gJ,{applyAnimatedValues:vu}),Yn=vJ.animated,B0=(n,e)=>{const t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),r=new Set(Object.keys(n[0].morphAttributes)),s={},o={},a=n[0].morphTargetsRelative,l=new Ct;let u=0;if(n.forEach((c,f)=>{let h=0;if(t!==(c.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let m in c.attributes){if(!i.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;s[m]===void 0&&(s[m]=[]),s[m].push(c.attributes[m]),h++}if(h!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(a!==c.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let m in c.morphAttributes){if(!r.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphAttributes must be consistent throughout all geometries."),null;o[m]===void 0&&(o[m]=[]),o[m].push(c.morphAttributes[m])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(c.userData),e){let m;if(c.index)m=c.index.count;else if(c.attributes.position!==void 0)m=c.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;l.addGroup(u,m,f),u+=m}}),t){let c=0;const f=[];n.forEach(h=>{const m=h.index;for(let v=0;v{let e,t,i,r=0;if(n.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;r+=s.array.length}),e&&t){const s=new e(r);let o=0;return n.forEach(a=>{s.set(a.array,o),o+=a.array.length}),new ln(s,t,i)}},mw=new hm,gw=new $,Zc=new $,js=new $,oa=new $,wo=new $,aa=new $,la=new $,xd=new $,wd=new $,Sd=new $,G0=new $,Ed=new $,Md=new $,Td=new $;class AL{constructor(e,t,i){this.camera=e,this.scene=t,this.startPoint=new $,this.endPoint=new $,this.collection=[],this.deep=i||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(mw,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Zc.copy(e),Zc.x=Math.min(e.x,t.x),Zc.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),js.setFromMatrixPosition(this.camera.matrixWorld),oa.copy(Zc),wo.set(t.x,Zc.y,0),aa.copy(t),la.set(Zc.x,t.y,0),oa.unproject(this.camera),wo.unproject(this.camera),aa.unproject(this.camera),la.unproject(this.camera),Ed.copy(oa).sub(js),Md.copy(wo).sub(js),Td.copy(aa).sub(js),Ed.normalize(),Md.normalize(),Td.normalize(),Ed.multiplyScalar(this.deep),Md.multiplyScalar(this.deep),Td.multiplyScalar(this.deep),Ed.add(js),Md.add(js),Td.add(js);var i=mw.planes;i[0].setFromCoplanarPoints(js,oa,wo),i[1].setFromCoplanarPoints(js,wo,aa),i[2].setFromCoplanarPoints(aa,la,js),i[3].setFromCoplanarPoints(la,oa,js),i[4].setFromCoplanarPoints(wo,aa,la),i[5].setFromCoplanarPoints(Td,Md,Ed),i[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const r=Math.min(e.x,t.x),s=Math.max(e.y,t.y),o=Math.max(e.x,t.x),a=Math.min(e.y,t.y);oa.set(r,s,-1),wo.set(o,s,-1),aa.set(o,a,-1),la.set(r,a,-1),xd.set(r,s,1),wd.set(o,s,1),Sd.set(o,a,1),G0.set(r,a,1),oa.unproject(this.camera),wo.unproject(this.camera),aa.unproject(this.camera),la.unproject(this.camera),xd.unproject(this.camera),wd.unproject(this.camera),Sd.unproject(this.camera),G0.unproject(this.camera);var i=mw.planes;i[0].setFromCoplanarPoints(oa,xd,wd),i[1].setFromCoplanarPoints(wo,wd,Sd),i[2].setFromCoplanarPoints(Sd,G0,la),i[3].setFromCoplanarPoints(G0,xd,oa),i[4].setFromCoplanarPoints(wo,aa,la),i[5].setFromCoplanarPoints(Sd,wd,xd),i[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),gw.copy(t.geometry.boundingSphere.center),gw.applyMatrix4(t.matrixWorld),e.containsPoint(gw)&&this.collection.push(t)),t.children.length>0)for(let i=0;i{if(!t||!u.current)return;const h=u.current.rotation.clone();u.current.updateMatrix(),u.current.updateWorldMatrix(!1,!1),u.current.getWorldQuaternion(c),f.getWorldQuaternion(l.current.quaternion).premultiply(c.invert()),i&&(u.current.rotation.x=h.x),r&&(u.current.rotation.y=h.y),s&&(u.current.rotation.z=h.z)}),Y.useImperativeHandle(a,()=>u.current,[]),Y.createElement("group",qu({ref:u,matrixAutoUpdate:!1,matrixWorldAutoUpdate:!1},o),Y.createElement("group",{ref:l},e))});function yJ(){var n=Object.create(null);function e(r,s){var o=r.id,a=r.name,l=r.dependencies;l===void 0&&(l=[]);var u=r.init;u===void 0&&(u=function(){});var c=r.getTransferables;if(c===void 0&&(c=null),!n[o])try{l=l.map(function(h){return h&&h.isWorkerModule&&(e(h,function(m){if(m instanceof Error)throw m}),h=n[h.id].value),h}),u=i("<"+a+">.init",u),c&&(c=i("<"+a+">.getTransferables",c));var f=null;typeof u=="function"?f=u.apply(void 0,l):console.error("worker module init function failed to rehydrate"),n[o]={id:o,value:f,getTransferables:c},s(f)}catch(h){h&&h.noLog||console.error(h),s(h)}}function t(r,s){var o,a=r.id,l=r.args;(!n[a]||typeof n[a].value!="function")&&s(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var u=(o=n[a]).value.apply(o,l);u&&typeof u.then=="function"?u.then(c,function(f){return s(f instanceof Error?f:new Error(""+f))}):c(u)}catch(f){s(f)}function c(f){try{var h=n[a].getTransferables&&n[a].getTransferables(f);(!h||!Array.isArray(h)||!h.length)&&(h=void 0),s(f,h)}catch(m){console.error(m),s(m)}}}function i(r,s){var o=void 0;self.troikaDefine=function(l){return o=l};var a=URL.createObjectURL(new Blob(["/** "+r.replace(/\*/g,"")+` **/ - -troikaDefine( -`+s+` -)`],{type:"application/javascript"}));try{importScripts(a)}catch(l){console.error(l)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(r){var s=r.data,o=s.messageId,a=s.action,l=s.data;try{a==="registerModule"&&e(l,function(u){u instanceof Error?postMessage({messageId:o,success:!1,error:u.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof u=="function"}})}),a==="callModule"&&t(l,function(u,c){u instanceof Error?postMessage({messageId:o,success:!1,error:u.message}):postMessage({messageId:o,success:!0,result:u},c||void 0)})}catch(u){postMessage({messageId:o,success:!1,error:u.stack})}})}function _J(n){var e=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];return e._getInitResult().then(function(r){if(typeof r=="function")return r.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=n.dependencies,i=n.init;t=Array.isArray(t)?t.map(function(s){return s&&s._getInitResult?s._getInitResult():s}):[];var r=Promise.all(t).then(function(s){return i.apply(null,s)});return e._getInitResult=function(){return r},r},e}var pF=function(){var n=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),n=!0}catch(t){typeof process<"u",console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return pF=function(){return n},n},xJ=0,wJ=0,vw=!1,op=Object.create(null),ap=Object.create(null),OE=Object.create(null);function Lm(n){if((!n||typeof n.init!="function")&&!vw)throw new Error("requires `options.init` function");var e=n.dependencies,t=n.init,i=n.getTransferables,r=n.workerId;if(!pF())return _J(n);r==null&&(r="#default");var s="workerModule"+ ++xJ,o=n.name||s,a=null;e=e&&e.map(function(u){return typeof u=="function"&&!u.workerModuleData&&(vw=!0,u=Lm({workerId:r,name:"<"+o+"> function dependency: "+u.name,init:`function(){return ( -`+wv(u)+` -)}`}),vw=!1),u&&u.workerModuleData&&(u=u.workerModuleData),u});function l(){for(var u=[],c=arguments.length;c--;)u[c]=arguments[c];if(!a){a=CL(r,"registerModule",l.workerModuleData);var f=function(){a=null,ap[r].delete(f)};(ap[r]||(ap[r]=new Set)).add(f)}return a.then(function(h){var m=h.isCallable;if(m)return CL(r,"callModule",{id:s,args:u});throw new Error("Worker module function was called but `init` did not return a callable function")})}return l.workerModuleData={isWorkerModule:!0,id:s,name:o,dependencies:e,init:wv(t),getTransferables:i&&wv(i)},l}function SJ(n){ap[n]&&ap[n].forEach(function(e){e()}),op[n]&&(op[n].terminate(),delete op[n])}function wv(n){var e=n.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function EJ(n){var e=op[n];if(!e){var t=wv(yJ);e=op[n]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+n.replace(/\*/g,"")+` **/ - -;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(i){var r=i.data,s=r.messageId,o=OE[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete OE[s],o(r)}}return e}function CL(n,e,t){return new Promise(function(i,r){var s=++wJ;OE[s]=function(o){o.success?i(o.result):r(new Error("Error in worker "+e+" call: "+o.error))},EJ(n).postMessage({messageId:s,action:e,data:t})})}function mF(){var n=function(e){function t(O,k,U,z,Q,J,te,se){var ne=1-te;se.x=ne*ne*O+2*ne*te*U+te*te*Q,se.y=ne*ne*k+2*ne*te*z+te*te*J}function i(O,k,U,z,Q,J,te,se,ne,fe){var Ie=1-ne;fe.x=Ie*Ie*Ie*O+3*Ie*Ie*ne*U+3*Ie*ne*ne*Q+ne*ne*ne*te,fe.y=Ie*Ie*Ie*k+3*Ie*Ie*ne*z+3*Ie*ne*ne*J+ne*ne*ne*se}function r(O,k){for(var U=/([MLQCZ])([^MLQCZ]*)/g,z,Q,J,te,se;z=U.exec(O);){var ne=z[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(fe){return parseFloat(fe)});switch(z[1]){case"M":te=Q=ne[0],se=J=ne[1];break;case"L":(ne[0]!==te||ne[1]!==se)&&k("L",te,se,te=ne[0],se=ne[1]);break;case"Q":{k("Q",te,se,te=ne[2],se=ne[3],ne[0],ne[1]);break}case"C":{k("C",te,se,te=ne[4],se=ne[5],ne[0],ne[1],ne[2],ne[3]);break}case"Z":(te!==Q||se!==J)&&k("L",te,se,Q,J);break}}}function s(O,k,U){U===void 0&&(U=16);var z={x:0,y:0};r(O,function(Q,J,te,se,ne,fe,Ie,Ue,he){switch(Q){case"L":k(J,te,se,ne);break;case"Q":{for(var H=J,ae=te,le=1;le0;)Ye[Be]=arguments[Be+2];var Le=Re[Ne]||(Re[Ne]=U.getUniformLocation(Se,Ne));U["uniform"+xe].apply(U,[Le].concat(Ye))},setAttribute:function(xe,Ne,Ye,Be,Le){var Fe=ie[xe];Fe||(Fe=ie[xe]={buf:U.createBuffer(),loc:U.getAttribLocation(Se,xe),data:null}),U.bindBuffer(U.ARRAY_BUFFER,Fe.buf),U.vertexAttribPointer(Fe.loc,Ne,U.FLOAT,!1,0,0),U.enableVertexAttribArray(Fe.loc),Q?U.vertexAttribDivisor(Fe.loc,Be):me("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Fe.loc,Be),Le!==Fe.data&&(U.bufferData(U.ARRAY_BUFFER,Le,Ye),Fe.data=Le)}})}}}te[de].transaction(G)},pe=function(de,je){ne++;try{U.activeTexture(U.TEXTURE0+ne);var X=se[de];X||(X=se[de]=U.createTexture(),U.bindTexture(U.TEXTURE_2D,X),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MIN_FILTER,U.NEAREST),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MAG_FILTER,U.NEAREST)),U.bindTexture(U.TEXTURE_2D,X),je(X,ne)}finally{ne--}},Ce=function(de,je,X){var G=U.createFramebuffer();fe.push(G),U.bindFramebuffer(U.FRAMEBUFFER,G),U.activeTexture(U.TEXTURE0+je),U.bindTexture(U.TEXTURE_2D,de),U.framebufferTexture2D(U.FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_2D,de,0);try{X(G)}finally{U.deleteFramebuffer(G),U.bindFramebuffer(U.FRAMEBUFFER,fe[--fe.length-1]||null)}},ge=function(){J={},te={},se={},ne=-1,fe.length=0};var Ie=me,Ue=ce,he=De,H=pe,ae=Ce,le=ge,Q=typeof WebGL2RenderingContext<"u"&&U instanceof WebGL2RenderingContext,J={},te={},se={},ne=-1,fe=[];U.canvas.addEventListener("webglcontextlost",function(de){ge(),de.preventDefault()},!1),l.set(U,z={gl:U,isWebGL2:Q,getExtension:me,withProgram:De,withTexture:pe,withTextureFramebuffer:Ce,handleContextLoss:ge})}k(z)}function f(O,k,U,z,Q,J,te,se){te===void 0&&(te=15),se===void 0&&(se=null),c(O,function(ne){var fe=ne.gl,Ie=ne.withProgram,Ue=ne.withTexture;Ue("copy",function(he,H){fe.texImage2D(fe.TEXTURE_2D,0,fe.RGBA,Q,J,0,fe.RGBA,fe.UNSIGNED_BYTE,k),Ie("copy",o,a,function(ae){var le=ae.setUniform,me=ae.setAttribute;me("aUV",2,fe.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),le("1i","image",H),fe.bindFramebuffer(fe.FRAMEBUFFER,se||null),fe.disable(fe.BLEND),fe.colorMask(te&8,te&4,te&2,te&1),fe.viewport(U,z,Q,J),fe.scissor(U,z,Q,J),fe.drawArrays(fe.TRIANGLES,0,3)})})})}function h(O,k,U){var z=O.width,Q=O.height;c(O,function(J){var te=J.gl,se=new Uint8Array(z*Q*4);te.readPixels(0,0,z,Q,te.RGBA,te.UNSIGNED_BYTE,se),O.width=k,O.height=U,f(te,se,0,0,z,Q)})}var m=Object.freeze({__proto__:null,withWebGLContext:c,renderImageData:f,resizeWebGLCanvasWithoutClearing:h});function v(O,k,U,z,Q,J){J===void 0&&(J=1);var te=new Uint8Array(O*k),se=z[2]-z[0],ne=z[3]-z[1],fe=[];s(U,function(me,ce,De,pe){fe.push({x1:me,y1:ce,x2:De,y2:pe,minX:Math.min(me,De),minY:Math.min(ce,pe),maxX:Math.max(me,De),maxY:Math.max(ce,pe)})}),fe.sort(function(me,ce){return me.maxX-ce.maxX});for(var Ie=0;Iege.minX&&ce-pege.minY){var de=g(me,ce,ge.x1,ge.y1,ge.x2,ge.y2);dece!=Ce.y2>ce&&me<(Ce.x2-Ce.x1)*(ce-Ce.y1)/(Ce.y2-Ce.y1)+Ce.x1;ge&&(De+=Ce.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function x(pe,Ce){var ge=36,de=0,je=new Map,X=Ce&&new Map,G;return pe.split(",").forEach(function ie(Re){if(Re.indexOf("+")!==-1)for(var Se=+Re;Se--;)ie(G);else{G=Re;var be=Re.split(">"),Ve=be[0],ke=be[1];Ve=String.fromCodePoint(de+=parseInt(Ve,ge)),ke=String.fromCodePoint(de+=parseInt(ke,ge)),je.set(Ve,ke),Ce&&X.set(ke,Ve)}}),{map:je,reverseMap:X}}var _,g,y;function w(){if(!_){var pe=x(v.pairs,!0),Ce=pe.map,ge=pe.reverseMap;_=Ce,g=ge,y=x(v.canonical,!1).map}}function E(pe){return w(),_.get(pe)||null}function M(pe){return w(),g.get(pe)||null}function b(pe){return w(),y.get(pe)||null}var C=i.L,P=i.R,A=i.EN,L=i.ES,N=i.ET,F=i.AN,B=i.CS,j=i.B,q=i.S,V=i.ON,W=i.BN,I=i.NSM,O=i.AL,k=i.LRO,U=i.RLO,z=i.LRE,Q=i.RLE,J=i.PDF,te=i.LRI,se=i.RLI,ne=i.FSI,fe=i.PDI;function Ie(pe,Ce){for(var ge=125,de=new Uint32Array(pe.length),je=0;je0)Fe--;else if(gt>0){for(it=0;!Be[Be.length-1]._isolate;)Be.pop();var wt=Be[Be.length-1]._isolInitIndex;wt!=null&&(Re.set(wt,ee),Re.set(ee,wt)),Be.pop(),gt--}Le=Be[Be.length-1],ie[ee]=Le._level,Le._override&&G(ee,Le._override)}else ze&J?(Fe===0&&(it>0?it--:!Le._isolate&&Be.length>1&&(Be.pop(),Le=Be[Be.length-1])),ie[ee]=Le._level):ze&j&&(ie[ee]=be.level);else ie[ee]=Le._level,Le._override&&ze!==W&&G(ee,Le._override)}for(var Ut=[],Gt=null,zt=be.start;zt<=be.end;zt++){var Qt=de[zt];if(!(Qt&l)){var Bt=ie[zt],Lt=Qt&s,zi=Qt===fe;Gt&&Bt===Gt._level?(Gt._end=zt,Gt._endsWithIsolInit=Lt):Ut.push(Gt={_start:zt,_end:zt,_level:Bt,_startsWithPDI:zi,_endsWithIsolInit:Lt})}}for(var _i=[],jt=0;jt=0;ue--)if(!(de[ue]&l)){Me=ie[ue];break}var Te=fi[fi.length-1],rt=ie[Te],ct=be.level;if(!(de[Te]&s)){for(var ft=Te+1;ft<=be.end;ft++)if(!(de[ft]&l)){ct=ie[ft];break}}_i.push({_seqIndices:fi,_sosType:Math.max(Me,ve)%2?P:C,_eosType:Math.max(ct,rt)%2?P:C})}}for(var mt=0;mt<_i.length;mt++){var Et=_i[mt],Oe=Et._seqIndices,ht=Et._sosType,cn=Et._eosType,Xt=ie[Oe[0]]&1?P:C;if(X.get(I))for(var xi=0;xi=0;yt--)if(!(de[Oe[yt]]&l)){Jt=de[Oe[yt]];break}G(Bi,Jt&(s|fe)?V:Jt)}}if(X.get(A))for(var Vt=0;Vt=-1;qn--){var Vn=qn===-1?ht:de[Oe[qn]];if(Vn&o){Vn===O&&G(_t,F);break}}}if(X.get(O))for(var En=0;En=0&&(ir=de[Oe[uo]],!!(ir&l));uo--);for(var co=fn+1;co=0&&de[Oe[cc]]&(N|l);cc--)G(Oe[cc],A);for(Gi++;Gi=0&&de[Oe[Go]]&l;Go--)G(Oe[Go],V);for(var Vo=Fl+1;Vo=0;jo--){var hc=Da[jo].char;if(hc===vh||hc===M(b(kt))||E(b(hc))===kt){fo.push([Da[jo].seqIndex,ho]),Da.length=jo;break}}}fo.sort(function(Si,ar){return Si[0]-ar[0]})}for(var yh=0;yh=0;xh--){var Nm=Oe[xh];if(de[Nm]&fc){var Gr=de[Nm]&Wo?P:C;Gr!==Xt?rr=Gr:rr=Xt;break}}}if(rr){if(de[Oe[Rn]]=de[Oe[Bl]]=rr,rr!==Xt){for(var sr=Rn+1;sr=0;Vl--)if(de[Oe[Vl]]&l)wh=Vl;else{wr=de[Oe[Vl]]&Wo?P:C;break}for(var Hl=cn,Wl=as+1;Wl=0&&h(pe[Ua])&u;Ua--)ie[Ua]=be.level}}return{levels:ie,paragraphs:Se};function pc(Si,ar){for(var Kn=Si;Kn=ie&&h(pe[be])&u;be--)Se[be]=G.level;for(var Ve=G.level,ke=1/0,xe=0;xeVe&&(Ve=Ne),Ne=ke;Ye--)for(var Be=0;Be=Ye){for(var Le=Be;Be+1=Ye;)Be++;Be>Le&&X.push([Le+ie,Be+ie])}}}),X}function ce(pe,Ce,ge,de){var je=De(pe,Ce,ge,de),X=[].concat(pe);return je.forEach(function(G,ie){X[ie]=(Ce.levels[G]&1?ae(pe[G]):null)||pe[G]}),X.join("")}function De(pe,Ce,ge,de){for(var je=me(pe,Ce,ge,de),X=[],G=0;G/gm;function t(i,r){let s=bt[r];return s?kE(s):i}return n.replace(e,t)}const Ii=[];for(let n=0;n<256;n++)Ii[n]=(n<16?"0":"")+n.toString(16);function TJ(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Ii[n&255]+Ii[n>>8&255]+Ii[n>>16&255]+Ii[n>>24&255]+"-"+Ii[e&255]+Ii[e>>8&255]+"-"+Ii[e>>16&15|64]+Ii[e>>24&255]+"-"+Ii[t&63|128]+Ii[t>>8&255]+"-"+Ii[t>>16&255]+Ii[t>>24&255]+Ii[i&255]+Ii[i>>8&255]+Ii[i>>16&255]+Ii[i>>24&255]).toUpperCase()}const cu=Object.assign||function(){let n=arguments[0];for(let e=1,t=arguments.length;e/gm,` -//!BEGIN_POST_CHUNK $1 -$& -//!END_POST_CHUNK -`),t=kE(t)),m){let x=m({vertexShader:e,fragmentShader:t});e=x.vertexShader,t=x.fragmentShader}if(h){let x=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,_=>(x.push(_),"")),f=`${h} -${x.join(` -`)} -${f}`}if(v){const x=` -uniform float ${v}; -`;s=x+s,u=x+u}return l&&(e=`vec3 troika_position_${r}; -vec3 troika_normal_${r}; -vec2 troika_uv_${r}; -${e} -`,s=`${s} -void troikaVertexTransform${r}(inout vec3 position, inout vec3 normal, inout vec2 uv) { - ${l} -} -`,o=` -troika_position_${r} = vec3(position); -troika_normal_${r} = vec3(normal); -troika_uv_${r} = vec2(uv); -troikaVertexTransform${r}(troika_position_${r}, troika_normal_${r}, troika_uv_${r}); -${o} -`,e=e.replace(/\b(position|normal|uv)\b/g,(x,_,g,y)=>/\battribute\s+vec[23]\s+$/.test(y.substr(0,g))?_:`troika_${_}_${r}`),n.map&&n.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${r}`))),e=LL(e,r,s,o,a),t=LL(t,r,u,c,f),{vertexShader:e,fragmentShader:t}}function LL(n,e,t,i,r){return(i||r||t)&&(n=n.replace(gF,` -${t} -void troikaOrigMain${e}() {`),n+=` -void main() { - ${i} - troikaOrigMain${e}(); - ${r} -}`),n}function RJ(n,e){return n==="uniforms"?void 0:typeof e=="function"?e.toString():e}let PJ=0;const IL=new Map;function LJ(n){const e=JSON.stringify(n,RJ);let t=IL.get(e);return t==null&&IL.set(e,t=++PJ),t}function IJ(n,e,t){const{defaultFontURL:i}=t,r=Object.create(null),s=1/0,o=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,a="[^\\S\\u00A0]",l=new RegExp(`${a}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function u(y,w){function E(){const M=b=>{console.error(`Failure loading font ${y}${y===i?"":"; trying fallback"}`,b),y!==i&&(y=i,E())};try{const b=new XMLHttpRequest;b.open("get",y,!0),b.responseType="arraybuffer",b.onload=function(){if(b.status>=400)M(new Error(b.statusText));else if(b.status>0)try{const C=n(b.response);w(C)}catch(C){M(C)}},b.onerror=M,b.send()}catch(b){M(b)}}E()}function c(y,w){y||(y=i);let E=r[y];E?E.pending?E.pending.push(w):w(E):(r[y]={pending:[w]},u(y,M=>{let b=r[y].pending;r[y]=M,b.forEach(C=>C(M))}))}function f({text:y="",font:w=i,sdfGlyphSize:E=64,fontSize:M=1,letterSpacing:b=0,lineHeight:C="normal",maxWidth:P=s,direction:A,textAlign:L="left",textIndent:N=0,whiteSpace:F="normal",overflowWrap:B="normal",anchorX:j=0,anchorY:q=0,includeCaretPositions:V=!1,chunkedBoundsSize:W=8192,colorRanges:I=null},O,k=!1){const U=x(),z={fontLoad:0,typesetting:0};y.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),y=y.replace(/\r\n/g,` -`).replace(/\r/g,` -`)),M=+M,b=+b,P=+P,C=C||"normal",N=+N,c(w,Q=>{const J=isFinite(P);let te=null,se=null,ne=null,fe=null,Ie=null,Ue=null,he=null,H=0,ae=0,le=F!=="nowrap";const{ascender:me,descender:ce,unitsPerEm:De,lineGap:pe,capHeight:Ce,xHeight:ge}=Q;z.fontLoad=x()-U;const de=x(),je=M/De;C==="normal"&&(C=(me-ce+pe)/De),C=C*M;const X=(C-(me-ce)*je)/2,G=-(me*je+X),ie=Math.min(C,(me-ce)*je),Re=(me+ce)/2*je-ie/2;let Se=N,be=new _;const Ve=[be];Q.forEachGlyph(y,M,b,(Ne,Ye,Be)=>{const Le=y.charAt(Be),Fe=Ne.advanceWidth*je,it=be.count;let gt;if("isEmpty"in Ne||(Ne.isWhitespace=!!Le&&new RegExp(a).test(Le),Ne.canBreakAfter=!!Le&&l.test(Le),Ne.isEmpty=Ne.xMin===Ne.xMax||Ne.yMin===Ne.yMax||o.test(Le)),!Ne.isWhitespace&&!Ne.isEmpty&&ae++,le&&J&&!Ne.isWhitespace&&Ye+Fe+Se>P&&it){if(be.glyphAt(it-1).glyphObj.canBreakAfter)gt=new _,Se=-Ye;else for(let ze=it;ze--;)if(ze===0&&B==="break-word"){gt=new _,Se=-Ye;break}else if(be.glyphAt(ze).glyphObj.canBreakAfter){gt=be.splitAt(ze+1);const ye=gt.glyphAt(0).x;Se-=ye;for(let He=gt.count;He--;)gt.glyphAt(He).x-=ye;break}gt&&(be.isSoftWrapped=!0,be=gt,Ve.push(be),H=P)}let ee=be.glyphAt(be.count);ee.glyphObj=Ne,ee.x=Ye+Se,ee.width=Fe,ee.charIndex=Be,Le===` -`&&(be=new _,Ve.push(be),Se=-(Ye+Fe+b*M)+N)}),Ve.forEach(Ne=>{for(let Ye=Ne.count;Ye--;){let{glyphObj:Be,x:Le,width:Fe}=Ne.glyphAt(Ye);if(!Be.isWhitespace){Ne.width=Le+Fe,Ne.width>H&&(H=Ne.width);return}}});let ke=0,xe=0;if(j&&(typeof j=="number"?ke=-j:typeof j=="string"&&(ke=-H*(j==="left"?0:j==="center"?.5:j==="right"?1:m(j)))),q){if(typeof q=="number")xe=-q;else if(typeof q=="string"){let Ne=Ve.length*C;xe=q==="top"?0:q==="top-baseline"?-G:q==="top-cap"?-G-Ce*je:q==="top-ex"?-G-ge*je:q==="middle"?Ne/2:q==="bottom"?Ne:q==="bottom-baseline"?Ne-X+ce*je:m(q)*Ne}}if(!k){const Ne=e.getEmbeddingLevels(y,A);te=new Uint16Array(ae),se=new Float32Array(ae*2),ne={},Ue=[s,s,-s,-s],he=[];let Ye=G;V&&(Ie=new Float32Array(y.length*3)),I&&(fe=new Uint8Array(ae*3));let Be=0,Le=-1,Fe=-1,it,gt;if(Ve.forEach((ee,ze)=>{let{count:ye,width:He}=ee;if(ye>0){let qe=0;for(let Bt=ye;Bt--&&ee.glyphAt(Bt).glyphObj.isWhitespace;)qe++;let wt=0,Ut=0;if(L==="center")wt=(H-He)/2;else if(L==="right")wt=H-He;else if(L==="justify"&&ee.isSoftWrapped){let Bt=0;for(let Lt=ye-qe;Lt--;)ee.glyphAt(Lt).glyphObj.isWhitespace&&Bt++;Ut=(H-He)/Bt}if(Ut||wt){let Bt=0;for(let Lt=0;Lt=Lt){let Pi=vn,pn=vn;for(;pnzi)break;pnzt=Bt;for(let Bt=0;Bt1&&v(Ie,Le,pn),Le=jt}if(I){const{charIndex:jt}=Lt;for(;jt>Fe;)Fe++,I.hasOwnProperty(Fe)&&(gt=I[Fe])}if(!zt.isWhitespace&&!zt.isEmpty){const jt=Be++;ne[zi]||(ne[zi]={path:zt.path,pathBounds:[zt.xMin,zt.yMin,zt.xMax,zt.yMax]});const vn=Lt.x+ke,Pi=Ye+xe;se[jt*2]=vn,se[jt*2+1]=Pi;const pn=vn+zt.xMin*je,Cn=Pi+zt.yMin*je,fi=vn+zt.xMax*je,os=Pi+zt.yMax*je;pnUe[2]&&(Ue[2]=fi),os>Ue[3]&&(Ue[3]=os),jt%W===0&&(it={start:jt,end:jt,rect:[s,s,-s,-s]},he.push(it)),it.end++;const nr=it.rect;if(pnnr[2]&&(nr[2]=fi),os>nr[3]&&(nr[3]=os),te[jt]=zi,I){const K=jt*3;fe[K]=gt>>16&255,fe[K+1]=gt>>8&255,fe[K+2]=gt&255}}}}Ye-=C}),Ie){const ee=y.length-Le;ee>1&&v(Ie,Le,ee)}}z.typesetting=x()-de,O({glyphIds:te,glyphPositions:se,glyphData:ne,caretPositions:Ie,caretHeight:ie,glyphColors:fe,chunkedBounds:he,fontSize:M,unitsPerEm:De,ascender:me*je,descender:ce*je,capHeight:Ce*je,xHeight:ge*je,lineHeight:C,topBaseline:G,blockBounds:[ke,xe-Ve.length*C,ke+H,xe],visibleBounds:Ue,timings:z})})}function h(y,w){f(y,E=>{const[M,b,C,P]=E.blockBounds;w({width:C-M,height:P-b})},{metricsOnly:!0})}function m(y){let w=y.match(/^([\d.]+)%$/),E=w?parseFloat(w[1]):NaN;return isNaN(E)?0:E/100}function v(y,w,E){const M=y[w*3],b=y[w*3+1],C=y[w*3+2],P=(b-M)/E;for(let A=0;A(Object.defineProperty(y,w,{get(){return this.data[this.index*g.length+E]},set(b){this.data[this.index*g.length+E]=b}}),y),{data:null,index:0}),{typeset:f,measure:h,loadFont:c}}const Nu=()=>(self.performance||Date).now(),O_=mF();let DL;function DJ(n,e,t,i,r,s,o,a,l,u,c=!0){return c?OJ(n,e,t,i,r,s,o,a,l,u).then(null,f=>(DL||(console.warn("WebGL SDF generation failed, falling back to JS",f),DL=!0),OL(n,e,t,i,r,s,o,a,l,u))):OL(n,e,t,i,r,s,o,a,l,u)}const Sv=[],UJ=5;let FE=0;function vF(){const n=Nu();for(;Sv.length&&Nu()-nnew Promise((e,t)=>{Sv.push(()=>{const i=Nu();try{O_.webgl.generateIntoCanvas(...n),e({timing:Nu()-i})}catch(r){t(r)}}),FE||(FE=setTimeout(vF,0))}),kJ=4,NJ=2e3,UL={};let FJ=0;function OL(n,e,t,i,r,s,o,a,l,u){const c="TroikaTextSDFGenerator_JS_"+FJ++%kJ;let f=UL[c];return f||(f=UL[c]={workerModule:Lm({name:c,workerId:c,dependencies:[mF,Nu],init(h,m){const v=h().javascript.generate;return function(...x){const _=m();return{textureData:v(...x),timing:m()-_}}},getTransferables(h){return[h.textureData.buffer]}}),requests:0,idleTimer:null}),f.requests++,clearTimeout(f.idleTimer),f.workerModule(n,e,t,i,r,s).then(({textureData:h,timing:m})=>{const v=Nu(),x=new Uint8Array(h.length*4);for(let _=0;_{SJ(c)},NJ)),{timing:m}})}function zJ(n){n._warm||(O_.webgl.isSupported(n),n._warm=!0)}const BJ=O_.webglUtils.resizeWebGLCanvasWithoutClearing;/*! -Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering. -Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE -*/function GJ(){return typeof window>"u"&&(self.window=self),function(n){var e={parse:function(r){var s=e._bin,o=new Uint8Array(r);if(s.readASCII(o,0,4)=="ttcf"){var a=4;s.readUshort(o,a),a+=2,s.readUshort(o,a),a+=2;var l=s.readUint(o,a);a+=4;for(var u=[],c=0;c>>o&1&&s++;return s},e._lctf.readClassDef=function(r,s){var o=e._bin,a=[],l=o.readUshort(r,s);if(s+=2,l==1){var u=o.readUshort(r,s);s+=2;var c=o.readUshort(r,s);s+=2;for(var f=0;f0&&(l.featureParams=a+u);var c=o.readUshort(r,s);s+=2,l.tab=[];for(var f=0;f255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[s])},e.CFF.readEncoding=function(r,s,o){e._bin;var a=[".notdef"],l=r[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var u=r[s];s++;for(var c=0;c>4,y=15&_;if(g!=15&&x.push(g),y!=15&&x.push(y),y==15)break}for(var w="",E=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],M=0;M=u.xMax||u.yMin>=u.yMax)return null;if(u.noc>0){u.endPts=[];for(var c=0;c=1&&c.fmt<=2){h=l.readUshort(r,o),o+=2;var v=l.readUshort(r,o);o+=2,m=e._lctf.numOfOnes(h);var x=e._lctf.numOfOnes(v);if(c.fmt==1){c.pairsets=[];var _=l.readUshort(r,o);o+=2;for(var g=0;g<_;g++){var y=u+l.readUshort(r,o);o+=2;var w=l.readUshort(r,y);y+=2;for(var E=[],M=0;M=1&&c.fmt<=2){if(c.fmt==1)c.delta=l.readShort(r,o),o+=2;else if(c.fmt==2){var h=l.readUshort(r,o);o+=2,c.newg=l.readUshorts(r,o,h),o+=2*c.newg.length}}else if(s==4){c.vals=[],h=l.readUshort(r,o),o+=2;for(var m=0;m>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;s=e.kern.readFormat0(r,s,f)}return f},e.kern.parseV1=function(r,s,o,a){var l=e._bin;l.readFixed(r,s),s+=4;var u=l.readUint(r,s);s+=4;for(var c={glyph1:[],rval:[]},f=0;f>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;s=e.kern.readFormat0(r,s,c)}return c},e.kern.readFormat0=function(r,s,o){var a=e._bin,l=-1,u=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2;for(var c=0;c=l.map.length?0:l.map[s];if(l.format==4){for(var u=-1,c=0;cs?0:65535&(l.idRangeOffset[u]!=0?l.glyphIdArray[s-l.startCount[u]+(l.idRangeOffset[u]>>1)-(l.idRangeOffset.length-u)]:s+l.idDelta[u])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(c=0;c-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,s,o))},e.U._simpleGlyph=function(r,s){for(var o=0;ol)){for(var _=!0,g=0,y=0;yl)){for(_=!0,y=0;y>1,u.length=0,f=!0;else if(F=="o3"||F=="o23")u.length%2!=0&&!f&&(h=u.shift()+a.nominalWidthX),c+=u.length>>1,u.length=0,f=!0;else if(F=="o4")u.length>1&&!f&&(h=u.shift()+a.nominalWidthX,f=!0),m&&e.U.P.closePath(l),_+=u.pop(),e.U.P.moveTo(l,x,_),m=!0;else if(F=="o5")for(;u.length>0;)x+=u.shift(),_+=u.shift(),e.U.P.lineTo(l,x,_);else if(F=="o6"||F=="o7")for(var B=u.length,j=F=="o6",q=0;qMath.abs(P-_)?x=C+u.shift():_=P+u.shift(),e.U.P.curveTo(l,g,y,w,E,A,L),e.U.P.curveTo(l,M,b,C,P,x,_));else if(F=="o14"){if(u.length>0&&!f&&(h=u.shift()+o.nominalWidthX,f=!0),u.length==4){var I=u.shift(),O=u.shift(),k=u.shift(),U=u.shift(),z=e.CFF.glyphBySE(o,k),Q=e.CFF.glyphBySE(o,U);e.U._drawCFF(o.CharStrings[z],s,o,a,l),s.x=I,s.y=O,e.U._drawCFF(o.CharStrings[Q],s,o,a,l)}m&&(e.U.P.closePath(l),m=!1)}else if(F=="o19"||F=="o20")u.length%2!=0&&!f&&(h=u.shift()+a.nominalWidthX),c+=u.length>>1,u.length=0,f=!0,v+=c+7>>3;else if(F=="o21")u.length>2&&!f&&(h=u.shift()+a.nominalWidthX,f=!0),_+=u.pop(),x+=u.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,x,_),m=!0;else if(F=="o22")u.length>1&&!f&&(h=u.shift()+a.nominalWidthX,f=!0),x+=u.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,x,_),m=!0;else if(F=="o25"){for(;u.length>6;)x+=u.shift(),_+=u.shift(),e.U.P.lineTo(l,x,_);g=x+u.shift(),y=_+u.shift(),w=g+u.shift(),E=y+u.shift(),x=w+u.shift(),_=E+u.shift(),e.U.P.curveTo(l,g,y,w,E,x,_)}else if(F=="o26")for(u.length%2&&(x+=u.shift());u.length>0;)g=x,y=_+u.shift(),x=w=g+u.shift(),_=(E=y+u.shift())+u.shift(),e.U.P.curveTo(l,g,y,w,E,x,_);else if(F=="o27")for(u.length%2&&(_+=u.shift());u.length>0;)y=_,w=(g=x+u.shift())+u.shift(),E=y+u.shift(),x=w+u.shift(),_=E,e.U.P.curveTo(l,g,y,w,E,x,_);else if(F=="o10"||F=="o29"){var J=F=="o10"?a:o;if(u.length==0)console.debug("error: empty stack");else{var te=u.pop(),se=J.Subrs[te+J.Bias];s.x=x,s.y=_,s.nStems=c,s.haveWidth=f,s.width=h,s.open=m,e.U._drawCFF(se,s,o,a,l),x=s.x,_=s.y,c=s.nStems,f=s.haveWidth,h=s.width,m=s.open}}else if(F=="o30"||F=="o31"){var ne=u.length,fe=(W=0,F=="o31");for(W+=ne-(B=-3&ne);W>>1|(21845&m)<<1;v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4,h[m]=((65280&v)>>>8|(255&v)<<8)>>>1}var x=function(F,B,j){for(var q=F.length,V=0,W=new t(B);V>>k]=U}return I},_=new e(288);for(m=0;m<144;++m)_[m]=8;for(m=144;m<256;++m)_[m]=9;for(m=256;m<280;++m)_[m]=7;for(m=280;m<288;++m)_[m]=8;var g=new e(32);for(m=0;m<32;++m)g[m]=5;var y=x(_,9),w=x(g,5),E=function(F){for(var B=F[0],j=1;jB&&(B=F[j]);return B},M=function(F,B,j){var q=B/8|0;return(F[q]|F[q+1]<<8)>>(7&B)&j},b=function(F,B){var j=B/8|0;return(F[j]|F[j+1]<<8|F[j+2]<<16)>>(7&B)},C=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],P=function(F,B,j){var q=new Error(B||C[F]);if(q.code=F,Error.captureStackTrace&&Error.captureStackTrace(q,P),!j)throw q;return q},A=function(F,B,j){var q=F.length;if(!q||j&&!j.l&&q<5)return B||new e(0);var V=!B||j,W=!j||j.i;j||(j={}),B||(B=new e(3*q));var I,O=function(Le){var Fe=B.length;if(Le>Fe){var it=new e(Math.max(2*Fe,Le));it.set(B),B=it}},k=j.f||0,U=j.p||0,z=j.b||0,Q=j.l,J=j.d,te=j.m,se=j.n,ne=8*q;do{if(!Q){j.f=k=M(F,U,1);var fe=M(F,U+1,3);if(U+=3,!fe){var Ie=F[(ge=((I=U)/8|0)+(7&I&&1)+4)-4]|F[ge-3]<<8,Ue=ge+Ie;if(Ue>q){W&&P(0);break}V&&O(z+Ie),B.set(F.subarray(ge,Ue),z),j.b=z+=Ie,j.p=U=8*Ue;continue}if(fe==1)Q=y,J=w,te=9,se=5;else if(fe==2){var he=M(F,U,31)+257,H=M(F,U+10,15)+4,ae=he+M(F,U+5,31)+1;U+=14;for(var le=new e(ae),me=new e(19),ce=0;ce>>4)<16)le[ce++]=ge;else{var je=0,X=0;for(ge==16?(X=3+M(F,U,3),U+=2,je=le[ce-1]):ge==17?(X=3+M(F,U,7),U+=3):ge==18&&(X=11+M(F,U,127),U+=7);X--;)le[ce++]=je}}var G=le.subarray(0,he),ie=le.subarray(he);te=E(G),se=E(ie),Q=x(G,te),J=x(ie,se)}else P(1);if(U>ne){W&&P(0);break}}V&&O(z+131072);for(var Re=(1<>>4;if((U+=15&je)>ne){W&&P(0);break}if(je||P(2),Ve<256)B[z++]=Ve;else{if(Ve==256){be=U,Q=null;break}var ke=Ve-254;if(Ve>264){var xe=r[ce=Ve-257];ke=M(F,U,(1<>>4;if(Ne||P(3),U+=15&Ne,ie=f[Ye],Ye>3&&(xe=s[Ye],ie+=b(F,U)&(1<ne){W&&P(0);break}V&&O(z+131072);for(var Be=z+ke;zLe.length)&&(it=Le.length);var gt=new(Le instanceof t?t:Le instanceof i?i:e)(it-Fe);return gt.set(Le.subarray(Fe,it)),gt}(B,0,z)},L=new e(0),N=typeof TextDecoder<"u"&&new TextDecoder;try{N.decode(L,{stream:!0})}catch{}return n.convert_streams=function(F){var B=new DataView(F),j=0;function q(){var he=B.getUint16(j);return j+=2,he}function V(){var he=B.getUint32(j);return j+=4,he}function W(he){Ie.setUint16(Ue,he),Ue+=2}function I(he){Ie.setUint32(Ue,he),Ue+=4}for(var O={signature:V(),flavor:V(),length:V(),numTables:q(),reserved:q(),totalSfntSize:V(),majorVersion:q(),minorVersion:q(),metaOffset:V(),metaLength:V(),metaOrigLength:V(),privOffset:V(),privLength:V()},k=0;Math.pow(2,k)<=O.numTables;)k++;k--;for(var U=16*Math.pow(2,k),z=16*O.numTables-U,Q=12,J=[],te=0;te{let[L,N]=A.split("+");L=parseInt(L,36),N=N?parseInt(N,36):0,c.set(P+=L,b[C]);for(let F=N;F--;)c.set(++P,b[C])})}}return c.get(M)||u}const h=1,m=2,v=3,x=4,_=[null,"isol","init","fina","medi"];function g(M){const b=new Uint8Array(M.length);let C=u,P=h,A=-1;for(let L=0;L65535&&L++)}return b}function y(M,b){const C=[];for(let A=0;A65535&&A++,C.push(n.U.codeToGlyph(M,L))}const P=M.GSUB;if(P){const{lookupList:A,featureList:L}=P;let N;const F=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,B=[];L.forEach(j=>{if(F.test(j.tag))for(let q=0;q{if(U!==-1){let Q=b[U];if(!Q){const{cmds:J,crds:te}=n.U.glyphToPath(M,U);let se="",ne=0;for(let H=0,ae=J.length;H1?",":"")+te[ne++]}let fe,Ie,Ue,he;if(te.length){fe=Ie=1/0,Ue=he=-1/0;for(let H=0,ae=te.length;HUe&&(Ue=le),me>he&&(he=me)}}else fe=Ue=Ie=he=0;Q=b[U]={index:U,advanceWidth:M.hmtx.aWidth[U],xMin:fe,yMin:Ie,xMax:Ue,yMax:he,path:se,pathCommandCount:J.length}}k!==-1&&(V+=n.U.getPairAdjustment(M,k,U)*W),q.call(null,Q,V,O),Q.advanceWidth&&(V+=Q.advanceWidth*W),j&&(V+=j*B),k=U}O+=F.codePointAt(O)>65535?2:1}),V}};return N}return function(b){const C=new Uint8Array(b,0,4),P=n._bin.readASCII(C,0,4);if(P==="wOFF")b=e(b);else if(P==="wOF2")throw new Error("woff2 fonts not supported");return E(n.parse(b)[0])}}const WJ=Lm({name:"Typr Font Parser",dependencies:[GJ,VJ,HJ],init(n,e,t){const i=n(),r=e();return t(i,r)}}),Tf={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},jJ=new Ze;function Qc(){return(self.performance||Date).now()}const kL=Object.create(null);function yF(n,e){n=YJ({},n);const t=Qc();if(n.font=qJ(n.font||Tf.defaultFontURL),n.text=""+n.text,n.sdfGlyphSize=n.sdfGlyphSize||Tf.sdfGlyphSize,n.colorRanges!=null){let f={};for(let h in n.colorRanges)if(n.colorRanges.hasOwnProperty(h)){let m=n.colorRanges[h];typeof m!="number"&&(m=jJ.set(m).getHex()),f[h]=m}n.colorRanges=f}Object.freeze(n);const{textureWidth:i,sdfExponent:r}=Tf,{sdfGlyphSize:s}=n,o=i/s*4;let a=kL[s];if(!a){const f=document.createElement("canvas");f.width=i,f.height=s*256/o,a=kL[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:f,sdfTexture:new Bn(f,void 0,void 0,void 0,An,An),contextLost:!1,glyphsByFont:new Map},a.sdfTexture.generateMipmaps=!1,XJ(a)}const{sdfTexture:l,sdfCanvas:u}=a;let c=a.glyphsByFont.get(n.font);c||a.glyphsByFont.set(n.font,c=new Map),ZJ(n).then(f=>{const{glyphIds:h,glyphPositions:m,fontSize:v,unitsPerEm:x,timings:_}=f,g=[],y=new Float32Array(h.length*4),w=v/x;let E=0,M=0;const b=Qc();h.forEach((N,F)=>{let B=c.get(N);if(!B){const{path:W,pathBounds:I}=f.glyphData[N],O=Math.max(I[2]-I[0],I[3]-I[1])/s*(Tf.sdfMargin*s+.5),k=a.glyphCount++,U=[I[0]-O,I[1]-O,I[2]+O,I[3]+O];c.set(N,B={path:W,atlasIndex:k,sdfViewBox:U}),g.push(B)}const{sdfViewBox:j}=B,q=m[M++],V=m[M++];y[E++]=q+j[0]*w,y[E++]=V+j[1]*w,y[E++]=q+j[2]*w,y[E++]=V+j[3]*w,h[F]=B.atlasIndex}),_.quads=(_.quads||0)+(Qc()-b);const C=Qc();_.sdf={};const P=u.height,A=Math.ceil(a.glyphCount/o),L=Math.pow(2,Math.ceil(Math.log2(A*s)));L>P&&(console.info(`Increasing SDF texture size ${P}->${L}`),BJ(u,i,L),l.dispose()),Promise.all(g.map(N=>_F(N,a,n.gpuAccelerateSDF).then(({timing:F})=>{_.sdf[N.atlasIndex]=F}))).then(()=>{g.length&&!a.contextLost&&(xF(a),l.needsUpdate=!0),_.sdfTotal=Qc()-C,_.total=Qc()-t,e(Object.freeze({parameters:n,sdfTexture:l,sdfGlyphSize:s,sdfExponent:r,glyphBounds:y,glyphAtlasIndices:h,glyphColors:f.glyphColors,caretPositions:f.caretPositions,caretHeight:f.caretHeight,chunkedBounds:f.chunkedBounds,ascender:f.ascender,descender:f.descender,lineHeight:f.lineHeight,capHeight:f.capHeight,xHeight:f.xHeight,topBaseline:f.topBaseline,blockBounds:f.blockBounds,visibleBounds:f.visibleBounds,timings:f.timings}))})}),Promise.resolve().then(()=>{a.contextLost||zJ(u)})}function _F({path:n,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:i,sdfCanvas:r,contextLost:s},o){if(s)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:l}=Tf,u=Math.max(t[2]-t[0],t[3]-t[1]),c=Math.floor(e/4),f=c%(a/i)*i,h=Math.floor(c/(a/i))*i,m=e%4;return DJ(i,i,n,t,u,l,r,f,h,m,o)}function XJ(n){const e=n.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),n.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),n.contextLost=!1;const i=[];n.glyphsByFont.forEach(r=>{r.forEach(s=>{i.push(_F(s,n,!0))})}),Promise.all(i).then(()=>{xF(n),n.sdfTexture.needsUpdate=!0})})}function $J({font:n,characters:e,sdfGlyphSize:t},i){let r=Array.isArray(e)?e.join(` -`):""+e;yF({font:n,sdfGlyphSize:t,text:r},i)}function YJ(n,e){for(let t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}let V0;function qJ(n){return V0||(V0=typeof document>"u"?{}:document.createElement("a")),V0.href=n,V0.href}function xF(n){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=n,{width:i,height:r}=e,s=n.sdfCanvas.getContext("webgl");let o=t.image.data;(!o||o.length!==i*r*4)&&(o=new Uint8Array(i*r*4),t.image={width:i,height:r,data:o},t.flipY=!1,t.isDataTexture=!0),s.readPixels(0,0,i,r,s.RGBA,s.UNSIGNED_BYTE,o)}}const KJ=Lm({name:"Typesetter",dependencies:[Tf,WJ,IJ,MJ],init(n,e,t,i){const{defaultFontURL:r}=n;return t(e,i(),{defaultFontURL:r})}}),ZJ=Lm({name:"Typesetter",dependencies:[KJ],init(n){return function(e){return new Promise(t=>{n.typeset(e,t)})}},getTransferables(n){const e=[n.glyphPositions.buffer,n.glyphIds.buffer];return n.caretPositions&&e.push(n.caretPositions.buffer),n.glyphColors&&e.push(n.glyphColors.buffer),e}}),NL={};function QJ(n){let e=NL[n];if(!e){const t=new Ul(1,1,n,n),i=t.clone(),r=t.attributes,s=i.attributes,o=new Ct,a=r.uv.count;for(let l=0;l{o.setAttribute(l,new at([...r[l].array,...s[l].array],r[l].itemSize))}),o.setIndex([...t.index.array,...i.index.array.map(l=>l+a)]),o.translate(.5,.5,0),e=NL[n]=o}return e}const JJ="aTroikaGlyphBounds",FL="aTroikaGlyphIndex",eee="aTroikaGlyphColor";class tee extends _T{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new ss,this.boundingBox=new rs}computeBoundingSphere(){}computeBoundingBox(){}setSide(e){const t=this.getIndex().count;this.setDrawRange(e===Ji?t/2:0,e===On?t:t/2)}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=QJ(e);["position","normal","uv"].forEach(i=>{this.attributes[i]=t.attributes[i].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,i,r,s){yw(this,JJ,e,4),yw(this,FL,t,1),yw(this,eee,s,3),this._blockBounds=i,this._chunkedBounds=r,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:i}=this;if(t){const{PI:r,floor:s,min:o,max:a,sin:l,cos:u}=Math,c=r/2,f=r*2,h=Math.abs(t),m=e[0]/h,v=e[2]/h,x=s((m+c)/f)!==s((v+c)/f)?-h:o(l(m)*h,l(v)*h),_=s((m-c)/f)!==s((v-c)/f)?h:a(l(m)*h,l(v)*h),g=s((m+r)/f)!==s((v+r)/f)?h*2:a(h-u(m)*h,h-u(v)*h);i.min.set(x,e[1],t<0?-g:0),i.max.set(_,e[3],t<0?0:g)}else i.min.set(e[0],e[1],0),i.max.set(e[2],e[3],0);i.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(FL).count,i=this._chunkedBounds;if(i)for(let r=i.length;r--;){t=i[r].end;let s=i[r].rect;if(s[1]e.y&&s[0]e.x)break}this.instanceCount=t}}function yw(n,e,t,i){const r=n.getAttribute(e);t?r&&r.array.length===t.length?(r.array.set(t),r.needsUpdate=!0):(n.setAttribute(e,new ju(t,i)),delete n._maxInstanceCount,n.dispose()):r&&n.deleteAttribute(e)}const nee=` -uniform vec2 uTroikaSDFTextureSize; -uniform float uTroikaSDFGlyphSize; -uniform vec4 uTroikaTotalBounds; -uniform vec4 uTroikaClipRect; -uniform mat3 uTroikaOrient; -uniform bool uTroikaUseGlyphColors; -uniform float uTroikaDistanceOffset; -uniform float uTroikaBlurRadius; -uniform vec2 uTroikaPositionOffset; -uniform float uTroikaCurveRadius; -attribute vec4 aTroikaGlyphBounds; -attribute float aTroikaGlyphIndex; -attribute vec3 aTroikaGlyphColor; -varying vec2 vTroikaGlyphUV; -varying vec4 vTroikaTextureUVBounds; -varying float vTroikaTextureChannel; -varying vec3 vTroikaGlyphColor; -varying vec2 vTroikaGlyphDimensions; -`,iee=` -vec4 bounds = aTroikaGlyphBounds; -bounds.xz += uTroikaPositionOffset.x; -bounds.yw -= uTroikaPositionOffset.y; - -vec4 outlineBounds = vec4( - bounds.xy - uTroikaDistanceOffset - uTroikaBlurRadius, - bounds.zw + uTroikaDistanceOffset + uTroikaBlurRadius -); -vec4 clippedBounds = vec4( - clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw), - clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw) -); - -vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy); - -position.xy = mix(bounds.xy, bounds.zw, clippedXY); - -uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy); - -float rad = uTroikaCurveRadius; -if (rad != 0.0) { - float angle = position.x / rad; - position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad); - normal.xz = vec2(sin(angle), cos(angle)); -} - -position = uTroikaOrient * position; -normal = uTroikaOrient * normal; - -vTroikaGlyphUV = clippedXY.xy; -vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]); - - -float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize; -vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize; -vec2 txStartUV = txUvPerSquare * vec2( - mod(floor(aTroikaGlyphIndex / 4.0), txCols), - floor(floor(aTroikaGlyphIndex / 4.0) / txCols) -); -vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare); -vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0); -`,ree=` -uniform sampler2D uTroikaSDFTexture; -uniform vec2 uTroikaSDFTextureSize; -uniform float uTroikaSDFGlyphSize; -uniform float uTroikaSDFExponent; -uniform float uTroikaDistanceOffset; -uniform float uTroikaFillOpacity; -uniform float uTroikaOutlineOpacity; -uniform float uTroikaBlurRadius; -uniform vec3 uTroikaStrokeColor; -uniform float uTroikaStrokeWidth; -uniform float uTroikaStrokeOpacity; -uniform bool uTroikaSDFDebug; -varying vec2 vTroikaGlyphUV; -varying vec4 vTroikaTextureUVBounds; -varying float vTroikaTextureChannel; -varying vec2 vTroikaGlyphDimensions; - -float troikaSdfValueToSignedDistance(float alpha) { - // Inverse of exponential encoding in webgl-sdf-generator - - float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y); - float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension; - float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0); - return signedDist; -} - -float troikaGlyphUvToSdfValue(vec2 glyphUV) { - vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV); - vec4 rgba = texture2D(uTroikaSDFTexture, textureUV); - float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1 - return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a; -} - -float troikaGlyphUvToDistance(vec2 uv) { - return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv)); -} - -float troikaGetAADist() { - - #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300 - return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5; - #else - return vTroikaGlyphDimensions.x / 64.0; - #endif -} - -float troikaGetFragDistValue() { - vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize); - float distance = troikaGlyphUvToDistance(clampedGlyphUV); - - // Extrapolate distance when outside bounds: - distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : - length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions); - - - - return distance; -} - -float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) { - #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL) - float alpha = step(-distanceOffset, -distance); - #else - - float alpha = smoothstep( - distanceOffset + aaDist, - distanceOffset - aaDist, - distance - ); - #endif - - return alpha; -} -`,see=` -float aaDist = troikaGetAADist(); -float fragDistance = troikaGetFragDistValue(); -float edgeAlpha = uTroikaSDFDebug ? - troikaGlyphUvToSdfValue(vTroikaGlyphUV) : - troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius)); - -#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL) -vec4 fillRGBA = gl_FragColor; -fillRGBA.a *= uTroikaFillOpacity; -vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity); -if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb; -gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep( - -uTroikaStrokeWidth - aaDist, - -uTroikaStrokeWidth + aaDist, - fragDistance -)); -gl_FragColor.a *= edgeAlpha; -#endif - -if (edgeAlpha == 0.0) { - discard; -} -`;function oee(n){const e=NE(n,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Pe},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Kt(0,0,0,0)},uTroikaClipRect:{value:new Kt(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Pe},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Ze},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Pt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:nee,vertexTransform:iee,fragmentDefs:ree,fragmentColorTransform:see,customRewriter({vertexShader:t,fragmentShader:i}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(i)&&(i=i.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(t)||(t=t.replace(gF,`uniform vec3 diffuse; -$& -vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; -`))),{vertexShader:t,fragmentShader:i}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const E2=new Ra({color:16777215,side:On,transparent:!0}),zL=8421504,BL=new xt,H0=new $,_w=new $,bd=[],aee=new $,xw="+x+y";function GL(n){return Array.isArray(n)?n[0]:n}let wF=()=>{const n=new Nn(new Ul(1,1),E2);return wF=()=>n,n},SF=()=>{const n=new Nn(new Ul(1,1,32,1),E2);return SF=()=>n,n};const lee={type:"syncstart"},uee={type:"synccomplete"},EF=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],cee=EF.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let MF=class extends Nn{constructor(){const e=new tee;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=zL,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=xw,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(lee),yF({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const i=this._queuedSyncs;i&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{i.forEach(r=>r&&r())})),this.dispatchEvent(uee),e&&e()})))}onBeforeRender(e,t,i,r,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s),s._hadOwnSide=s.hasOwnProperty("side"),this.geometry.setSide(s._actualSide=s.side),s.side=ko}onAfterRender(e,t,i,r,s,o){s._hadOwnSide?s.side=s._actualSide:delete s.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=E2.clone());if((!e||e.baseMaterial!==t)&&(e=this._derivedMaterial=oee(t),t.addEventListener("dispose",function i(){t.removeEventListener("dispose",i),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let i=e._outlineMtl;return i||(i=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),i.isTextOutlineMaterial=!0,i.depthWrite=!1,i.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),i.dispose()})),[i,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return GL(this.material).getDepthMaterial()}get customDistanceMaterial(){return GL(this.material).getDistanceMaterial()}_prepareForRender(e){const t=e.isTextOutlineMaterial,i=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:a,blockBounds:l}=r;i.uTroikaSDFTexture.value=a,i.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),i.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,i.uTroikaSDFExponent.value=r.sdfExponent,i.uTroikaTotalBounds.value.fromArray(l),i.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let u=0,c=0,f=0,h,m,v,x=0,_=0;if(t){let{outlineWidth:y,outlineOffsetX:w,outlineOffsetY:E,outlineBlur:M,outlineOpacity:b}=this;u=this._parsePercent(y)||0,c=Math.max(0,this._parsePercent(M)||0),h=b,x=this._parsePercent(w)||0,_=this._parsePercent(E)||0}else f=Math.max(0,this._parsePercent(this.strokeWidth)||0),f&&(v=this.strokeColor,i.uTroikaStrokeColor.value.set(v??zL),m=this.strokeOpacity,m==null&&(m=1)),h=this.fillOpacity;i.uTroikaDistanceOffset.value=u,i.uTroikaPositionOffset.value.set(x,_),i.uTroikaBlurRadius.value=c,i.uTroikaStrokeWidth.value=f,i.uTroikaStrokeOpacity.value=m,i.uTroikaFillOpacity.value=h??1,i.uTroikaCurveRadius.value=this.curveRadius||0;let g=this.clipRect;if(g&&Array.isArray(g)&&g.length===4)i.uTroikaClipRect.value.fromArray(g);else{const y=(this.fontSize||.1)*100;i.uTroikaClipRect.value.set(l[0]-y,l[1]-y,l[2]+y,l[3]+y)}this.geometry.applyClipRect(i.uTroikaClipRect.value)}i.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new Ze;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||xw;if(o!==e._orientation){let a=i.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let l=o!==xw&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,u,c,f,h]=l;H0.set(0,0,0)[c]=u==="-"?1:-1,_w.set(0,0,0)[h]=f==="-"?-1:1,BL.lookAt(aee,H0.cross(_w),_w),a.setFromMatrix4(BL)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),i=t?parseFloat(t[1]):NaN;e=(isNaN(i)?0:i/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new Pe){t.copy(e);const i=this.curveRadius;return i&&(t.x=Math.atan2(e.x,Math.abs(i)-Math.abs(e.z))*Math.abs(i)),t}worldPositionToTextCoords(e,t=new Pe){return H0.copy(e),this.localPositionToTextCoords(this.worldToLocal(H0),t)}raycast(e,t){const{textRenderInfo:i,curveRadius:r}=this;if(i){const s=i.blockBounds,o=r?SF():wF(),a=o.geometry,{position:l,uv:u}=a.attributes;for(let c=0;c{this[i]=e[i]}),this}clone(){return new this.constructor().copy(this)}};EF.forEach(n=>{const e="_private_"+n;Object.defineProperty(MF.prototype,n,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});const fee=Y.forwardRef(({sdfGlyphSize:n=64,anchorX:e="center",anchorY:t="middle",font:i,fontSize:r=1,children:s,characters:o,onSync:a,...l},u)=>{const c=ui(({invalidate:v})=>v),[f]=Y.useState(()=>new MF),[h,m]=Y.useMemo(()=>{const v=[];let x="";return Y.Children.forEach(s,_=>{typeof _=="string"||typeof _=="number"?x+=_:v.push(_)}),[v,x]},[s]);return i9(()=>new Promise(v=>$J({font:i,characters:o},v)),["troika-text",i,o]),Y.useLayoutEffect(()=>void f.sync(()=>{c(),a&&a(f)})),Y.useEffect(()=>()=>f.dispose(),[f]),Y.createElement("primitive",qu({object:f,ref:u,font:i,text:m,anchorX:e,anchorY:t,fontSize:r,sdfGlyphSize:n},l),h)});/*! - * camera-controls - * https://github.com/yomotsu/camera-controls - * (c) 2017 @yomotsu - * Released under the MIT License. - */const In={LEFT:1,RIGHT:2,MIDDLE:4},Ae=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Jc={NONE:0,IN:1,OUT:-1};function fu(n){return n.isPerspectiveCamera}function Ja(n){return n.isOrthographicCamera}const ef=Math.PI*2,VL=Math.PI/2,TF=1e-5,Ad=Math.PI/180;function Xs(n,e,t){return Math.max(e,Math.min(t,n))}function _n(n,e=TF){return Math.abs(n)0==m>c&&(m=c,t.value=(m-c)/s),m}function WL(n,e,t,i,r=1/0,s,o){i=Math.max(1e-4,i);const a=2/i,l=a*s,u=1/(1+l+.48*l*l+.235*l*l*l);let c=e.x,f=e.y,h=e.z,m=n.x-c,v=n.y-f,x=n.z-h;const _=c,g=f,y=h,w=r*i,E=w*w,M=m*m+v*v+x*x;if(M>E){const q=Math.sqrt(M);m=m/q*w,v=v/q*w,x=x/q*w}c=n.x-m,f=n.y-v,h=n.z-x;const b=(t.x+a*m)*s,C=(t.y+a*v)*s,P=(t.z+a*x)*s;t.x=(t.x-a*b)*u,t.y=(t.y-a*C)*u,t.z=(t.z-a*P)*u,o.x=c+(m+b)*u,o.y=f+(v+C)*u,o.z=h+(x+P)*u;const A=_-n.x,L=g-n.y,N=y-n.z,F=o.x-_,B=o.y-g,j=o.z-y;return A*F+L*B+N*j>0&&(o.x=_,o.y=g,o.z=y,t.x=(o.x-_)/s,t.y=(o.y-g)/s,t.z=(o.z-y)/s),o}function ww(n,e){e.set(0,0),n.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=n.length,e.y/=n.length}function Sw(n,e){return Ja(n)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}let hee=class{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s{},this._enabled=!0,this._state=Ae.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Jc.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new vt.Vector3,this._focalOffsetVelocity=new vt.Vector3,this._zoomVelocity={value:0},this._truckInternal=(g,y,w)=>{let E,M;if(fu(this._camera)){const b=Rt.copy(this._camera.position).sub(this._target),C=this._camera.getEffectiveFOV()*Ad,P=b.length()*Math.tan(C*.5);E=this.truckSpeed*g*P/this._elementRect.height,M=this.truckSpeed*y*P/this._elementRect.height}else if(Ja(this._camera)){const b=this._camera;E=g*(b.right-b.left)/b.zoom/this._elementRect.width,M=y*(b.top-b.bottom)/b.zoom/this._elementRect.height}else return;this.verticalDragToForward?(w?this.setFocalOffset(this._focalOffsetEnd.x+E,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(E,0,!0),this.forward(-M,!0)):w?this.setFocalOffset(this._focalOffsetEnd.x+E,this._focalOffsetEnd.y+M,this._focalOffsetEnd.z,!0):this.truck(E,M,!0)},this._rotateInternal=(g,y)=>{const w=ef*this.azimuthRotateSpeed*g/this._elementRect.height,E=ef*this.polarRotateSpeed*y/this._elementRect.height;this.rotate(w,E,!0)},this._dollyInternal=(g,y,w)=>{const E=Math.pow(.95,-g*this.dollySpeed),M=this._sphericalEnd.radius,b=this._sphericalEnd.radius*E,C=Xs(b,this.minDistance,this.maxDistance),P=C-b;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(b,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(P,!0),this._dollyToNoClamp(C,!0)):this._dollyToNoClamp(C,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?b:C)-M,this._dollyControlCoord.set(y,w)),this._lastDollyDirection=Math.sign(-g)},this._zoomInternal=(g,y,w)=>{const E=Math.pow(.95,g*this.dollySpeed),M=this._zoom,b=this._zoom*E;this.zoomTo(b,!0),this.dollyToCursor&&(this._changedZoom+=b-M,this._dollyControlCoord.set(y,w))},typeof vt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new vt.Quaternion().setFromUnitVectors(this._camera.up,X0),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=Ae.NONE,this._target=new vt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new vt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new vt.Spherical().setFromVector3(Rt.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new vt.Vector3,new vt.Vector3,new vt.Vector3,new vt.Vector3],this._updateNearPlaneCorners(),this._boundary=new vt.Box3(new vt.Vector3(-1/0,-1/0,-1/0),new vt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new vt.Vector2,this.mouseButtons={left:Ae.ROTATE,middle:Ae.DOLLY,right:Ae.TRUCK,wheel:fu(this._camera)?Ae.DOLLY:Ja(this._camera)?Ae.ZOOM:Ae.NONE},this.touches={one:Ae.TOUCH_ROTATE,two:fu(this._camera)?Ae.TOUCH_DOLLY_TRUCK:Ja(this._camera)?Ae.TOUCH_ZOOM_TRUCK:Ae.NONE,three:Ae.TOUCH_TRUCK};const i=new vt.Vector2,r=new vt.Vector2,s=new vt.Vector2,o=g=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const E=this._domElement.getBoundingClientRect(),M=g.clientX/E.width,b=g.clientY/E.height;if(Mthis._interactiveArea.right||bthis._interactiveArea.bottom)return}const y=g.pointerType!=="mouse"?null:(g.buttons&In.LEFT)===In.LEFT?In.LEFT:(g.buttons&In.MIDDLE)===In.MIDDLE?In.MIDDLE:(g.buttons&In.RIGHT)===In.RIGHT?In.RIGHT:null;if(y!==null){const E=this._findPointerByMouseButton(y);E&&this._disposePointer(E)}if((g.buttons&In.LEFT)===In.LEFT&&this._lockedPointer)return;const w={pointerId:g.pointerId,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:y};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,h(g)},a=g=>{g.cancelable&&g.preventDefault();const y=g.pointerId,w=this._lockedPointer||this._findPointerById(y);if(w){if(w.clientX=g.clientX,w.clientY=g.clientY,w.deltaX=g.movementX,w.deltaY=g.movementY,this._state=0,g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(g.buttons&In.LEFT)===In.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(g.buttons&In.MIDDLE)===In.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(g.buttons&In.RIGHT)===In.RIGHT&&(this._state=this._state|this.mouseButtons.right);m()}},l=g=>{const y=this._findPointerById(g.pointerId);if(!(y&&y===this._lockedPointer)){if(y&&this._disposePointer(y),g.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=Ae.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=Ae.NONE;v()}};let u=-1;const c=g=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===Ae.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const b=this._domElement.getBoundingClientRect(),C=g.clientX/b.width,P=g.clientY/b.height;if(Cthis._interactiveArea.right||Pthis._interactiveArea.bottom)return}if(g.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===Ae.ROTATE||this.mouseButtons.wheel===Ae.TRUCK){const b=performance.now();u-b<1e3&&this._getClientRect(this._elementRect),u=b}const y=pee?-1:-3,w=g.deltaMode===1?g.deltaY/y:g.deltaY/(y*10),E=this.dollyToCursor?(g.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,M=this.dollyToCursor?(g.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case Ae.ROTATE:{this._rotateInternal(g.deltaX,g.deltaY),this._isUserControllingRotate=!0;break}case Ae.TRUCK:{this._truckInternal(g.deltaX,g.deltaY,!1),this._isUserControllingTruck=!0;break}case Ae.OFFSET:{this._truckInternal(g.deltaX,g.deltaY,!0),this._isUserControllingOffset=!0;break}case Ae.DOLLY:{this._dollyInternal(-w,E,M),this._isUserControllingDolly=!0;break}case Ae.ZOOM:{this._zoomInternal(-w,E,M),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},f=g=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===zE.ACTION.NONE){const y=g instanceof PointerEvent?g.pointerId:0,w=this._findPointerById(y);w&&this._disposePointer(w),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l);return}g.preventDefault()}},h=g=>{if(!this._enabled)return;if(ww(this._activePointers,br),this._getClientRect(this._elementRect),i.copy(br),r.copy(br),this._activePointers.length>=2){const w=br.x-this._activePointers[1].clientX,E=br.y-this._activePointers[1].clientY,M=Math.sqrt(w*w+E*E);s.set(0,M);const b=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,C=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;r.set(b,C)}if(this._state=0,!g)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in g&&g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(g.buttons&In.LEFT)===In.LEFT&&(this._state=this._state|this.mouseButtons.left),(g.buttons&In.MIDDLE)===In.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&In.RIGHT)===In.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&Ae.ROTATE)===Ae.ROTATE||(this._state&Ae.TOUCH_ROTATE)===Ae.TOUCH_ROTATE||(this._state&Ae.TOUCH_DOLLY_ROTATE)===Ae.TOUCH_DOLLY_ROTATE||(this._state&Ae.TOUCH_ZOOM_ROTATE)===Ae.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&Ae.TRUCK)===Ae.TRUCK||(this._state&Ae.TOUCH_TRUCK)===Ae.TOUCH_TRUCK||(this._state&Ae.TOUCH_DOLLY_TRUCK)===Ae.TOUCH_DOLLY_TRUCK||(this._state&Ae.TOUCH_ZOOM_TRUCK)===Ae.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&Ae.DOLLY)===Ae.DOLLY||(this._state&Ae.TOUCH_DOLLY)===Ae.TOUCH_DOLLY||(this._state&Ae.TOUCH_DOLLY_TRUCK)===Ae.TOUCH_DOLLY_TRUCK||(this._state&Ae.TOUCH_DOLLY_OFFSET)===Ae.TOUCH_DOLLY_OFFSET||(this._state&Ae.TOUCH_DOLLY_ROTATE)===Ae.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&Ae.ZOOM)===Ae.ZOOM||(this._state&Ae.TOUCH_ZOOM)===Ae.TOUCH_ZOOM||(this._state&Ae.TOUCH_ZOOM_TRUCK)===Ae.TOUCH_ZOOM_TRUCK||(this._state&Ae.TOUCH_ZOOM_OFFSET)===Ae.TOUCH_ZOOM_OFFSET||(this._state&Ae.TOUCH_ZOOM_ROTATE)===Ae.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&Ae.OFFSET)===Ae.OFFSET||(this._state&Ae.TOUCH_OFFSET)===Ae.TOUCH_OFFSET||(this._state&Ae.TOUCH_DOLLY_OFFSET)===Ae.TOUCH_DOLLY_OFFSET||(this._state&Ae.TOUCH_ZOOM_OFFSET)===Ae.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},m=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,ww(this._activePointers,br);const y=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,w=y?-y.deltaX:r.x-br.x,E=y?-y.deltaY:r.y-br.y;if(r.copy(br),((this._state&Ae.ROTATE)===Ae.ROTATE||(this._state&Ae.TOUCH_ROTATE)===Ae.TOUCH_ROTATE||(this._state&Ae.TOUCH_DOLLY_ROTATE)===Ae.TOUCH_DOLLY_ROTATE||(this._state&Ae.TOUCH_ZOOM_ROTATE)===Ae.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(w,E),this._isUserControllingRotate=!0),(this._state&Ae.DOLLY)===Ae.DOLLY||(this._state&Ae.ZOOM)===Ae.ZOOM){const M=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,C=this.dollyDragInverted?-1:1;(this._state&Ae.DOLLY)===Ae.DOLLY?(this._dollyInternal(C*E*j0,M,b),this._isUserControllingDolly=!0):(this._zoomInternal(C*E*j0,M,b),this._isUserControllingZoom=!0)}if((this._state&Ae.TOUCH_DOLLY)===Ae.TOUCH_DOLLY||(this._state&Ae.TOUCH_ZOOM)===Ae.TOUCH_ZOOM||(this._state&Ae.TOUCH_DOLLY_TRUCK)===Ae.TOUCH_DOLLY_TRUCK||(this._state&Ae.TOUCH_ZOOM_TRUCK)===Ae.TOUCH_ZOOM_TRUCK||(this._state&Ae.TOUCH_DOLLY_OFFSET)===Ae.TOUCH_DOLLY_OFFSET||(this._state&Ae.TOUCH_ZOOM_OFFSET)===Ae.TOUCH_ZOOM_OFFSET||(this._state&Ae.TOUCH_DOLLY_ROTATE)===Ae.TOUCH_DOLLY_ROTATE||(this._state&Ae.TOUCH_ZOOM_ROTATE)===Ae.TOUCH_ZOOM_ROTATE){const M=br.x-this._activePointers[1].clientX,b=br.y-this._activePointers[1].clientY,C=Math.sqrt(M*M+b*b),P=s.y-C;s.set(0,C);const A=this.dollyToCursor?(r.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(r.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&Ae.TOUCH_DOLLY)===Ae.TOUCH_DOLLY||(this._state&Ae.TOUCH_DOLLY_ROTATE)===Ae.TOUCH_DOLLY_ROTATE||(this._state&Ae.TOUCH_DOLLY_TRUCK)===Ae.TOUCH_DOLLY_TRUCK||(this._state&Ae.TOUCH_DOLLY_OFFSET)===Ae.TOUCH_DOLLY_OFFSET?(this._dollyInternal(P*j0,A,L),this._isUserControllingDolly=!0):(this._zoomInternal(P*j0,A,L),this._isUserControllingZoom=!0)}((this._state&Ae.TRUCK)===Ae.TRUCK||(this._state&Ae.TOUCH_TRUCK)===Ae.TOUCH_TRUCK||(this._state&Ae.TOUCH_DOLLY_TRUCK)===Ae.TOUCH_DOLLY_TRUCK||(this._state&Ae.TOUCH_ZOOM_TRUCK)===Ae.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(w,E,!1),this._isUserControllingTruck=!0),((this._state&Ae.OFFSET)===Ae.OFFSET||(this._state&Ae.TOUCH_OFFSET)===Ae.TOUCH_OFFSET||(this._state&Ae.TOUCH_DOLLY_OFFSET)===Ae.TOUCH_DOLLY_OFFSET||(this._state&Ae.TOUCH_ZOOM_OFFSET)===Ae.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(w,E,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},v=()=>{ww(this._activePointers,br),r.copy(br),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",x),this._domElement.ownerDocument.addEventListener("pointerlockerror",_),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),h())},this.unlockPointer=()=>{var g,y,w;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(g=this._domElement)===null||g===void 0||g.ownerDocument.exitPointerLock(),(y=this._domElement)===null||y===void 0||y.ownerDocument.removeEventListener("pointerlockchange",x),(w=this._domElement)===null||w===void 0||w.ownerDocument.removeEventListener("pointerlockerror",_),this.cancel()};const x=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},_=()=>{this.unlockPointer()};this._addAllEventListeners=g=>{this._domElement=g,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",c,{passive:!1}),this._domElement.addEventListener("contextmenu",f)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",c,{passive:!1}),this._domElement.removeEventListener("contextmenu",f),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("pointerlockchange",x),this._domElement.ownerDocument.removeEventListener("pointerlockerror",_))},this.cancel=()=>{this._state!==Ae.NONE&&(this._state=Ae.NONE,this._activePointers.length=0,v())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=Xs(e.width,0,1),this._interactiveArea.height=Xs(e.height,0,1),this._interactiveArea.x=Xs(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=Xs(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const r=Xs(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=Xs(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=r,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!i||sn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&sn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Jc.NONE,this._changedDolly=0,this._dollyToNoClamp(Xs(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=sn(o,this._spherical.radius);if(!(i>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||sn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Pd).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||sn(this._target.x,this._targetEnd.x,this.restThreshold)&&sn(this._target.y,this._targetEnd.y,this.restThreshold)&&sn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=Xs(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||sn(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),So.setFromMatrixColumn(this._camera.matrix,0),Eo.setFromMatrixColumn(this._camera.matrix,1),So.multiplyScalar(e),Eo.multiplyScalar(-t);const r=Rt.copy(So).add(Eo),s=qt.copy(this._targetEnd).add(r);return this.moveTo(s.x,s.y,s.z,i)}forward(e,t=!1){Rt.setFromMatrixColumn(this._camera.matrix,0),Rt.crossVectors(this._camera.up,Rt),Rt.multiplyScalar(e);const i=qt.copy(this._targetEnd).add(Rt);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return Rt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+Rt.x,this._targetEnd.y+Rt.y,this._targetEnd.z+Rt.z,t)}moveTo(e,t,i,r=!1){this._isUserControllingTruck=!1;const s=Rt.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,r||this._target.copy(this._targetEnd);const o=!r||sn(this._target.x,this._targetEnd.x,this.restThreshold)&&sn(this._target.y,this._targetEnd.y,this.restThreshold)&&sn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,i,r=!1){const a=Rt.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(a.x,a.y,a.z,r)}fitToBox(e,t,{cover:i=!1,paddingLeft:r=0,paddingRight:s=0,paddingBottom:o=0,paddingTop:a=0}={}){const l=[],u=e.isBox3?nf.copy(e):nf.setFromObject(e);u.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const c=HL(this._sphericalEnd.theta,VL),f=HL(this._sphericalEnd.phi,VL);l.push(this.rotateTo(c,f,t));const h=Rt.setFromSpherical(this._sphericalEnd).normalize(),m=qL.setFromUnitVectors(h,Mw),v=sn(Math.abs(h.y),1);v&&m.multiply(bw.setFromAxisAngle(X0,c)),m.multiply(this._yAxisUpSpaceInverse);const x=YL.makeEmpty();qt.copy(u.min).applyQuaternion(m),x.expandByPoint(qt),qt.copy(u.min).setX(u.max.x).applyQuaternion(m),x.expandByPoint(qt),qt.copy(u.min).setY(u.max.y).applyQuaternion(m),x.expandByPoint(qt),qt.copy(u.max).setZ(u.min.z).applyQuaternion(m),x.expandByPoint(qt),qt.copy(u.min).setZ(u.max.z).applyQuaternion(m),x.expandByPoint(qt),qt.copy(u.max).setY(u.min.y).applyQuaternion(m),x.expandByPoint(qt),qt.copy(u.max).setX(u.min.x).applyQuaternion(m),x.expandByPoint(qt),qt.copy(u.max).applyQuaternion(m),x.expandByPoint(qt),x.min.x-=r,x.min.y-=o,x.max.x+=s,x.max.y+=a,m.setFromUnitVectors(Mw,h),v&&m.premultiply(bw.invert()),m.premultiply(this._yAxisUpSpace);const _=x.getSize(Rt),g=x.getCenter(qt).applyQuaternion(m);if(fu(this._camera)){const y=this.getDistanceToFitBox(_.x,_.y,_.z,i);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.dollyTo(y,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(Ja(this._camera)){const y=this._camera,w=y.right-y.left,E=y.top-y.bottom,M=i?Math.max(w/_.x,E/_.y):Math.min(w/_.x,E/_.y);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.zoomTo(M,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const i=[],s=e instanceof vt.Sphere?Tw.copy(e):zE.createBoundingSphere(e,Tw);if(i.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),fu(this._camera)){const o=this.getDistanceToFitSphere(s.radius);i.push(this.dollyTo(o,t))}else if(Ja(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,l=2*s.radius,u=Math.min(o/l,a/l);i.push(this.zoomTo(u,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,r,s,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Jc.NONE,this._changedDolly=0;const l=qt.set(r,s,o),u=Rt.set(e,t,i);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(u.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const c=!a||sn(this._target.x,this._targetEnd.x,this.restThreshold)&&sn(this._target.y,this._targetEnd.y,this.restThreshold)&&sn(this._target.z,this._targetEnd.z,this.restThreshold)&&sn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&sn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&sn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(c)}lerpLookAt(e,t,i,r,s,o,a,l,u,c,f,h,m,v=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Jc.NONE,this._changedDolly=0;const x=Rt.set(r,s,o),_=qt.set(e,t,i);ys.setFromVector3(_.sub(x).applyQuaternion(this._yAxisUpSpace));const g=tf.set(c,f,h),y=qt.set(a,l,u);Ld.setFromVector3(y.sub(g).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(x.lerp(g,m));const w=Ld.theta-ys.theta,E=Ld.phi-ys.phi,M=Ld.radius-ys.radius;this._sphericalEnd.set(ys.radius+M*m,ys.phi+E*m,ys.theta+w*m),this.normalizeRotations(),this._needsUpdate=!0,v||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const b=!v||sn(this._target.x,this._targetEnd.x,this.restThreshold)&&sn(this._target.y,this._targetEnd.y,this.restThreshold)&&sn(this._target.z,this._targetEnd.z,this.restThreshold)&&sn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&sn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&sn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(b)}setPosition(e,t,i,r=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,r)}setTarget(e,t,i,r=!1){const s=this.getPosition(Rt),o=this.setLookAt(s.x,s.y,s.z,e,t,i,r);return this._sphericalEnd.phi=Xs(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,i,r=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,r||this._focalOffset.copy(this._focalOffsetEnd);const s=!r||sn(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&sn(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&sn(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),So.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Eo.setFromMatrixColumn(this._camera.matrixWorldInverse,1),hu.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const r=Rt.set(e,t,i),s=r.distanceTo(this._camera.position),o=r.sub(this._camera.position);So.multiplyScalar(o.x),Eo.multiplyScalar(o.y),hu.multiplyScalar(o.z),Rt.copy(So).add(Eo).add(hu),Rt.z=Rt.z+s,this.dollyTo(s,!1),this.setFocalOffset(-Rt.x,Rt.y,-Rt.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,r){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new vt.Vector4,typeof e=="number"?this._viewport.set(e,t,i,r):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,r=!1){if(Sw(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,o=this._camera.getEffectiveFOV()*Ad,a=this._camera.aspect;return((r?s>a:st.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const r=t.lengthSq();if(r===0)return e;const s=qt.copy(t).add(e),a=this._boundary.clampPoint(s,tf).sub(s),l=a.lengthSq();if(l===0)return e.add(t);if(l===r)return e;if(i===0)return e.add(t).add(a);{const u=1+i*l/t.dot(a);return e.add(qt.copy(t).multiplyScalar(u)).add(a.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(fu(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*Ad,r=Math.tan(i*.5)*t,s=r*e.aspect;this._nearPlaneCorners[0].set(-s,-r,0),this._nearPlaneCorners[1].set(s,-r,0),this._nearPlaneCorners[2].set(s,r,0),this._nearPlaneCorners[3].set(-s,r,0)}else if(Ja(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,r=e.right*t,s=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(i,s,0),this._nearPlaneCorners[1].set(r,s,0),this._nearPlaneCorners[2].set(r,o,0),this._nearPlaneCorners[3].set(i,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Sw(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(Pd);Aw.lookAt(jL,i,this._camera.up);for(let r=0;r<4;r++){const s=qt.copy(this._nearPlaneCorners[r]);s.applyMatrix4(Aw);const o=tf.addVectors(this._target,s);$0.set(o,i),$0.far=this._spherical.radius+1;const a=$0.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new vt.Sphere){const i=t,r=i.center;nf.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&nf.expandByObject(o)}),nf.getCenter(r);let s=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const c=l.attributes.position;for(let f=0,h=c.count;f"u")&&(t[i]=KL[i]);return t.max=e||t.max,t.truncate=="middle"?bF(n,t.max,t.ellipse,t.chars):AF(n,t.max,t.ellipse,t.chars,t.truncate)};k_.exports.ellipsizeMiddle=bF;k_.exports.ellipsize=AF;var mee=k_.exports;const gee=ts(mee),CF=["ctrl","alt","meta","shift"],RF="__0_1_2_3_4_5_6_7_8_9_a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z_ _`_'_\"_~_!_@_#_$_%_^_&_*_(_)_._-_+_=_[_]_{_}_<_>_,_/_?_;_:_\\_|_capslock_numlock_enter_tab_arrowdown_arrowleft_arrowright_arrowup_end_home_pagedown_pageup_backspace_delete_insert_escape_f1_f2_f3_f4_f5_f6_f7_f8_f9_f10_f11_f12_f13_f14_f15_f16_f17_f18_f19_f20_f21_f22_f23".split("_");RF[1]="_";const M2={};for(const[n,e]of RF.entries())M2[e]=n;const vee={space:" ",plus:"+",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",esc:"escape"},T2=4,yee=9,b2=yee+T2,_ee=2**T2,PF=2**b2,xee=2**(2*b2),wee=2**(3*b2);function See(n){let e;return n==="+"?["+"]:(n.slice(-1)=="+"?(e=n.slice(0,-2).split("+"),e.push("+")):e=n.split("+"),e.map(t=>vee[t]||t))}function Eee(n){const e=new Set(n);let t=M2[n[n.length-1].toLowerCase()]||0;for(const i of CF)t=2*t+(e.has(i)?1:0);return t}function ZL(n){return n>>T2}function Cw(n){return n%_ee}function Mee(n,e){if(n===void 0||ZL(n)>0)return!1;const t=Cw(n),i=Cw(e);return t===i&&ZL(e)===0?!1:(t&Cw(e))===t}function Tee(n){let e=M2[n.key.toLowerCase()]||0;for(const t of CF)e=2*e+(n[`${t}Key`]?1:0);return e}function N_(n){return n.map(See)}function F_(n){if(n.length>4)throw"Can't encode sequence of more than 4 keys!";let e=0;for(const t of n)e=e*PF+Eee(t);return e}function bee(n){return n=0;r--)t=2**i*n[r]+t,i=i+13,e.push(t);return e}function Cee(n={}){return{history:[],historySize:0,bindings:new Map,disabledSequenceCodes:new Set,...n}}function Ree(n,e,t){const i=F_(N_(e));return n.bindings.has(i)||n.bindings.set(i,new Set),n.bindings.get(i).add(t),LF(n)}function Pee(n,e,t){const i=F_(N_(e)),r=n.bindings.get(i);return r&&(r.delete(t),r.size==0&&n.bindings.delete(i)),LF(n)}function Lee(n,e){const t=F_(N_(e));return n.disabledSequenceCodes.delete(t),n}function Iee(n,e){const t=F_(N_(e));return n.disabledSequenceCodes.add(t),n}function Dee(n,e){const t=Tee(e),i=n.history.at(-1);return Mee(i,t)&&n.history.pop(),n.history.push(t),n.history.length>n.historySize&&n.history.shift(),n}function Uee(n){const e=[];for(const t of Aee(n.history))n.disabledSequenceCodes.has(t)||e.push(...n.bindings.get(t)||[]);return e}function Oee(n,e){n=Dee(n,e);const t=Uee(n);for(const i of t)i(e);return[n,t]}function LF(n){n.historySize=0;for(const e of n.bindings.keys())n.historySize=Math.max(n.historySize,bee(e));return n}class kee{add(...e){const t=e.slice(0,-1),i=e.at(-1);return this.state=Ree(this.state,t,i),this}remove(...e){const t=e.slice(0,-1),i=e.at(-1);return this.state=Pee(this.state,t,i),this}enable(...e){return this.state=Lee(this.state,e),this}disable(...e){return this.state=Iee(this.state,e),this}handle(e){const[t,i]=Oee(this.state,e);return this.state=t,i.length>0}constructor(e){this.state=e,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.handle=this.handle.bind(this)}}function z_(){return new kee(Cee())}let QL=!1;const A2=z_(),C2=z_(),R2=z_(),IF=new Map;let du=[];const Sl=n=>Array.isArray(n)?n.map(e=>e.toLowerCase()):[n.toLowerCase()],Nee=n=>e=>{const t=e.target,i=t.tagName==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);if(!(t.isContentEditable||(i||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&!t.readOnly))return n(e)},Fee=n=>{(!n.action||n.action==="keypress")&&A2.add(...Sl(n.keys),n.callback),n.action==="keyup"&&C2.add(...Sl(n.keys),n.callback),n.action==="keydown"&&R2.add(...Sl(n.keys),n.callback)},zee=n=>{(!n.action||n.action==="keypress")&&A2.remove(...Sl(n.keys),n.callback),n.action==="keyup"&&C2.remove(...Sl(n.keys),n.callback),n.action==="keydown"&&R2.remove(...Sl(n.keys),n.callback)},Bee=n=>{var e,t,i;const r=z_();r.add(...Sl(n.keys),n.callback),(t=(e=n.ref)==null?void 0:e.current)==null||t.addEventListener(n.action??"keypress",r.handle),IF.set((i=n.ref)==null?void 0:i.current,r)},Gee=n=>{var e,t,i,r;if((e=n.ref)!=null&&e.current&&!n.disabled){const s=IF.get((t=n.ref)==null?void 0:t.current);s.remove(...Sl(n.keys),n.callback),(r=(i=n.ref)==null?void 0:i.current)==null||r.removeEventListener(n.action??"keypress",s.handle)}},P2=(n=[])=>{const[e,t]=Y.useState([]);return Y.useLayoutEffect(()=>{!QL&&window!==void 0&&(window.addEventListener("keypress",A2.handle),window.addEventListener("keyup",C2.handle),window.addEventListener("keydown",R2.handle),QL=!0)},[]),Y.useLayoutEffect(()=>(n.map(i=>{var r;i.disabled||(i.callback=Nee(i.callback),(r=i.ref)!=null&&r.current?(Bee(i),du=[...du,i]):i.ref||(Fee(i),du=[...du,i]))}),()=>{n.map(i=>{Gee(i),zee(i),du=du.filter(r=>i!==r)})}),[n]),Y.useEffect(()=>{t(du)},[]),e};function Vee(){try{return navigator.platform.toUpperCase().indexOf("MAC")>=0}catch{return!1}}function Hee(){return Vee()?"⌘":"CTRL"}Hee();/*! - * hold-event - * https://github.com/yomotsu/hold-event - * (c) 2020 @yomotsu - * Released under the MIT License. - */var lp;(function(n){n.HOLD_START="holdStart",n.HOLD_END="holdEnd",n.HOLDING="holding"})(lp||(lp={}));class Wee{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s{if(!this._enabled||this._holding)return;this._deltaTime=0,this._elapsedTime=0,this._lastTime=performance.now(),this.dispatchEvent({type:lp.HOLD_START,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),this._holding=!0;const i=()=>{this._intervalId=this.holdIntervalDelay?window.setTimeout(i,this.holdIntervalDelay):window.requestAnimationFrame(i);const r=performance.now();this._deltaTime=r-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:lp.HOLDING,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t})};this._intervalId=this.holdIntervalDelay?window.setTimeout(i,this.holdIntervalDelay):window.requestAnimationFrame(i)},this._holdEnd=t=>{if(!this._enabled||!this._holding)return;const i=performance.now();this._deltaTime=i-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:lp.HOLD_END,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),window.clearTimeout(this._intervalId),window.cancelAnimationFrame(this._intervalId),this._holding=!1},this.holdIntervalDelay=e}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._enabled||this._holdEnd())}}class B_ extends jee{constructor(e,t){super(t),this._holdStart=this._holdStart.bind(this),this._holdEnd=this._holdEnd.bind(this);const i=s=>{Xee(s)||s.keyCode===e&&this._holdStart(s)},r=s=>{s.keyCode===e&&this._holdEnd(s)};document.addEventListener("keydown",i),document.addEventListener("keyup",r),window.addEventListener("blur",this._holdEnd)}}function Xee(n){const e=n.target;return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.isContentEditable}var $ee={exports:{}};/*! - Copyright (c) 2018 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var s="",o=0;o-1){const s=[...e.slice(r),i].map(o=>o.data.id);throw new Error(`Invalid Graph: Circular node path detected: ${s.join(" -> ")}.`)}t>i.depth&&(i.depth=t,DF(i.out,[...e,i]))}}function UF(n,e){let t=!1;const i=n.reduce((o,a)=>({...o,[a.id]:{data:a,out:[],depth:-1,ins:[]}}),{});try{for(const o of e){const a=o.source,l=o.target;if(!i.hasOwnProperty(a))throw new Error(`Missing source Node ${a}`);if(!i.hasOwnProperty(l))throw new Error(`Missing target Node ${l}`);const u=i[a],c=i[l];c.ins.push(u),u.out.push(c)}DF(Object.values(i))}catch{t=!0}const r=Object.keys(i).map(o=>i[o].depth),s=Math.max(...r);return{invalid:t,depths:i,maxDepth:s||1}}const t3=["radialin","radialout"];function Yee({nodes:n,edges:e,mode:t="lr",nodeLevelRatio:i=2}){const{depths:r,maxDepth:s,invalid:o}=UF(n,e);if(o)return null;const a=t3.includes(t)?1:5,l=n.length/s*i*a;if(t){const u=(m,v)=>x=>m?(r[x.id].depth-s/2)*l*(v?-1:1):void 0,c=u(["lr","rl"].includes(t),t==="rl"),f=u(["td","bu"].includes(t),t==="td"),h=u(["zin","zout"].includes(t),t==="zout");n.forEach(m=>{m.fx=c(m),m.fy=f(m),m.fz=h(m)})}return t3.includes(t)?Qj(u=>{const c=r[u.id];return(t==="radialin"?s-c.depth:c.depth)*l}).strength(1):null}function qee(n){return new Promise((e,t)=>{let i;function r(){i?e(i):(i=n.step(),r())}r()})}function Im(n){const e=[],t=[];return n.forEachNode((i,r)=>{e.push({...r,id:i,radius:r.size||1})}),n.forEachEdge((i,r)=>{t.push({...r,id:i})}),{nodes:e,edges:t}}function Kee(){const n=V=>()=>V;let t=V=>V.index,i=[],r=[],s,o=[100,100],a=n(1),l=n(-1),u=n(100),c=n(.1),f={},h=.1,m=.001,v=[],x=[0,0],_,g=V=>V.cluster,y="treemap",w=!0,E=.1;function M(V){if(!w)return M;y==="force"&&(_.tick(),F());for(let W=0,I=i.length,O,k=V*E;WW.radius).sort(function(W,I){return I.height-W.height||I.value-W.value}),v=V(s).leaves(),F()}function j(){let V=0;i.length!==0&&r.forEach(function(W){let I,O;if(i){if(I=W.source,O=W.target,typeof W.source!="object"&&(I=i.find(k=>k.id===W.source)),typeof W.target!="object"&&(O=i.find(k=>k.id===W.target)),I===void 0||O===void 0)throw Error("Error setting links, couldnt find nodes for a link (see it on the console)");W.source=I,W.target=O,W.index=V++}})}function q(){let V;!i||!i.length||(j(),V=L(),_=fk(V.nodes).force("x",mE(o[0]/2).strength(.1)).force("y",gE(o[1]/2).strength(.1)).force("collide",rk(W=>W.r).iterations(4)).force("charge",hk().strength(l)).force("links",sk(V.nodes.length?V.links:[]).distance(u).strength(c)),v=_.nodes(),F())}return M.template=function(V){return arguments.length?(y=V,b(),M):y},M.groupBy=function(V){return arguments.length?typeof V=="string"?(g=function(W){return W[V]},M):(g=V,M):g},M.enableGrouping=function(V){return arguments.length?(w=V,M):w},M.strength=function(V){return arguments.length?(E=V,M):E},M.getLinkStrength=function(V){return w?g(V.source)===g(V.target)?typeof h=="function"?h(V):h:typeof m=="function"?m(V):m:typeof h=="function"?h(V):h},M.id=function(V){return arguments.length?(t=V,M):t},M.size=function(V){return arguments.length?(o=V,M):o},M.linkStrengthInterCluster=function(V){return arguments.length?(m=V,M):m},M.linkStrengthIntraCluster=function(V){return arguments.length?(h=V,M):h},M.nodes=function(V){return arguments.length?(i=V,M):i},M.links=function(V){return arguments.length?(V===null?r=[]:r=V,b(),M):r},M.template=function(V){return arguments.length?(y=V,b(),M):y},M.forceNodeSize=function(V){return arguments.length?(a=typeof V=="function"?V:n(+V),b(),M):a},M.nodeSize=M.forceNodeSize,M.forceCharge=function(V){return arguments.length?(l=typeof V=="function"?V:n(+V),b(),M):l},M.forceLinkDistance=function(V){return arguments.length?(u=typeof V=="function"?V:n(+V),b(),M):u},M.forceLinkStrength=function(V){return arguments.length?(c=typeof V=="function"?V:n(+V),b(),M):c},M.offset=function(V){return arguments.length?(x=typeof V=="function"?V:n(+V),M):x},M.getFocis=F,M}function Qa({graph:n,nodeLevelRatio:e=2,mode:t=null,dimensions:i=2,nodeStrength:r=-250,linkDistance:s=50,clusterStrength:o=.5,linkStrengthInterCluster:a=.01,linkStrengthIntraCluster:l=.5,forceLinkDistance:u=100,forceLinkStrength:c=.1,clusterType:f="force",forceCharge:h=-700,getNodePosition:m,drags:v,clusterAttribute:x,forceLayout:_}){const{nodes:g,edges:y}=Im(n),E=i===2&&y.length>25?r*2:r;let M,b;_==="forceDirected2d"?(M=mE(),b=gE()):(M=mE(600).strength(.05),b=gE(600).strength(.05));const C=fk().force("center",G9(0,0)).force("link",sk()).force("charge",hk().strength(E)).force("x",M).force("y",b).force("z",Jj()).force("collide",rk(N=>N.radius+10)).force("dagRadial",Yee({nodes:g,edges:y,mode:t,nodeLevelRatio:e})).stop();let P;if(x){let N=h;if(g!=null&&g.length){const F=Math.ceil(g.length/200);N=h*F}P=Kee().strength(o).template(f).groupBy(F=>F.data[x]).links(y).size([100,100]).linkStrengthInterCluster(a).linkStrengthIntraCluster(l).forceLinkDistance(u).forceLinkStrength(c).forceCharge(N).forceNodeSize(F=>F.radius)}let A=C.numDimensions(i).nodes(g);if(P&&(A=A.force("group",P)),s){let N=A.force("link");N&&(N.id(F=>F.id).links(y).distance(s),P&&(N=N.strength((P==null?void 0:P.getLinkStrength)??.1)))}const L=new Map(g.map(N=>[N.id,N]));return{step(){for(;C.alpha()>.01;)C.tick();return!0},getNodePosition(N){var F,B;if(m){const j=m(N,{graph:n,drags:v,nodes:g,edges:y});if(j)return j}return(F=v==null?void 0:v[N])!=null&&F.position?(B=v==null?void 0:v[N])==null?void 0:B.position:L.get(N)}}}function Zee({graph:n,radius:e,drags:t,getNodePosition:i}){const r=VX(n,{scale:e}),{nodes:s,edges:o}=Im(n);return{step(){return!0},getNodePosition(a){var l,u;if(i){const c=i(a,{graph:n,drags:t,nodes:s,edges:o});if(c)return c}return(l=t==null?void 0:t[a])!=null&&l.position?(u=t==null?void 0:t[a])==null?void 0:u.position:r==null?void 0:r[a]}}}const Qee={td:{x:"x",y:"y",factor:-1},lr:{x:"y",y:"x",factor:1}};function n3({graph:n,drags:e,mode:t="td",nodeSeparation:i=1,nodeSize:r=[50,50],getNodePosition:s}){const{nodes:o,edges:a}=Im(n),{depths:l}=UF(o,a),u=Object.keys(l).map(x=>l[x]),c=MX().id(x=>x.data.id).parentId(x=>{var _,g,y;return(y=(g=(_=x.ins)==null?void 0:_[0])==null?void 0:g.data)==null?void 0:y.id})(u),h=LX().separation(()=>i).nodeSize(r)(y_(c)).descendants(),m=Qee[t],v=new Map(o.map(x=>{const{x:_,y:g}=h.find(y=>y.data.id===x.id);return[x.id,{...x,[m.x]:_*m.factor,[m.y]:g*m.factor,z:0}]}));return{step(){return!0},getNodePosition(x){var _,g;if(s){const y=s(x,{graph:n,drags:e,nodes:o,edges:a});if(y)return y}return(_=e==null?void 0:e[x])!=null&&_.position?(g=e==null?void 0:e[x])==null?void 0:g.position:v.get(x)}}}function Jee({graph:n,margin:e,drags:t,getNodePosition:i,ratio:r,gridSize:s,maxIterations:o}){const{nodes:a,edges:l}=Im(n),u=ZX(n,{maxIterations:o,inputReducer:(c,f)=>({...f,x:f.x||0,y:f.y||0}),settings:{ratio:r,margin:e,gridSize:s}});return{step(){return!0},getNodePosition(c){var f,h;if(i){const m=i(c,{graph:n,drags:t,nodes:a,edges:l});if(m)return m}return(f=t==null?void 0:t[c])!=null&&f.position?(h=t==null?void 0:t[c])==null?void 0:h.position:u==null?void 0:u[c]}}}function ete({graph:n,drags:e,iterations:t,...i}){v$.assign(n);const r=h$(n,{iterations:t,settings:i});return{step(){return!0},getNodePosition(s){var o;return((o=e==null?void 0:e[s])==null?void 0:o.position)||(r==null?void 0:r[s])}}}function tte({graph:n,drags:e,getNodePosition:t}){const{nodes:i,edges:r}=Im(n);return{step(){return!0},getNodePosition(s){return t(s,{graph:n,drags:e,nodes:i,edges:r})}}}const nte=["forceDirected2d","treeTd2d","treeLr2d","radialOut2d","treeTd3d","treeLr3d","radialOut3d","forceDirected3d"];function ite({type:n,...e}){if(nte.includes(n)){const{nodeStrength:t,linkDistance:i,nodeLevelRatio:r}=e;if(n==="forceDirected2d")return Qa({...e,dimensions:2,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:i,forceLayout:n});if(n==="treeTd2d")return Qa({...e,mode:"td",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:i||50,forceLayout:n});if(n==="treeLr2d")return Qa({...e,mode:"lr",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:i||50,forceLayout:n});if(n==="radialOut2d")return Qa({...e,mode:"radialout",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-500,linkDistance:i||100,forceLayout:n});if(n==="treeTd3d")return Qa({...e,mode:"td",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:i||50});if(n==="treeLr3d")return Qa({...e,mode:"lr",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:i||50,forceLayout:n});if(n==="radialOut3d")return Qa({...e,mode:"radialout",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:i||100,forceLayout:n});if(n==="forceDirected3d")return Qa({...e,dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:i,forceLayout:n})}else if(n==="circular2d"){const{radius:t}=e;return Zee({...e,radius:t||300})}else{if(n==="hierarchicalTd")return n3({...e,mode:"td"});if(n==="hierarchicalLr")return n3({...e,mode:"lr"});if(n==="nooverlap"){const{graph:t,maxIterations:i,ratio:r,margin:s,gridSize:o,...a}=e;return Jee({type:"nooverlap",graph:t,margin:s||10,maxIterations:i||50,ratio:r||10,gridSize:o||20,...a})}else if(n==="forceatlas2"){const{graph:t,iterations:i,gravity:r,scalingRatio:s,...o}=e;return ete({type:"forceatlas2",graph:t,...o,scalingRatio:s||100,gravity:r||10,iterations:i||50})}else if(n==="custom")return tte({type:"custom",...e})}throw new Error(`Layout ${n} not found.`)}function OF({nodeCount:n,nodePosition:e,labelType:t,camera:i}){return(r,s)=>{var o;if(i&&e&&((o=i==null?void 0:i.position)==null?void 0:o.z)/(i==null?void 0:i.zoom)-(e==null?void 0:e.z)>6e3)return!1;if(t==="all")return!0;if(t==="nodes"&&r==="node")return!0;if(t==="edges"&&r==="edge")return!0;if(t==="auto"&&r==="node"){if(s>7)return!0;if(i&&e&&i.position.z/i.zoom-e.z<3e3)return!0}return!1}}function kF(n,e){switch(e){case"above":return n;case"below":return-n;case"inline":case"natural":default:return 0}}function rte({graph:n}){const e=M$(n);return{ranks:e,getSizeForNode:t=>e[t]*80}}function ste({graph:n}){const e=C$(n);return{ranks:e,getSizeForNode:t=>e[t]*20}}function ote({graph:n,attribute:e,defaultSize:t}){const i=new Map;return e?n.forEachNode((r,s)=>{var o;const a=(o=s.data)==null?void 0:o[e];isNaN(a)&&console.warn(`Attribute ${a} is not a number for node ${s.id}`),i.set(r,a||0)}):console.warn("Attribute sizing configured but no attribute provided"),{getSizeForNode:r=>!e||!i?t:i.get(r)}}const i3={pagerank:rte,centrality:ste,attribute:ote,none:({defaultSize:n})=>({getSizeForNode:e=>n})};function ate({type:n,...e}){var t;const i=(t=i3[n])==null?void 0:t.call(i3,e);if(!i&&n!=="default")throw new Error(`Unknown sizing strategy: ${n}`);const{graph:r,minSize:s,maxSize:o}=e,a=new Map;let l,u;if(r.forEachNode((c,f)=>{let h;n==="default"?h=f.size||e.defaultSize:h=i.getSizeForNode(c),(l===void 0||hu)&&(u=h),a.set(c,h)}),n!=="none"){const c=Ok().domain([l,u]).rangeRound([s,o]);for(const[f,h]of a)a.set(f,c(h))}return a}function lte(n,e,t){n.clear();for(const i of e)try{n.addNode(i.id,i)}catch({message:r}){console.error(`[Graph] ${r}`)}for(const i of t)try{n.addEdge(i.source,i.target,i)}catch({message:r}){console.error(`[Graph] ${r}`)}return n}function ute({graph:n,layout:e,sizingType:t,labelType:i,sizingAttribute:r,defaultNodeSize:s,minNodeSize:o,maxNodeSize:a}){const l=[],u=[],c=new Map,f=ate({graph:n,type:t,attribute:r,minSize:o,maxSize:a,defaultSize:s}),h=n.nodes().length,m=OF({nodeCount:h,labelType:i});return n.forEachNode((v,x)=>{const _=e.getNodePosition(v),{data:g,fill:y,icon:w,label:E,size:M,...b}=x,C=f.get(x.id),P=m("node",C),L=(n.inboundNeighbors(x.id)||[]).map(F=>n.getNodeAttributes(F)),N={...x,size:C,labelVisible:P,label:E,icon:w,fill:y,parents:L,data:{...b,...g??{}},position:{..._,x:_.x||0,y:_.y||0,z:_.z||1}};c.set(x.id,N),l.push(N)}),n.forEachEdge((v,x)=>{const _=c.get(x.source),g=c.get(x.target);if(_&&g){const{data:y,id:w,label:E,size:M,...b}=x,C=m("edge",M);u.push({...x,id:w,label:E,labelVisible:C,size:M,data:{...b,id:w,...y||{}}})}}),{nodes:l,edges:u}}const ks={mass:10,tension:1e3,friction:300,precision:.1};function NF(n,e,t){const i=e.getLength(),r=n==="end"?i:i/2,s=n==="end"?t/2:0,o=(r-s)/i,a=e.getPointAt(o),l=e.getTangentAt(o);return[a,l]}function FF(n){return[n+6,2+n/1.5]}const Rw=.7;function zF(n,e,t=0){const i=new $(n.x,n.y||0,n.z||0),r=new $(e.x,e.y||0,e.z||0),s=new $().addVectors(i,r).divideScalar(2);return s.setLength(s.length()+t)}function cte(n,e,t=-1){const i=n.clone(),r=e.clone(),s=new $().subVectors(r,i),o=s.length(),a=s.clone().normalize(),l=new $().subVectors(r,i).divideScalar(2),u=Math.abs(a.x)%1,c=new $(-a.y,a.x-u*a.z,u*a.y).normalize(),f=new $().add(i).add(l).add(c.multiplyScalar(o/4).multiplyScalar(t));return[n,f,e]}function nm(n,e,t,i,r,s){const o=r3(n,t,e),a=r3(t,n,i);return r?new t_(...cte(o,a,s)):new lT(o,a)}function im(n){return new $(n.position.x,n.position.y,n.position.z||0)}function r3(n,e,t){const i=n.distanceTo(e);return n.clone().add(e.clone().sub(n).multiplyScalar(t/i))}function s3(n,e){return{...n,position:{...n.position,x:n.position.x+e.x,y:n.position.y+e.y,z:n.position.z+e.z}}}function fte({edge:n,edges:e,curved:t}){let i=t,r;const s=e.filter(o=>o.target===n.target&&o.source===n.source).map(o=>o.id);if(s.length>1){i=!0;const o=s.indexOf(n.id);s.length===2?r=o===0?Rw:-Rw:r=(o-Math.floor(s.length/2))*Rw}return{curved:i,curveOffset:r}}function Ey(n){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let a of n)e=Math.min(e,a.position.x),t=Math.max(t,a.position.x),i=Math.min(i,a.position.y),r=Math.max(r,a.position.y),s=Math.min(s,a.position.z),o=Math.max(o,a.position.z);return{height:r-i,width:t-e,minX:e,maxX:t,minY:i,maxY:r,minZ:s,maxZ:o,x:(t+e)/2,y:(r+i)/2,z:(o+s)/2}}function hte(n,e){return e?n.reduce((t,i)=>{const r=i.data[e];return r&&t.set(r,[...t.get(r)||[],i]),t},new Map):new Map}function dte({nodes:n,clusterAttribute:e}){const t=new Map;if(e){const i=hte(n,e);for(const[r,s]of i){const o=Ey(s);t.set(r,{label:r,nodes:s,position:o})}}return t}const L2=({sensitivity:n=7,interval:e=50,timeout:t=0,disabled:i,onPointerOver:r,onPointerOut:s})=>{const o=Y.useRef(!1),a=Y.useRef(null),l=Y.useRef(0),u=Y.useRef({x:null,y:null,px:null,py:null}),c=Y.useCallback(_=>{u.current.x=_.clientX,u.current.y=_.clientY},[]),f=Y.useCallback(_=>{a.current=clearTimeout(a.current);const{px:g,x:y,py:w,y:E}=u.current;Math.abs(g-y)+Math.abs(w-E)f(_),e))},[e,r,n]),h=Y.useCallback(()=>{clearTimeout(a.current),typeof window<"u"&&document.removeEventListener("mousemove",c,!1)},[c]),m=Y.useCallback(_=>{i||(o.current=!0,h(),l.current!==1&&(u.current.px=_.pointer.x,u.current.py=_.pointer.y,typeof window<"u"&&document.addEventListener("mousemove",c,!1),a.current=setTimeout(()=>f(_),t)))},[h,f,i,c,t]),v=Y.useCallback(_=>{a.current=clearTimeout(a.current),l.current=0,s(_)},[s]),x=Y.useCallback(_=>{o.current=!1,h(),l.current===1&&(a.current=setTimeout(()=>v(_),t))},[h,v,t]);return{pointerOver:m,pointerOut:x}},pte=({draggable:n,set:e,position:t,onDragStart:i,onDragEnd:r})=>{const s=ui(x=>x.camera),o=ui(x=>x.raycaster),a=ui(x=>x.size),l=ui(x=>x.gl),{mouse2D:u,mouse3D:c,offset:f,normal:h,plane:m}=Y.useMemo(()=>({mouse2D:new Pe,mouse3D:new $,offset:new $,normal:new $,plane:new ha}),[]),v=Y.useMemo(()=>l.domElement.getBoundingClientRect(),[l.domElement]);return Xq({onDragStart:({event:x})=>{const{eventObject:_,point:g}=x;_.getWorldPosition(f).sub(g),c.copy(g),i()},onDrag:({event:x})=>{const _=(x.clientX-((v==null?void 0:v.left)??0))/a.width*2-1,g=-((x.clientY-((v==null?void 0:v.top)??0))/a.height)*2+1;u.set(_,g),o.setFromCamera(u,s),s.getWorldDirection(h).negate(),m.setFromNormalAndCoplanarPoint(h,c),o.ray.intersectPlane(m,c);const y=new $(t.x,t.y,t.z).copy(c).add(f);return e(y)},onDragEnd:r},{drag:{enabled:n,threshold:10}})};function mte(n,e,t){return AK(n,e,t)}const{Provider:gte,useStore:nt}=iq(),vte=({actives:n=[],selections:e=[],collapsedNodeIds:t=[],theme:i})=>tq(r=>({theme:{...i,edge:{...i.edge,label:{...i.edge.label,fontSize:i.edge.label.fontSize??6}}},edges:[],nodes:[],collapsedNodeIds:t,clusters:new Map,panning:!1,draggingId:null,actives:n,edgeContextMenus:new Set,edgeMeshes:[],selections:e,drags:{},graph:new dn({multi:!0}),setTheme:s=>r(o=>({...o,theme:s})),setClusters:s=>r(o=>({...o,clusters:s})),setEdgeContextMenus:s=>r(o=>({...o,edgeContextMenus:s})),setEdgeMeshes:s=>r(o=>({...o,edgeMeshes:s})),setPanning:s=>r(o=>({...o,panning:s})),setDrags:s=>r(o=>({...o,drags:s})),setDraggingId:s=>r(o=>({...o,draggingId:s})),setActives:s=>r(o=>({...o,actives:s})),setSelections:s=>r(o=>({...o,selections:s})),setNodes:s=>r(o=>({...o,nodes:s,centerPosition:Ey(s)})),setEdges:s=>r(o=>({...o,edges:s})),setNodePosition:(s,o)=>r(a=>{var l,u;const c=a.nodes.find(x=>x.id===s),f=im(c),m=new $(o.x,o.y,o.z).sub(f),v=[...a.nodes];if((l=a.selections)!=null&&l.includes(s))(u=a.selections)==null||u.forEach(x=>{const _=a.nodes.find(g=>g.id===x);if(_){const g=a.nodes.indexOf(_);v[g]=s3(_,m)}});else{const x=a.nodes.indexOf(c);v[x]=s3(c,m)}return{...a,drags:{...a.drags,[s]:c},nodes:v}}),setCollapsedNodeIds:(s=[])=>r(o=>({...o,collapsedNodeIds:s}))}));function BF({nodeId:n,nodes:e,edges:t,currentHiddenNodes:i,currentHiddenEdges:r}){const s=[],o=[],a=i.map(m=>m.id),l=r.map(m=>m.id),u=t.filter(m=>m.source===n),c=u.map(m=>m.target);o.push(...u);for(const m of c){const v=t.filter(_=>_.target===m&&_.source!==n);let x=!1;if((v.length===0||v.length>0&&!a.includes(m)&&v.map(g=>g.id).every(g=>l.includes(g)))&&(x=!0),x){const _=e.find(y=>y.id===m);_&&s.push(_);const g=BF({nodeId:m,nodes:e,edges:t,currentHiddenEdges:o,currentHiddenNodes:s});o.push(...g.hiddenEdges),s.push(...g.hiddenNodes)}}const f=Object.values(o.reduce((m,v)=>({...m,[v.id]:v}),{})),h=Object.values(s.reduce((m,v)=>({...m,[v.id]:v}),{}));return{hiddenEdges:f,hiddenNodes:h}}const yte=({collapsedIds:n,nodes:e,edges:t})=>{const i=[],r=[];for(const u of n){const{hiddenEdges:c,hiddenNodes:f}=BF({nodeId:u,nodes:e,edges:t,currentHiddenEdges:r,currentHiddenNodes:i});i.push(...f),r.push(...c)}const s=i.map(u=>u.id),o=r.map(u=>u.id),a=e.filter(u=>!s.includes(u.id)),l=t.filter(u=>!o.includes(u.id));return{visibleNodes:a,visibleEdges:l}},_te=({layoutType:n,sizingType:e,labelType:t,sizingAttribute:i,clusterAttribute:r,selections:s,nodes:o,edges:a,actives:l,collapsedNodeIds:u,defaultNodeSize:c,maxNodeSize:f,minNodeSize:h,layoutOverrides:m})=>{const v=nt(V=>V.graph),x=nt(V=>V.setClusters),_=nt(V=>V.collapsedNodeIds),g=nt(V=>V.setEdges),y=nt(V=>V.nodes),w=nt(V=>V.setNodes),E=nt(V=>V.setSelections),M=nt(V=>V.setActives),b=nt(V=>V.drags),C=nt(V=>V.setDrags),P=nt(V=>V.setCollapsedNodeIds),A=Y.useRef(!1),L=Y.useRef(null),N=ui(V=>V.camera),{visibleEdges:F,visibleNodes:B}=Y.useMemo(()=>yte({collapsedIds:_,nodes:o,edges:a}),[_,o,a]),j=Y.useRef(b);Y.useEffect(()=>{j.current=b},[b]);const q=Y.useCallback(async V=>{L.current=V||ite({...m,type:n,graph:v,drags:j.current,clusterAttribute:r}),await qee(L.current);const W=ute({graph:v,layout:L.current,sizingType:e,labelType:t,sizingAttribute:i,maxNodeSize:f,minNodeSize:h,defaultNodeSize:c}),I=dte({nodes:W.nodes,clusterAttribute:r});g(W.edges),w(W.nodes),x(I)},[m,n,r,e,t,i,f,h,c,g,w,x]);Y.useEffect(()=>{const V=y.map(I=>({...I,labelVisible:OF({nodeCount:y==null?void 0:y.length,labelType:t,camera:N,nodePosition:I==null?void 0:I.position})("node",I==null?void 0:I.size)}));V.some((I,O)=>I.labelVisible!==y[O].labelVisible)&&w(V)},[N,N.zoom,N.position.z,w,y,t]),Y.useEffect(()=>{A.current&&E(s)},[s,E]),Y.useEffect(()=>{A.current&&M(l)},[l,M]),Y.useEffect(()=>{async function V(){A.current=!1,lte(v,B,F),await q(),A.current=!0}V()},[B,F]),Y.useEffect(()=>{A.current&&P(u)},[u,P]),Y.useEffect(()=>{A.current&&(j.current={},C({}),q())},[n,q,C]),Y.useEffect(()=>{A.current&&q(L.current)},[e,i,t,q])},nh=({text:n,fontSize:e,fontUrl:t,color:i,opacity:r,stroke:s,active:o,ellipsis:a,rotation:l})=>{const u=a&&!o?gee(n,a):n,c=Y.useMemo(()=>new Ze(i),[i]),f=Y.useMemo(()=>s?new Ze(s):void 0,[s]);return Ge.jsx(dF,{position:[0,0,1],children:Ge.jsx(fee,{font:t,fontSize:e,color:c,fillOpacity:r,textAlign:"center",outlineWidth:s?1:0,outlineColor:f,depthOffset:0,maxWidth:100,overflowWrap:"break-word",rotation:l,children:u})})};nh.defaultProps={opacity:1,fontSize:7,color:"#2A6475",ellipsis:75};const GF=({color:n,size:e,opacity:t,animated:i,strokeWidth:r,innerRadius:s=4,segments:o=25})=>{const a=Y.useMemo(()=>new Ze(n),[n]),{ringSize:l,ringOpacity:u}=Os({from:{ringOpacity:0,ringSize:[1e-5,1e-5,1e-5]},to:{ringOpacity:t,ringSize:[e/2,e/2,1]},config:{...ks,duration:i?void 0:0}}),c=r/10,f=s+c;return Ge.jsx(dF,{position:[0,0,1],children:Ge.jsxs(Yn.mesh,{scale:l,children:[Ge.jsx("ringGeometry",{attach:"geometry",args:[s,f,o]}),Ge.jsx(Yn.meshBasicMaterial,{attach:"material",color:a,transparent:!0,depthTest:!1,opacity:u,side:On,fog:!0})]})})};GF.defaultProps={color:"#D8E6EA",size:1,opacity:.5,strokeWidth:5};const VF=({color:n,id:e,size:t,active:i,selected:r,opacity:s,animated:o})=>{const{scale:a,nodeOpacity:l}=Os({from:{scale:[1e-5,1e-5,1e-5],nodeOpacity:0},to:{scale:[t,t,t],nodeOpacity:s},config:{...ks,duration:o?void 0:0}}),u=Y.useMemo(()=>new Ze(n),[n]),c=nt(f=>f.theme);return Ge.jsxs(Ge.Fragment,{children:[Ge.jsxs(Yn.mesh,{userData:{id:e,type:"node"},scale:a,children:[Ge.jsx("sphereGeometry",{attach:"geometry",args:[1,25,25]}),Ge.jsx(Yn.meshPhongMaterial,{attach:"material",side:On,transparent:!0,fog:!0,opacity:l,color:u})]}),Ge.jsx(GF,{opacity:r?.5:0,size:t,animated:o,color:r?c.ring.activeFill:c.ring.fill})]})};VF.defaultProps={opacity:1,active:!1};const HF=Y.createContext({controls:null,resetControls:()=>{},zoomIn:()=>{},zoomOut:()=>{},panLeft:()=>{},panRight:()=>{},panUp:()=>{},panDown:()=>{}}),I2=()=>{const n=Y.useContext(HF);if(n===void 0)throw new Error("`useCameraControls` hook must be used within a `ControlsProvider` component");return n};Cr.install({THREE:{MOUSE:RD,Vector2:Pe,Vector3:$,Vector4:Kt,Quaternion:ki,Matrix4:xt,Spherical:PO,Box3:rs,Sphere:ss,Raycaster:TT,MathUtils:{DEG2RAD:(JL=Zv)==null?void 0:JL.DEG2RAD,clamp:(e3=Zv)==null?void 0:e3.clamp}}});NO({ThreeCameraControls:Cr});const G_={ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40},o3=new B_(G_.ARROW_LEFT,100),a3=new B_(G_.ARROW_RIGHT,100),l3=new B_(G_.ARROW_UP,100),u3=new B_(G_.ARROW_DOWN,100),WF=Y.forwardRef(({mode:n,children:e,animated:t,disabled:i,minDistance:r,maxDistance:s},o)=>{const a=Y.useRef(null),l=ui(M=>M.camera),u=ui(M=>M.gl),c=n==="orbit",f=nt(M=>M.setPanning);g_((M,b)=>{var C,P;(C=a.current)!=null&&C.enabled&&((P=a.current)==null||P.update(b)),c&&(a.current.azimuthAngle+=20*b*Zv.DEG2RAD)},-1),Y.useEffect(()=>()=>{var M;return(M=a.current)==null?void 0:M.dispose()},[]);const h=Y.useCallback(()=>{var M;(M=a.current)==null||M.zoom(l.zoom/2,t)},[t,l.zoom]),m=Y.useCallback(()=>{var M;(M=a.current)==null||M.zoom(-l.zoom/2,t)},[t,l.zoom]),v=Y.useCallback(M=>{var b;c||(b=a.current)==null||b.truck(-.03*M.deltaTime,0,t)},[t,c]),x=Y.useCallback(M=>{var b;c||(b=a.current)==null||b.truck(.03*M.deltaTime,0,t)},[t,c]),_=Y.useCallback(M=>{var b;c||(b=a.current)==null||b.truck(0,.03*M.deltaTime,t)},[t,c]),g=Y.useCallback(M=>{var b;c||(b=a.current)==null||b.truck(0,-.03*M.deltaTime,t)},[t,c]),y=Y.useCallback(M=>{M.code==="Space"&&(n==="rotate"?a.current.mouseButtons.left=Cr.ACTION.TRUCK:a.current.mouseButtons.left=Cr.ACTION.ROTATE)},[n]),w=Y.useCallback(M=>{M.code==="Space"&&(n==="rotate"?a.current.mouseButtons.left=Cr.ACTION.ROTATE:a.current.mouseButtons.left=Cr.ACTION.TRUCK)},[n]);Y.useEffect(()=>(i||(o3.addEventListener("holding",x),a3.addEventListener("holding",v),l3.addEventListener("holding",_),u3.addEventListener("holding",g),typeof window<"u"&&(window.addEventListener("keydown",y),window.addEventListener("keyup",w))),()=>{o3.removeEventListener("holding",x),a3.removeEventListener("holding",v),l3.removeEventListener("holding",_),u3.removeEventListener("holding",g),typeof window<"u"&&(window.removeEventListener("keydown",y),window.removeEventListener("keyup",w))}),[i,y,w,g,x,v,_]),Y.useEffect(()=>{i?(a.current.mouseButtons.left=Cr.ACTION.NONE,a.current.mouseButtons.middle=Cr.ACTION.NONE,a.current.mouseButtons.wheel=Cr.ACTION.NONE):(a.current.mouseButtons.left=Cr.ACTION.TRUCK,a.current.mouseButtons.middle=Cr.ACTION.TRUCK,a.current.mouseButtons.wheel=Cr.ACTION.DOLLY)},[i]),Y.useEffect(()=>{const M=()=>f(!0),b=()=>f(!1),C=a.current;return C&&(C.addEventListener("control",M),C.addEventListener("controlend",b)),()=>{C&&(C.removeEventListener("control",M),C.removeEventListener("controlend",b))}},[a,f]),Y.useEffect(()=>{n==="rotate"?a.current.mouseButtons.left=Cr.ACTION.ROTATE:a.current.mouseButtons.left=Cr.ACTION.TRUCK},[n]),P2([{name:"Zoom In",disabled:i,category:"Graph",keys:"command+shift+i",callback:M=>{M.preventDefault(),h()}},{name:"Zoom Out",category:"Graph",disabled:i,keys:"command+shift+o",callback:M=>{M.preventDefault(),m()}}]);const E=Y.useMemo(()=>({controls:a.current,zoomIn:()=>h(),zoomOut:()=>m(),panLeft:(M=100)=>x({deltaTime:M}),panRight:(M=100)=>v({deltaTime:M}),panDown:(M=100)=>g({deltaTime:M}),panUp:(M=100)=>_({deltaTime:M}),resetControls:M=>{var b;return(b=a.current)==null?void 0:b.reset(M)}}),[h,m,x,v,g,_,a.current]);return Y.useImperativeHandle(o,()=>E),Ge.jsxs(HF.Provider,{value:E,children:[Ge.jsx("threeCameraControls",{ref:a,args:[l,u.domElement],smoothTime:.1,minDistance:r,dollyToCursor:!0,maxDistance:s}),e]})});WF.defaultProps={mode:"rotate",minDistance:1e3,maxDistance:5e4};function jF(n,e){const t=e.position.z;nl.x0&&(e==null?void 0:e.x)l.y0&&(e==null?void 0:e.y)Math.abs(i-n%Math.PI){const i=nt(x=>x.nodes),[r,s]=Y.useState(!1),o=ui(x=>x.invalidate),{controls:a}=I2(),l=ui(x=>x.camera),u=Y.useRef(!1),c=Y.useCallback(async(x,_)=>{const g=(_==null?void 0:_.animated)!==void 0?_==null?void 0:_.animated:!0,y=(_==null?void 0:_.centerOnlyIfNodesNotInView)!==void 0?_==null?void 0:_.centerOnlyIfNodesNotInView:!1;if(!u.current||!y||y&&(x!=null&&x.some(w=>!c3(l,w.position)))){const{x:w,y:E,z:M}=Ey(x);await a.setTarget(w,E,M,g),r||s(!0),o()}},[o,a,i]),f=Y.useCallback(async(x,_={animated:!0,fitOnlyIfNodesNotInView:!1})=>{const{fitOnlyIfNodesNotInView:g}=_;if(!g||g&&(x!=null&&x.some(y=>!c3(l,y.position)))){const{minX:y,maxX:w,minY:E,maxY:M,minZ:b,maxZ:C}=Ey(x);if(!t.includes("3d")){const{horizontalRotation:P,verticalRotation:A}=wte(a==null?void 0:a.azimuthAngle,a==null?void 0:a.polarAngle);a==null||a.rotate(P,A,!0)}await(a==null?void 0:a.zoomTo(1,_==null?void 0:_.animated)),await(a==null?void 0:a.fitToBox(new rs(new $(y,E,b),new $(w,M,C)),_==null?void 0:_.animated,{cover:!1,paddingLeft:Y0,paddingRight:Y0,paddingBottom:Y0,paddingTop:Y0}))}},[l,a,t]),h=Y.useCallback(x=>{let _=null;return x!=null&&x.length&&(_=x.reduce((g,y)=>{const w=i.find(E=>E.id===y);if(w)g.push(w);else throw new Error(`Attempted to center ${y} but it was not found in the nodes`);return g},[])),_},[i]),m=Y.useCallback((x,_)=>{const g=h(x);c(g||i,{animated:n,centerOnlyIfNodesNotInView:_==null?void 0:_.centerOnlyIfNodesNotInView})},[n,c,h,i]),v=Y.useCallback(async(x,_)=>{const g=h(x);await f(g||i,{animated:n,..._})},[n,f,h,i]);return Y.useLayoutEffect(()=>{async function x(){a&&(i!=null&&i.length)&&(u.current||(await c(i,{animated:!1}),await f(i,{animated:!1}),u.current=!0))}x()},[a,c,i,n,l,f]),P2([{name:"Center",disabled:e,category:"Graph",keys:["command+shift+c"],callback:()=>c(i)}]),{centerNodes:c,centerNodesById:m,fitNodesInViewById:v,isCentered:r}},XF=({image:n,id:e,size:t,opacity:i,animated:r})=>{const s=Y.useMemo(()=>new yO().load(n),[n]),{scale:o,spriteOpacity:a}=Os({from:{scale:[1e-5,1e-5,1e-5],spriteOpacity:0},to:{scale:[t,t,t],spriteOpacity:i},config:{...ks,duration:r?void 0:0}});return Ge.jsx(Yn.sprite,{userData:{id:e,type:"node"},scale:o,children:Ge.jsx(Yn.spriteMaterial,{attach:"material",opacity:a,fog:!0,depthTest:!1,transparent:!0,side:On,children:Ge.jsx("primitive",{attach:"map",object:s,minFilter:An})})})};XF.defaultProps={opacity:1};const $F=({animated:n,disabled:e,id:t,draggable:i,labelFontUrl:r,contextMenu:s,onClick:o,onDoubleClick:a,onPointerOver:l,onDragged:u,onPointerOut:c,onContextMenu:f,renderNode:h})=>{var m,v,x;const _=I2(),g=nt(ge=>ge.theme),y=nt(ge=>ge.nodes.find(de=>de.id===t)),w=nt(ge=>ge.edges),E=nt(ge=>ge.draggingId),M=nt(ge=>ge.collapsedNodeIds),b=nt(ge=>ge.setDraggingId),C=nt(ge=>ge.setNodePosition),P=nt(ge=>ge.setCollapsedNodeIds),A=nt(ge=>ge.collapsedNodeIds.includes(t)),L=nt(ge=>{var de;return(de=ge.actives)==null?void 0:de.includes(t)}),N=nt(ge=>{var de;return(de=ge.selections)==null?void 0:de.includes(t)}),F=nt(ge=>{var de;return((de=ge.selections)==null?void 0:de.length)>0}),B=nt(ge=>ge.centerPosition),j=E===t,{position:q,label:V,subLabel:W,size:I=7,labelVisible:O=!0}=y,k=Y.useRef(null),[U,z]=Y.useState(!1),[Q,J]=Y.useState(!1),te=U||N||L,se=F?te?g.node.selectedOpacity:g.node.inactiveOpacity:g.node.opacity,ne=Y.useMemo(()=>w.filter(de=>de.source===t).length>0||A,[w,t,A]),fe=Y.useCallback(()=>{ne&&P(A?M.filter(ge=>ge!==t):[...M,t])},[ne,M,t,A,P]),[{nodePosition:Ie,labelPosition:Ue,subLabelPosition:he}]=Os(()=>({from:{nodePosition:B?[B.x,B.y,0]:[0,0,0],labelPosition:[0,-(I+7),2],subLabelPosition:[0,-(I+14),2]},to:{nodePosition:q?[q.x,q.y,te?q.z+1:q.z]:[0,0,0],labelPosition:[0,-(I+7),2],subLabelPosition:[0,-(I+14),2]},config:{...ks,duration:n&&!E?void 0:0}}),[j,q,n,I,te]),H=pte({draggable:i,position:q,set:ge=>C(t,ge),onDragStart:()=>{b(t),z(!0)},onDragEnd:()=>{b(null),z(!1),u==null||u(y)}});np(U&&!E&&o!==void 0,"pointer"),np(U&&i&&!j&&o===void 0,"grab"),np(j,"grabbing");const ae=te||j,le=ae?g.node.activeFill:y.fill||g.node.fill,{pointerOver:me,pointerOut:ce}=L2({disabled:e||j,onPointerOver:ge=>{_.controls.truckSpeed=0,z(!0),l==null||l(y,ge)},onPointerOut:ge=>{_.controls.truckSpeed=2,z(!1),c==null||c(y,ge)}}),De=Y.useMemo(()=>h?h({id:t,color:le,size:I,active:ae,opacity:se,animated:n,selected:N,node:y}):Ge.jsx(Ge.Fragment,{children:y.icon?Ge.jsx(XF,{id:t,image:y.icon||"",size:I+8,opacity:se,animated:n,color:le,node:y,active:ae,selected:N}):Ge.jsx(VF,{id:t,size:I,opacity:se,animated:n,color:le,node:y,active:ae,selected:N})}),[h,t,le,I,ae,se,n,N,y]),pe=Y.useMemo(()=>{var ge,de,je;return(O||N||U)&&V&&Ge.jsxs(Ge.Fragment,{children:[Ge.jsx(Yn.group,{position:Ue,children:Ge.jsx(nh,{text:V,fontUrl:r,opacity:se,stroke:g.node.label.stroke,active:N||U||j||L,color:N||U||j||L?g.node.label.activeColor:g.node.label.color})}),W&&Ge.jsx(Yn.group,{position:he,children:Ge.jsx(nh,{text:W,fontUrl:r,fontSize:5,opacity:se,stroke:(ge=g.node.subLabel)==null?void 0:ge.stroke,active:N||U||j||L,color:N||U||j||L?(de=g.node.subLabel)==null?void 0:de.activeColor:(je=g.node.subLabel)==null?void 0:je.color})})]})},[U,L,j,N,V,r,Ue,O,se,W,he,g.node.label.activeColor,g.node.label.color,g.node.label.stroke,(m=g.node.subLabel)==null?void 0:m.activeColor,(v=g.node.subLabel)==null?void 0:v.color,(x=g.node.subLabel)==null?void 0:x.stroke]),Ce=Y.useMemo(()=>Q&&s&&Ge.jsx(o2,{prepend:!0,center:!0,children:s({data:y,canCollapse:ne,isCollapsed:A,onCollapse:fe,onClose:()=>J(!1)})}),[Q,s,y,ne,A,fe]);return Ge.jsxs(Yn.group,{renderOrder:1,userData:{id:t,type:"node"},ref:k,position:Ie,onPointerOver:me,onPointerOut:ce,onClick:ge=>{!e&&!j&&(o==null||o(y,{canCollapse:ne,isCollapsed:A},ge))},onDoubleClick:ge=>{!e&&!j&&(a==null||a(y,ge))},onContextMenu:()=>{e||(J(!0),f==null||f(y,{canCollapse:ne,isCollapsed:A,onCollapse:fe}))},...H(),children:[De,Ce,pe]})};$F.defaultProps={draggable:!1};const YF=({animated:n,color:e,length:t,opacity:i,position:r,rotation:s,size:o,onActive:a,onContextMenu:l})=>{const u=Y.useMemo(()=>new Ze(e),[e]),c=Y.useRef(null),f=nt(_=>_.draggingId),h=nt(_=>_.centerPosition),[{pos:m,arrowOpacity:v}]=Os(()=>({from:{pos:h?[h.x,h.y,h.z]:[0,0,0],arrowOpacity:0},to:{pos:[r.x,r.y,r.z],arrowOpacity:i},config:{...ks,duration:n&&!f?void 0:0}}),[n,f,i,r]),x=Y.useCallback(()=>{var _;const g=new $(0,1,0);(_=c.current)==null||_.quaternion.setFromUnitVectors(g,s)},[s,c]);return Y.useEffect(()=>x(),[x]),Ge.jsxs(Yn.mesh,{position:m,ref:c,scale:[1,1,1],onPointerOver:()=>a(!0),onPointerOut:()=>a(!1),onPointerDown:_=>{_.nativeEvent.buttons===2&&(_.stopPropagation(),l())},children:[Ge.jsx("cylinderGeometry",{args:[0,o,t,20,1,!0],attach:"geometry"}),Ge.jsx(Yn.meshBasicMaterial,{attach:"material",color:u,depthTest:!1,opacity:v,transparent:!0,side:On,fog:!0})]})};YF.defaultProps={size:1,opacity:.5,color:"#D8E6EA"};const qF=({curveOffset:n,animated:e,color:t,curve:i,curved:r=!1,id:s,opacity:o,size:a,onContextMenu:l,onClick:u,onPointerOver:c,onPointerOut:f})=>{const h=Y.useRef(null),m=nt(y=>y.draggingId),v=Y.useMemo(()=>new Ze(t),[t]),x=nt(y=>y.centerPosition),_=Y.useRef(!1),{lineOpacity:g}=Os({from:{lineOpacity:0},to:{lineOpacity:o},config:{...ks,duration:e?void 0:0}});return Os(()=>{const y=i.getPoint(0),w=i.getPoint(1);return{from:{fromVertices:_.current?[w==null?void 0:w.x,w==null?void 0:w.y,(w==null?void 0:w.z)||0]:[x==null?void 0:x.x,x==null?void 0:x.y,(x==null?void 0:x.z)||0],toVertices:[y==null?void 0:y.x,y==null?void 0:y.y,(y==null?void 0:y.z)||0]},to:{fromVertices:[y==null?void 0:y.x,y==null?void 0:y.y,(y==null?void 0:y.z)||0],toVertices:[w==null?void 0:w.x,w==null?void 0:w.y,(w==null?void 0:w.z)||0]},onChange:E=>{const{fromVertices:M,toVertices:b}=E.value,C=new $(...M),P=new $(...b),A=nm(C,0,P,0,r,n);h.current.copy(new $u(A,20,a/2,5,!1))},config:{...ks,duration:e&&!m?void 0:0}}},[e,m,i,a]),Y.useEffect(()=>{_.current=!0},[]),Ge.jsxs("mesh",{userData:{id:s,type:"edge"},onPointerOver:c,onPointerOut:f,onClick:u,onPointerDown:y=>{y.nativeEvent.buttons===2&&(y.stopPropagation(),l())},children:[Ge.jsx("tubeGeometry",{attach:"geometry",ref:h}),Ge.jsx(Yn.meshBasicMaterial,{attach:"material",opacity:g,fog:!0,transparent:!0,depthTest:!1,color:v})]})};qF.defaultProps={color:"#000",size:1,opacity:1};const h3=3,KF=({animated:n,arrowPlacement:e,contextMenu:t,disabled:i,labelPlacement:r,id:s,interpolation:o,labelFontUrl:a,onContextMenu:l,onClick:u,onPointerOver:c,onPointerOut:f})=>{const h=nt(H=>H.theme),m=nt(H=>H.draggingId),[v,x]=Y.useState(!1),[_,g]=Y.useState(!1),y=nt(H=>H.edges),w=y.find(H=>H.id===s),{target:E,source:M,label:b,labelVisible:C=!1,size:P=1}=w,A=nt(H=>H.nodes.find(ae=>ae.id===M)),L=nt(H=>H.nodes.find(ae=>ae.id===E)),N=(P+h.edge.label.fontSize)/2,[F,B]=Y.useMemo(()=>FF(P),[P]),{curveOffset:j,curved:q}=Y.useMemo(()=>fte({edge:w,edges:y,curved:o==="curved"}),[w,y,o]),[V,W,I]=Y.useMemo(()=>{const H=im(A),ae=A.size,le=im(L),me=L.size;let ce=nm(H,ae,le,me,q,j);const[De,pe]=NF(e,ce,F);return e==="end"&&(ce=nm(H,ae,De,0,q,j)),[ce,De,pe]},[A,L,q,j,e,F]),O=Y.useMemo(()=>{let H=zF(A.position,L.position,kF(N,r));if(q){const ae=new $().subVectors(H,V.getPoint(.5));switch(r){case"above":ae.y=ae.y-h3;break;case"below":ae.y=ae.y+h3;break}H=H.sub(ae)}return H},[A.position,L.position,N,r,q,V]),k=nt(H=>{var ae;return(ae=H.selections)==null?void 0:ae.includes(s)}),U=nt(H=>{var ae;return(ae=H.selections)==null?void 0:ae.length}),z=nt(H=>{var ae;return(ae=H.actives)==null?void 0:ae.includes(s)}),Q=nt(H=>H.centerPosition),J=U?k||z?h.edge.selectedOpacity:h.edge.inactiveOpacity:h.edge.opacity,[{labelPosition:te}]=Os(()=>({from:{labelPosition:Q?[Q.x,Q.y,Q.z]:[0,0,0]},to:{labelPosition:[O.x,O.y,O.z]},config:{...ks,duration:n&&!m?void 0:0}}),[O,n,m]),se=Y.useMemo(()=>new nc(0,0,r==="natural"?0:Math.atan((L.position.y-A.position.y)/(L.position.x-A.position.x))),[L.position.x,L.position.y,A.position.x,A.position.y,r]);np(v&&!m&&u!==void 0,"pointer");const{pointerOver:ne,pointerOut:fe}=L2({disabled:i,onPointerOver:H=>{x(!0),c==null||c(w,H)},onPointerOut:H=>{x(!1),f==null||f(w,H)}}),Ie=Y.useMemo(()=>e!=="none"&&Ge.jsx(YF,{animated:n,color:k||v||z?h.arrow.activeFill:h.arrow.fill,length:F,opacity:J,position:W,rotation:I,size:B,onActive:x,onContextMenu:()=>{i||(g(!0),l==null||l(w))}}),[v,n,F,e,W,I,B,i,w,z,k,l,J,h.arrow.activeFill,h.arrow.fill]),Ue=Y.useMemo(()=>C&&b&&Ge.jsx(Yn.group,{position:te,children:Ge.jsx(nh,{text:b,ellipsis:15,fontUrl:a,stroke:h.edge.label.stroke,color:k||v||z?h.edge.label.activeColor:h.edge.label.color,opacity:J,fontSize:h.edge.label.fontSize,rotation:se})}),[v,z,k,b,a,te,se,C,J,h.edge.label.activeColor,h.edge.label.color,h.edge.label.fontSize,h.edge.label.stroke]),he=Y.useMemo(()=>_&&t&&Ge.jsx(o2,{prepend:!0,center:!0,position:O,children:t({data:w,onClose:()=>g(!1)})}),[_,t,O,w]);return Ge.jsxs("group",{children:[Ge.jsx(qF,{curveOffset:j,animated:n,color:k||v||z?h.edge.activeFill:h.edge.fill,curve:V,curved:q,id:s,opacity:J,size:P,onClick:H=>{i||u==null||u(w,H)},onPointerOver:ne,onPointerOut:fe,onContextMenu:()=>{i||(g(!0),l==null||l(w))}}),Ie,Ue,he]})};KF.defaultProps={labelPlacement:"inline",arrowPlacement:"end"};const d3=new Dl(0,0,0);function Ete(n,e){const t=Y.useRef(),i=nt(l=>l.theme);nt(l=>{t.current=l});const r=Y.useRef(new Map),s=e==="curved",o=Y.useCallback(l=>{const u=[],c=r.current,{nodes:f}=t.current;return l.forEach(h=>{const{target:m,source:v,size:x=1}=h,_=f.find(V=>V.id===v),g=f.find(V=>V.id===m);if(!_||!g)return;const y=`fromX:${_.position.x},fromY:${_.position.y},toX:${g.position.x}},toY:${g.position.y}`;if(c.has(y)){const V=c.get(y);u.push(V);return}const w=im(_),E=_.size+i.edge.label.fontSize,M=im(g),b=g.size+i.edge.label.fontSize;let C=nm(w,E,M,b,s),P=new $u(C,20,x/2,5,!1);if(n==="none"){u.push(P),c.set(y,P);return}const[A,L]=FF(x),[N,F]=NF(n,C,A),B=new ki;B.setFromUnitVectors(new $(0,1,0),F);const j=new rc(0,L,A,20,1,!0);if(j.applyQuaternion(B),j.translate(N.x,N.y,N.z),n&&n==="end"){const V=nm(w,E,N,0,s);P=new $u(V,20,x/2,5,!1)}const q=B0([P,j]);u.push(q),c.set(y,q)}),u},[n,s,i.edge.label.fontSize]),a=Y.useCallback((l,u)=>{const c=o(l),f=o(u);return B0([f.length?B0(f):d3,c.length?B0(c):d3],!0)},[o]);return{getGeometries:o,getGeometry:a}}function Mte(n,e,t){const{onClick:i,onContextMenu:r,onPointerOut:s,onPointerOver:o}=n,a=nt(v=>v.edgeContextMenus),l=nt(v=>v.setEdgeContextMenus),u=Y.useRef(!1),c=Y.useCallback(()=>{u.current=!0},[]),f=Y.useRef(!1),h=Y.useCallback(()=>{f.current=!0},[]),m=Y.useCallback((v,x)=>{i&&u.current&&(u.current=!1,t||x.forEach(_=>{i(_)})),(e||r)&&f.current&&(f.current=!1,t||x.forEach(_=>{a.has(_.id)||(l(new Set([...a,_.id])),r==null||r(_))})),o&&x.filter(g=>!v.includes(g)).forEach(g=>{o(g)}),s&&v.filter(g=>!x.includes(g)).forEach(g=>{s(g)})},[e,t,a,l,i,r,o,s]);return{handleClick:c,handleContextMenu:h,handleIntersections:m}}function Tte(n,e){const t=Y.useRef(n);Y.useEffect(()=>{t.current=n},[n]);const i=Y.useCallback(()=>{const s=t.current.getAttribute("position"),o=Array.from({length:s.array.length}).fill(0),a=Array.from(s.array);return{from:o,to:a}},[]),r=Y.useCallback(s=>{const o=new Float32Array(s),a=new ln(o,3,!1);t.current.setAttribute("position",a),a.needsUpdate=!0},[]);Os(()=>{if(!e)return null;const s=i();return{from:{positions:s.from},to:{positions:s.to},onChange:o=>{r(o.value.positions)},config:{...ks,duration:e?void 0:0}}},[e])}function bte(n,e,t){const[{activeOpacity:i,inactiveOpacity:r}]=Os(()=>({from:{activeOpacity:0,inactiveOpacity:0},to:{activeOpacity:e?t.edge.selectedOpacity:t.edge.opacity,inactiveOpacity:e?t.edge.inactiveOpacity:t.edge.opacity},config:{...ks,duration:n?void 0:0}}),[n,e,t]);return{activeOpacity:i,inactiveOpacity:r}}const ZF=({animated:n,color:e,contextMenu:t,edge:i,labelFontUrl:r,labelPlacement:s,opacity:o})=>{const a=nt(P=>P.theme),{target:l,source:u,label:c,labelVisible:f=!1,size:h=1}=i,m=nt(P=>P.nodes),v=m.find(P=>P.id===u),x=m.find(P=>P.id===l),_=nt(P=>P.draggingId),g=(h+a.edge.label.fontSize)/2,y=Y.useMemo(()=>zF(v.position,x.position,kF(g,s)),[v.position,x.position,g,s]),w=nt(P=>P.edgeContextMenus),E=nt(P=>P.setEdgeContextMenus),[{labelPosition:M}]=Os(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[y.x,y.y,y.z]},config:{...ks,duration:n&&!_?void 0:0}}),[y,n,_]),b=Y.useCallback(P=>{w.delete(P.id),E(new Set(w.values()))},[w,E]),C=Y.useMemo(()=>new nc(0,0,s==="natural"?0:Math.atan((x.position.y-v.position.y)/(x.position.x-v.position.x))),[x.position.x,x.position.y,v.position.x,v.position.y,s]);return Ge.jsxs("group",{children:[f&&c&&Ge.jsx(Yn.group,{position:M,children:Ge.jsx(nh,{text:c,ellipsis:15,fontUrl:r,stroke:a.edge.label.stroke,color:e,opacity:o,fontSize:a.edge.label.fontSize,rotation:C})}),t&&w.has(i.id)&&Ge.jsx(o2,{prepend:!0,center:!0,position:y,children:t({data:i,onClose:()=>b(i)})})]})};ZF.defaultProps={labelPlacement:"inline"};const Ate=({interpolation:n="linear",arrowPlacement:e="end",labelPlacement:t="inline",animated:i,contextMenu:r,disabled:s,edges:o,labelFontUrl:a,onClick:l,onContextMenu:u,onPointerOut:c,onPointerOver:f})=>{const h=nt(k=>k.theme),{getGeometries:m,getGeometry:v}=Ete(e,n),x=nt(k=>k.draggingId),_=nt(k=>k.edgeMeshes),g=nt(k=>k.setEdgeMeshes),y=nt(k=>k.actives||[]),w=nt(k=>k.selections||[]),[E,M,b,C]=Y.useMemo(()=>{const k=[],U=[],z=[],Q=[];return o.forEach(J=>{if(x===J.source||x===J.target){w.includes(J.id)||y.includes(J.id)?z.push(J):Q.push(J);return}w.includes(J.id)||y.includes(J.id)?k.push(J):U.push(J)}),[k,U,z,Q]},[o,y,w,x]),P=!!w.length,A=Y.useMemo(()=>v(E,M),[v,E,M]),{activeOpacity:L,inactiveOpacity:N}=bte(i,P,h);Tte(A,i),Y.useEffect(()=>{if(x===null){const U=m(o).map(z=>new Nn(z));g(U)}},[m,g,o,x]);const F=Y.useRef(new Nn),B=Y.useRef(new Nn),j=Y.useCallback(k=>{if(!k.camera)return[];const U=k.intersectObjects(_);return U.length?U.map(z=>o[_.indexOf(z.object)]):[]},[_,o]),{handleClick:q,handleContextMenu:V,handleIntersections:W}=Mte({onClick:l,onContextMenu:u,onPointerOut:c,onPointerOver:f},r,s),I=Y.useRef(null),O=Y.useRef([]);return g_(k=>{if(F.current.geometry=A,s)return;const U=I.current;if((x||x===null&&U!==null)&&(B.current.geometry=v(b,C)),I.current=x,x)return;const z=O.current,Q=j(k.raycaster);W(z,Q),Q.join()!==z.join()&&(B.current.geometry=v(Q,[])),O.current=Q}),Ge.jsxs("group",{onClick:q,onContextMenu:V,children:[Ge.jsxs("mesh",{ref:F,children:[Ge.jsx(Yn.meshBasicMaterial,{attach:"material-0",color:h.edge.fill,depthTest:!1,fog:!0,opacity:N,side:On,transparent:!0}),Ge.jsx(Yn.meshBasicMaterial,{attach:"material-1",color:h.edge.activeFill,depthTest:!1,fog:!0,opacity:L,side:On,transparent:!0})]}),Ge.jsxs("mesh",{ref:B,children:[Ge.jsx(Yn.meshBasicMaterial,{attach:"material-0",color:h.edge.fill,depthTest:!1,fog:!0,opacity:N,side:On,transparent:!0}),Ge.jsx(Yn.meshBasicMaterial,{attach:"material-1",color:h.edge.activeFill,depthTest:!1,fog:!0,opacity:L,side:On,transparent:!0})]}),o.map(k=>Ge.jsx(ZF,{animated:i,contextMenu:r,color:h.edge.label.color,disabled:s,edge:k,labelFontUrl:a,labelPlacement:t},k.id))]})},QF=({animated:n,position:e,padding:t,labelFontUrl:i,disabled:r,radius:s,nodes:o,label:a,onClick:l,onPointerOver:u,onPointerOut:c})=>{var f,h,m,v,x;const _=nt(I=>I.theme),g=Math.max(e.width,e.height)/2,y=g-s+t,[w,E]=Y.useState(!1),M=nt(I=>I.centerPosition),b=nt(I=>{var O;return(O=I.actives)==null?void 0:O.some(k=>o.some(U=>U.id===k))}),C=nt(I=>{var O;return(O=I.selections)==null?void 0:O.some(k=>o.some(U=>U.id===k))}),A=nt(I=>{var O;return((O=I.selections)==null?void 0:O.length)>0})?C||w||b?(f=_.cluster)==null?void 0:f.selectedOpacity:(h=_.cluster)==null?void 0:h.inactiveOpacity:(m=_.cluster)==null?void 0:m.opacity,{circleOpacity:L,circlePosition:N,labelPosition:F}=Os({from:{circlePosition:[M.x,M.y,-1],circleOpacity:0,labelPosition:[0,-y,2]},to:{labelPosition:[0,-y,2],circlePosition:e?[e.x,e.y,-1]:[0,0,-1],circleOpacity:A},config:{...ks,duration:n?void 0:0}}),B=Y.useMemo(()=>{var I;return new Ze((I=_.cluster)==null?void 0:I.stroke)},[(v=_.cluster)==null?void 0:v.stroke]),j=Y.useMemo(()=>{var I;return new Ze((I=_.cluster)==null?void 0:I.fill)},[(x=_.cluster)==null?void 0:x.fill]);np(w&&l!==void 0,"pointer");const{pointerOver:q,pointerOut:V}=L2({disabled:r,onPointerOver:I=>{E(!0),u==null||u({nodes:o,label:a},I)},onPointerOut:I=>{E(!1),c==null||c({nodes:o,label:a},I)}});return Y.useMemo(()=>{var I,O,k;return _.cluster&&Ge.jsxs(Yn.group,{position:N,onPointerOver:q,onPointerOut:V,onClick:U=>{r||l==null||l({nodes:o,label:a},U)},children:[Ge.jsxs("mesh",{children:[Ge.jsx("ringGeometry",{attach:"geometry",args:[y,0,128]}),Ge.jsx(Yn.meshBasicMaterial,{attach:"material",color:j,transparent:!0,depthTest:!1,opacity:(I=_.cluster)!=null&&I.fill?L:0,side:On,fog:!0})]}),Ge.jsxs("mesh",{children:[Ge.jsx("ringGeometry",{attach:"geometry",args:[y,g+t,128]}),Ge.jsx(Yn.meshBasicMaterial,{attach:"material",color:B,transparent:!0,depthTest:!1,opacity:L,side:On,fog:!0})]}),((O=_.cluster)==null?void 0:O.label)&&Ge.jsx(Yn.group,{position:F,children:Ge.jsx(nh,{text:a,opacity:A,fontUrl:i,stroke:_.cluster.label.stroke,active:!1,color:(k=_.cluster)==null?void 0:k.label.color,fontSize:12})})]})},[_.cluster,N,q,V,y,j,L,g,t,B,F,a,A,i,r,l,o])};QF.defaultProps={radius:2,padding:40};const JF=Y.forwardRef(({onNodeClick:n,onNodeDoubleClick:e,onNodeContextMenu:t,onEdgeContextMenu:i,onEdgeClick:r,onEdgePointerOver:s,onEdgePointerOut:o,onNodePointerOver:a,onNodePointerOut:l,onClusterClick:u,onNodeDragged:c,onClusterPointerOver:f,onClusterPointerOut:h,contextMenu:m,animated:v,disabled:x,draggable:_,edgeLabelPosition:g,edgeArrowPosition:y,edgeInterpolation:w,labelFontUrl:E,renderNode:M,...b},C)=>{const{layoutType:P,clusterAttribute:A}=b,L=ui(Q=>Q.gl),N=ui(Q=>Q.scene),F=ui(Q=>Q.camera);if(_te(b),A&&!(P==="forceDirected2d"||P==="forceDirected3d"))throw new Error("Clustering is only supported for the force directed layouts.");const B=nt(Q=>Q.graph),j=nt(Q=>Q.nodes),q=nt(Q=>Q.edges),V=nt(Q=>[...Q.clusters.values()]),{centerNodesById:W,fitNodesInViewById:I,isCentered:O}=Ste({animated:v,disabled:x,layoutType:P});Y.useImperativeHandle(C,()=>({centerGraph:W,fitNodesInView:I,graph:B,renderScene:()=>L.render(N,F)}),[W,I,B,L,N,F]);const k=Y.useMemo(()=>j.map(Q=>Ge.jsx($F,{id:Q==null?void 0:Q.id,labelFontUrl:E,draggable:_,disabled:x,animated:v,contextMenu:m,renderNode:M,onClick:n,onDoubleClick:e,onContextMenu:t,onPointerOver:a,onPointerOut:l,onDragged:c},Q==null?void 0:Q.id)),[v,m,x,_,E,j,n,t,e,c,l,a,M]),U=Y.useMemo(()=>v?q.map(Q=>Ge.jsx(KF,{id:Q.id,disabled:x,animated:v,labelFontUrl:E,labelPlacement:g,arrowPlacement:y,interpolation:w,contextMenu:m,onClick:r,onContextMenu:i,onPointerOver:s,onPointerOut:o},Q.id)):Ge.jsx(Ate,{edges:q,disabled:x,animated:v,labelFontUrl:E,labelPlacement:g,arrowPlacement:y,interpolation:w,contextMenu:m,onClick:r,onContextMenu:i,onPointerOver:s,onPointerOut:o}),[v,m,x,y,w,g,q,E,r,i,o,s]),z=Y.useMemo(()=>V.map(Q=>Ge.jsx(QF,{animated:v,disabled:x,labelFontUrl:E,onClick:u,onPointerOver:f,onPointerOut:h,...Q},Q.label)),[v,V,x,E,u,h,f]);return O&&Ge.jsxs(Y.Fragment,{children:[U,k,z]})});JF.defaultProps={edgeInterpolation:"linear"};const ez={canvas:{background:"#fff"},node:{fill:"#7CA0AB",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{color:"#2A6475",stroke:"#fff",activeColor:"#1DE9AC"},subLabel:{color:"#ddd",stroke:"transparent",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#D8E6EA",activeFill:"#1DE9AC"},edge:{fill:"#D8E6EA",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475",activeColor:"#1DE9AC",fontSize:6}},arrow:{fill:"#D8E6EA",activeFill:"#1DE9AC"},cluster:{stroke:"#D8E6EA",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475"}}};function Pw(n,e,t){e=Array.isArray(e)?e:[e];const i=[],r=[];for(const s of e){const o=[...n.inEdgeEntries(s)??[],...n.outEdgeEntries(s)??[]];if(o)for(const a of o){const l=a.attributes.id;if(t==="in"?a.target===s&&!r.includes(l)&&r.push(l):t==="out"?a.source===s&&!r.includes(l)&&r.push(l):r.includes(l)||r.push(l),t==="out"||t==="all"){const u=a.target;i.includes(u)||i.push(u)}(t==="in"||t==="all")&&(i.includes(a.source)||i.push(a.source))}}return{nodes:i,edges:r}}function q0(n,e,t){const{offsetX:i,offsetY:r}=n,{width:s,height:o}=t;e.set(i/s*2-1,-(r/o)*2+1)}function Cte(n){const e=document.createElement("div");return e.style.pointerEvents="none",e.style.border=n.lasso.border,e.style.backgroundColor=n.lasso.background,e.style.position="fixed",e}const Rte=({children:n,type:e="none",onLasso:t,onLassoEnd:i,disabled:r})=>{var s;const o=nt(B=>B.theme),a=ui(B=>B.camera),l=ui(B=>B.gl),u=ui(B=>B.setEvents),c=ui(B=>B.size),f=ui(B=>B.get),h=ui(B=>B.scene),m=I2(),v=nt(B=>B.actives),x=nt(B=>B.setActives),_=nt(B=>B.edges),g=nt(B=>B.edgeMeshes),y=Y.useRef(!1),w=Y.useRef(null),E=Y.useRef(null),M=Y.useRef(Cte(o)),b=Y.useRef(null),C=Y.useRef(!1),P=Y.useRef(f().events.enabled),A=Y.useRef((s=m.controls)==null?void 0:s.enabled);Y.useEffect(()=>{y.current&&(t==null||t(v)),y.current=!0},[v,t]);const L=Y.useCallback(B=>{if(C.current){const[j,q,V]=b.current;V.x=Math.max(j.x,B.clientX),V.y=Math.max(j.y,B.clientY),q.x=Math.min(j.x,B.clientX),q.y=Math.min(j.y,B.clientY),M.current.style.left=`${q.x}px`,M.current.style.top=`${q.y}px`,M.current.style.width=`${V.x-q.x}px`,M.current.style.height=`${V.y-q.y}px`,q0(B,w.current.endPoint,c),q0(B,E.current.endPoint,c);const W=[],I=E.current.select().sort(k=>k.uuid).map(k=>_[g.indexOf(k)].id);W.push(...I);const O=w.current.select().sort(k=>k.uuid).filter(k=>{var U,z;return k.isMesh&&((U=k.userData)==null?void 0:U.id)&&(((z=k.userData)==null?void 0:z.type)===e||e==="all")}).map(k=>k.userData.id);W.push(...O),requestAnimationFrame(()=>{x(W)}),document.addEventListener("pointermove",L,{passive:!0,capture:!0,once:!0})}},[_,g,x,c,e]),N=Y.useCallback(()=>{var B;C.current&&(u({enabled:P.current}),C.current=!1,(B=M.current.parentElement)==null||B.removeChild(M.current),m.controls.enabled=A.current,i==null||i(v),document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",N))},[u,m.controls,i,v,L]),F=Y.useCallback(B=>{var j,q;if(B.shiftKey){P.current=f().events.enabled,A.current=(j=m.controls)==null?void 0:j.enabled,w.current=new AL(a,h);const V=new kp;g.length&&V.add(...g),E.current=new AL(a,V),b.current=[new Pe,new Pe,new Pe];const[W]=b.current;m.controls.enabled=!1,u({enabled:!1}),C.current=!0,(q=l.domElement.parentElement)==null||q.appendChild(M.current),M.current.style.left=`${B.clientX}px`,M.current.style.top=`${B.clientY}px`,M.current.style.width="0px",M.current.style.height="0px",W.x=B.clientX,W.y=B.clientY,q0(B,w.current.startPoint,c),q0(B,E.current.startPoint,c),document.addEventListener("pointermove",L,{passive:!0,capture:!0,once:!0}),document.addEventListener("pointerup",N,{passive:!0})}},[a,m.controls,g,f,l.domElement.parentElement,L,N,h,u,c]);return Y.useEffect(()=>{if(!(r||e==="none"))return typeof window<"u"&&(document.addEventListener("pointerdown",F,{passive:!0}),document.addEventListener("pointermove",L,{passive:!0}),document.addEventListener("pointerup",N,{passive:!0})),()=>{typeof window<"u"&&(document.removeEventListener("pointerdown",F),document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",N))}},[e,r,F,L,N]),Ge.jsx("group",{children:n})},Pte=({selections:n=[],nodes:e=[],actives:t=[],focusOnSelect:i=!0,type:r="single",pathHoverType:s="out",pathSelectionType:o="direct",ref:a,hotkeys:l=["selectAll","deselect","delete"],disabled:u,onSelection:c})=>{const[f,h]=Y.useState([]),[m,v]=Y.useState(t),[x,_]=Y.useState(n),[g,y]=Y.useState(!1),w=r==="multi"||r==="multiModifier",E=Y.useCallback(W=>{if(!u&&W){W=Array.isArray(W)?W:[W];const I=W.filter(O=>!x.includes(O));if(I.length){const O=[...x,...I];c==null||c(O),_(O)}}},[u,x,c]),M=Y.useCallback(W=>{if(!u&&W){W=Array.isArray(W)?W:[W];const I=x.filter(O=>!W.includes(O));c==null||c(I),_(I)}},[u,x,c]),b=Y.useCallback((W=[])=>{u||(W=Array.isArray(W)?W:[W],v([]),_(W),c==null||c(W))},[u,c]),C=Y.useCallback(W=>{x.includes(W)?M(W):w?E(W):b(W)},[E,b,x,w,M]),P=Y.useCallback(W=>{if(w?r==="multiModifier"?g?E(W.id):b(W.id):E(W.id):b(W.id),i===!0||i==="singleOnly"&&!g){if(!a.current)throw new Error("No ref found for the graph canvas.");const I=a.current.getGraph(),{nodes:O}=Pw(I,[W.id],o);a.current.fitNodesInView([W.id,...O],{fitOnlyIfNodesNotInView:!0})}},[E,b,i,w,g,o,a,r]),A=Y.useCallback((W,I)=>{const O=a.current.getGraph();if(!O)throw new Error("Graph is not initialized");const k=mte(O,W,I);b([W,I]);const U=[];for(let z=0;zz),...U])},[b,a]),L=Y.useCallback(W=>{const I=W.target,O=I.tagName!=="INPUT"&&I.tagName!=="SELECT"&&I.tagName!=="TEXTAREA"&&!I.isContentEditable,k=W.metaKey||W.ctrlKey;O&&k&&(W.preventDefault(),y(!0))},[]);Y.useEffect(()=>(typeof window<"u"&&window.addEventListener("keydown",L),()=>{typeof window<"u"&&window.removeEventListener("keydown",L)}),[L]);const N=Y.useCallback(W=>{if(W.button!==2&&(x.length||m.length)&&(b(),y(!1),i&&x.length===1)){if(!a.current)throw new Error("No ref found for the graph canvas.");a.current.fitNodesInView([],{fitOnlyIfNodesNotInView:!0})}},[b,i,m.length,x.length,a]),F=Y.useCallback(W=>{v(W)},[]),B=Y.useCallback(W=>{b(W)},[b]),j=Y.useCallback(W=>{if(s){const I=a.current.getGraph();if(!I)throw new Error("No ref found for the graph canvas.");const{nodes:O,edges:k}=Pw(I,[W.id],s);h([...O,...k])}},[s,a]),q=Y.useCallback(()=>{s&&h([])},[s]);return Y.useEffect(()=>{var W;if(o!=="direct"&&x.length>0){const I=(W=a.current)==null?void 0:W.getGraph();if(I){const{nodes:O,edges:k}=Pw(I,x,o);v([...O,...k])}}},[x,o,a]),P2([{name:"Select All",keys:"mod+a",disabled:!l.includes("selectAll"),category:"Graph",description:"Select all nodes and edges",callback:W=>{if(W.preventDefault(),!u&&r!=="single"){const I=e.map(O=>O.id);c==null||c(I),_(I)}}},{name:"Deselect Selections",category:"Graph",disabled:!l.includes("deselect"),description:"Deselect selected nodes and edges",keys:"escape",callback:W=>{u||(W.preventDefault(),c==null||c([]),_([]))}}]),{actives:Y.useMemo(()=>[...m,...f],[m,f]),onNodeClick:P,onNodePointerOver:j,onNodePointerOut:q,onLasso:F,onLassoEnd:B,selectNodePaths:A,onCanvasClick:N,selections:x,clearSelections:b,addSelection:E,removeSelection:M,toggleSelection:C,setSelections:_}},Lte="_canvas_670zp_1",Ite={canvas:Lte},Dte={alpha:!0,antialias:!0},Ute={position:[0,0,1e3],near:5,far:5e4,fov:10},tz=Y.forwardRef(({cameraMode:n,edges:e,children:t,nodes:i,theme:r,minDistance:s,maxDistance:o,onCanvasClick:a,animated:l,disabled:u,lassoType:c,onLasso:f,onLassoEnd:h,glOptions:m,...v},x)=>{var _,g;const y=Y.useRef(null),w=Y.useRef(null),E=Y.useRef(null);Y.useImperativeHandle(x,()=>({centerGraph:(L,N)=>{var F;return(F=y.current)==null?void 0:F.centerGraph(L,N)},fitNodesInView:(L,N)=>{var F;return(F=y.current)==null?void 0:F.fitNodesInView(L,N)},zoomIn:()=>{var L;return(L=w.current)==null?void 0:L.zoomIn()},zoomOut:()=>{var L;return(L=w.current)==null?void 0:L.zoomOut()},panLeft:()=>{var L;return(L=w.current)==null?void 0:L.panLeft()},panRight:()=>{var L;return(L=w.current)==null?void 0:L.panRight()},panDown:()=>{var L;return(L=w.current)==null?void 0:L.panDown()},panUp:()=>{var L;return(L=w.current)==null?void 0:L.panUp()},resetControls:L=>{var N;return(N=w.current)==null?void 0:N.resetControls(L)},getControls:()=>{var L;return(L=w.current)==null?void 0:L.controls},getGraph:()=>{var L;return(L=y.current)==null?void 0:L.graph},exportCanvas:()=>(y.current.renderScene(),E.current.toDataURL())}));const{selections:M,actives:b,collapsedNodeIds:C}=v,P=e.length+i.length>400?!1:l,A=Y.useMemo(()=>({...m,...Dte}),[m]);return Ge.jsx("div",{className:Ite.canvas,children:Ge.jsx(B9,{legacy:!0,linear:!0,ref:E,flat:!0,gl:A,camera:Ute,onPointerMissed:a,children:Ge.jsxs(gte,{createStore:()=>vte({selections:M,actives:b,theme:r,collapsedNodeIds:C}),children:[((_=r.canvas)==null?void 0:_.background)&&Ge.jsx("color",{attach:"background",args:[r.canvas.background]}),Ge.jsx("ambientLight",{intensity:1}),t,((g=r.canvas)==null?void 0:g.fog)&&Ge.jsx("fog",{attach:"fog",args:[r.canvas.fog,4e3,9e3]}),Ge.jsx(WF,{mode:n,ref:w,disabled:u,minDistance:s,maxDistance:o,animated:l,children:Ge.jsx(Rte,{disabled:u,type:c,onLasso:f,onLassoEnd:h,children:Ge.jsx(Y.Suspense,{children:Ge.jsx(JF,{ref:y,disabled:u,animated:P,edges:e,nodes:i,...v})})})})]})})})});tz.defaultProps={cameraMode:"pan",layoutType:"forceDirected2d",sizingType:"default",labelType:"auto",theme:ez,animated:!0,defaultNodeSize:7,minNodeSize:5,maxNodeSize:15,lassoType:"none",glOptions:{}};const Ote=({kanjiNodeList:n})=>{const[e,t]=[[],[]];for(const f of n){const h={id:"n-"+f.name,label:f.name,dataNode:f};e.push(h);for(const m of f.children){const v={id:f.name+"->"+m.name,source:"n-"+f.name,target:"n-"+m.name};t.push(v)}}const i=Y.useRef(null),{selections:r,actives:s,onNodeClick:o,onCanvasClick:a,onNodePointerOver:l,onNodePointerOut:u}=Pte({ref:i,nodes:e,edges:t,pathHoverType:"in",pathSelectionType:"in",type:"multi"}),c=ez;return c.canvas&&(c.canvas.background="#b2b2b2"),Ge.jsx(tz,{ref:i,labelFontUrl:"https://ey2pz3.csb.app/NotoSansSC-Regular.ttf",layoutType:"treeTd2d",nodes:e,edges:t,selections:r,actives:s,onNodePointerOver:l,onNodePointerOut:u,onCanvasClick:a,onNodeClick:o})},p3={丶:["0"],一:["0"],丨:["0"],亅:["0"],丿:["0"],乙:["0"],丁:["一","亅"],七:["儿","一"],九:["丿","乙"],几:["丿","乙"],了:["亅"],二:["一"],人:["0"],入:["0"],八:["0"],儿:["0"],刀:["丿"],力:["丿"],十:["一","丨"],又:["乂"],乃:["刀"],乂:["丿"],卜:["丨","丶"],冂:["丨"],亠:["一","丶"],勹:["冂"],匸:["匚"],亻:["丨"],厶:["丶"],卩:["丨"],冖:["一"],冫:["丶"],凵:["丨"],刂:["亅","丨"],厂:["丿","一"],匕:["儿"],匚:["一","凵"],万:["一","丿"],丈:["十","乂"],三:["一","二"],上:["卜","一"],下:["一","卜"],丸:["九","丶"],久:["勹","人"],亡:["匸","丶"],凡:["几","丶"],刃:["刀","丶"],千:["十"],口:["丨","一"],土:["十","一"],夕:["久","丶"],大:["人","一"],女:["丿","一"],子:["了","一"],寸:["十","亅","丶"],小:["亅","八"],山:["丨","凵"],川:["丿","丨"],工:["一","丨"],己:["彐","儿"],干:["一","十"],弓:["己"],才:["十"],之:["亠","了"],巾:["冂","丨"],乞:["一","乙"],士:["十","一"],巳:["尸","儿"],彑:["凵","一"],也:["儿","丨"],弋:["一","丶"],夂:["又"],兀:["一","儿"],廾:["一","丿","丨"],尸:["彐","丿"],囗:["冂","一"],宀:["冖","丶"],勺:["勹","丶"],于:["干","亅"],巛:["川"],幺:["厶"],广:["厂","丶"],阝:["了","丨"],廴:["0"],彐:["二"],彡:["三"],彳:["丨"],忄:["丨","丶"],扌:["亅","二"],尢:["一","儿"],氵:["冫"],屮:["丨","凵"],不:["一","丿","卜"],与:["弓","一"],中:["口","丨"],丹:["丿","冂","丶","一"],予:["了","丶","冖","亅"],互:["一","彑"],五:["一","力"],井:["丿","丨","二"],仁:["亻","二"],今:["人","一"],介:["人","丿","丨"],仏:["亻","厶"],元:["二","儿"],公:["八","厶"],六:["亠","八"],内:["人","冂"],円:["冂","丨","一"],冗:["冖","几"],凶:["凵","乂"],分:["八","刀"],切:["七","刀"],刈:["乂","刂"],化:["亻","匕"],匹:["匚","儿"],区:["匚","乂"],升:["廾"],午:["干"],厄:["厂","卩"],及:["乃","八"],友:["十","又"],双:["又"],反:["丿","又"],収:["丨","又"],天:["一","大"],太:["大","丶"],夫:["人","二"],孔:["子","儿"],少:["小","丿"],尺:["尸","八"],屯:["十","屮","儿"],幻:["幺"],引:["弓","丨"],心:["丶"],戸:["一","尸"],手:["扌"],支:["十","又"],文:["亠","乂"],斗:["十","丶"],斤:["丿","一","丨"],方:["亠","丿"],日:["口","一"],月:["丿","冂","二"],木:["十","八"],欠:["勹","人"],止:["卜","丨","一"],比:["匕"],毛:["二","儿"],氏:["弋"],水:["亅","丶"],火:["丶","人"],父:["八","乂"],片:["丿","亠"],牛:["二","丨"],犬:["大","丶"],王:["一","土"],巴:["尸","丶","儿"],允:["厶","儿"],爪:["丿","八","丨"],牙:["一","才"],匂:["勹","匕"],勾:["勹","厶"],乏:["之"],壬:["士"],廿:["廾","一"],戈:["弋"],云:["二","厶"],歹:["一","夕"],灬:["丶"],尹:["彐","一","丨"],攵:["乂"],辶:["丶","廴"],殳:["几","又"],气:["一","乙"],礻:["主","戈","卜"],丑:["刀","二"],勿:["勹","丿"],毋:["女","十"],爿:["丨","凵","一","丿"],夬:["大"],出:["山"],世:["凵","廿"],付:["亻","寸"],仕:["亻","士"],代:["亻","弋"],仙:["亻","山"],他:["亻","也"],以:["丨","丶","人"],令:["人","丶","了"],兄:["口","儿"],只:["口","八"],史:["中","乂"],号:["口","弓"],叶:["口","十"],叱:["口","匕"],加:["力","口"],占:["卜","口"],可:["丁","口"],句:["勹","口"],司:["一","口"],召:["刀","口"],台:["厶","口"],古:["十","口"],右:["十","口"],石:["一","丿","口"],四:["囗","儿"],囚:["囗","人"],凸:["丨","一"],凹:["凵"],冬:["夂","丶"],処:["夂","几"],皮:["丿","丨","又"],奴:["女","又"],功:["工","力"],巧:["工","弓"],包:["勹","巳"],去:["土","厶"],圧:["厂","土"],庁:["广","丁"],広:["广","厶"],刊:["干","刂"],北:["匕"],半:["二","丨","丶"],外:["夕","卜"],央:["大","冂"],失:["夫"],矢:["一","大"],尻:["尸","九"],尼:["尸","匕"],左:["十","工"],布:["十","巾"],平:["干","丶"],幼:["幺","力"],弁:["厶","廾"],必:["心","丿"],打:["扌","丁"],払:["扌","厶"],斥:["斤","丶"],丘:["斤","一"],未:["木","一"],末:["木","一"],本:["木","一"],札:["木","儿"],正:["一","止"],母:["凵","丶","一"],民:["巳","氏"],氷:["水","丶"],永:["丶","水"],汁:["氵","十"],犯:["亅","卩"],生:["十","二"],主:["王","丶"],玉:["王","丶"],巨:["匚","彐"],用:["冂","二","丨"],冊:["冂","丨","一"],田:["冂","土"],由:["田"],甲:["日","丨"],申:["日","丨"],白:["日"],旧:["丨","日"],旦:["日","一"],甘:["廾","二"],皿:["冂","丨","一"],目:["日"],且:["目"],矛:["了","丶","冖","亅"],示:["二","小"],礼:["礻","儿"],写:["冖","与"],立:["亠","丶","一"],市:["亠","巾"],穴:["宀","八"],玄:["亠","幺"],辺:["辶","刀"],込:["辶","入"],弘:["弓","厶"],瓦:["一","九","丶"],丼:["井","丶"],丙:["一","内"],叩:["口","卩"],禾:["木"],乍:["一","丨","二"],衤:["丶","了","丨"],疋:["冖","止"],卯:["丿","卩"],氺:["亅","冫"],罒:["口","丨"],疒:["广","冫"],癶:["夕","八"],旡:["一","尢"],辻:["辶","十"],両:["一","山","冂"],争:["勹","彐","一","亅"],交:["亠","父"],仮:["亻","反"],仰:["亻","卯"],仲:["亻","中"],件:["亻","牛"],任:["亻","壬"],企:["人","止"],伏:["亻","犬"],伐:["亻","戈"],休:["亻","木"],会:["人","云"],伝:["亻","云"],充:["亠","允"],兆:["儿","冫"],先:["土","儿"],光:["丨","丶","兀"],全:["人","王"],共:["廾","一","八"],再:["王","冂"],刑:["井","刂"],列:["歹","刂"],劣:["少","力"],匠:["匚","斤"],印:["丨","卩"],危:["勹","厄"],叫:["口","丨"],各:["夂","口"],合:["人","一","口"],吉:["士","口"],同:["冂","一","口"],名:["夕","口"],后:["斤","口"],吏:["十","中","乂"],吐:["口","土"],向:["丶","冂","口"],回:["囗","口"],因:["囗","大"],団:["囗","寸"],在:["十","亻","土"],地:["土","也"],壮:["丨","冫","士"],多:["夕"],好:["女","子"],如:["女","口"],妃:["女","己"],妄:["亡","女"],存:["十","亻","子"],宅:["宀","七"],宇:["宀","于"],守:["宀","寸"],安:["宀","女"],寺:["土","寸"],尽:["尺","丶"],州:["川","丶"],巡:["辶","巛"],帆:["巾","凡"],年:["一","干"],式:["弋","工"],弐:["一","弋","二"],当:["丨","丶","彐"],忙:["忄","亡"],成:["万","戈"],旨:["匕","日"],早:["日","十"],旬:["勹","日"],曲:["丨","日"],有:["十","月"],朱:["未"],朴:["木","卜"],机:["木","几"],朽:["木","弓"],次:["冫","欠"],死:["歹","匕"],毎:["一","毋"],気:["气","乂"],汗:["氵","干"],汚:["氵","二","弓"],江:["氵","工"],池:["氵","也"],灯:["火","丁"],灰:["十","火"],百:["一","白"],竹:["丨","丁"],米:["木","丶"],糸:["幺","小"],缶:["午","山"],羊:["丶","三","丨"],羽:["卩","冫"],老:["耂","匕"],考:["耂","弓"],耳:["二","丨"],肉:["人","冂"],肌:["月","几"],自:["目","丶"],至:["一","厶","土"],舌:["千","口"],舟:["丹","丶"],色:["勹","巴"],芋:["廾","于"],芝:["廾","之"],虫:["中","一","丶"],血:["皿","丶"],行:["彳","二","丁"],衣:["亠"],西:["兀","囗"],迅:["辶","乙","十"],字:["宀","子"],伊:["亻","尹"],旭:["九","日"],庄:["广","土"],亘:["一","旦"],圭:["土"],汐:["氵","夕"],伎:["亻","支"],臼:["彐"],汎:["氵","凡"],亦:["亠","丨","亅","八"],瓜:["爪"],虍:["卜","厂","七"],艮:["彐","衣"],吊:["口","巾"],聿:["尹","二","丨"],而:["一","丿","冂","丨"],耒:["未"],此:["止","匕"],舛:["夕","干"],迄:["辶","乞"],耂:["土"],尖:["小","大"],乱:["舌","儿"],亜:["二","口","丨"],伯:["亻","白"],伴:["亻","半"],伸:["亻","申"],伺:["亻","司"],似:["亻","以"],但:["亻","旦"],位:["亻","立"],低:["亻","氏","丶"],住:["亻","主"],佐:["亻","左"],体:["亻","本"],何:["亻","可"],余:["人","示"],作:["亻","乍"],克:["古","儿"],児:["旧","儿"],兵:["丘","八"],冷:["冫","令"],初:["衤","刀"],判:["半","刂"],別:["口","力","刂"],利:["禾","刂"],助:["且","力"],努:["奴","力"],励:["厂","万","力"],労:["丶","冖","力"],医:["匚","矢"],即:["艮","丶","卩"],却:["去","卩"],卵:["卯","丶"],君:["尹","口"],吟:["口","今"],否:["不","口"],含:["今","口"],吸:["口","及"],吹:["口","欠"],呈:["口","王"],呉:["口","弓","一","八"],告:["土","口"],困:["囗","木"],囲:["囗","井"],図:["囗","丶","乂"],坂:["土","反"],均:["土","勹","亠"],坊:["土","方"],坑:["土","亠","几"],声:["士","尸"],壱:["士","冖","匕"],売:["士","冖","儿"],妊:["女","壬"],妙:["女","少"],妥:["爪","女"],妨:["女","方"],孝:["耂","子"],完:["宀","元"],対:["文","寸"],寿:["三","丿","寸"],尾:["尸","毛"],尿:["尸","水"],局:["尸","口"],岐:["山","支"],岩:["山","石"],希:["乂","布"],床:["广","木"],序:["广","予"],廷:["廴","壬"],弟:["丶","弓","丨"],形:["一","廾","彡"],役:["彳","殳"],忌:["己","心"],忍:["刃","心"],志:["士","心"],忘:["亡","心"],応:["广","心"],快:["忄","夬"],我:["手","戈"],戒:["戈","廾"],戻:["戸","大"],扱:["扌","及"],扶:["扌","夫"],批:["扌","比"],技:["扌","支"],抄:["扌","少"],把:["扌","巴"],抑:["扌","卯"],投:["扌","殳"],抗:["扌","亠","几"],折:["扌","斤"],抜:["扌","友"],択:["扌","尺"],改:["己","攵"],攻:["工","攵"],更:["一","申","乂"],杉:["木","彡"],材:["木","才"],村:["木","寸"],束:["木","口"],条:["夂","木"],来:["未","丶"],求:["十","丶","氺"],決:["氵","夬"],汽:["氵","气"],沈:["氵","冖","尢"],沖:["氵","中"],没:["氵","殳"],沢:["氵","尺"],災:["巛","火"],状:["丨","冫","犬"],狂:["亅","王"],男:["田","力"],町:["田","丁"],社:["礻","土"],秀:["禾","乃"],私:["禾","厶"],究:["穴","九"],系:["糸"],肖:["丨","丶","月"],肝:["月","干"],臣:["匚","丨","彐"],良:["艮","丶"],花:["廾","化"],芳:["廾","方"],芸:["廾","云"],見:["目","儿"],角:["勹","用"],言:["亠","二","口"],谷:["八","人","口"],豆:["立","口"],貝:["目","八"],赤:["土","丨","亅","八"],走:["土","止"],足:["口","止"],身:["丶","月"],車:["二","丨","日"],辛:["立","十"],迎:["辶","卯"],近:["辶","斤"],返:["辶","反"],邦:["三","丿","阝"],里:["日","丨","二"],防:["阝","方"],麦:["十","二","夂"],串:["中"],李:["木","子"],那:["刀","二","阝"],沙:["氵","少"],呂:["口","丶"],杏:["木","口"],冶:["冫","台"],汰:["氵","太"],肘:["月","寸"],阪:["阝","反"],弄:["王","廾"],妖:["女","大"],呆:["口","木"],辰:["厂","二","艮"],豕:["一","勿"],甫:["十","用","丶"],豸:["丶","勿"],坐:["人","丨"],吾:["五","口"],釆:["米"],酉:["兀","日"],並:["丶","二","丨"],乳:["爪","子","儿"],事:["十","中","尹","亅"],享:["亠","口","子"],京:["亠","口","小"],佳:["亻","圭"],併:["亻","丶","一","廾"],使:["亻","吏"],例:["亻","列"],侍:["亻","寺"],供:["亻","共"],依:["亻","衣"],価:["亻","西"],侮:["亻","一","母"],免:["勹","中","儿"],具:["目","一","八"],典:["曲","八"],到:["至","刂"],制:["牛","巾","刂"],刷:["尸","巾","刂"],券:["丶","一","大","刀"],刺:["木","冂","刂"],刻:["玄","人","刂"],効:["交","力"],卒:["亠","人","十"],卓:["卜","早"],協:["十","力"],参:["厶","大","彡"],叔:["上","小","又"],取:["耳","又"],受:["爪","冖","又"],周:["冂","土","口"],味:["口","未"],呼:["口","丶","一","亅"],命:["人","一","叩"],和:["禾","口"],固:["囗","古"],国:["囗","玉"],坪:["土","平"],垂:["千","廾","土"],夜:["亠","亻","夂","丶"],奇:["大","可"],奉:["二","大","丨"],奔:["大","十","廾"],妹:["女","未"],妻:["十","尹","女"],姉:["女","十","巾"],始:["女","台"],姓:["女","生"],委:["禾","女"],季:["禾","子"],学:["丶","冖","子"],宗:["宀","示"],官:["宀","丨","口"],宙:["宀","由"],定:["宀","一","止"],宜:["宀","且"],宝:["宀","玉"],実:["宀","二","大"],尚:["丨","丶","冂","口"],居:["尸","古"],屈:["尸","出"],届:["尸","由"],岬:["山","甲"],岳:["丘","山"],岸:["山","厂","干"],幸:["土","丶","干"],底:["广","氏","丶"],店:["广","占"],府:["广","付"],延:["廴","止"],弦:["弓","玄"],彼:["彳","皮"],往:["彳","主"],征:["彳","正"],径:["彳","了","丶","工"],忠:["中","心"],念:["今","心"],怖:["忄","布"],性:["忄","生"],怪:["忄","又","土"],房:["戸","方"],所:["戸","斤"],承:["了","水","三"],披:["扌","皮"],抱:["扌","包"],抵:["扌","氏","丶"],抹:["扌","末"],押:["扌","甲"],抽:["扌","由"],担:["扌","旦"],拍:["扌","白"],拐:["扌","口","力"],拒:["扌","巨"],拓:["扌","石"],拘:["扌","句"],招:["扌","召"],拝:["扌","一","三","丨"],拠:["扌","攵","几"],拡:["扌","広"],放:["方","攵"],斉:["文","丿","丨","二"],昆:["日","比"],昇:["日","升"],明:["日","月"],易:["日","勿"],昔:["廾","一","日"],服:["月","卩","又"],杯:["木","不"],東:["木","日"],松:["木","公"],板:["木","反"],析:["木","斤"],林:["木"],枚:["木","攵"],果:["田","木"],枝:["木","支"],枠:["木","九","十"],枢:["木","区"],欧:["区","欠"],武:["一","弋","止"],歩:["止","少"],殴:["区","殳"],毒:["十","二","母"],河:["氵","可"],沸:["氵","弓","丿","丨"],油:["氵","由"],治:["氵","台"],沼:["氵","召"],沿:["氵","几","口"],況:["氵","兄"],泊:["氵","白"],泌:["氵","必"],法:["氵","去"],泡:["氵","包"],波:["氵","皮"],泣:["氵","立"],泥:["氵","尼"],注:["氵","主"],泳:["氵","永"],炉:["火","戸"],炊:["火","欠"],炎:["火"],版:["片","反"],牧:["牛","攵"],物:["牛","勿"],画:["一","田","凵"],的:["白","勺"],盲:["亡","目"],直:["十","目","一"],知:["矢","口"],祈:["礻","斤"],祉:["礻","止"],空:["穴","工"],突:["穴","犬"],者:["耂","日"],肢:["月","支"],肥:["月","巴"],肩:["戸","月"],肪:["月","方"],肯:["止","月"],育:["亠","厶","月"],舎:["人","土","口"],芽:["廾","牙"],苗:["廾","田"],若:["廾","右"],苦:["廾","古"],英:["廾","央"],茂:["廾","厂","戈"],茎:["廾","了","丶","工"],表:["十","二","衣"],迫:["辶","白"],述:["辶","木","丶"],邪:["牙","阝"],邸:["氏","丶","阝"],金:["人","干","丶","一"],長:["丨","二","艮"],門:["丨","彐","月"],阻:["阝","且"],附:["阝","付"],雨:["一","巾","丶"],青:["十","二","月"],非:["丨","三"],奈:["大","示"],阿:["阝","可"],昌:["日"],虎:["虍","几"],弥:["弓","勹","小"],茅:["廾","矛"],拙:["扌","出"],朋:["月"],苑:["廾","夕","卩"],於:["方","人","丶"],旺:["日","王"],采:["爪","木"],宛:["宀","夕","卩"],岡:["冂","丶","一","山"],玩:["王","元"],股:["月","殳"],呪:["口","兄"],刹:["乂","木","刂"],狙:["亅","且"],妬:["女","石"],阜:["丶","丨","口","十"],枕:["木","冖","尢"],拉:["扌","立"],奄:["大","申","儿"],或:["戈","口","一"],其:["甘","一","八"],隹:["亻","一","丨","三"],昏:["氏","日"],隶:["尹","氺"],孟:["子","皿"],兔:["免","丶"],飠:["人","丶","艮"],函:["一","弓","氺","凵"],乗:["禾","二","廾"],亭:["亠","口","冖","丁"],侯:["亻","彐","矢"],侵:["亻","彐","冖","又"],便:["亻","更"],係:["亻","系"],促:["亻","足"],俊:["亻","厶","八","夂"],俗:["亻","谷"],保:["亻","呆"],信:["亻","言"],冒:["冂","二","目"],冠:["冖","元","寸"],則:["貝","刂"],削:["肖","刂"],前:["丶","一","月","刂"],勅:["束","力"],勇:["了","丶","男"],卑:["丶","甲","十"],南:["十","冂","丶","干"],卸:["午","止","卩"],厘:["厂","里"],厚:["厂","日","子"],叙:["余","又"],咲:["口","丶","天"],単:["丶","甲","十"],哀:["衣","口"],品:["口"],型:["刑","土"],垣:["土","亘"],城:["土","成"],変:["亦","夂"],奏:["二","大","天"],契:["三","丨","刀","大"],姻:["女","因"],姿:["次","女"],威:["厂","戈","一","女"],孤:["子","瓜"],客:["宀","各"],宣:["宀","亘"],室:["宀","至"],封:["圭","寸"],専:["十","由","寸"],屋:["尸","至"],峠:["山","上","下"],峡:["山","夫","丶"],巻:["丶","一","大","己"],帝:["立","冖","巾"],帥:["丶","丨","口","巾"],幽:["山","幺"],度:["广","廿","又"],建:["廴","聿"],弧:["弓","瓜"],待:["彳","寺"],律:["彳","聿"],後:["彳","幺","夂"],怒:["奴","心"],思:["田","心"],怠:["台","心"],急:["勹","彐","心"],恒:["忄","亘"],恨:["忄","艮"],悔:["忄","一","母"],括:["扌","舌"],拷:["扌","考"],拾:["扌","合"],持:["扌","寺"],指:["扌","旨"],挑:["扌","兆"],挟:["扌","夫","丶"],政:["正","攵"],故:["古","攵"],施:["方","一","也"],星:["日","生"],映:["日","央"],春:["二","大","日"],昨:["日","乍"],昭:["日","召"],是:["日","一","止"],昼:["尺","旦"],枯:["木","古"],架:["加","木"],柄:["木","丙"],某:["甘","木"],染:["氵","九","木"],柔:["矛","木"],柱:["木","主"],柳:["木","卯"],査:["木","且"],栄:["丶","冖","木"],段:["丨","一","殳"],泉:["白","水"],洋:["氵","羊"],洗:["氵","先"],洞:["氵","同"],津:["氵","聿"],洪:["氵","共"],活:["氵","舌"],派:["氵","丿","斤"],浄:["氵","争"],浅:["氵","二","戈"],海:["氵","一","母"],炭:["山","灰"],点:["占","灬"],為:["丶","丿","灬"],牲:["牛","生"],狩:["亅","守"],独:["亅","虫"],狭:["亅","夫","丶"],珍:["王","人","彡"],甚:["甘","匹"],界:["田","介"],畑:["火","田"],疫:["疒","殳"],発:["癶","一","廾","儿"],皆:["比","白"],皇:["白","王"],盆:["分","皿"],相:["木","目"],盾:["丿","十","目"],省:["少","目"],看:["手","目"],県:["目","凵","小"],砂:["石","少"],研:["石","一","廾"],砕:["石","九","十"],祖:["礻","且"],祝:["礻","兄"],神:["礻","申"],秋:["禾","火"],科:["禾","斗"],秒:["禾","少"],窃:["穴","切"],糾:["糸","丨"],紀:["糸","己"],約:["糸","勺"],紅:["糸","工"],美:["羊","大"],耐:["而","寸"],肺:["月","十","巾"],胃:["田","月"],胆:["月","旦"],背:["北","月"],胎:["月","台"],胞:["月","包"],臭:["自","犬"],茶:["廾","人","木"],草:["廾","早"],荒:["廾","亡","儿","丨"],荘:["廾","壮"],要:["西","女"],訂:["言","丁"],計:["言","十"],貞:["卜","貝"],負:["勹","貝"],赴:["走","卜"],軌:["車","九"],軍:["冖","車"],迷:["辶","米"],追:["辶","丶","丨","口"],退:["辶","艮"],送:["辶","丶","天"],逃:["辶","兆"],逆:["辶","丶","一","屮"],郊:["交","阝"],郎:["丶","艮","阝"],重:["千","里"],限:["阝","艮"],面:["一","丿","囗","丨","二"],革:["廿","中","十"],音:["立","日"],風:["几","虫"],飛:["升","乙","丶"],食:["人","丶","艮"],首:["丶","一","自"],香:["禾","日"],彦:["立","厂","彡"],胡:["古","月"],虹:["虫","工"],眉:["尸","丶","目"],怨:["夕","卩","心"],咽:["口","因"],畏:["田","一","艮"],拶:["扌","巛","夕"],柵:["木","冊"],拭:["扌","式"],栃:["木","丿","万"],昧:["日","未"],勃:["十","冖","子","力"],侶:["亻","口","丶"],柿:["木","市"],屏:["尸","丶","一","廾"],巷:["共","巳"],頁:["一","丶","貝"],洛:["氵","各"],柏:["木","白"],殆:["歹","台"],哉:["土","戈","口"],洲:["氵","州"],修:["亻","丨","攵","彡"],俳:["亻","非"],俵:["亻","表"],俸:["亻","奉"],倉:["人","丶","彐","丿","口"],個:["亻","固"],倍:["亻","立","口"],倒:["亻","到"],候:["亻","丨","彐","矢"],借:["亻","昔"],倣:["亻","方","攵"],値:["亻","十","目","凵"],倫:["亻","人","一","冊"],俺:["亻","奄"],党:["宀","丶","兄"],兼:["丶","一","彐","丨","八"],准:["冫","隹"],凍:["冫","東"],剖:["立","口","刂"],剛:["岡","刂"],剣:["人","一","央","刂"],剤:["斉","刂"],勉:["免","力"],匿:["匚","若"],原:["厂","白","小"],員:["口","貝"],哲:["折","口"],唆:["口","厶","八","夂"],唇:["辰","口"],唐:["广","尹","口"],埋:["土","里"],姫:["女","臣"],娘:["女","良"],娠:["女","辰"],娯:["女","呉"],夏:["一","自","夂"],孫:["子","系"],宮:["宀","口","丶"],宰:["宀","辛"],害:["宀","三","丨","口"],宴:["宀","日","女"],宵:["宀","肖"],家:["宀","豕"],容:["宀","谷"],射:["身","寸"],将:["丨","冫","爪","寸"],展:["尸","廾","一","艮"],峰:["山","夂","三","丨"],島:["白","一","山"],差:["羊","工"],師:["丶","丨","口","一","巾"],席:["广","廿","巾"],帯:["廿","丨","冖","巾"],帰:["丨","彐","冖","巾"],座:["广","坐"],庫:["广","車"],庭:["广","廷"],弱:["弓","冫"],徐:["彳","余"],徒:["彳","走"],従:["彳","丶","一","止"],恋:["亦","心"],恐:["工","凡","心"],恥:["耳","心"],恩:["因","心"],恭:["共","忄","丶"],息:["自","心"],恵:["十","由","心"],悟:["忄","吾"],悦:["忄","丶","兄"],悩:["忄","丶","凶"],扇:["戸","羽"],挙:["丶","一","八","手"],振:["扌","辰"],挿:["扌","千","申"],捕:["扌","甫"],捜:["扌","申","又"],敏:["一","母","攵"],料:["米","斗"],旅:["方","一","氏"],既:["艮","丶","旡"],時:["日","寺"],書:["聿","日"],朗:["丶","艮","月"],栓:["木","全"],校:["木","交"],株:["木","朱"],核:["木","玄","人"],根:["木","艮"],格:["木","各"],栽:["土","戈","木"],桃:["木","兆"],案:["安","木"],桑:["又","木"],桜:["木","丶","女"],桟:["木","三","二","戈"],梅:["木","一","母"],殉:["歹","旬"],殊:["歹","朱"],残:["歹","二","戈"],殺:["乂","木","殳"],泰:["二","大","氺"],流:["氵","亠","厶","儿","丨"],浜:["氵","兵"],浦:["氵","甫"],浪:["氵","良"],浮:["氵","爪","子"],浴:["氵","谷"],浸:["氵","彐","冖","又"],消:["氵","肖"],涙:["氵","戻"],烈:["列","灬"],特:["牛","寺"],珠:["王","朱"],班:["王","丿","丶"],瓶:["丶","一","廾","瓦"],畔:["田","半"],留:["卯","田"],畜:["玄","田"],疲:["疒","皮"],疾:["疒","矢"],病:["疒","丙"],症:["疒","正"],益:["丶","一","八","皿"],真:["十","具"],眠:["目","民"],砲:["石","包"],破:["石","皮"],祥:["礻","羊"],秘:["禾","必"],租:["禾","且"],秩:["禾","失"],称:["禾","勹","小"],竜:["立","申","儿"],笑:["竹","大"],粉:["米","分"],粋:["米","九","十"],紋:["糸","文"],納:["糸","内"],純:["糸","屯"],紙:["糸","氏"],級:["糸","及"],紛:["糸","分"],素:["十","二","糸"],紡:["糸","方"],索:["十","冖","糸"],翁:["公","羽"],耕:["耒","井"],耗:["耒","毛"],胴:["月","同"],胸:["月","勹","凶"],能:["厶","月","匕"],脂:["月","旨"],脅:["力","月"],脈:["月","丿","斤"],致:["至","攵"],航:["舟","亠","几"],般:["舟","殳"],荷:["廾","何"],華:["廾","一","二","丨"],虐:["虍","匚","一"],蚊:["虫","文"],衰:["衣","囗","一"],被:["衤","皮"],討:["言","寸"],訓:["言","川"],託:["言","七"],記:["言","己"],財:["貝","才"],貢:["工","貝"],起:["走","己"],軒:["車","干"],辱:["辰","寸"],透:["辶","秀"],逐:["辶","豕"],逓:["辶","丿","二","丨","巾"],途:["辶","余"],通:["辶","了","丶","用"],逝:["辶","折"],速:["辶","束"],造:["辶","告"],連:["辶","車"],郡:["君","阝"],酌:["酉","勺"],配:["酉","己"],酒:["氵","酉"],針:["金","十"],降:["阝","夂","干"],陛:["阝","比","土"],院:["阝","完"],陣:["阝","車"],除:["阝","余"],陥:["阝","勹","旧"],隻:["隹","又"],飢:["飠","几"],馬:["丨","一","二","灬"],骨:["冂","冖","月"],高:["亠","口","冂"],鬼:["丶","甲","儿","厶"],浩:["氵","告"],栗:["西","木"],桂:["木","圭"],桐:["木","同"],拳:["丶","一","大","手"],唄:["口","貝"],冥:["冖","日","六"],挨:["扌","厶","矢"],挫:["扌","坐"],桁:["木","行"],脊:["人","冫","月"],凄:["冫","妻"],芯:["廾","心"],捉:["扌","足"],捗:["扌","止","小","丿"],酎:["酉","寸"],剥:["彐","氺","刂"],脇:["月","力"],哺:["口","甫"],釜:["父","金"],莫:["廾","日","大"],朔:["丶","一","屮","月"],韋:["丶","一","口","干"],這:["辶","言"],烏:["丶","彐","一","弓","灬"],柴:["此","木"],乾:["十","早","乞"],偏:["亻","戸","冊"],停:["亻","亭"],健:["亻","建"],側:["亻","則"],偵:["亻","貞"],偶:["亻","甲","厶","冂"],偽:["亻","為"],副:["一","口","田","刂"],剰:["乗","刂"],動:["重","力"],勘:["甚","力"],務:["矛","夂","力"],唯:["口","隹"],唱:["口","昌"],商:["立","冂","儿","口"],問:["門","口"],啓:["戸","攵","口"],喝:["口","日","勹","人"],圏:["囗","巻"],域:["土","或"],執:["幸","丸"],培:["土","立","口"],基:["其","土"],堀:["土","屈"],堂:["宀","丶","口","土"],婆:["波","女"],婚:["女","昏"],婦:["女","彐","冖","巾"],宿:["宀","亻","百"],寂:["宀","叔"],寄:["宀","奇"],密:["宀","必","山"],尉:["尸","示","寸"],崇:["山","宗"],崎:["山","奇"],崩:["山","朋"],巣:["丶","果"],帳:["巾","長"],常:["宀","丶","吊"],庶:["广","廿","灬"],康:["广","隶"],庸:["广","尹","用"],張:["弓","長"],強:["弓","厶","虫"],彩:["采","彡"],彫:["周","彡"],得:["彳","旦","寸"],悠:["亻","丨","攵","心"],患:["串","心"],悪:["亜","心"],悼:["忄","卓"],情:["忄","青"],惜:["忄","昔"],惨:["忄","参"],捨:["扌","人","干","口"],据:["扌","居"],掃:["扌","彐","冖","巾"],授:["扌","受"],排:["扌","非"],掘:["扌","屈"],掛:["扌","圭","卜"],採:["扌","采"],探:["扌","冖","八","木"],接:["扌","立","女"],控:["扌","空"],推:["扌","隹"],措:["扌","昔"],掲:["扌","日","匂"],描:["扌","苗"],救:["求","攵"],敗:["貝","攵"],教:["孝","攵"],斎:["文","丿","丨","示"],斜:["余","斗"],断:["凵","米","斤"],旋:["方","一","疋"],族:["方","一","矢"],曹:["廾","曲","日"],望:["亡","月","王"],械:["木","戒"],欲:["谷","欠"],殻:["士","殳","冗"],涯:["氵","厂","圭"],液:["氵","夜"],涼:["氵","京"],淑:["氵","叔"],淡:["氵","炎"],深:["氵","冖","八","木"],混:["氵","昆"],添:["氵","天","忄","丶"],清:["氵","青"],渇:["氵","日","匂"],済:["氵","斉"],渉:["氵","歩"],渋:["氵","止","冫"],渓:["氵","爪","夫"],猛:["亅","孟"],猟:["亅","丶","几","用"],猫:["亅","苗"],率:["亠","幺","冫","十"],現:["王","見"],球:["王","求"],理:["王","里"],産:["立","厂","生"],略:["田","各"],異:["田","共"],盗:["次","皿"],盛:["成","皿"],眺:["目","兆"],眼:["目","艮"],票:["西","示"],祭:["夕","癶","示"],移:["禾","多"],窒:["穴","至"],窓:["穴","厶","心"],章:["立","早"],笛:["竹","由"],符:["竹","付"],第:["竹","弓","丨"],粒:["米","立"],粗:["米","且"],粘:["米","占"],粛:["隶","米","丿","丨"],粧:["米","庄"],累:["田","糸"],細:["糸","田"],紳:["糸","申"],紹:["糸","召"],紺:["糸","甘"],終:["糸","冬"],組:["糸","且"],経:["糸","又","土"],翌:["羽","立"],習:["羽","白"],脚:["月","却"],脱:["月","丶","兄"],脳:["月","丶","凶"],舶:["舟","白"],船:["舟","几","口"],菊:["廾","勹","米"],菌:["廾","囗","禾"],菓:["廾","果"],菜:["廾","采"],著:["廾","者"],虚:["虍","丨","丶","一"],蛇:["虫","宀","匕"],蛍:["丶","冖","虫"],術:["行","木","丶"],街:["行","圭"],袋:["代","衣"],規:["夫","見"],視:["礻","見"],訟:["言","公"],訪:["言","方"],設:["言","殳"],許:["言","午"],訳:["言","尺"],豚:["月","豕"],貧:["分","貝"],貨:["化","貝"],販:["貝","反"],責:["十","二","貝"],赦:["赤","攵"],軟:["車","欠"],転:["車","云"],逮:["辶","隶"],週:["辶","周"],進:["辶","隹"],逸:["辶","兔"],部:["立","口","阝"],郭:["享","阝"],郵:["垂","阝"],郷:["幺","艮","丶","阝"],都:["者","阝"],酔:["酉","九","十"],釈:["釆","尺"],野:["里","予"],釣:["金","勺"],閉:["門","才"],陰:["阝","今","云"],陳:["阝","東"],陵:["阝","土","八","夂"],陶:["阝","勹","缶"],陸:["阝","土","八"],険:["阝","人","一","央"],隆:["阝","夂","一","生"],雪:["雨","彐"],頂:["丁","頁"],魚:["勹","田","灬"],鳥:["白","一","灬"],麻:["广","林"],黄:["廾","一","由","八"],黒:["里","灬"],鹿:["广","西","比"],梨:["利","木"],亀:["勹","田","申","儿"],淳:["氵","享"],猪:["亅","者"],笹:["竹","世"],渚:["氵","者"],爽:["大","乂"],梢:["木","肖"],淫:["氵","爪","壬"],葛:["廾","日","勹","人"],崖:["山","厂","圭"],苛:["廾","可"],惧:["忄","具"],痕:["疒","艮"],頃:["匕","頁"],梗:["木","更"],斬:["車","斤"],埼:["土","奇"],戚:["厂","戈","上","小"],羞:["羊","丑"],袖:["衤","由"],曽:["丶","田","日"],堆:["土","隹"],唾:["口","垂"],貪:["今","貝"],捻:["扌","念"],惚:["忄","勿","心"],庵:["广","奄"],雀:["少","隹"],笠:["竹","立"],梁:["氵","刀","八","木"],萌:["廾","明"],菱:["廾","土","八","夂"],偉:["亻","韋"],傍:["亻","立","冖","方"],傘:["人","十"],備:["亻","廾","一","丿","用"],割:["害","刂"],創:["倉","刂"],勝:["月","丶","一","大","力"],募:["莫","力"],博:["十","甫","寸"],善:["羊","丶","一","口"],喚:["口","勹","冂","八","大"],喜:["士","口","丶","一"],喪:["土","口","艮"],喫:["口","契"],営:["丶","冖","口"],堅:["臣","又","土"],堕:["阝","有","土"],堤:["土","是"],堪:["土","甚"],報:["幸","卩","又"],場:["土","日","一","勿"],塀:["土","屏"],塁:["田","冫","土"],塔:["土","廾","合"],塚:["土","冖","豕"],奥:["宀","米","大"],婿:["女","疋","月"],媒:["女","某"],富:["宀","一","口","田"],寒:["宀","井","一","八","丶"],尊:["丶","酉","寸"],尋:["彐","工","口","寸"],就:["京","尢","丶"],属:["尸","虫","冂"],帽:["巾","冒"],幅:["巾","一","口","田"],幾:["幺","戈","人"],廃:["广","発"],廊:["广","郎"],弾:["弓","単"],御:["彳","卸"],復:["彳","一","日","夂"],循:["彳","盾"],悲:["非","心"],惑:["或","心"],惰:["忄","左","月"],愉:["忄","人","一","月","刂"],慌:["忄","荒"],扉:["戸","非"],掌:["宀","丶","口","手"],提:["扌","是"],揚:["扌","日","一","勿"],換:["扌","勹","冂","八","大"],握:["扌","屋"],揮:["扌","軍"],援:["扌","爪","一","友"],揺:["扌","爪","干","山"],搭:["扌","廾","合"],敢:["一","丶","耳","攵"],散:["廾","一","月","攵"],敬:["廾","句","攵"],晩:["日","勹","口","丨","儿"],普:["並","日"],景:["日","京"],晴:["日","青"],晶:["日"],暁:["日","十","廾","一","儿"],暑:["日","者"],替:["夫","日"],最:["日","取"],朝:["十","早","月"],期:["其","月"],棋:["木","其"],棒:["木","奉"],棚:["木","朋"],棟:["木","東"],森:["木"],棺:["木","官"],植:["木","直"],検:["木","人","一","央"],業:["丨","丶","一","未"],極:["木","了","口","又","一"],欺:["其","欠"],歯:["止","米","凵"],殖:["歹","直"],減:["氵","厂","戈","一","口"],渡:["氵","度"],渦:["氵","冂","口"],温:["氵","日","皿"],測:["氵","則"],港:["氵","巷"],湖:["氵","胡"],湯:["氵","日","一","勿"],湾:["氵","亦","弓"],湿:["氵","日","丨","丶","一"],満:["氵","廾","両"],滋:["氵","丶","一","幺"],無:["一","丨","灬"],焦:["隹","灬"],然:["月","犬","灬"],焼:["火","十","廾","一","儿"],煮:["者","灬"],猶:["亅","丶","酉"],琴:["王","今"],番:["釆","田"],畳:["田","冖","且"],疎:["了","止","束"],痛:["疒","了","丶","用"],痢:["疒","利"],登:["癶","豆"],着:["羊","目"],短:["矢","豆"],硝:["石","肖"],硫:["石","亠","厶","儿","丨"],硬:["石","更"],程:["禾","呈"],税:["禾","丶","兄"],童:["立","里"],筆:["竹","聿"],等:["竹","寺"],筋:["竹","月","力"],筒:["竹","同"],答:["竹","合"],策:["竹","木","冂"],紫:["此","糸"],結:["糸","吉"],絞:["糸","交"],絡:["糸","各"],給:["糸","合"],統:["糸","充"],絵:["糸","会"],絶:["糸","色"],腐:["府","肉"],腕:["月","宛"],落:["廾","洛"],葉:["廾","世","木"],葬:["廾","死"],蛮:["亦","虫"],衆:["血","豕"],裁:["土","戈","衣"],裂:["列","衣"],装:["壮","衣"],裕:["衤","谷"],補:["衤","甫"],覚:["丶","冖","見"],訴:["言","斥"],診:["言","人","彡"],証:["言","正"],詐:["言","乍"],評:["言","平"],詞:["言","司"],詠:["言","永"],象:["勹","冖","丶","豕"],貫:["毋","貝"],貯:["貝","宀","丁"],貴:["中","一","貝"],買:["罒","貝"],貸:["代","貝"],費:["弓","丿","丨","貝"],貿:["卯","貝"],賀:["加","貝"],超:["走","召"],越:["走","匚","戈"],距:["口","止","巨"],軸:["車","由"],軽:["車","又","土"],遂:["辶","丶","豕"],遅:["辶","尸","羊"],遇:["辶","甲","厶","冂"],遊:["辶","方","一","子"],運:["辶","軍"],遍:["辶","戸","冊"],過:["辶","冂","口"],道:["辶","首"],達:["辶","土","羊"],酢:["酉","乍"],量:["日","一","里"],鈍:["金","屯"],開:["門","一","廾"],閑:["門","木"],間:["門","日"],陽:["阝","日","一","勿"],隅:["阝","甲","厶","冂"],隊:["阝","丶","豕"],階:["阝","皆"],随:["阝","辶","有"],雄:["十","厶","隹"],集:["隹","木"],雇:["戸","隹"],雰:["雨","分"],雲:["雨","云"],項:["工","頁"],順:["川","頁"],飯:["飠","反"],飲:["飠","欠"],智:["知","日"],須:["彡","頁"],萩:["廾","秋"],敦:["享","攵"],媛:["女","爪","一","友"],嵐:["山","風"],椎:["木","隹"],翔:["羊","羽"],喬:["大","口","冂"],湧:["氵","了","丶","用","力"],茨:["廾","次"],椅:["木","奇"],喉:["口","侯"],腎:["臣","又","月"],痩:["疒","申","又"],貼:["貝","占"],斑:["王","文"],喩:["口","人","一","月","巛"],喧:["口","宣"],喋:["口","世","木"],貰:["世","貝"],筈:["竹","舌"],揃:["扌","前"],斯:["其","斤"],覗:["司","見"],隈:["阝","畏"],遥:["爪","缶","辶"],淵:["氵","片","爿","一"],稀:["禾","希"],斐:["非","文"],傑:["亻","舛","木"],催:["亻","山","隹"],債:["亻","責"],傷:["亻","一","日","勿"],傾:["亻","頃"],働:["亻","動"],僧:["亻","丶","田","日"],勢:["土","八","丸","力"],勤:["廿","中","王","力"],勧:["一","十","隹","力"],嗣:["口","冊","司"],嘆:["口","廿","中","夫"],園:["囗","土","口","衣"],塊:["土","鬼"],塗:["氵","余","土"],塩:["土","一","口","皿"],墓:["莫","土"],夢:["廾","罒","冖","夕"],奨:["丨","冫","爪","寸","大"],嫁:["女","家"],嫌:["女","兼"],寛:["宀","廾","見"],寝:["宀","丨","冫","彐","冖","又"],幕:["廾","日","大","巾"],幹:["十","早","人","干"],廉:["广","兼"],微:["彳","山","攵","一","几"],想:["相","心"],愁:["秋","心"],意:["音","心"],愚:["甲","厶","冂","心"],愛:["爪","冖","心","夂"],感:["厂","戈","一","口","心"],慈:["丶","一","幺","心"],慎:["忄","真"],慨:["忄","既"],戦:["単","戈"],損:["扌","員"],搬:["扌","般"],携:["扌","隹","乃"],搾:["扌","穴","乍"],摂:["扌","耳","冫"],数:["米","女","攵"],新:["立","木","斤"],暇:["日","尸","二","彐","又"],暖:["日","爪","一","友"],暗:["日","音"],棄:["亠","厶","廿","丨","木"],楼:["木","米","女"],楽:["冫","白","木"],歳:["止","厂","戈","一","小"],殿:["尸","共","殳"],源:["氵","原"],準:["氵","隹","十"],溝:["氵","井","再"],溶:["氵","容"],滅:["氵","厂","戈","一","火"],滑:["氵","骨"],滝:["氵","竜"],滞:["氵","帯"],漠:["氵","莫"],漢:["氵","廿","中","夫"],煙:["火","西","土"],照:["昭","灬"],煩:["火","頁"],献:["南","犬"],猿:["亅","土","口","衣"],環:["王","罒","一","口","衣"],痴:["疒","知"],盟:["明","皿"],睡:["目","垂"],督:["叔","目"],碁:["其","石"],禁:["林","示"],福:["礻","一","口","田"],稚:["禾","隹"],節:["竹","即"],絹:["糸","口","月"],継:["糸","凵","米"],続:["糸","売"],罪:["罒","非"],置:["罒","直"],署:["罒","者"],群:["君","羊"],義:["羊","我"],聖:["耳","口","王"],腰:["月","西","女"],腸:["月","日","一","勿"],腹:["月","一","日","夂"],艇:["舟","廷"],蒸:["廾","了","水","一","灬"],蓄:["廾","畜"],虜:["虍","男"],虞:["虍","口","天"],裏:["衣","里"],裸:["衤","果"],褐:["衤","日","勹","人"],解:["角","刀","牛"],触:["角","虫"],試:["言","式"],詩:["言","寺"],詰:["言","吉"],話:["言","舌"],該:["言","玄","人"],詳:["言","羊"],誇:["言","大","二","弓"],誉:["丶","一","八","言"],誠:["言","成"],豊:["曲","豆"],賃:["任","貝"],賄:["貝","有"],資:["次","貝"],賊:["貝","戈","十"],跡:["口","止","亦"],路:["口","止","各"],跳:["口","止","兆"],践:["口","止","二","戈"],較:["車","交"],載:["土","戈","車"],辞:["舌","辛"],農:["曲","辰"],違:["辶","韋"],遠:["辶","土","口","衣"],遣:["辶","中","一","丨","口"],酬:["酉","州"],鈴:["金","令"],鉄:["金","失"],鉛:["金","几","口"],鉢:["金","本"],鉱:["金","広"],隔:["阝","一","口","冂","儿","丨"],雅:["牙","隹"],零:["雨","令"],雷:["雨","田"],電:["雨","申","儿"],靴:["革","化"],預:["予","頁"],頑:["元","頁"],飼:["飠","司"],飽:["飠","包"],飾:["飠","一","巾"],鼓:["十","豆","支"],睦:["目","土","八"],彙:["彑","冖","果"],詣:["言","旨"],窟:["穴","屈"],僅:["亻","廿","中","王"],嗅:["口","臭"],傲:["亻","土","方","攵"],隙:["阝","小","日"],腫:["月","重"],嫉:["女","疾"],塞:["宀","井","一","八","土"],詮:["言","全"],腺:["月","泉"],煎:["前","灬"],羨:["羊","氵","欠"],頓:["屯","頁"],填:["土","真"],溺:["氵","弱"],蜂:["虫","夂","三","丨"],慄:["忄","栗"],賂:["貝","各"],毀:["臼","土","殳"],嘩:["口","華"],溜:["氵","留"],馴:["馬","川"],幌:["巾","日","光"],瑞:["王","山","而"],蓮:["廾","連"],蒼:["廾","倉"],蒲:["廾","浦"],像:["亻","象"],僕:["亻","業"],僚:["亻","大","丶","日","小"],嘱:["口","属"],塾:["享","丸","土"],境:["土","音","儿"],増:["土","曽"],墨:["黒","土"],奪:["大","隹","寸"],嫡:["女","立","冂","古"],察:["宀","祭"],寡:["宀","一","丿","且","八","刀"],寧:["宀","心","皿","丁"],層:["尸","丶","田","日"],彰:["章","彡"],徳:["彳","十","罒","心"],徴:["彳","山","攵","王"],態:["能","心"],慕:["莫","忄","丶"],慢:["忄","日","罒","又"],憎:["忄","丶","田","日"],摘:["扌","立","冂","古"],旗:["方","一","其"],暦:["厂","林","日"],暮:["廾","日","大"],概:["木","既"],構:["木","井","再"],様:["木","羊","水"],模:["木","莫"],歌:["可","欠"],歴:["厂","林","止"],滴:["氵","立","冂","古"],漁:["氵","魚"],漂:["氵","票"],漆:["氵","木","人","氺"],漏:["氵","尸","雨"],演:["氵","宀","一","由","八"],漫:["氵","日","罒","又"],漬:["氵","責"],漸:["氵","斬"],獄:["亅","言","犬"],疑:["匕","矢","了","丶","疋"],碑:["石","卑"],磁:["石","丶","一","幺"],禅:["礻","単"],禍:["礻","冂","口"],種:["禾","重"],稲:["禾","爪","旧"],穀:["士","冖","一","殳","禾"],端:["立","山","而"],箇:["竹","固"],算:["竹","目","廾"],管:["竹","官"],精:["米","青"],維:["糸","隹"],綱:["糸","岡"],網:["糸","冂","丶","一","亡"],綿:["糸","白","巾"],総:["糸","公","心"],緑:["糸","彐","氺"],緒:["糸","者"],練:["糸","東"],罰:["罒","言","刂"],聞:["門","耳"],膜:["月","莫"],製:["制","衣"],複:["衤","一","日","夂"],誌:["言","志"],認:["言","忍"],誓:["折","言"],誘:["言","秀"],語:["言","吾"],誤:["言","口","天"],説:["言","丶","兄"],読:["言","売"],豪:["亠","口","冖","豕"],踊:["口","止","了","丶","用"],適:["辶","立","冂","古"],遭:["辶","曹"],遮:["辶","庶"],酵:["酉","孝"],酷:["酉","告"],酸:["酉","厶","八","夂"],銀:["金","艮"],銃:["金","充"],銅:["金","同"],銘:["金","名"],銭:["金","三","二","戈"],関:["門","丶","天"],閣:["門","各"],閥:["門","伐"],際:["阝","祭"],障:["阝","章"],隠:["阝","爪","彐","心"],雌:["此","隹"],雑:["九","木","隹"],需:["雨","而"],静:["青","争"],領:["令","頁"],駄:["馬","太"],駅:["馬","尺"],駆:["馬","区"],髪:["丨","二","厶","彡","友"],魂:["云","鬼"],鳴:["口","鳥"],鼻:["自","田","廾"],熊:["能","灬"],聡:["耳","公","心"],漱:["氵","束","欠"],瑠:["王","留"],璃:["王","亠","凶","厶","冂"],萎:["廾","委"],裾:["衤","居"],遜:["辶","孫"],遡:["辶","朔"],箋:["竹","戈"],綻:["糸","定"],蜜:["宀","必","虫"],貌:["豸","白","儿"],辣:["辛","束"],瘍:["疒","日","一","勿"],嘘:["口","虚"],儀:["亻","義"],億:["亻","意"],劇:["虍","豕","刂"],勲:["動","灬"],器:["口","犬"],噴:["口","十","廾","貝"],墜:["隊","土"],墳:["土","十","廾","貝"],審:["宀","番"],寮:["宀","大","丶","日","小"],導:["道","寸"],履:["尸","復"],幣:["巾","冫","攵"],弊:["巾","冫","攵","廾"],影:["景","彡"],徹:["彳","育","攵"],慣:["忄","貫"],慮:["虍","思"],慰:["尉","心"],慶:["广","西","冖","心","夂"],憂:["一","白","冖","心","夂"],憤:["忄","十","廾","貝"],戯:["虚","戈"],摩:["麻","手"],撃:["車","殳","手"],撤:["扌","育","攵"],撮:["扌","最"],撲:["扌","業"],敵:["立","冂","古","攵"],敷:["甫","方","攵"],暫:["斬","日"],暴:["日","共","水"],槽:["木","曹"],標:["木","票"],権:["木","一","十","隹"],横:["木","黄"],歓:["一","十","隹","欠"],潔:["氵","三","丨","刀","糸"],潜:["氵","替"],潟:["氵","臼","勹","灬"],潤:["氵","門","王"],潮:["氵","朝"],澄:["氵","登"],熟:["享","丸","灬"],熱:["土","八","丸","灬"],監:["臣","一","丶","皿"],盤:["般","皿"],確:["石","巾","隹"],稼:["禾","家"],稿:["禾","高"],穂:["禾","恵"],窮:["穴","身","弓"],窯:["穴","羊","灬"],箱:["竹","相"],範:["竹","車","卩"],緊:["臣","又","糸"],線:["糸","泉"],締:["糸","帝"],編:["糸","戸","冊"],緩:["糸","爪","一","友"],縁:["糸","彐","豕"],縄:["糸","田","申","儿"],罷:["罒","能"],膚:["虍","胃"],舗:["舎","甫"],舞:["無","舛"],蔵:["廾","厂","戈","臣"],衝:["行","重"],褒:["衣","保"],誕:["言","延"],課:["言","果"],調:["言","周"],談:["言","炎"],請:["言","青"],論:["言","人","一","冊"],諸:["言","者"],諾:["言","若"],賓:["宀","一","小","丿","貝"],賛:["夫","貝"],賜:["貝","易"],賞:["宀","丶","口","貝"],賠:["貝","立","口"],賦:["貝","武"],質:["斤","貝"],趣:["走","取"],踏:["口","止","水","日"],輝:["光","軍"],輩:["非","車"],輪:["車","人","一","冊"],遷:["辶","西","大","巳"],選:["辶","巳","共"],遺:["辶","貴"],鋭:["金","丶","兄"],鋳:["金","寿"],閲:["門","丶","兄"],震:["雨","辰"],霊:["雨","二","丨","丶","一"],養:["羊","八","良"],餓:["飠","我"],駐:["馬","主"],魅:["鬼","未"],黙:["里","犬","灬"],駒:["馬","句"],憧:["忄","童"],嬉:["女","喜"],潰:["氵","貴"],稽:["禾","尢","丶","旨"],畿:["幺","戈","田"],餌:["飠","耳"],踪:["口","止","宗"],嘲:["口","朝"],誰:["言","隹"],膝:["月","木","人","氺"],箸:["竹","者"],罵:["罒","馬"],頬:["夫","丶","頁"],樣:["木","羊","永"],噂:["口","尊"],磐:["般","石"],儒:["亻","需"],凝:["冫","疑"],壁:["尸","口","辛","土"],壇:["土","亠","回","旦"],壊:["土","十","罒","衣"],壌:["土","六","井","一","衣"],奮:["大","隹","田"],嬢:["女","六","井","一","衣"],憩:["舌","自","心"],憲:["宀","十","二","罒","心"],憶:["忄","意"],憾:["忄","感"],懐:["忄","亠","罒","衣"],擁:["扌","亠","幺","隹"],操:["扌","品","木"],整:["束","攵","正"],曇:["日","雲"],橋:["木","喬"],機:["木","幾"],激:["氵","白","方","攵"],濁:["氵","罒","勹","虫"],濃:["氵","農"],燃:["火","然"],獣:["丶","田","一","口","犬"],獲:["亅","廾","隻"],磨:["麻","石"],積:["禾","責"],穏:["禾","爪","彐","心"],築:["竹","工","凡","木"],樹:["木","十","豆","寸"],篤:["竹","馬"],糖:["米","唐"],緯:["糸","韋"],縛:["糸","甫","寸"],縦:["糸","従"],縫:["糸","辶","夂","三","丨"],繁:["敏","糸"],膨:["月","十","豆","彡"],興:["臼","同","一","八"],薄:["廾","氵","甫","寸"],薦:["廾","广","西","弓","灬"],薪:["廾","新"],薫:["廾","重","灬"],薬:["廾","楽"],融:["一","口","冂","儿","丨","虫"],衛:["行","韋"],衡:["行","勹","田","大"],親:["立","木","見"],諭:["言","人","一","月","刂"],謀:["言","某"],謡:["言","爪","缶"],賢:["臣","又","貝"],輸:["車","人","一","月","刂"],避:["辶","尸","口","辛"],還:["辶","罒","一","口","衣"],鋼:["金","岡"],錠:["金","定"],錬:["金","東"],錯:["金","昔"],録:["金","彐","氺"],隣:["阝","米","舛"],隷:["士","示","隶"],頭:["豆","頁"],頼:["束","頁"],館:["飠","官"],龍:["立","月","弓","儿","三"],錦:["金","白","巾"],骸:["骨","玄","人"],蓋:["廾","去","皿"],諧:["言","皆"],醒:["酉","星"],膳:["月","善"],賭:["貝","者"],諦:["言","帝"],麺:["麦","面"],謂:["言","胃"],樽:["木","尊"],鴨:["甲","鳥"],償:["亻","宀","丶","員"],優:["亻","憂"],厳:["丶","厂","敢"],嚇:["口","赤"],懇:["豸","艮","心"],懲:["彳","山","攵","一","王","心"],擦:["扌","察"],擬:["扌","疑"],濯:["氵","羽","隹"],燥:["火","品","木"],爵:["爪","罒","艮","丶","寸"],犠:["牛","義"],療:["疒","大","丶","日","小"],矯:["矢","喬"],礁:["石","焦"],縮:["糸","宿"],績:["糸","責"],繊:["糸","土","戈","丨","丶","一"],翼:["羽","異"],聴:["耳","十","罒","心"],覧:["臣","一","丶","見"],謙:["言","兼"],講:["言","井","再"],謝:["言","射"],謹:["言","廿","中","王"],購:["貝","井","再"],轄:["車","害"],醜:["酉","鬼"],鍛:["金","段"],霜:["雨","相"],頻:["止","小","丿","頁"],鮮:["魚","羊"],磯:["石","幾"],瞳:["目","童"],瞭:["目","大","丶","日","小"],曖:["日","愛"],韓:["十","早","韋"],臆:["月","意"],鍵:["金","建"],鍋:["金","冂","口"],謎:["言","迷"],闇:["門","音"],蔑:["廾","罒","厂","戈","丶"],璧:["尸","口","辛","玉"],餅:["飠","丶","一","廾"],齢:["歯","令"],繋:["車","殳","糸"],濡:["氵","需"],霞:["雨","尸","二","彐","又"],篠:["竹","亻","丨","条"],曜:["日","羽","隹"],濫:["氵","監"],癒:["疒","人","一","月","刂","心"],癖:["疒","尸","口","辛"],瞬:["目","爪","冖","舛"],礎:["石","林","疋"],穫:["禾","廾","隻"],簡:["竹","間"],糧:["米","量"],織:["糸","音","戈"],繕:["糸","善"],翻:["番","羽"],職:["耳","音","戈"],臨:["臣","一","品"],藩:["廾","氵","番"],襟:["衤","禁"],覆:["西","復"],覇:["西","革","月"],観:["一","十","隹","見"],贈:["貝","丶","田","日"],鎖:["金","丨","丶","貝"],鎮:["金","真"],闘:["門","豆","寸"],離:["亠","凶","厶","冂","隹"],難:["廿","中","夫","隹"],題:["是","頁"],額:["客","頁"],顔:["彦","頁"],顕:["日","丨","丶","一","頁"],類:["米","犬","頁"],騎:["馬","奇"],騒:["馬","又","虫"],験:["馬","人","一","央"],蔽:["廾","巾","冫","攵"],藤:["廾","月","丶","一","大","氺"],鎌:["金","兼"],藍:["廾","監"],鯉:["魚","里"],顎:["口","二","弓","頁"],戴:["土","戈","異"],瀬:["氵","頼"],爆:["火","暴"],簿:["竹","氵","甫","寸"],繰:["糸","品","木"],羅:["罒","維"],臓:["月","蔵"],藻:["廾","氵","品","木"],識:["言","音","戈"],譜:["言","普"],警:["敬","言"],鏡:["金","音","儿"],霧:["雨","務"],韻:["音","員"],願:["原","頁"],髄:["骨","辶","有"],鯨:["魚","京"],鶏:["爪","夫","鳥"],麗:["一","冂","丶","鹿"],艶:["豊","色"],蹴:["口","止","就"],麓:["林","鹿"],蘭:["廾","門","東"],蘇:["廾","魚","禾"],懸:["目","一","小","系","心"],欄:["木","門","東"],競:["立","兄"],籍:["竹","耒","昔"],議:["言","義"],譲:["言","六","井","一","衣"],醸:["酉","六","井","一","衣"],鐘:["金","童"],響:["幺","郎","音"],騰:["月","丶","一","大","馬"],艦:["舟","監"],護:["言","廾","隻"],躍:["口","止","羽","隹"],露:["雨","路"],顧:["雇","頁"],魔:["麻","鬼"],鶴:["巾","隹","鳥"],襲:["龍","衣"],驚:["敬","馬"],籠:["竹","龍"],鑑:["金","監"],鷹:["广","亻","隹","鳥"],鬱:["林","缶","冖","凵","乂","冫","匕","彡"]};class V_{constructor(e){Ha(this,"name");Ha(this,"children");Ha(this,"parents");Ha(this,"isRelevant",!1);Ha(this,"isKnown",!1);Ha(this,"priority");Ha(this,"displayNode");this.name=e,this.children=[],this.parents=[]}addChild(e){this.children.push(e)}addParent(e){this.parents.push(e)}}function m3(n,e){let t=e.find(i=>i.name===n);return t||(t=new V_(n),e.push(t)),t}function kte(){const n=new V_("0"),e=[n],t=Object.keys(p3);for(let i=0;i{if(!(!f||f.isRelevant)){f.isRelevant=!0;for(const h of f.parents)r(h)}};for(const f of t){const h=e.find(m=>m.name===f);r(h)}const s=f=>{const h=new V_(f.name);h.isRelevant=f.isRelevant,h.isKnown=f.isKnown,h.priority=f.priority;for(const m of f.children)if(m.isRelevant){const v=s(m);h.addChild(v),v.addParent(h)}return h},o=s(n);for(const f of e)f.isRelevant=!1;Fte(o,i);const a=f=>{f.children.sort((h,m)=>(h.priority||0)-(m.priority||0)),f.parents.sort((h,m)=>(h.priority||0)-(m.priority||0));for(const h of f.children)a(h)};a(o);const l=new Set,u=[],c=f=>{if(!l.has(f.name)){l.add(f.name),u.push(f);for(const h of f.children)c(h)}};return c(o),[u,o]}function Fte(n,e){const t=new Set,i=r=>{t.add(r),e.find(o=>o===r.name)&&(r.isKnown=!0);for(const o of r.children)t.has(o)||i(o)};i(n)}const[zte,Bte]=kte();function Gte(n,e=""){const t=n.split(""),i=e.split(""),[r,s]=Nte(Bte,zte,t,i);return[r,s]}function Vte(){const[n,e]=Y.useState([]),[t,i]=Y.useState(new V_("")),[r,s]=Y.useState(""),[o,a]=Y.useState("");Y.useEffect(()=>{const[u,c]=Gte(r,o);return e(u),i(c),()=>{}},[r,o]);const l=()=>{console.log(r),console.log(n);debugger};return Ge.jsxs("div",{className:"flex flex-row",children:[Ge.jsx("div",{style:{position:"fixed",left:0,top:0,width:"50%",height:"100%"},children:Ge.jsx(Ote,{kanjiNodeList:n,kanjiRoot:t})}),Ge.jsx("div",{style:{position:"fixed",right:0,top:0,width:"50%",height:"100%"},children:Ge.jsxs("div",{className:"m-4 text-left",children:[Ge.jsx("h1",{className:"text-3xl ",children:"Kanji Order Tool"}),Ge.jsxs("div",{className:"mt-6",children:[Ge.jsxs("form",{children:[Ge.jsxs("div",{className:"mb-4",children:[Ge.jsx("label",{htmlFor:"targetKanji",className:"block text-lg font-medium text-gray-700",children:"Target Kanji"}),Ge.jsx("textarea",{id:"targetKanji",value:r,onChange:u=>s(u.target.value),className:"mt-1 p-2 border border-gray-300 rounded-md"})]}),Ge.jsxs("div",{className:"mb-4",children:[Ge.jsx("label",{htmlFor:"knownKanji",className:"block text-lg font-medium text-gray-700",children:"Known Kanji"}),Ge.jsx("textarea",{value:o,onChange:u=>a(u.target.value),id:"knownKanji",className:"mt-1 p-2 border border-gray-300 rounded-md"})]})]}),Ge.jsx("button",{onClick:l,children:"Debug"})]})]})})]})}Iw.createRoot(document.getElementById("root")).render(Ge.jsx(Lw.StrictMode,{children:Ge.jsx(Vte,{})})); diff --git a/index.html b/index.html index 9481d5d..a2dbc5e 100644 --- a/index.html +++ b/index.html @@ -6,12 +6,11 @@ Vite + React + TS - - -
+
a
+ \ No newline at end of file