diff --git "a/static/assets/Experience-f42a3bd5.js" "b/static/assets/Experience-f42a3bd5.js" deleted file mode 100644--- "a/static/assets/Experience-f42a3bd5.js" +++ /dev/null @@ -1,3698 +0,0 @@ -function J3(n,e){for(var t=0;tr[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();function q1(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _d={},K3={get exports(){return _d},set exports(n){_d=n}},c0={},D={},Y3={get exports(){return D},set exports(n){D=n}},kt={};/** - * @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 sh=Symbol.for("react.element"),Q3=Symbol.for("react.portal"),Z3=Symbol.for("react.fragment"),q3=Symbol.for("react.strict_mode"),eO=Symbol.for("react.profiler"),tO=Symbol.for("react.provider"),nO=Symbol.for("react.context"),rO=Symbol.for("react.forward_ref"),iO=Symbol.for("react.suspense"),sO=Symbol.for("react.memo"),oO=Symbol.for("react.lazy"),Qw=Symbol.iterator;function aO(n){return n===null||typeof n!="object"?null:(n=Qw&&n[Qw]||n["@@iterator"],typeof n=="function"?n:null)}var PR={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},IR=Object.assign,BR={};function Nu(n,e,t){this.props=n,this.context=e,this.refs=BR,this.updater=t||PR}Nu.prototype.isReactComponent={};Nu.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")};Nu.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function LR(){}LR.prototype=Nu.prototype;function eE(n,e,t){this.props=n,this.context=e,this.refs=BR,this.updater=t||PR}var tE=eE.prototype=new LR;tE.constructor=eE;IR(tE,Nu.prototype);tE.isPureReactComponent=!0;var Zw=Array.isArray,DR=Object.prototype.hasOwnProperty,nE={current:null},OR={key:!0,ref:!0,__self:!0,__source:!0};function FR(n,e,t){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)DR.call(e,r)&&!OR.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1>>1,ee=z[ae];if(0>>1;aei(Le,q))wei(Fe,Le)?(z[ae]=Fe,z[we]=q,ae=we):(z[ae]=Le,z[pe]=q,ae=pe);else if(wei(Fe,q))z[ae]=Fe,z[we]=q,ae=we;else break e}}return Z}function i(z,Z){var q=z.sortIndex-Z.sortIndex;return q!==0?q:z.id-Z.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=[],c=[],d=1,h=null,p=3,m=!1,v=!1,E=!1,x=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(z){for(var Z=t(c);Z!==null;){if(Z.callback===null)r(c);else if(Z.startTime<=z)r(c),Z.sortIndex=Z.expirationTime,e(l,Z);else break;Z=t(c)}}function w(z){if(E=!1,_(z),!v)if(t(l)!==null)v=!0,ne(C);else{var Z=t(c);Z!==null&&ie(w,Z.startTime-z)}}function C(z,Z){v=!1,E&&(E=!1,g(I),I=-1),m=!0;var q=p;try{for(_(Z),h=t(l);h!==null&&(!(h.expirationTime>Z)||z&&!U());){var ae=h.callback;if(typeof ae=="function"){h.callback=null,p=h.priorityLevel;var ee=ae(h.expirationTime<=Z);Z=n.unstable_now(),typeof ee=="function"?h.callback=ee:h===t(l)&&r(l),_(Z)}else r(l);h=t(l)}if(h!==null)var ve=!0;else{var pe=t(c);pe!==null&&ie(w,pe.startTime-Z),ve=!1}return ve}finally{h=null,p=q,m=!1}}var b=!1,B=null,I=-1,R=5,L=-1;function U(){return!(n.unstable_now()-Lz||125ae?(z.sortIndex=q,e(c,z),t(l)===null&&z===t(c)&&(E?(g(I),I=-1):E=!0,ie(w,q-ae))):(z.sortIndex=ee,e(l,z),v||m||(v=!0,ne(C))),z},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(z){var Z=p;return function(){var q=p;p=Z;try{return z.apply(this,arguments)}finally{p=q}}}})(UR);(function(n){n.exports=UR})(EO);/** - * @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 kR=D,yi=N_;function Oe(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"),U_=Object.prototype.hasOwnProperty,AO=/^[: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]*$/,tM={},nM={};function SO(n){return U_.call(nM,n)?!0:U_.call(tM,n)?!1:AO.test(n)?nM[n]=!0:(tM[n]=!0,!1)}function wO(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function MO(n,e,t,r){if(e===null||typeof e>"u"||wO(n,e,t,r))return!0;if(r)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 Wr(n,e,t,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var dr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){dr[n]=new Wr(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];dr[e]=new Wr(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){dr[n]=new Wr(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){dr[n]=new Wr(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){dr[n]=new Wr(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){dr[n]=new Wr(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){dr[n]=new Wr(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){dr[n]=new Wr(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){dr[n]=new Wr(n,5,!1,n.toLowerCase(),null,!1,!1)});var iE=/[\-:]([a-z])/g;function sE(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(iE,sE);dr[e]=new Wr(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(iE,sE);dr[e]=new Wr(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(iE,sE);dr[e]=new Wr(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){dr[n]=new Wr(n,1,!1,n.toLowerCase(),null,!1,!1)});dr.xlinkHref=new Wr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){dr[n]=new Wr(n,1,!1,n.toLowerCase(),null,!0,!0)});function oE(n,e,t,r){var i=dr.hasOwnProperty(e)?dr[e]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{iy=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Jf(n):""}function TO(n){switch(n.tag){case 5:return Jf(n.type);case 16:return Jf("Lazy");case 13:return Jf("Suspense");case 19:return Jf("SuspenseList");case 0:case 2:case 15:return n=sy(n.type,!1),n;case 11:return n=sy(n.type.render,!1),n;case 1:return n=sy(n.type,!0),n;default:return""}}function G_(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 Gc:return"Fragment";case Hc:return"Portal";case k_:return"Profiler";case aE:return"StrictMode";case z_:return"Suspense";case H_:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case GR:return(n.displayName||"Context")+".Consumer";case HR:return(n._context.displayName||"Context")+".Provider";case lE:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case cE:return e=n.displayName||null,e!==null?e:G_(n.type)||"Memo";case ta:e=n._payload,n=n._init;try{return G_(n(e))}catch{}}return null}function bO(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 G_(e);case 8:return e===aE?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Sa(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function WR(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function CO(n){var e=WR(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Lp(n){n._valueTracker||(n._valueTracker=CO(n))}function $R(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=WR(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function vg(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 V_(n,e){var t=e.checked;return Rn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function iM(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=Sa(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function XR(n,e){e=e.checked,e!=null&&oE(n,"checked",e,!1)}function W_(n,e){XR(n,e);var t=Sa(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?$_(n,e.type,t):e.hasOwnProperty("defaultValue")&&$_(n,e.type,Sa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function sM(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="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 $_(n,e,t){(e!=="number"||vg(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Kf=Array.isArray;function iu(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Dp.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function Ed(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var td={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},RO=["Webkit","ms","Moz","O"];Object.keys(td).forEach(function(n){RO.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),td[e]=td[n]})});function YR(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||td.hasOwnProperty(n)&&td[n]?(""+e).trim():e+"px"}function QR(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=YR(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var PO=Rn({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 J_(n,e){if(e){if(PO[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Oe(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Oe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Oe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Oe(62))}}function K_(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 Y_=null;function uE(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Q_=null,su=null,ou=null;function lM(n){if(n=lh(n)){if(typeof Q_!="function")throw Error(Oe(280));var e=n.stateNode;e&&(e=p0(e),Q_(n.stateNode,n.type,e))}}function ZR(n){su?ou?ou.push(n):ou=[n]:su=n}function qR(){if(su){var n=su,e=ou;if(ou=su=null,lM(n),e)for(n=0;n>>=0,n===0?32:31-(HO(n)/GO|0)|0}var Op=64,Fp=4194304;function Yf(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 Eg(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=Yf(a):(s&=o,s!==0&&(r=Yf(s)))}else o=t&~i,o!==0?r=Yf(o):s!==0&&(r=Yf(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0t;t++)e.push(n);return e}function oh(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-ss(e),n[e]=t}function XO(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 r=n.eventTimes;for(n=n.expirationTimes;0=rd),vM=String.fromCharCode(32),yM=!1;function _P(n,e){switch(n){case"keyup":return xF.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xP(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Vc=!1;function AF(n,e){switch(n){case"compositionend":return xP(e);case"keypress":return e.which!==32?null:(yM=!0,vM);case"textInput":return n=e.data,n===vM&&yM?null:n;default:return null}}function SF(n,e){if(Vc)return n==="compositionend"||!yE&&_P(n,e)?(n=vP(),Qm=mE=aa=null,Vc=!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=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=AM(t)}}function wP(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?wP(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function MP(){for(var n=window,e=vg();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=vg(n.document)}return e}function _E(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 BF(n){var e=MP(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&wP(t.ownerDocument.documentElement,t)){if(r!==null&&_E(t)){if(e=r.start,n=r.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 i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=SM(t,s);var o=SM(t,r);i&&o&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(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,Wc=null,rx=null,sd=null,ix=!1;function wM(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;ix||Wc==null||Wc!==vg(r)||(r=Wc,"selectionStart"in r&&_E(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),sd&&bd(sd,r)||(sd=r,r=wg(rx,"onSelect"),0jc||(n.current=ux[jc],ux[jc]=null,jc--)}function fn(n,e){jc++,ux[jc]=n.current,n.current=e}var wa={},Mr=La(wa),ni=La(!1),Il=wa;function yu(n,e){var t=n.type.contextTypes;if(!t)return wa;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function ri(n){return n=n.childContextTypes,n!=null}function Tg(){mn(ni),mn(Mr)}function IM(n,e,t){if(Mr.current!==wa)throw Error(Oe(168));fn(Mr,e),fn(ni,t)}function DP(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Oe(108,bO(n)||"Unknown",i));return Rn({},t,r)}function bg(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||wa,Il=Mr.current,fn(Mr,n),fn(ni,ni.current),!0}function BM(n,e,t){var r=n.stateNode;if(!r)throw Error(Oe(169));t?(n=DP(n,e,Il),r.__reactInternalMemoizedMergedChildContext=n,mn(ni),mn(Mr),fn(Mr,n)):mn(ni),fn(ni,t)}var co=null,m0=!1,_y=!1;function OP(n){co===null?co=[n]:co.push(n)}function WF(n){m0=!0,OP(n)}function Da(){if(!_y&&co!==null){_y=!0;var n=0,e=tn;try{var t=co;for(tn=1;n>=o,i-=o,po=1<<32-ss(e)+i|t<I?(R=B,B=null):R=B.sibling;var L=p(g,B,_[I],w);if(L===null){B===null&&(B=R);break}n&&B&&L.alternate===null&&e(g,B),A=s(L,A,I),b===null?C=L:b.sibling=L,b=L,B=R}if(I===_.length)return t(g,B),xn&&il(g,I),C;if(B===null){for(;I<_.length;I++)B=h(g,_[I],w),B!==null&&(A=s(B,A,I),b===null?C=B:b.sibling=B,b=B);return xn&&il(g,I),C}for(B=r(g,B);I<_.length;I++)R=m(B,g,I,_[I],w),R!==null&&(n&&R.alternate!==null&&B.delete(R.key===null?I:R.key),A=s(R,A,I),b===null?C=R:b.sibling=R,b=R);return n&&B.forEach(function(U){return e(g,U)}),xn&&il(g,I),C}function E(g,A,_,w){var C=Sf(_);if(typeof C!="function")throw Error(Oe(150));if(_=C.call(_),_==null)throw Error(Oe(151));for(var b=C=null,B=A,I=A=0,R=null,L=_.next();B!==null&&!L.done;I++,L=_.next()){B.index>I?(R=B,B=null):R=B.sibling;var U=p(g,B,L.value,w);if(U===null){B===null&&(B=R);break}n&&B&&U.alternate===null&&e(g,B),A=s(U,A,I),b===null?C=U:b.sibling=U,b=U,B=R}if(L.done)return t(g,B),xn&&il(g,I),C;if(B===null){for(;!L.done;I++,L=_.next())L=h(g,L.value,w),L!==null&&(A=s(L,A,I),b===null?C=L:b.sibling=L,b=L);return xn&&il(g,I),C}for(B=r(g,B);!L.done;I++,L=_.next())L=m(B,g,I,L.value,w),L!==null&&(n&&L.alternate!==null&&B.delete(L.key===null?I:L.key),A=s(L,A,I),b===null?C=L:b.sibling=L,b=L);return n&&B.forEach(function(j){return e(g,j)}),xn&&il(g,I),C}function x(g,A,_,w){if(typeof _=="object"&&_!==null&&_.type===Gc&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Bp:e:{for(var C=_.key,b=A;b!==null;){if(b.key===C){if(C=_.type,C===Gc){if(b.tag===7){t(g,b.sibling),A=i(b,_.props.children),A.return=g,g=A;break e}}else if(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ta&&kM(C)===b.type){t(g,b.sibling),A=i(b,_.props),A.ref=Cf(g,b,_),A.return=g,g=A;break e}t(g,b);break}else e(g,b);b=b.sibling}_.type===Gc?(A=Sl(_.props.children,g.mode,w,_.key),A.return=g,g=A):(w=sg(_.type,_.key,_.props,null,g.mode,w),w.ref=Cf(g,A,_),w.return=g,g=w)}return o(g);case Hc:e:{for(b=_.key;A!==null;){if(A.key===b)if(A.tag===4&&A.stateNode.containerInfo===_.containerInfo&&A.stateNode.implementation===_.implementation){t(g,A.sibling),A=i(A,_.children||[]),A.return=g,g=A;break e}else{t(g,A);break}else e(g,A);A=A.sibling}A=by(_,g.mode,w),A.return=g,g=A}return o(g);case ta:return b=_._init,x(g,A,b(_._payload),w)}if(Kf(_))return v(g,A,_,w);if(Sf(_))return E(g,A,_,w);Vp(g,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,A!==null&&A.tag===6?(t(g,A.sibling),A=i(A,_),A.return=g,g=A):(t(g,A),A=Ty(_,g.mode,w),A.return=g,g=A),o(g)):t(g,A)}return x}var xu=VP(!0),WP=VP(!1),ch={},Fs=La(ch),Id=La(ch),Bd=La(ch);function pl(n){if(n===ch)throw Error(Oe(174));return n}function CE(n,e){switch(fn(Bd,e),fn(Id,n),fn(Fs,ch),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:j_(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=j_(e,n)}mn(Fs),fn(Fs,e)}function Eu(){mn(Fs),mn(Id),mn(Bd)}function $P(n){pl(Bd.current);var e=pl(Fs.current),t=j_(e,n.type);e!==t&&(fn(Id,n),fn(Fs,t))}function RE(n){Id.current===n&&(mn(Fs),mn(Id))}var Mn=La(0);function Lg(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var xy=[];function PE(){for(var n=0;nt?t:4,n(!0);var r=Ey.transition;Ey.transition={};try{n(!1),e()}finally{tn=t,Ey.transition=r}}function a2(){return Wi().memoizedState}function JF(n,e,t){var r=va(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},l2(n))c2(e,t);else if(t=kP(n,e,t,r),t!==null){var i=Hr();os(t,n,r,i),u2(t,e,r)}}function KF(n,e,t){var r=va(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(l2(n))c2(e,i);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(i.hasEagerState=!0,i.eagerState=a,cs(a,o)){var l=e.interleaved;l===null?(i.next=i,TE(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=kP(n,e,i,r),t!==null&&(i=Hr(),os(t,n,r,i),u2(t,e,r))}}function l2(n){var e=n.alternate;return n===Cn||e!==null&&e===Cn}function c2(n,e){od=Dg=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function u2(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,dE(n,t)}}var Og={readContext:Vi,useCallback:yr,useContext:yr,useEffect:yr,useImperativeHandle:yr,useInsertionEffect:yr,useLayoutEffect:yr,useMemo:yr,useReducer:yr,useRef:yr,useState:yr,useDebugValue:yr,useDeferredValue:yr,useTransition:yr,useMutableSource:yr,useSyncExternalStore:yr,useId:yr,unstable_isNewReconciler:!1},YF={readContext:Vi,useCallback:function(n,e){return Bs().memoizedState=[n,e===void 0?null:e],n},useContext:Vi,useEffect:HM,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,tg(4194308,4,n2.bind(null,e,n),t)},useLayoutEffect:function(n,e){return tg(4194308,4,n,e)},useInsertionEffect:function(n,e){return tg(4,2,n,e)},useMemo:function(n,e){var t=Bs();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=Bs();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=JF.bind(null,Cn,n),[r.memoizedState,n]},useRef:function(n){var e=Bs();return n={current:n},e.memoizedState=n},useState:zM,useDebugValue:OE,useDeferredValue:function(n){return Bs().memoizedState=n},useTransition:function(){var n=zM(!1),e=n[0];return n=jF.bind(null,n[1]),Bs().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Cn,i=Bs();if(xn){if(t===void 0)throw Error(Oe(407));t=t()}else{if(t=e(),or===null)throw Error(Oe(349));Ll&30||JP(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,HM(YP.bind(null,r,s,n),[n]),r.flags|=2048,Od(9,KP.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=Bs(),e=or.identifierPrefix;if(xn){var t=mo,r=po;t=(r&~(1<<32-ss(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Ld++,0<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[Ls]=e,n[Pd]=r,_2(n,e,!1,!1),e.stateNode=n;e:{switch(o=K_(t,r),t){case"dialog":dn("cancel",n),dn("close",n),i=r;break;case"iframe":case"object":case"embed":dn("load",n),i=r;break;case"video":case"audio":for(i=0;iSu&&(e.flags|=128,r=!0,Rf(s,!1),e.lanes=4194304)}else{if(!r)if(n=Lg(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Rf(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!xn)return _r(e),null}else 2*Hn()-s.renderingStartTime>Su&&t!==1073741824&&(e.flags|=128,r=!0,Rf(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=Hn(),e.sibling=null,t=Mn.current,fn(Mn,r?t&1|2:t&1),e):(_r(e),null);case 22:case 23:return HE(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?fi&1073741824&&(_r(e),e.subtreeFlags&6&&(e.flags|=8192)):_r(e),null;case 24:return null;case 25:return null}throw Error(Oe(156,e.tag))}function iN(n,e){switch(EE(e),e.tag){case 1:return ri(e.type)&&Tg(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Eu(),mn(ni),mn(Mr),PE(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return RE(e),null;case 13:if(mn(Mn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Oe(340));_u()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return mn(Mn),null;case 4:return Eu(),null;case 10:return ME(e.type._context),null;case 22:case 23:return HE(),null;case 24:return null;default:return null}}var $p=!1,Ar=!1,sN=typeof WeakSet=="function"?WeakSet:Set,it=null;function Qc(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Ln(n,e,r)}else t.current=null}function Ax(n,e,t){try{t()}catch(r){Ln(n,e,r)}}var YM=!1;function oN(n,e){if(sx=Ag,n=MP(),_E(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,d=0,h=n,p=null;t:for(;;){for(var m;h!==t||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)p=h,h=m;for(;;){if(h===n)break t;if(p===t&&++c===i&&(a=o),p===s&&++d===r&&(l=o),(m=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=m}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(ox={focusedElem:n,selectionRange:t},Ag=!1,it=e;it!==null;)if(e=it,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,it=n;else for(;it!==null;){e=it;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 E=v.memoizedProps,x=v.memoizedState,g=e.stateNode,A=g.getSnapshotBeforeUpdate(e.elementType===e.type?E:es(e.type,E),x);g.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Oe(163))}}catch(w){Ln(e,e.return,w)}if(n=e.sibling,n!==null){n.return=e.return,it=n;break}it=e.return}return v=YM,YM=!1,v}function ad(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&Ax(e,t,s)}i=i.next}while(i!==r)}}function y0(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 r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function Sx(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 A2(n){var e=n.alternate;e!==null&&(n.alternate=null,A2(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Ls],delete e[Pd],delete e[cx],delete e[GF],delete e[VF])),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 S2(n){return n.tag===5||n.tag===3||n.tag===4}function QM(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||S2(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 wx(n,e,t){var r=n.tag;if(r===5||r===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=Mg));else if(r!==4&&(n=n.child,n!==null))for(wx(n,e,t),n=n.sibling;n!==null;)wx(n,e,t),n=n.sibling}function Mx(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(Mx(n,e,t),n=n.sibling;n!==null;)Mx(n,e,t),n=n.sibling}var cr=null,ns=!1;function Xo(n,e,t){for(t=t.child;t!==null;)w2(n,e,t),t=t.sibling}function w2(n,e,t){if(Os&&typeof Os.onCommitFiberUnmount=="function")try{Os.onCommitFiberUnmount(u0,t)}catch{}switch(t.tag){case 5:Ar||Qc(t,e);case 6:var r=cr,i=ns;cr=null,Xo(n,e,t),cr=r,ns=i,cr!==null&&(ns?(n=cr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):cr.removeChild(t.stateNode));break;case 18:cr!==null&&(ns?(n=cr,t=t.stateNode,n.nodeType===8?yy(n.parentNode,t):n.nodeType===1&&yy(n,t),Md(n)):yy(cr,t.stateNode));break;case 4:r=cr,i=ns,cr=t.stateNode.containerInfo,ns=!0,Xo(n,e,t),cr=r,ns=i;break;case 0:case 11:case 14:case 15:if(!Ar&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Ax(t,e,o),i=i.next}while(i!==r)}Xo(n,e,t);break;case 1:if(!Ar&&(Qc(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Ln(t,e,a)}Xo(n,e,t);break;case 21:Xo(n,e,t);break;case 22:t.mode&1?(Ar=(r=Ar)||t.memoizedState!==null,Xo(n,e,t),Ar=r):Xo(n,e,t);break;default:Xo(n,e,t)}}function ZM(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new sN),e.forEach(function(r){var i=mN.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Ki(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Hn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*lN(r/1960))-r,10n?16:n,la===null)var r=!1;else{if(n=la,la=null,Ug=0,Wt&6)throw Error(Oe(331));var i=Wt;for(Wt|=4,it=n.current;it!==null;){var s=it,o=s.child;if(it.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lHn()-kE?Al(n,0):UE|=t),ii(n,e)}function B2(n,e){e===0&&(n.mode&1?(e=Fp,Fp<<=1,!(Fp&130023424)&&(Fp=4194304)):e=1);var t=Hr();n=Co(n,e),n!==null&&(oh(n,e,t),ii(n,t))}function pN(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),B2(n,t)}function mN(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(Oe(314))}r!==null&&r.delete(e),B2(n,t)}var L2;L2=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||ni.current)ei=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return ei=!1,nN(n,e,t);ei=!!(n.flags&131072)}else ei=!1,xn&&e.flags&1048576&&FP(e,Rg,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;ng(n,e),n=e.pendingProps;var i=yu(e,Mr.current);lu(e,t),i=BE(null,e,r,n,i,t);var s=LE();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,ri(r)?(s=!0,bg(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,bE(e),i.updater=g0,e.stateNode=i,i._reactInternals=e,mx(e,r,n,t),e=yx(null,e,r,!0,s,t)):(e.tag=0,xn&&s&&xE(e),Fr(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(ng(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=vN(r),n=es(r,n),i){case 0:e=vx(null,e,r,n,t);break e;case 1:e=jM(null,e,r,n,t);break e;case 11:e=$M(null,e,r,n,t);break e;case 14:e=XM(null,e,r,es(r.type,n),t);break e}throw Error(Oe(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:es(r,i),vx(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:es(r,i),jM(n,e,r,i,t);case 3:e:{if(g2(e),n===null)throw Error(Oe(387));r=e.pendingProps,s=e.memoizedState,i=s.element,zP(n,e),Bg(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Au(Error(Oe(423)),e),e=JM(n,e,r,t,i);break e}else if(r!==i){i=Au(Error(Oe(424)),e),e=JM(n,e,r,t,i);break e}else for(di=pa(e.stateNode.containerInfo.firstChild),gi=e,xn=!0,rs=null,t=WP(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(_u(),r===i){e=Ro(n,e,t);break e}Fr(n,e,r,t)}e=e.child}return e;case 5:return $P(e),n===null&&dx(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,ax(r,i)?o=null:s!==null&&ax(r,s)&&(e.flags|=32),m2(n,e),Fr(n,e,o,t),e.child;case 6:return n===null&&dx(e),null;case 13:return v2(n,e,t);case 4:return CE(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=xu(e,null,r,t):Fr(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:es(r,i),$M(n,e,r,i,t);case 7:return Fr(n,e,e.pendingProps,t),e.child;case 8:return Fr(n,e,e.pendingProps.children,t),e.child;case 12:return Fr(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,fn(Pg,r._currentValue),r._currentValue=o,s!==null)if(cs(s.value,o)){if(s.children===i.children&&!ni.current){e=Ro(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===r){if(s.tag===1){l=yo(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),hx(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(Oe(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),hx(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}Fr(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,lu(e,t),i=Vi(i),r=r(i),e.flags|=1,Fr(n,e,r,t),e.child;case 14:return r=e.type,i=es(r,e.pendingProps),i=es(r.type,i),XM(n,e,r,i,t);case 15:return h2(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:es(r,i),ng(n,e),e.tag=1,ri(r)?(n=!0,bg(e)):n=!1,lu(e,t),GP(e,r,i),mx(e,r,i,t),yx(null,e,r,!0,n,t);case 19:return y2(n,e,t);case 22:return p2(n,e,t)}throw Error(Oe(156,e.tag))};function D2(n,e){return oP(n,e)}function gN(n,e,t,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zi(n,e,t,r){return new gN(n,e,t,r)}function VE(n){return n=n.prototype,!(!n||!n.isReactComponent)}function vN(n){if(typeof n=="function")return VE(n)?1:0;if(n!=null){if(n=n.$$typeof,n===lE)return 11;if(n===cE)return 14}return 2}function ya(n,e){var t=n.alternate;return t===null?(t=zi(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 sg(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")VE(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Gc:return Sl(t.children,i,s,e);case aE:o=8,i|=8;break;case k_:return n=zi(12,t,e,i|2),n.elementType=k_,n.lanes=s,n;case z_:return n=zi(13,t,e,i),n.elementType=z_,n.lanes=s,n;case H_:return n=zi(19,t,e,i),n.elementType=H_,n.lanes=s,n;case VR:return x0(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case HR:o=10;break e;case GR:o=9;break e;case lE:o=11;break e;case cE:o=14;break e;case ta:o=16,r=null;break e}throw Error(Oe(130,n==null?n:typeof n,""))}return e=zi(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function Sl(n,e,t,r){return n=zi(7,n,r,e),n.lanes=t,n}function x0(n,e,t,r){return n=zi(22,n,r,e),n.elementType=VR,n.lanes=t,n.stateNode={isHidden:!1},n}function Ty(n,e,t){return n=zi(6,n,null,e),n.lanes=t,n}function by(n,e,t){return e=zi(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function yN(n,e,t,r,i){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=ay(0),this.expirationTimes=ay(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ay(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function WE(n,e,t,r,i,s,o,a,l){return n=new yN(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=zi(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},bE(s),n}function _N(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}e(),n.exports=xi})(xO);const U2=q1(Pl);var oT=Pl;eM.createRoot=oT.createRoot,eM.hydrateRoot=oT.hydrateRoot;/** - * @license - * Copyright 2010-2023 Three.js Authors - * SPDX-License-Identifier: MIT - */const uh="153",ol={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},al={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},k2=0,Px=1,z2=2,wN=3,H2=0,M0=1,ud=2,ts=3,zs=0,Gr=1,Ui=2,MN=2,_o=0,wl=1,Ix=2,Bx=3,Lx=4,G2=5,ul=100,V2=101,W2=102,Dx=103,Ox=104,$2=200,X2=201,j2=202,J2=203,JE=204,KE=205,K2=206,Y2=207,Q2=208,Z2=209,q2=210,eI=0,tI=1,nI=2,Hg=3,rI=4,iI=5,sI=6,oI=7,fh=0,aI=1,lI=2,as=0,cI=1,uI=2,fI=3,YE=4,dI=5,T0=300,Po=301,Ma=302,wu=303,Nd=304,zu=306,Ta=1e3,ur=1001,Mu=1002,Dn=1003,Ud=1004,TN=1004,uu=1005,bN=1005,un=1006,b0=1007,CN=1007,Hs=1008,RN=1008,Ns=1009,hI=1010,pI=1011,C0=1012,QE=1013,go=1014,Sr=1015,kr=1016,ZE=1017,qE=1018,_a=1020,mI=1021,Ur=1023,gI=1024,vI=1025,xa=1026,Fl=1027,eA=1028,tA=1029,yI=1030,nA=1031,rA=1033,og=33776,ag=33777,lg=33778,cg=33779,Fx=35840,Nx=35841,Ux=35842,kx=35843,_I=36196,zx=37492,Hx=37496,Gx=37808,Vx=37809,Wx=37810,$x=37811,Xx=37812,jx=37813,Jx=37814,Kx=37815,Yx=37816,Qx=37817,Zx=37818,qx=37819,e1=37820,t1=37821,ug=36492,xI=36283,n1=36284,r1=36285,i1=36286,EI=2200,AI=2201,SI=2202,Tu=2300,Nl=2301,fg=2302,ml=2400,gl=2401,kd=2402,R0=2500,iA=2501,wI=0,sA=1,Gg=2,oA=3e3,Ea=3001,MI=3200,TI=3201,Oa=0,bI=1,Aa="",Pt="srgb",us="srgb-linear",aA="display-p3",PN=0,dg=7680,IN=7681,BN=7682,LN=7683,DN=34055,ON=34056,FN=5386,NN=512,UN=513,kN=514,zN=515,HN=516,GN=517,VN=518,CI=519,RI=512,PI=513,II=514,BI=515,LI=516,DI=517,OI=518,FI=519,zd=35044,WN=35048,$N=35040,XN=35045,jN=35049,JN=35041,KN=35046,YN=35050,QN=35042,ZN="100",s1="300 es",Vg=1035,Ds=2e3,Hd=2001;class Ws{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s>8&255]+xr[n>>16&255]+xr[n>>24&255]+"-"+xr[e&255]+xr[e>>8&255]+"-"+xr[e>>16&15|64]+xr[e>>24&255]+"-"+xr[t&63|128]+xr[t>>8&255]+"-"+xr[t>>16&255]+xr[t>>24&255]+xr[r&255]+xr[r>>8&255]+xr[r>>16&255]+xr[r>>24&255]).toLowerCase()}function On(n,e,t){return Math.max(e,Math.min(t,n))}function lA(n,e){return(n%e+e)%e}function qN(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function eU(n,e,t){return n!==e?(t-n)/(e-n):0}function fd(n,e,t){return(1-t)*n+t*e}function tU(n,e,t,r){return fd(n,e,1-Math.exp(-t*r))}function nU(n,e=1){return e-Math.abs(lA(n,e*2)-e)}function rU(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function iU(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function sU(n,e){return n+Math.floor(Math.random()*(e-n+1))}function oU(n,e){return n+Math.random()*(e-n)}function aU(n){return n*(.5-Math.random())}function lU(n){n!==void 0&&(aT=n);let e=aT+=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 cU(n){return n*Ml}function uU(n){return n*bu}function o1(n){return(n&n-1)===0&&n!==0}function NI(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Wg(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function fU(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+r)/2),d=o((e+r)/2),h=s((e-r)/2),p=o((e-r)/2),m=s((r-e)/2),v=o((r-e)/2);switch(i){case"XYX":n.set(a*d,l*h,l*p,a*c);break;case"YZY":n.set(l*p,a*d,l*h,a*c);break;case"ZXZ":n.set(l*h,l*p,a*d,a*c);break;case"XZX":n.set(a*d,l*v,l*m,a*c);break;case"YXY":n.set(l*m,a*d,l*v,a*c);break;case"ZYZ":n.set(l*v,l*m,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function hi(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 Ft(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 qc={DEG2RAD:Ml,RAD2DEG:bu,generateUUID:vi,clamp:On,euclideanModulo:lA,mapLinear:qN,inverseLerp:eU,lerp:fd,damp:tU,pingpong:nU,smoothstep:rU,smootherstep:iU,randInt:sU,randFloat:oU,randFloatSpread:aU,seededRandom:lU,degToRad:cU,radToDeg:uU,isPowerOfTwo:o1,ceilPowerOfTwo:NI,floorPowerOfTwo:Wg,setQuaternionFromProperEuler:fU,normalize:Ft,denormalize:hi};class Me{constructor(e=0,t=0){Me.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,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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 r=this.dot(e)/t;return Math.acos(On(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,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 r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ot{constructor(e,t,r,i,s,o,a,l,c){Ot.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c)}set(e,t,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=t,d[4]=s,d[5]=l,d[6]=r,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.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 r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],d=r[4],h=r[7],p=r[2],m=r[5],v=r[8],E=i[0],x=i[3],g=i[6],A=i[1],_=i[4],w=i[7],C=i[2],b=i[5],B=i[8];return s[0]=o*E+a*A+l*C,s[3]=o*x+a*_+l*b,s[6]=o*g+a*w+l*B,s[1]=c*E+d*A+h*C,s[4]=c*x+d*_+h*b,s[7]=c*g+d*w+h*B,s[2]=p*E+m*A+v*C,s[5]=p*x+m*_+v*b,s[8]=p*g+m*w+v*B,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],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return t*o*d-t*a*c-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=d*o-a*c,p=a*l-d*s,m=c*s-o*l,v=t*h+r*p+i*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const E=1/v;return e[0]=h*E,e[1]=(i*c-d*r)*E,e[2]=(a*r-i*o)*E,e[3]=p*E,e[4]=(d*t-i*l)*E,e[5]=(i*s-a*t)*E,e[6]=m*E,e[7]=(r*l-c*t)*E,e[8]=(o*t-r*s)*E,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,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Cy.makeScale(e,t)),this}rotate(e){return this.premultiply(Cy.makeRotation(-e)),this}translate(e,t){return this.premultiply(Cy.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),r=Math.sin(e);return this.set(t,-r,0,r,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,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Cy=new Ot;function UI(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const dU={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function eu(n,e){return new dU[n](e)}function Gd(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const lT={};function dd(n){n in lT||(lT[n]=!0,console.warn(n))}function fu(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ry(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const hU=new Ot().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),pU=new Ot().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function mU(n){return n.convertSRGBToLinear().applyMatrix3(pU)}function gU(n){return n.applyMatrix3(hU).convertLinearToSRGB()}const vU={[us]:n=>n,[Pt]:n=>n.convertSRGBToLinear(),[aA]:mU},yU={[us]:n=>n,[Pt]:n=>n.convertLinearToSRGB(),[aA]:gU},Bi={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 us},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 r=vU[e],i=yU[t];if(r===void 0||i===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return i(r(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let dc;class cA{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{dc===void 0&&(dc=Gd("canvas")),dc.width=e.width,dc.height=e.height;const r=dc.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=dc}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=Gd("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==T0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ta:e.x=e.x-Math.floor(e.x);break;case ur:e.x=e.x<0?0:1;break;case Mu: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 Ta:e.y=e.y-Math.floor(e.y);break;case ur:e.y=e.y<0?0:1;break;case Mu: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 dd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Pt?Ea:oA}set encoding(e){dd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Ea?Pt:Aa}}gn.DEFAULT_IMAGE=null;gn.DEFAULT_MAPPING=T0;gn.DEFAULT_ANISOTROPY=1;class en{constructor(e=0,t=0,r=0,i=1){en.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+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,r,i,s;const l=e.elements,c=l[0],d=l[4],h=l[8],p=l[1],m=l[5],v=l[9],E=l[2],x=l[6],g=l[10];if(Math.abs(d-p)<.01&&Math.abs(h-E)<.01&&Math.abs(v-x)<.01){if(Math.abs(d+p)<.1&&Math.abs(h+E)<.1&&Math.abs(v+x)<.1&&Math.abs(c+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(c+1)/2,w=(m+1)/2,C=(g+1)/2,b=(d+p)/4,B=(h+E)/4,I=(v+x)/4;return _>w&&_>C?_<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(_),i=b/r,s=B/r):w>C?w<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(w),r=b/i,s=I/i):C<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(C),r=B/s,i=I/s),this.set(r,i,s,t),this}let A=Math.sqrt((x-v)*(x-v)+(h-E)*(h-E)+(p-d)*(p-d));return Math.abs(A)<.001&&(A=1),this.x=(x-v)/A,this.y=(h-E)/A,this.z=(p-d)/A,this.w=Math.acos((c+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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,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 fs extends Ws{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new en(0,0,e,t),this.scissorTest=!1,this.viewport=new en(0,0,e,t);const i={width:e,height:t,depth:1};r.encoding!==void 0&&(dd("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),r.colorSpace=r.encoding===Ea?Pt:Aa),this.texture=new gn(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:un,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,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 vl(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 P0 extends gn{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=Dn,this.minFilter=Dn,this.wrapR=ur,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class EU extends fs{constructor(e=1,t=1,r=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new P0(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class uA extends gn{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=Dn,this.minFilter=Dn,this.wrapR=ur,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class AU extends fs{constructor(e=1,t=1,r=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new uA(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class SU extends fs{constructor(e=1,t=1,r=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,_=1-g*g;if(_>Number.EPSILON){const C=Math.sqrt(_),b=Math.atan2(C,g*A);x=Math.sin(x*b)/C,a=Math.sin(a*b)/C}const w=a*A;if(l=l*x+p*w,c=c*x+m*w,d=d*x+v*w,h=h*x+E*w,x===1-a){const C=1/Math.sqrt(l*l+c*c+d*d+h*h);l*=C,c*=C,d*=C,h*=C}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],h=s[o],p=s[o+1],m=s[o+2],v=s[o+3];return e[t]=a*v+d*h+l*m-c*p,e[t+1]=l*v+d*p+c*h-a*m,e[t+2]=c*v+d*m+a*p-l*h,e[t+3]=d*v-a*h-l*p-c*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,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),h=a(s/2),p=l(r/2),m=l(i/2),v=l(s/2);switch(o){case"XYZ":this._x=p*d*h+c*m*v,this._y=c*m*h-p*d*v,this._z=c*d*v+p*m*h,this._w=c*d*h-p*m*v;break;case"YXZ":this._x=p*d*h+c*m*v,this._y=c*m*h-p*d*v,this._z=c*d*v-p*m*h,this._w=c*d*h+p*m*v;break;case"ZXY":this._x=p*d*h-c*m*v,this._y=c*m*h+p*d*v,this._z=c*d*v+p*m*h,this._w=c*d*h-p*m*v;break;case"ZYX":this._x=p*d*h-c*m*v,this._y=c*m*h+p*d*v,this._z=c*d*v-p*m*h,this._w=c*d*h+p*m*v;break;case"YZX":this._x=p*d*h+c*m*v,this._y=c*m*h+p*d*v,this._z=c*d*v-p*m*h,this._w=c*d*h-p*m*v;break;case"XZY":this._x=p*d*h-c*m*v,this._y=c*m*h-p*d*v,this._z=c*d*v+p*m*h,this._w=c*d*h+p*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],d=t[6],h=t[10],p=r+a+h;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(d-l)*m,this._y=(s-c)*m,this._z=(o-i)*m}else if(r>a&&r>h){const m=2*Math.sqrt(1+r-a-h);this._w=(d-l)/m,this._x=.25*m,this._y=(i+o)/m,this._z=(s+c)/m}else if(a>h){const m=2*Math.sqrt(1+a-r-h);this._w=(s-c)/m,this._x=(i+o)/m,this._y=.25*m,this._z=(l+d)/m}else{const m=2*Math.sqrt(1+h-r-a);this._w=(o-i)/m,this._x=(s+c)/m,this._y=(l+d)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(On(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,d=t._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*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=r,this._y=i,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*r+t*this._x,this._y=m*i+t*this._y,this._z=m*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),h=Math.sin((1-t)*d)/c,p=Math.sin(t*d)/c;return this._w=o*h+this._w*p,this._x=r*h+this._x*p,this._y=i*h+this._y*p,this._z=s*h+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),r*Math.sin(s),r*Math.cos(s),t*Math.sin(i))}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 G{constructor(e=0,t=0,r=0){G.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,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(cT.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(cT.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*i-a*r,d=l*r+a*t-s*i,h=l*i+s*r-o*t,p=-s*t-o*r-a*i;return this.x=c*l+p*-s+d*-a-h*-o,this.y=d*l+p*-o+h*-s-c*-a,this.z=h*l+p*-a+c*-o-d*-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,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return Iy.copy(this).projectOnVector(e),this.sub(Iy)}reflect(e){return this.sub(Iy.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 r=this.dot(e)/t;return Math.acos(On(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Iy=new G,cT=new ar;class ms{constructor(e=new G(1/0,1/0,1/0),t=new G(-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,r=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,to),to.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(If),Jp.subVectors(this.max,If),pc.subVectors(e.a,If),mc.subVectors(e.b,If),gc.subVectors(e.c,If),jo.subVectors(mc,pc),Jo.subVectors(gc,mc),ja.subVectors(pc,gc);let t=[0,-jo.z,jo.y,0,-Jo.z,Jo.y,0,-ja.z,ja.y,jo.z,0,-jo.x,Jo.z,0,-Jo.x,ja.z,0,-ja.x,-jo.y,jo.x,0,-Jo.y,Jo.x,0,-ja.y,ja.x,0];return!By(t,pc,mc,gc,Jp)||(t=[1,0,0,0,1,0,0,0,1],!By(t,pc,mc,gc,Jp))?!1:(Kp.crossVectors(jo,Jo),t=[Kp.x,Kp.y,Kp.z],By(t,pc,mc,gc,Jp))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,to).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(to).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:(eo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),eo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),eo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),eo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),eo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),eo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),eo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),eo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(eo),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 eo=[new G,new G,new G,new G,new G,new G,new G,new G],to=new G,hc=new ms,pc=new G,mc=new G,gc=new G,jo=new G,Jo=new G,ja=new G,If=new G,Jp=new G,Kp=new G,Ja=new G;function By(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){Ja.fromArray(n,s);const a=i.x*Math.abs(Ja.x)+i.y*Math.abs(Ja.y)+i.z*Math.abs(Ja.z),l=e.dot(Ja),c=t.dot(Ja),d=r.dot(Ja);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const wU=new ms,Bf=new G,Ly=new G;class $i{constructor(e=new G,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):wU.setFromPoints(e).getCenter(r);let i=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;Bf.subVectors(e,this.center);const t=Bf.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Bf,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Ly.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Bf.copy(e.center).add(Ly)),this.expandByPoint(Bf.copy(e.center).sub(Ly))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const no=new G,Dy=new G,Yp=new G,Ko=new G,Oy=new G,Qp=new G,Fy=new G;class Hu{constructor(e=new G,t=new G(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,no)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=no.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(no.copy(this.origin).addScaledVector(this.direction,t),no.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Dy.copy(e).add(t).multiplyScalar(.5),Yp.copy(t).sub(e).normalize(),Ko.copy(this.origin).sub(Dy);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Yp),a=Ko.dot(this.direction),l=-Ko.dot(Yp),c=Ko.lengthSq(),d=Math.abs(1-o*o);let h,p,m,v;if(d>0)if(h=o*l-a,p=o*a-l,v=s*d,h>=0)if(p>=-v)if(p<=v){const E=1/d;h*=E,p*=E,m=h*(h+o*p+2*a)+p*(o*h+p+2*l)+c}else p=s,h=Math.max(0,-(o*p+a)),m=-h*h+p*(p+2*l)+c;else p=-s,h=Math.max(0,-(o*p+a)),m=-h*h+p*(p+2*l)+c;else p<=-v?(h=Math.max(0,-(-o*s+a)),p=h>0?-s:Math.min(Math.max(-s,-l),s),m=-h*h+p*(p+2*l)+c):p<=v?(h=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(h=Math.max(0,-(o*s+a)),p=h>0?s:Math.min(Math.max(-s,-l),s),m=-h*h+p*(p+2*l)+c);else p=o>0?-s:s,h=Math.max(0,-(o*p+a)),m=-h*h+p*(p+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Dy).addScaledVector(Yp,p),m}intersectSphere(e,t){no.subVectors(e.center,this.origin);const r=no.dot(this.direction),i=no.dot(no)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+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 r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,p=this.origin;return c>=0?(r=(e.min.x-p.x)*c,i=(e.max.x-p.x)*c):(r=(e.max.x-p.x)*c,i=(e.min.x-p.x)*c),d>=0?(s=(e.min.y-p.y)*d,o=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,o=(e.min.y-p.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-p.z)*h,l=(e.max.z-p.z)*h):(a=(e.max.z-p.z)*h,l=(e.min.z-p.z)*h),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,no)!==null}intersectTriangle(e,t,r,i,s){Oy.subVectors(t,e),Qp.subVectors(r,e),Fy.crossVectors(Oy,Qp);let o=this.direction.dot(Fy),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ko.subVectors(this.origin,e);const l=a*this.direction.dot(Qp.crossVectors(Ko,Qp));if(l<0)return null;const c=a*this.direction.dot(Oy.cross(Ko));if(c<0||l+c>o)return null;const d=-a*Ko.dot(Fy);return d<0?null:this.at(d/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 Et{constructor(e,t,r,i,s,o,a,l,c,d,h,p,m,v,E,x){Et.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c,d,h,p,m,v,E,x)}set(e,t,r,i,s,o,a,l,c,d,h,p,m,v,E,x){const g=this.elements;return g[0]=e,g[4]=t,g[8]=r,g[12]=i,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=d,g[10]=h,g[14]=p,g[3]=m,g[7]=v,g[11]=E,g[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Et().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[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,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/vc.setFromMatrixColumn(e,0).length(),s=1/vc.setFromMatrixColumn(e,1).length(),o=1/vc.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const p=o*d,m=o*h,v=a*d,E=a*h;t[0]=l*d,t[4]=-l*h,t[8]=c,t[1]=m+v*c,t[5]=p-E*c,t[9]=-a*l,t[2]=E-p*c,t[6]=v+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*d,m=l*h,v=c*d,E=c*h;t[0]=p+E*a,t[4]=v*a-m,t[8]=o*c,t[1]=o*h,t[5]=o*d,t[9]=-a,t[2]=m*a-v,t[6]=E+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*d,m=l*h,v=c*d,E=c*h;t[0]=p-E*a,t[4]=-o*h,t[8]=v+m*a,t[1]=m+v*a,t[5]=o*d,t[9]=E-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*d,m=o*h,v=a*d,E=a*h;t[0]=l*d,t[4]=v*c-m,t[8]=p*c+E,t[1]=l*h,t[5]=E*c+p,t[9]=m*c-v,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*c,v=a*l,E=a*c;t[0]=l*d,t[4]=E-p*h,t[8]=v*h+m,t[1]=h,t[5]=o*d,t[9]=-a*d,t[2]=-c*d,t[6]=m*h+v,t[10]=p-E*h}else if(e.order==="XZY"){const p=o*l,m=o*c,v=a*l,E=a*c;t[0]=l*d,t[4]=-h,t[8]=c*d,t[1]=p*h+E,t[5]=o*d,t[9]=m*h-v,t[2]=v*h-m,t[6]=a*d,t[10]=E*h+p}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(MU,e,TU)}lookAt(e,t,r){const i=this.elements;return ci.subVectors(e,t),ci.lengthSq()===0&&(ci.z=1),ci.normalize(),Yo.crossVectors(r,ci),Yo.lengthSq()===0&&(Math.abs(r.z)===1?ci.x+=1e-4:ci.z+=1e-4,ci.normalize(),Yo.crossVectors(r,ci)),Yo.normalize(),Zp.crossVectors(ci,Yo),i[0]=Yo.x,i[4]=Zp.x,i[8]=ci.x,i[1]=Yo.y,i[5]=Zp.y,i[9]=ci.y,i[2]=Yo.z,i[6]=Zp.z,i[10]=ci.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],d=r[1],h=r[5],p=r[9],m=r[13],v=r[2],E=r[6],x=r[10],g=r[14],A=r[3],_=r[7],w=r[11],C=r[15],b=i[0],B=i[4],I=i[8],R=i[12],L=i[1],U=i[5],j=i[9],$=i[13],K=i[2],Y=i[6],ne=i[10],ie=i[14],z=i[3],Z=i[7],q=i[11],ae=i[15];return s[0]=o*b+a*L+l*K+c*z,s[4]=o*B+a*U+l*Y+c*Z,s[8]=o*I+a*j+l*ne+c*q,s[12]=o*R+a*$+l*ie+c*ae,s[1]=d*b+h*L+p*K+m*z,s[5]=d*B+h*U+p*Y+m*Z,s[9]=d*I+h*j+p*ne+m*q,s[13]=d*R+h*$+p*ie+m*ae,s[2]=v*b+E*L+x*K+g*z,s[6]=v*B+E*U+x*Y+g*Z,s[10]=v*I+E*j+x*ne+g*q,s[14]=v*R+E*$+x*ie+g*ae,s[3]=A*b+_*L+w*K+C*z,s[7]=A*B+_*U+w*Y+C*Z,s[11]=A*I+_*j+w*ne+C*q,s[15]=A*R+_*$+w*ie+C*ae,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],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],h=e[6],p=e[10],m=e[14],v=e[3],E=e[7],x=e[11],g=e[15];return v*(+s*l*h-i*c*h-s*a*p+r*c*p+i*a*m-r*l*m)+E*(+t*l*m-t*c*p+s*o*p-i*o*m+i*c*d-s*l*d)+x*(+t*c*h-t*a*m-s*o*h+r*o*m+s*a*d-r*c*d)+g*(-i*a*d-t*l*h+t*a*p+i*o*h-r*o*p+r*l*d)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=e[9],p=e[10],m=e[11],v=e[12],E=e[13],x=e[14],g=e[15],A=h*x*c-E*p*c+E*l*m-a*x*m-h*l*g+a*p*g,_=v*p*c-d*x*c-v*l*m+o*x*m+d*l*g-o*p*g,w=d*E*c-v*h*c+v*a*m-o*E*m-d*a*g+o*h*g,C=v*h*l-d*E*l-v*a*p+o*E*p+d*a*x-o*h*x,b=t*A+r*_+i*w+s*C;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/b;return e[0]=A*B,e[1]=(E*p*s-h*x*s-E*i*m+r*x*m+h*i*g-r*p*g)*B,e[2]=(a*x*s-E*l*s+E*i*c-r*x*c-a*i*g+r*l*g)*B,e[3]=(h*l*s-a*p*s-h*i*c+r*p*c+a*i*m-r*l*m)*B,e[4]=_*B,e[5]=(d*x*s-v*p*s+v*i*m-t*x*m-d*i*g+t*p*g)*B,e[6]=(v*l*s-o*x*s-v*i*c+t*x*c+o*i*g-t*l*g)*B,e[7]=(o*p*s-d*l*s+d*i*c-t*p*c-o*i*m+t*l*m)*B,e[8]=w*B,e[9]=(v*h*s-d*E*s-v*r*m+t*E*m+d*r*g-t*h*g)*B,e[10]=(o*E*s-v*a*s+v*r*c-t*E*c-o*r*g+t*a*g)*B,e[11]=(d*a*s-o*h*s-d*r*c+t*h*c+o*r*m-t*a*m)*B,e[12]=C*B,e[13]=(d*E*i-v*h*i+v*r*p-t*E*p-d*r*x+t*h*x)*B,e[14]=(v*a*i-o*E*i-v*r*l+t*E*l+o*r*x-t*a*x)*B,e[15]=(o*h*i-d*a*i+d*r*l-t*h*l-o*r*p+t*a*p)*B,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){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,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,d=o+o,h=a+a,p=s*c,m=s*d,v=s*h,E=o*d,x=o*h,g=a*h,A=l*c,_=l*d,w=l*h,C=r.x,b=r.y,B=r.z;return i[0]=(1-(E+g))*C,i[1]=(m+w)*C,i[2]=(v-_)*C,i[3]=0,i[4]=(m-w)*b,i[5]=(1-(p+g))*b,i[6]=(x+A)*b,i[7]=0,i[8]=(v+_)*B,i[9]=(x-A)*B,i[10]=(1-(p+E))*B,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=vc.set(i[0],i[1],i[2]).length();const o=vc.set(i[4],i[5],i[6]).length(),a=vc.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Yi.copy(this);const c=1/s,d=1/o,h=1/a;return Yi.elements[0]*=c,Yi.elements[1]*=c,Yi.elements[2]*=c,Yi.elements[4]*=d,Yi.elements[5]*=d,Yi.elements[6]*=d,Yi.elements[8]*=h,Yi.elements[9]*=h,Yi.elements[10]*=h,t.setFromRotationMatrix(Yi),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=Ds){const l=this.elements,c=2*s/(t-e),d=2*s/(r-i),h=(t+e)/(t-e),p=(r+i)/(r-i);let m,v;if(a===Ds)m=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(a===Hd)m=-o/(o-s),v=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=d,l[9]=p,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,r,i,s,o,a=Ds){const l=this.elements,c=1/(t-e),d=1/(r-i),h=1/(o-s),p=(t+e)*c,m=(r+i)*d;let v,E;if(a===Ds)v=(o+s)*h,E=-2*h;else if(a===Hd)v=s*h,E=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=E,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const vc=new G,Yi=new Et,MU=new G(0,0,0),TU=new G(1,1,1),Yo=new G,Zp=new G,ci=new G,uT=new Et,fT=new ar;class dh{constructor(e=0,t=0,r=0,i=dh.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],d=i[9],h=i[2],p=i[6],m=i[10];switch(t){case"XYZ":this._y=Math.asin(On(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-On(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(On(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-On(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(On(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-On(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return uT.makeRotationFromQuaternion(e),this.setFromRotationMatrix(uT,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return fT.setFromEuler(this),this.setFromQuaternion(fT,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}}dh.DEFAULT_ORDER="XYZ";class Tl{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0&&(r=r.concat(o))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Lf,e,CU),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Lf,RU,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 r=0,i=t.length;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));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?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=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 c=0,d=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),h.length>0&&(r.shapes=h),p.length>0&&(r.skeletons=p),m.length>0&&(r.animations=m),v.length>0&&(r.nodes=v)}return r.object=i,r;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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 r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){Qi.subVectors(i,t),io.subVectors(r,t),Ny.subVectors(e,t);const o=Qi.dot(Qi),a=Qi.dot(io),l=Qi.dot(Ny),c=io.dot(io),d=io.dot(Ny),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);const p=1/h,m=(c*l-a*d)*p,v=(o*d-a*l)*p;return s.set(1-m-v,v,m)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,so),so.x>=0&&so.y>=0&&so.x+so.y<=1}static getUV(e,t,r,i,s,o,a,l){return em===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),em=!0),this.getInterpolation(e,t,r,i,s,o,a,l)}static getInterpolation(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,so),l.setScalar(0),l.addScaledVector(s,so.x),l.addScaledVector(o,so.y),l.addScaledVector(a,so.z),l}static isFrontFacing(e,t,r,i){return Qi.subVectors(r,t),io.subVectors(e,t),Qi.cross(io).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qi.subVectors(this.c,this.b),io.subVectors(this.a,this.b),Qi.cross(io).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return qr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return qr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return em===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),em=!0),qr.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}getInterpolation(e,t,r,i,s){return qr.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return qr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return qr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;_c.subVectors(i,r),xc.subVectors(s,r),Uy.subVectors(e,r);const l=_c.dot(Uy),c=xc.dot(Uy);if(l<=0&&c<=0)return t.copy(r);ky.subVectors(e,i);const d=_c.dot(ky),h=xc.dot(ky);if(d>=0&&h<=d)return t.copy(i);const p=l*h-d*c;if(p<=0&&l>=0&&d<=0)return o=l/(l-d),t.copy(r).addScaledVector(_c,o);zy.subVectors(e,s);const m=_c.dot(zy),v=xc.dot(zy);if(v>=0&&m<=v)return t.copy(s);const E=m*c-l*v;if(E<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(r).addScaledVector(xc,a);const x=d*v-m*h;if(x<=0&&h-d>=0&&m-v>=0)return vT.subVectors(s,i),a=(h-d)/(h-d+(m-v)),t.copy(i).addScaledVector(vT,a);const g=1/(x+E+p);return o=E*g,a=p*g,t.copy(r).addScaledVector(_c,o).addScaledVector(xc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let IU=0;class Xn extends Ws{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:IU++}),this.uuid=vi(),this.name="",this.type="Material",this.blending=wl,this.side=zs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=JE,this.blendDst=KE,this.blendEquation=ul,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Hg,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=CI,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=dg,this.stencilZFail=dg,this.stencilZPass=dg,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 r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==wl&&(r.blending=this.blending),this.side!==zs&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(r.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=this.flatShading),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}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 r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const kI={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},Zi={h:0,s:0,l:0},tm={h:0,s:0,l:0};function Hy(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 Xe=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Pt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Bi.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=Bi.workingColorSpace){return this.r=e,this.g=t,this.b=r,Bi.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=Bi.workingColorSpace){if(e=lA(e,1),t=On(t,0,1),r=On(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=Hy(o,s,e+1/3),this.g=Hy(o,s,e),this.b=Hy(o,s,e-1/3)}return Bi.toWorkingColorSpace(this,i),this}setStyle(e,t=Pt){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[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 r(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 r(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 r(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(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[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=Pt){const r=kI[e.toLowerCase()];return r!==void 0?this.setHex(r,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=fu(e.r),this.g=fu(e.g),this.b=fu(e.b),this}copyLinearToSRGB(e){return this.r=Ry(e.r),this.g=Ry(e.g),this.b=Ry(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Pt){return Bi.fromWorkingColorSpace(Er.copy(this),e),Math.round(On(Er.r*255,0,255))*65536+Math.round(On(Er.g*255,0,255))*256+Math.round(On(Er.b*255,0,255))}getHexString(e=Pt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Bi.workingColorSpace){Bi.fromWorkingColorSpace(Er.copy(this),t);const r=Er.r,i=Er.g,s=Er.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=d<=.5?h/(o+a):h/(2-o-a),o){case r:l=(i-s)/h+(i>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;!(c&8388608);)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}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:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function Kr(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=On(n,-65504,65504),fo.floatView[0]=n;const e=fo.uint32View[0],t=e>>23&511;return fo.baseTable[t]+((e&8388607)>>fo.shiftTable[t])}function Zf(n){const e=n>>10;return fo.uint32View[0]=fo.mantissaTable[fo.offsetTable[e]+(n&1023)]+fo.exponentTable[e],fo.floatView[0]}const yl={toHalfFloat:Kr,fromHalfFloat:Zf},Wn=new G,nm=new Me;class Kt{constructor(e,t,r=!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=r,this.usage=zd,this.updateRange={offset:0,count:-1},this.gpuType=Sr,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,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let h=0,p=c.length;h0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,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 r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],h=s[c];for(let p=0,m=h.length;p0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(yT.copy(s).invert(),Ka.copy(e.ray).applyMatrix4(yT),!(r.boundingBox!==null&&Ka.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,Ka)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,h=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,E=p.length;vt.far?null:{distance:c,point:cm.clone(),object:n}}function um(n,e,t,r,i,s,o,a,l,c){n.getVertexPosition(a,Ac),n.getVertexPosition(l,Sc),n.getVertexPosition(c,wc);const d=HU(n,e,t,r,Ac,Sc,wc,lm);if(d){i&&(sm.fromBufferAttribute(i,a),om.fromBufferAttribute(i,l),am.fromBufferAttribute(i,c),d.uv=qr.getInterpolation(lm,Ac,Sc,wc,sm,om,am,new Me)),s&&(sm.fromBufferAttribute(s,a),om.fromBufferAttribute(s,l),am.fromBufferAttribute(s,c),d.uv1=qr.getInterpolation(lm,Ac,Sc,wc,sm,om,am,new Me),d.uv2=d.uv1),o&&(xT.fromBufferAttribute(o,a),ET.fromBufferAttribute(o,l),AT.fromBufferAttribute(o,c),d.normal=qr.getInterpolation(lm,Ac,Sc,wc,xT,ET,AT,new G),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new G,materialIndex:0};qr.getNormal(Ac,Sc,wc,h.normal),d.face=h}return d}class Fa extends It{constructor(e=1,t=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],h=[];let p=0,m=0;v("z","y","x",-1,-1,r,t,e,o,s,0),v("z","y","x",1,-1,r,t,-e,o,s,1),v("x","z","y",1,1,e,r,t,i,o,2),v("x","z","y",1,-1,e,r,-t,i,o,3),v("x","y","z",1,-1,e,t,r,i,s,4),v("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new ct(c,3)),this.setAttribute("normal",new ct(d,3)),this.setAttribute("uv",new ct(h,2));function v(E,x,g,A,_,w,C,b,B,I,R){const L=w/B,U=C/I,j=w/2,$=C/2,K=b/2,Y=B+1,ne=I+1;let ie=0,z=0;const Z=new G;for(let q=0;q0?1:-1,d.push(Z.x,Z.y,Z.z),h.push(ee/B),h.push(1-q/I),ie+=1}}for(let q=0;q0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class hh extends Vt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Et,this.projectionMatrix=new Et,this.projectionMatrixInverse=new Et,this.coordinateSystem=Ds}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 Fn extends hh{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=bu*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ml*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return bu*2*Math.atan(Math.tan(Ml*.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,r,i,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=r,this.view.offsetY=i,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(Ml*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,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 Mc=-90,Tc=1;class GI extends Vt{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null;const i=new Fn(Mc,Tc,e,t);i.layers=this.layers,this.add(i);const s=new Fn(Mc,Tc,e,t);s.layers=this.layers,this.add(s);const o=new Fn(Mc,Tc,e,t);o.layers=this.layers,this.add(o);const a=new Fn(Mc,Tc,e,t);a.layers=this.layers,this.add(a);const l=new Fn(Mc,Tc,e,t);l.layers=this.layers,this.add(l);const c=new Fn(Mc,Tc,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Ds)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.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===Hd)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.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 c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const r=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[i,s,o,a,l,c]=this.children,d=e.getRenderTarget(),h=e.toneMapping,p=e.xr.enabled;e.toneMapping=as,e.xr.enabled=!1;const m=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,i),e.setRenderTarget(r,1),e.render(t,s),e.setRenderTarget(r,2),e.render(t,o),e.setRenderTarget(r,3),e.render(t,a),e.setRenderTarget(r,4),e.render(t,l),r.texture.generateMipmaps=m,e.setRenderTarget(r,5),e.render(t,c),e.setRenderTarget(d),e.toneMapping=h,e.xr.enabled=p,r.texture.needsPMREMUpdate=!0}}class ph extends gn{constructor(e,t,r,i,s,o,a,l,c,d){e=e!==void 0?e:[],t=t!==void 0?t:Po,super(e,t,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class hA extends fs{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];t.encoding!==void 0&&(dd("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Ea?Pt:Aa),this.texture=new ph(i,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:un}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 r={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 ); - - } - `},i=new Fa(5,5,5),s=new ds({name:"CubemapFromEquirect",uniforms:Cu(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Gr,blending:_o});s.uniforms.tEquirect.value=t;const o=new Qn(i,s),a=t.minFilter;return t.minFilter===Hs&&(t.minFilter=un),new GI(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,i);e.setRenderTarget(s)}}const Wy=new G,$U=new G,XU=new Ot;class ra{constructor(e=new G(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,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const i=Wy.subVectors(r,t).cross($U.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const r=e.delta(Wy),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<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 r=t||XU.getNormalMatrix(e),i=this.coplanarPoint(Wy).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.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 Ya=new $i,fm=new G;class I0{constructor(e=new ra,t=new ra,r=new ra,i=new ra,s=new ra,o=new ra){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=Ds){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],d=i[5],h=i[6],p=i[7],m=i[8],v=i[9],E=i[10],x=i[11],g=i[12],A=i[13],_=i[14],w=i[15];if(r[0].setComponents(l-s,p-c,x-m,w-g).normalize(),r[1].setComponents(l+s,p+c,x+m,w+g).normalize(),r[2].setComponents(l+o,p+d,x+v,w+A).normalize(),r[3].setComponents(l-o,p-d,x-v,w-A).normalize(),r[4].setComponents(l-a,p-h,x-E,w-_).normalize(),t===Ds)r[5].setComponents(l+a,p+h,x+E,w+_).normalize();else if(t===Hd)r[5].setComponents(a,h,E,_).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(),Ya.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ya.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ya)}intersectsSprite(e){return Ya.center.set(0,0,0),Ya.radius=.7071067811865476,Ya.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ya)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)0?e.max.x:e.min.x,fm.y=i.normal.y>0?e.max.y:e.min.y,fm.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(fm)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function VI(){let n=null,e=!1,t=null,r=null;function i(s,o){t(s,o),r=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(r=n.requestAnimationFrame(i),e=!0)},stop:function(){n.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function jU(n,e){const t=e.isWebGL2,r=new WeakMap;function i(c,d){const h=c.array,p=c.usage,m=n.createBuffer();n.bindBuffer(d,m),n.bufferData(d,h,p),c.onUploadCallback();let v;if(h instanceof Float32Array)v=n.FLOAT;else if(h instanceof Uint16Array)if(c.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(h instanceof Int16Array)v=n.SHORT;else if(h instanceof Uint32Array)v=n.UNSIGNED_INT;else if(h instanceof Int32Array)v=n.INT;else if(h instanceof Int8Array)v=n.BYTE;else if(h instanceof Uint8Array)v=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)v=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:v,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,d,h){const p=d.array,m=d.updateRange;n.bindBuffer(h,c),m.count===-1?n.bufferSubData(h,0,p):(t?n.bufferSubData(h,m.offset*p.BYTES_PER_ELEMENT,p,m.offset,m.count):n.bufferSubData(h,m.offset*p.BYTES_PER_ELEMENT,p.subarray(m.offset,m.offset+m.count)),m.count=-1),d.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),r.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const d=r.get(c);d&&(n.deleteBuffer(d.buffer),r.delete(c))}function l(c,d){if(c.isGLBufferAttribute){const p=r.get(c);(!p||p.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`,ok=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,ak=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,lk=`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,ck=`#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`,uk=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`,fk=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - varying vec3 vColor; -#endif`,dk=`#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`,hk=`#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 -}; -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`,pk=`#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`,mk=`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`,gk=`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,vk=`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,yk=`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,_k=`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,xk="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ek=`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 ); -}`,Ak=`#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`,Sk=`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`,wk=`#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`,Mk=`#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`,Tk=`#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`,bk=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,Ck=`#ifdef USE_FOG - varying float vFogDepth; -#endif`,Rk=`#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`,Pk=`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,Ik=`#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 -}`,Bk=`#ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,Lk=`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,Dk=`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,Ok=`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`,Fk=`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`,Nk=`#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`,Uk=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,kk=`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`,zk=`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,Hk=`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`,Gk=`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`,Vk=`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 ); -}`,Wk=` -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`,$k=`#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`,Xk=`#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); -#endif`,jk=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,Jk=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,Kk=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - varying float vFragDepth; - varying float vIsPerspective; - #else - uniform float logDepthBufFC; - #endif -#endif`,Yk=`#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`,Qk=`#ifdef USE_MAP - diffuseColor *= texture2D( map, vMapUv ); -#endif`,Zk=`#ifdef USE_MAP - uniform sampler2D map; -#endif`,qk=`#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`,ez=`#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`,tz=`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,nz=`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,rz=`#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`,iz=`#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`,sz=`#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`,oz=`#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`,az=`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, vNormalMapUv ); - #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;`,lz=`#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`,cz=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,uz=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,fz=`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`,dz=`#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`,hz=`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = geometryNormal; -#endif`,pz=`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,mz=`#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`,gz=`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,vz=`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,yz=`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 ); -}`,_z=`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,xz=`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,Ez=`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,Az=`#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`,Sz=`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,wz=`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,Mz=`#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`,Tz=`#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`,bz=`#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`,Cz=`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; -}`,Rz=`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,Pz=`#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`,Iz=`#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`,Bz=`#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`,Lz=`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,Dz=`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,Oz=`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,Fz=`#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; }`,Nz=`#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`,Uz=`#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`,kz=`#ifdef USE_UV - 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`,zz=`#ifdef USE_UV - 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`,Hz=`#ifdef USE_UV - 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`,Gz=`#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 Vz=`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,Wz=`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,$z=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,Xz=`#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 -}`,jz=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,Jz=`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 -}`,Kz=`#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; -}`,Yz=`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#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 - 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 -}`,Qz=`#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; -}`,Zz=`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -void main () { - #include - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`,qz=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,eH=`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,tH=`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 -}`,nH=`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 -}`,rH=`#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 -}`,iH=`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 -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #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 -}`,sH=`#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 -}`,oH=`#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 -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 - #include -}`,aH=`#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; -}`,lH=`#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 -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #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 -}`,cH=`#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 -}`,uH=`#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 -}`,fH=`#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 -}`,dH=`#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 -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 + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,hH=`#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 -}`,pH=`#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 -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 - 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 -}`,mH=`#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 -}`,gH=`#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 -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 - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`,vH=`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 -}`,yH=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,_H=`#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,xH=`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 -}`,EH=`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 -}`,AH=`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 - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`,Dt={alphamap_fragment:JU,alphamap_pars_fragment:KU,alphatest_fragment:YU,alphatest_pars_fragment:QU,aomap_fragment:ZU,aomap_pars_fragment:qU,begin_vertex:ek,beginnormal_vertex:tk,bsdfs:nk,iridescence_fragment:rk,bumpmap_pars_fragment:ik,clipping_planes_fragment:sk,clipping_planes_pars_fragment:ok,clipping_planes_pars_vertex:ak,clipping_planes_vertex:lk,color_fragment:ck,color_pars_fragment:uk,color_pars_vertex:fk,color_vertex:dk,common:hk,cube_uv_reflection_fragment:pk,defaultnormal_vertex:mk,displacementmap_pars_vertex:gk,displacementmap_vertex:vk,emissivemap_fragment:yk,emissivemap_pars_fragment:_k,encodings_fragment:xk,encodings_pars_fragment:Ek,envmap_fragment:Ak,envmap_common_pars_fragment:Sk,envmap_pars_fragment:wk,envmap_pars_vertex:Mk,envmap_physical_pars_fragment:Nk,envmap_vertex:Tk,fog_vertex:bk,fog_pars_vertex:Ck,fog_fragment:Rk,fog_pars_fragment:Pk,gradientmap_pars_fragment:Ik,lightmap_fragment:Bk,lightmap_pars_fragment:Lk,lights_lambert_fragment:Dk,lights_lambert_pars_fragment:Ok,lights_pars_begin:Fk,lights_toon_fragment:Uk,lights_toon_pars_fragment:kk,lights_phong_fragment:zk,lights_phong_pars_fragment:Hk,lights_physical_fragment:Gk,lights_physical_pars_fragment:Vk,lights_fragment_begin:Wk,lights_fragment_maps:$k,lights_fragment_end:Xk,logdepthbuf_fragment:jk,logdepthbuf_pars_fragment:Jk,logdepthbuf_pars_vertex:Kk,logdepthbuf_vertex:Yk,map_fragment:Qk,map_pars_fragment:Zk,map_particle_fragment:qk,map_particle_pars_fragment:ez,metalnessmap_fragment:tz,metalnessmap_pars_fragment:nz,morphcolor_vertex:rz,morphnormal_vertex:iz,morphtarget_pars_vertex:sz,morphtarget_vertex:oz,normal_fragment_begin:az,normal_fragment_maps:lz,normal_pars_fragment:cz,normal_pars_vertex:uz,normal_vertex:fz,normalmap_pars_fragment:dz,clearcoat_normal_fragment_begin:hz,clearcoat_normal_fragment_maps:pz,clearcoat_pars_fragment:mz,iridescence_pars_fragment:gz,output_fragment:vz,packing:yz,premultiplied_alpha_fragment:_z,project_vertex:xz,dithering_fragment:Ez,dithering_pars_fragment:Az,roughnessmap_fragment:Sz,roughnessmap_pars_fragment:wz,shadowmap_pars_fragment:Mz,shadowmap_pars_vertex:Tz,shadowmap_vertex:bz,shadowmask_pars_fragment:Cz,skinbase_vertex:Rz,skinning_pars_vertex:Pz,skinning_vertex:Iz,skinnormal_vertex:Bz,specularmap_fragment:Lz,specularmap_pars_fragment:Dz,tonemapping_fragment:Oz,tonemapping_pars_fragment:Fz,transmission_fragment:Nz,transmission_pars_fragment:Uz,uv_pars_fragment:kz,uv_pars_vertex:zz,uv_vertex:Hz,worldpos_vertex:Gz,background_vert:Vz,background_frag:Wz,backgroundCube_vert:$z,backgroundCube_frag:Xz,cube_vert:jz,cube_frag:Jz,depth_vert:Kz,depth_frag:Yz,distanceRGBA_vert:Qz,distanceRGBA_frag:Zz,equirect_vert:qz,equirect_frag:eH,linedashed_vert:tH,linedashed_frag:nH,meshbasic_vert:rH,meshbasic_frag:iH,meshlambert_vert:sH,meshlambert_frag:oH,meshmatcap_vert:aH,meshmatcap_frag:lH,meshnormal_vert:cH,meshnormal_frag:uH,meshphong_vert:fH,meshphong_frag:dH,meshphysical_vert:hH,meshphysical_frag:pH,meshtoon_vert:mH,meshtoon_frag:gH,points_vert:vH,points_frag:yH,shadow_vert:_H,shadow_frag:xH,sprite_vert:EH,sprite_frag:AH},$e={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ot},alphaMap:{value:null},alphaMapTransform:{value:new Ot},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ot}},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 Ot}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ot}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ot},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ot},normalScale:{value:new Me(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ot},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ot}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ot}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ot}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(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 Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ot},alphaTest:{value:0},uvTransform:{value:new Ot}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new Me(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ot},alphaMap:{value:null},alphaMapTransform:{value:new Ot},alphaTest:{value:0}}},is={basic:{uniforms:Dr([$e.common,$e.specularmap,$e.envmap,$e.aomap,$e.lightmap,$e.fog]),vertexShader:Dt.meshbasic_vert,fragmentShader:Dt.meshbasic_frag},lambert:{uniforms:Dr([$e.common,$e.specularmap,$e.envmap,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.fog,$e.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Dt.meshlambert_vert,fragmentShader:Dt.meshlambert_frag},phong:{uniforms:Dr([$e.common,$e.specularmap,$e.envmap,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.fog,$e.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30}}]),vertexShader:Dt.meshphong_vert,fragmentShader:Dt.meshphong_frag},standard:{uniforms:Dr([$e.common,$e.envmap,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.roughnessmap,$e.metalnessmap,$e.fog,$e.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Dt.meshphysical_vert,fragmentShader:Dt.meshphysical_frag},toon:{uniforms:Dr([$e.common,$e.aomap,$e.lightmap,$e.emissivemap,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.gradientmap,$e.fog,$e.lights,{emissive:{value:new Xe(0)}}]),vertexShader:Dt.meshtoon_vert,fragmentShader:Dt.meshtoon_frag},matcap:{uniforms:Dr([$e.common,$e.bumpmap,$e.normalmap,$e.displacementmap,$e.fog,{matcap:{value:null}}]),vertexShader:Dt.meshmatcap_vert,fragmentShader:Dt.meshmatcap_frag},points:{uniforms:Dr([$e.points,$e.fog]),vertexShader:Dt.points_vert,fragmentShader:Dt.points_frag},dashed:{uniforms:Dr([$e.common,$e.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Dt.linedashed_vert,fragmentShader:Dt.linedashed_frag},depth:{uniforms:Dr([$e.common,$e.displacementmap]),vertexShader:Dt.depth_vert,fragmentShader:Dt.depth_frag},normal:{uniforms:Dr([$e.common,$e.bumpmap,$e.normalmap,$e.displacementmap,{opacity:{value:1}}]),vertexShader:Dt.meshnormal_vert,fragmentShader:Dt.meshnormal_frag},sprite:{uniforms:Dr([$e.sprite,$e.fog]),vertexShader:Dt.sprite_vert,fragmentShader:Dt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ot},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Dt.background_vert,fragmentShader:Dt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Dt.backgroundCube_vert,fragmentShader:Dt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Dt.cube_vert,fragmentShader:Dt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Dt.equirect_vert,fragmentShader:Dt.equirect_frag},distanceRGBA:{uniforms:Dr([$e.common,$e.displacementmap,{referencePosition:{value:new G},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Dt.distanceRGBA_vert,fragmentShader:Dt.distanceRGBA_frag},shadow:{uniforms:Dr([$e.lights,$e.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:Dt.shadow_vert,fragmentShader:Dt.shadow_frag}};is.physical={uniforms:Dr([is.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ot},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ot},clearcoatNormalScale:{value:new Me(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ot},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ot},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ot},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ot},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ot},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ot},transmissionSamplerSize:{value:new Me},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ot},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ot},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ot},anisotropyVector:{value:new Me},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ot}}]),vertexShader:Dt.meshphysical_vert,fragmentShader:Dt.meshphysical_frag};const dm={r:0,b:0,g:0};function SH(n,e,t,r,i,s,o){const a=new Xe(0);let l=s===!0?0:1,c,d,h=null,p=0,m=null;function v(x,g){let A=!1,_=g.isScene===!0?g.background:null;switch(_&&_.isTexture&&(_=(g.backgroundBlurriness>0?t:e).get(_)),_===null?E(a,l):_&&_.isColor&&(E(_,1),A=!0),n.xr.getEnvironmentBlendMode()){case"opaque":A=!0;break;case"additive":r.buffers.color.setClear(0,0,0,1,o),A=!0;break;case"alpha-blend":r.buffers.color.setClear(0,0,0,0,o),A=!0;break}(n.autoClear||A)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),_&&(_.isCubeTexture||_.mapping===zu)?(d===void 0&&(d=new Qn(new Fa(1,1,1),new ds({name:"BackgroundCubeMaterial",uniforms:Cu(is.backgroundCube.uniforms),vertexShader:is.backgroundCube.vertexShader,fragmentShader:is.backgroundCube.fragmentShader,side:Gr,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(b,B,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),d.material.uniforms.envMap.value=_,d.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,d.material.toneMapped=_.colorSpace!==Pt,(h!==_||p!==_.version||m!==n.toneMapping)&&(d.material.needsUpdate=!0,h=_,p=_.version,m=n.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new Qn(new Gu(2,2),new ds({name:"BackgroundMaterial",uniforms:Cu(is.background.uniforms),vertexShader:is.background.vertexShader,fragmentShader:is.background.fragmentShader,side:zs,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=_.colorSpace!==Pt,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(h!==_||p!==_.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,h=_,p=_.version,m=n.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function E(x,g){x.getRGB(dm,zI(n)),r.buffers.color.setClear(dm.r,dm.g,dm.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(x,g=1){a.set(x),l=g,E(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,E(a,l)},render:v}}function wH(n,e,t,r){const i=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=x(null);let c=l,d=!1;function h(K,Y,ne,ie,z){let Z=!1;if(o){const q=E(ie,ne,Y);c!==q&&(c=q,m(c.object)),Z=g(K,ie,ne,z),Z&&A(K,ie,ne,z)}else{const q=Y.wireframe===!0;(c.geometry!==ie.id||c.program!==ne.id||c.wireframe!==q)&&(c.geometry=ie.id,c.program=ne.id,c.wireframe=q,Z=!0)}z!==null&&t.update(z,n.ELEMENT_ARRAY_BUFFER),(Z||d)&&(d=!1,I(K,Y,ne,ie),z!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(z).buffer))}function p(){return r.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(K){return r.isWebGL2?n.bindVertexArray(K):s.bindVertexArrayOES(K)}function v(K){return r.isWebGL2?n.deleteVertexArray(K):s.deleteVertexArrayOES(K)}function E(K,Y,ne){const ie=ne.wireframe===!0;let z=a[K.id];z===void 0&&(z={},a[K.id]=z);let Z=z[Y.id];Z===void 0&&(Z={},z[Y.id]=Z);let q=Z[ie];return q===void 0&&(q=x(p()),Z[ie]=q),q}function x(K){const Y=[],ne=[],ie=[];for(let z=0;z=0){const pe=z[ee];let Le=Z[ee];if(Le===void 0&&(ee==="instanceMatrix"&&K.instanceMatrix&&(Le=K.instanceMatrix),ee==="instanceColor"&&K.instanceColor&&(Le=K.instanceColor)),pe===void 0||pe.attribute!==Le||Le&&pe.data!==Le.data)return!0;q++}return c.attributesNum!==q||c.index!==ie}function A(K,Y,ne,ie){const z={},Z=Y.attributes;let q=0;const ae=ne.getAttributes();for(const ee in ae)if(ae[ee].location>=0){let pe=Z[ee];pe===void 0&&(ee==="instanceMatrix"&&K.instanceMatrix&&(pe=K.instanceMatrix),ee==="instanceColor"&&K.instanceColor&&(pe=K.instanceColor));const Le={};Le.attribute=pe,pe&&pe.data&&(Le.data=pe.data),z[ee]=Le,q++}c.attributes=z,c.attributesNum=q,c.index=ie}function _(){const K=c.newAttributes;for(let Y=0,ne=K.length;Y=0){let ve=z[ae];if(ve===void 0&&(ae==="instanceMatrix"&&K.instanceMatrix&&(ve=K.instanceMatrix),ae==="instanceColor"&&K.instanceColor&&(ve=K.instanceColor)),ve!==void 0){const pe=ve.normalized,Le=ve.itemSize,we=t.get(ve);if(we===void 0)continue;const Fe=we.buffer,et=we.type,ut=we.bytesPerElement,Rt=r.isWebGL2===!0&&(et===n.INT||et===n.UNSIGNED_INT||ve.gpuType===QE);if(ve.isInterleavedBufferAttribute){const rt=ve.data,J=rt.stride,Re=ve.offset;if(rt.isInstancedInterleavedBuffer){for(let Se=0;Se0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";B="mediump"}return B==="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 c=o||e.has("WEBGL_draw_buffers"),d=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),v=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),E=n.getParameter(n.MAX_VERTEX_ATTRIBS),x=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),g=n.getParameter(n.MAX_VARYING_VECTORS),A=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),_=p>0,w=o||e.has("OES_texture_float"),C=_&&w,b=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:d,maxTextures:h,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:v,maxAttributes:E,maxVertexUniforms:x,maxVaryings:g,maxFragmentUniforms:A,vertexTextures:_,floatFragmentTextures:w,floatVertexTextures:C,maxSamples:b}}function bH(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new ra,a=new Ot,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,p){const m=h.length!==0||p||r!==0||i;return i=p,r=h.length,m},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,p){t=d(h,p,0)},this.setState=function(h,p,m){const v=h.clippingPlanes,E=h.clipIntersection,x=h.clipShadows,g=n.get(h);if(!i||v===null||v.length===0||s&&!x)s?d(null):c();else{const A=s?0:r,_=A*4;let w=g.clippingState||null;l.value=w,w=d(v,p,_,m);for(let C=0;C!==_;++C)w[C]=t[C];g.clippingState=w,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=A}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(h,p,m,v){const E=h!==null?h.length:0;let x=null;if(E!==0){if(x=l.value,v!==!0||x===null){const g=m+E*4,A=p.matrixWorldInverse;a.getNormalMatrix(A),(x===null||x.length0){const c=new hA(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class xo extends hh{constructor(e=-1,t=1,r=1,i=-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=r,this.bottom=i,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,r,i,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=r,this.view.offsetY=i,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),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*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 tu=4,ST=[.125,.215,.35,.446,.526,.582],fl=20,$y=new xo,wT=new Xe;let Xy=null;const ll=(1+Math.sqrt(5))/2,bc=1/ll,MT=[new G(1,1,1),new G(-1,1,1),new G(1,1,-1),new G(-1,1,-1),new G(0,ll,bc),new G(0,ll,-bc),new G(bc,0,ll),new G(-bc,0,ll),new G(ll,bc,0),new G(-ll,bc,0)];class a1{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,r=.1,i=100){Xy=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,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=CT(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=bT(),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?_:0,_,_),d.setRenderTarget(i),E&&d.render(v,a),d.render(e,a)}v.geometry.dispose(),v.material.dispose(),d.toneMapping=p,d.autoClear=h,e.background=x}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Po||e.mapping===Ma;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=CT()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=bT());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Qn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;hm(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,$y)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;ifl&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${fl}`);const g=[];let A=0;for(let B=0;B_-tu?i-_+tu:0),b=4*(this._cubeSize-w);hm(t,C,b,3*w,2*w),l.setRenderTarget(t),l.render(h,$y)}}function RH(n){const e=[],t=[],r=[];let i=n;const s=n-tu+1+ST.length;for(let o=0;on-tu?l=ST[o-n+tu-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),d=-c,h=1+c,p=[d,d,h,d,h,h,d,d,h,h,d,h],m=6,v=6,E=3,x=2,g=1,A=new Float32Array(E*v*m),_=new Float32Array(x*v*m),w=new Float32Array(g*v*m);for(let b=0;b2?0:-1,R=[B,I,0,B+2/3,I,0,B+2/3,I+1,0,B,I,0,B+2/3,I+1,0,B,I+1,0];A.set(R,E*v*b),_.set(p,x*v*b);const L=[b,b,b,b,b,b];w.set(L,g*v*b)}const C=new It;C.setAttribute("position",new Kt(A,E)),C.setAttribute("uv",new Kt(_,x)),C.setAttribute("faceIndex",new Kt(w,g)),e.push(C),i>tu&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function TT(n,e,t){const r=new fs(n,e,t);return r.texture.mapping=zu,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function hm(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function PH(n,e,t){const r=new Float32Array(fl),i=new G(0,1,0);return new ds({name:"SphericalGaussianBlur",defines:{n:fl,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:pA(),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:_o,depthTest:!1,depthWrite:!1})}function bT(){return new ds({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:pA(),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:_o,depthTest:!1,depthWrite:!1})}function CT(){return new ds({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:pA(),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:_o,depthTest:!1,depthWrite:!1})}function pA(){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 IH(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===wu||l===Nd,d=l===Po||l===Ma;if(c||d)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new a1(n)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||d&&h&&i(h)){t===null&&(t=new a1(n));const p=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,p),a.addEventListener("dispose",s),p.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(L=Math.ceil(R/e.maxTextureSize),R=e.maxTextureSize);const U=new Float32Array(R*L*4*v),j=new P0(U,R,L,v);j.type=Sr,j.needsUpdate=!0;const $=I*4;for(let Y=0;Y0)return n;const i=e*t;let s=RT[i];if(s===void 0&&(s=new Float32Array(i),RT[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Zn(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` -`)}function B4(n){switch(n){case us:return["Linear","( value )"];case Pt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),["Linear","( value )"]}}function FT(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` - -`+i+` - -`+I4(n.getShaderSource(e),o)}else return i}function L4(n,e){const t=B4(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function D4(n,e){let t;switch(e){case cI:t="Linear";break;case uI:t="Reinhard";break;case fI:t="OptimizedCineon";break;case YE:t="ACESFilmic";break;case dI:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function O4(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(qf).join(` -`)}function F4(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` -`)}function N4(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function l1(n){return n.replace(U4,k4)}function k4(n,e){const t=Dt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return l1(t)}const z4=/#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 kT(n){return n.replace(z4,H4)}function H4(n,e,t,r){let i="";for(let s=parseInt(e);s0&&(x+=` -`),g=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(qf).join(` -`),g.length>0&&(g+=` -`)):(x=[zT(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 "+d:"",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.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?"#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(qf).join(` -`),g=[m,zT(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 "+c:"",t.envMap?"#define "+d:"",t.envMap?"#define "+h:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.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.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?"#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!==as?"#define TONE_MAPPING":"",t.toneMapping!==as?Dt.tonemapping_pars_fragment:"",t.toneMapping!==as?D4("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Dt.encodings_pars_fragment,L4("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(qf).join(` -`)),o=l1(o),o=NT(o,t),o=UT(o,t),a=l1(a),a=NT(a,t),a=UT(a,t),o=kT(o),a=kT(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(A=`#version 300 es -`,x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` -`)+` -`+x,g=["#define varying in",t.glslVersion===s1?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===s1?"":"#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 _=A+x+o,w=A+g+a,C=OT(i,i.VERTEX_SHADER,_),b=OT(i,i.FRAGMENT_SHADER,w);if(i.attachShader(E,C),i.attachShader(E,b),t.index0AttributeName!==void 0?i.bindAttribLocation(E,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(E,0,"position"),i.linkProgram(E),n.debug.checkShaderErrors){const R=i.getProgramInfoLog(E).trim(),L=i.getShaderInfoLog(C).trim(),U=i.getShaderInfoLog(b).trim();let j=!0,$=!0;if(i.getProgramParameter(E,i.LINK_STATUS)===!1)if(j=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,E,C,b);else{const K=FT(i,C,"vertex"),Y=FT(i,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(E,i.VALIDATE_STATUS)+` - -Program Info Log: `+R+` -`+K+` -`+Y)}else R!==""?console.warn("THREE.WebGLProgram: Program Info Log:",R):(L===""||U==="")&&($=!1);$&&(this.diagnostics={runnable:j,programLog:R,vertexShader:{log:L,prefix:x},fragmentShader:{log:U,prefix:g}})}i.deleteShader(C),i.deleteShader(b);let B;this.getUniforms=function(){return B===void 0&&(B=new hg(i,E)),B};let I;return this.getAttributes=function(){return I===void 0&&(I=N4(i,E)),I},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(E),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=P4++,this.cacheKey=e,this.usedTimes=1,this.program=E,this.vertexShader=C,this.fragmentShader=b,this}let J4=0;class K4{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.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 r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new Y4(e),t.set(e,r)),r}}class Y4{constructor(e){this.id=J4++,this.code=e,this.usedTimes=0}}function Q4(n,e,t,r,i,s,o){const a=new Tl,l=new K4,c=[],d=i.isWebGL2,h=i.logarithmicDepthBuffer,p=i.vertexTextures;let m=i.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 E(R){return R===0?"uv":`uv${R}`}function x(R,L,U,j,$){const K=j.fog,Y=$.geometry,ne=R.isMeshStandardMaterial?j.environment:null,ie=(R.isMeshStandardMaterial?t:e).get(R.envMap||ne),z=ie&&ie.mapping===zu?ie.image.height:null,Z=v[R.type];R.precision!==null&&(m=i.getMaxPrecision(R.precision),m!==R.precision&&console.warn("THREE.WebGLProgram.getParameters:",R.precision,"not supported, using",m,"instead."));const q=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,ae=q!==void 0?q.length:0;let ee=0;Y.morphAttributes.position!==void 0&&(ee=1),Y.morphAttributes.normal!==void 0&&(ee=2),Y.morphAttributes.color!==void 0&&(ee=3);let ve,pe,Le,we;if(Z){const vn=is[Z];ve=vn.vertexShader,pe=vn.fragmentShader}else ve=R.vertexShader,pe=R.fragmentShader,l.update(R),Le=l.getVertexShaderID(R),we=l.getFragmentShaderID(R);const Fe=n.getRenderTarget(),et=$.isInstancedMesh===!0,ut=!!R.map,Rt=!!R.matcap,rt=!!ie,J=!!R.aoMap,Re=!!R.lightMap,Se=!!R.bumpMap,De=!!R.normalMap,be=!!R.displacementMap,tt=!!R.emissiveMap,We=!!R.metalnessMap,je=!!R.roughnessMap,at=R.anisotropy>0,St=R.clearcoat>0,Qt=R.iridescence>0,k=R.sheen>0,N=R.transmission>0,de=at&&!!R.anisotropyMap,Pe=St&&!!R.clearcoatMap,Ie=St&&!!R.clearcoatNormalMap,ke=St&&!!R.clearcoatRoughnessMap,Ye=Qt&&!!R.iridescenceMap,He=Qt&&!!R.iridescenceThicknessMap,ye=k&&!!R.sheenColorMap,te=k&&!!R.sheenRoughnessMap,me=!!R.specularMap,Ce=!!R.specularColorMap,Be=!!R.specularIntensityMap,Ne=N&&!!R.transmissionMap,nt=N&&!!R.thicknessMap,mt=!!R.gradientMap,re=!!R.alphaMap,ue=R.alphaTest>0,le=!!R.extensions,Ge=!!Y.attributes.uv1,Je=!!Y.attributes.uv2,Ut=!!Y.attributes.uv3;return{isWebGL2:d,shaderID:Z,shaderType:R.type,shaderName:R.name,vertexShader:ve,fragmentShader:pe,defines:R.defines,customVertexShaderID:Le,customFragmentShaderID:we,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:m,instancing:et,instancingColor:et&&$.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:Fe===null?n.outputColorSpace:Fe.isXRRenderTarget===!0?Fe.texture.colorSpace:us,map:ut,matcap:Rt,envMap:rt,envMapMode:rt&&ie.mapping,envMapCubeUVHeight:z,aoMap:J,lightMap:Re,bumpMap:Se,normalMap:De,displacementMap:p&&be,emissiveMap:tt,normalMapObjectSpace:De&&R.normalMapType===bI,normalMapTangentSpace:De&&R.normalMapType===Oa,metalnessMap:We,roughnessMap:je,anisotropy:at,anisotropyMap:de,clearcoat:St,clearcoatMap:Pe,clearcoatNormalMap:Ie,clearcoatRoughnessMap:ke,iridescence:Qt,iridescenceMap:Ye,iridescenceThicknessMap:He,sheen:k,sheenColorMap:ye,sheenRoughnessMap:te,specularMap:me,specularColorMap:Ce,specularIntensityMap:Be,transmission:N,transmissionMap:Ne,thicknessMap:nt,gradientMap:mt,opaque:R.transparent===!1&&R.blending===wl,alphaMap:re,alphaTest:ue,combine:R.combine,mapUv:ut&&E(R.map.channel),aoMapUv:J&&E(R.aoMap.channel),lightMapUv:Re&&E(R.lightMap.channel),bumpMapUv:Se&&E(R.bumpMap.channel),normalMapUv:De&&E(R.normalMap.channel),displacementMapUv:be&&E(R.displacementMap.channel),emissiveMapUv:tt&&E(R.emissiveMap.channel),metalnessMapUv:We&&E(R.metalnessMap.channel),roughnessMapUv:je&&E(R.roughnessMap.channel),anisotropyMapUv:de&&E(R.anisotropyMap.channel),clearcoatMapUv:Pe&&E(R.clearcoatMap.channel),clearcoatNormalMapUv:Ie&&E(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ke&&E(R.clearcoatRoughnessMap.channel),iridescenceMapUv:Ye&&E(R.iridescenceMap.channel),iridescenceThicknessMapUv:He&&E(R.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&E(R.sheenColorMap.channel),sheenRoughnessMapUv:te&&E(R.sheenRoughnessMap.channel),specularMapUv:me&&E(R.specularMap.channel),specularColorMapUv:Ce&&E(R.specularColorMap.channel),specularIntensityMapUv:Be&&E(R.specularIntensityMap.channel),transmissionMapUv:Ne&&E(R.transmissionMap.channel),thicknessMapUv:nt&&E(R.thicknessMap.channel),alphaMapUv:re&&E(R.alphaMap.channel),vertexTangents:!!Y.attributes.tangent&&(De||at),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,vertexUv1s:Ge,vertexUv2s:Je,vertexUv3s:Ut,pointsUvs:$.isPoints===!0&&!!Y.attributes.uv&&(ut||re),fog:!!K,useFog:R.fog===!0,fogExp2:K&&K.isFogExp2,flatShading:R.flatShading===!0,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:$.isSkinnedMesh===!0,morphTargets:Y.morphAttributes.position!==void 0,morphNormals:Y.morphAttributes.normal!==void 0,morphColors:Y.morphAttributes.color!==void 0,morphTargetsCount:ae,morphTextureStride:ee,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:R.dithering,shadowMapEnabled:n.shadowMap.enabled&&U.length>0,shadowMapType:n.shadowMap.type,toneMapping:R.toneMapped?n.toneMapping:as,useLegacyLights:n.useLegacyLights,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===Ui,flipSided:R.side===Gr,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionDerivatives:le&&R.extensions.derivatives===!0,extensionFragDepth:le&&R.extensions.fragDepth===!0,extensionDrawBuffers:le&&R.extensions.drawBuffers===!0,extensionShaderTextureLOD:le&&R.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:d||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||r.has("EXT_shader_texture_lod"),customProgramCacheKey:R.customProgramCacheKey()}}function g(R){const L=[];if(R.shaderID?L.push(R.shaderID):(L.push(R.customVertexShaderID),L.push(R.customFragmentShaderID)),R.defines!==void 0)for(const U in R.defines)L.push(U),L.push(R.defines[U]);return R.isRawShaderMaterial===!1&&(A(L,R),_(L,R),L.push(n.outputColorSpace)),L.push(R.customProgramCacheKey),L.join()}function A(R,L){R.push(L.precision),R.push(L.outputColorSpace),R.push(L.envMapMode),R.push(L.envMapCubeUVHeight),R.push(L.mapUv),R.push(L.alphaMapUv),R.push(L.lightMapUv),R.push(L.aoMapUv),R.push(L.bumpMapUv),R.push(L.normalMapUv),R.push(L.displacementMapUv),R.push(L.emissiveMapUv),R.push(L.metalnessMapUv),R.push(L.roughnessMapUv),R.push(L.anisotropyMapUv),R.push(L.clearcoatMapUv),R.push(L.clearcoatNormalMapUv),R.push(L.clearcoatRoughnessMapUv),R.push(L.iridescenceMapUv),R.push(L.iridescenceThicknessMapUv),R.push(L.sheenColorMapUv),R.push(L.sheenRoughnessMapUv),R.push(L.specularMapUv),R.push(L.specularColorMapUv),R.push(L.specularIntensityMapUv),R.push(L.transmissionMapUv),R.push(L.thicknessMapUv),R.push(L.combine),R.push(L.fogExp2),R.push(L.sizeAttenuation),R.push(L.morphTargetsCount),R.push(L.morphAttributeCount),R.push(L.numDirLights),R.push(L.numPointLights),R.push(L.numSpotLights),R.push(L.numSpotLightMaps),R.push(L.numHemiLights),R.push(L.numRectAreaLights),R.push(L.numDirLightShadows),R.push(L.numPointLightShadows),R.push(L.numSpotLightShadows),R.push(L.numSpotLightShadowsWithMaps),R.push(L.shadowMapType),R.push(L.toneMapping),R.push(L.numClippingPlanes),R.push(L.numClipIntersection),R.push(L.depthPacking)}function _(R,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),R.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),R.push(a.mask)}function w(R){const L=v[R.type];let U;if(L){const j=is[L];U=HI.clone(j.uniforms)}else U=R.uniforms;return U}function C(R,L){let U;for(let j=0,$=c.length;j<$;j++){const K=c[j];if(K.cacheKey===L){U=K,++U.usedTimes;break}}return U===void 0&&(U=new j4(n,L,R,s),c.push(U)),U}function b(R){if(--R.usedTimes===0){const L=c.indexOf(R);c[L]=c[c.length-1],c.pop(),R.destroy()}}function B(R){l.remove(R)}function I(){l.dispose()}return{getParameters:x,getProgramCacheKey:g,getUniforms:w,acquireProgram:C,releaseProgram:b,releaseShaderCache:B,programs:c,dispose:I}}function Z4(){let n=new WeakMap;function e(s){let o=n.get(s);return o===void 0&&(o={},n.set(s,o)),o}function t(s){n.delete(s)}function r(s,o,a){n.get(s)[o]=a}function i(){n=new WeakMap}return{get:e,remove:t,update:r,dispose:i}}function q4(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function HT(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function GT(){const n=[];let e=0;const t=[],r=[],i=[];function s(){e=0,t.length=0,r.length=0,i.length=0}function o(h,p,m,v,E,x){let g=n[e];return g===void 0?(g={id:h.id,object:h,geometry:p,material:m,groupOrder:v,renderOrder:h.renderOrder,z:E,group:x},n[e]=g):(g.id=h.id,g.object=h,g.geometry=p,g.material=m,g.groupOrder=v,g.renderOrder=h.renderOrder,g.z=E,g.group=x),e++,g}function a(h,p,m,v,E,x){const g=o(h,p,m,v,E,x);m.transmission>0?r.push(g):m.transparent===!0?i.push(g):t.push(g)}function l(h,p,m,v,E,x){const g=o(h,p,m,v,E,x);m.transmission>0?r.unshift(g):m.transparent===!0?i.unshift(g):t.unshift(g)}function c(h,p){t.length>1&&t.sort(h||q4),r.length>1&&r.sort(p||HT),i.length>1&&i.sort(p||HT)}function d(){for(let h=e,p=n.length;h=s.length?(o=new GT,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function tG(){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 G,color:new Xe};break;case"SpotLight":t={position:new G,direction:new G,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new G,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new G,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new G,halfWidth:new G,halfHeight:new G};break}return n[e.id]=t,t}}}function nG(){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 Me};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Me};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Me,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let rG=0;function iG(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function sG(n,e){const t=new tG,r=nG(),i={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 d=0;d<9;d++)i.probe.push(new G);const s=new G,o=new Et,a=new Et;function l(d,h){let p=0,m=0,v=0;for(let U=0;U<9;U++)i.probe[U].set(0,0,0);let E=0,x=0,g=0,A=0,_=0,w=0,C=0,b=0,B=0,I=0;d.sort(iG);const R=h===!0?Math.PI:1;for(let U=0,j=d.length;U0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=$e.LTC_FLOAT_1,i.rectAreaLTC2=$e.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=$e.LTC_HALF_1,i.rectAreaLTC2=$e.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=p,i.ambient[1]=m,i.ambient[2]=v;const L=i.hash;(L.directionalLength!==E||L.pointLength!==x||L.spotLength!==g||L.rectAreaLength!==A||L.hemiLength!==_||L.numDirectionalShadows!==w||L.numPointShadows!==C||L.numSpotShadows!==b||L.numSpotMaps!==B)&&(i.directional.length=E,i.spot.length=g,i.rectArea.length=A,i.point.length=x,i.hemi.length=_,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.pointShadow.length=C,i.pointShadowMap.length=C,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=w,i.pointShadowMatrix.length=C,i.spotLightMatrix.length=b+B-I,i.spotLightMap.length=B,i.numSpotLightShadowsWithMaps=I,L.directionalLength=E,L.pointLength=x,L.spotLength=g,L.rectAreaLength=A,L.hemiLength=_,L.numDirectionalShadows=w,L.numPointShadows=C,L.numSpotShadows=b,L.numSpotMaps=B,i.version=rG++)}function c(d,h){let p=0,m=0,v=0,E=0,x=0;const g=h.matrixWorldInverse;for(let A=0,_=d.length;A<_;A++){const w=d[A];if(w.isDirectionalLight){const C=i.directional[p];C.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(g),p++}else if(w.isSpotLight){const C=i.spot[v];C.position.setFromMatrixPosition(w.matrixWorld),C.position.applyMatrix4(g),C.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(g),v++}else if(w.isRectAreaLight){const C=i.rectArea[E];C.position.setFromMatrixPosition(w.matrixWorld),C.position.applyMatrix4(g),a.identity(),o.copy(w.matrixWorld),o.premultiply(g),a.extractRotation(o),C.halfWidth.set(w.width*.5,0,0),C.halfHeight.set(0,w.height*.5,0),C.halfWidth.applyMatrix4(a),C.halfHeight.applyMatrix4(a),E++}else if(w.isPointLight){const C=i.point[m];C.position.setFromMatrixPosition(w.matrixWorld),C.position.applyMatrix4(g),m++}else if(w.isHemisphereLight){const C=i.hemi[x];C.direction.setFromMatrixPosition(w.matrixWorld),C.direction.transformDirection(g),x++}}}return{setup:l,setupView:c,state:i}}function VT(n,e){const t=new sG(n,e),r=[],i=[];function s(){r.length=0,i.length=0}function o(h){r.push(h)}function a(h){i.push(h)}function l(h){t.setup(r,h)}function c(h){t.setupView(r,h)}return{init:s,state:{lightsArray:r,shadowsArray:i,lights:t},setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function oG(n,e){let t=new WeakMap;function r(s,o=0){const a=t.get(s);let l;return a===void 0?(l=new VT(n,e),t.set(s,[l])):o>=a.length?(l=new VT(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class mA extends Xn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=MI,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 gA extends Xn{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 aG=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,lG=`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 cG(n,e,t){let r=new I0;const i=new Me,s=new Me,o=new en,a=new mA({depthPacking:TI}),l=new gA,c={},d=t.maxTextureSize,h={[zs]:Gr,[Gr]:zs,[Ui]:Ui},p=new ds({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Me},radius:{value:4}},vertexShader:aG,fragmentShader:lG}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const v=new It;v.setAttribute("position",new Kt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const E=new Qn(v,p),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=M0;let g=this.type;this.render=function(C,b,B){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||C.length===0)return;const I=n.getRenderTarget(),R=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),U=n.state;U.setBlending(_o),U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const j=g!==ts&&this.type===ts,$=g===ts&&this.type!==ts;for(let K=0,Y=C.length;Kd||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/z.x),i.x=s.x*z.x,ie.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/z.y),i.y=s.y*z.y,ie.mapSize.y=s.y)),ie.map===null||j===!0||$===!0){const q=this.type!==ts?{minFilter:Dn,magFilter:Dn}:{};ie.map!==null&&ie.map.dispose(),ie.map=new fs(i.x,i.y,q),ie.map.texture.name=ne.name+".shadowMap",ie.camera.updateProjectionMatrix()}n.setRenderTarget(ie.map),n.clear();const Z=ie.getViewportCount();for(let q=0;q0||b.map&&b.alphaTest>0){const U=R.uuid,j=b.uuid;let $=c[U];$===void 0&&($={},c[U]=$);let K=$[j];K===void 0&&(K=R.clone(),$[j]=K),R=K}if(R.visible=b.visible,R.wireframe=b.wireframe,I===ts?R.side=b.shadowSide!==null?b.shadowSide:b.side:R.side=b.shadowSide!==null?b.shadowSide:h[b.side],R.alphaMap=b.alphaMap,R.alphaTest=b.alphaTest,R.map=b.map,R.clipShadows=b.clipShadows,R.clippingPlanes=b.clippingPlanes,R.clipIntersection=b.clipIntersection,R.displacementMap=b.displacementMap,R.displacementScale=b.displacementScale,R.displacementBias=b.displacementBias,R.wireframeLinewidth=b.wireframeLinewidth,R.linewidth=b.linewidth,B.isPointLight===!0&&R.isMeshDistanceMaterial===!0){const U=n.properties.get(R);U.light=B}return R}function w(C,b,B,I,R){if(C.visible===!1)return;if(C.layers.test(b.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&R===ts)&&(!C.frustumCulled||r.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,C.matrixWorld);const j=e.update(C),$=C.material;if(Array.isArray($)){const K=j.groups;for(let Y=0,ne=K.length;Y=1):z.indexOf("OpenGL ES")!==-1&&(ie=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),ne=ie>=2);let Z=null,q={};const ae=n.getParameter(n.SCISSOR_BOX),ee=n.getParameter(n.VIEWPORT),ve=new en().fromArray(ae),pe=new en().fromArray(ee);function Le(re,ue,le,Ge){const Je=new Uint8Array(4),Ut=n.createTexture();n.bindTexture(re,Ut),n.texParameteri(re,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(re,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let an=0;an"u"?!1:/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap;let E;const x=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function A(k,N){return g?new OffscreenCanvas(k,N):Gd("canvas")}function _(k,N,de,Pe){let Ie=1;if((k.width>Pe||k.height>Pe)&&(Ie=Pe/Math.max(k.width,k.height)),Ie<1||N===!0)if(typeof HTMLImageElement<"u"&&k instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&k instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&k instanceof ImageBitmap){const ke=N?Wg:Math.floor,Ye=ke(Ie*k.width),He=ke(Ie*k.height);E===void 0&&(E=A(Ye,He));const ye=de?A(Ye,He):E;return ye.width=Ye,ye.height=He,ye.getContext("2d").drawImage(k,0,0,Ye,He),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+k.width+"x"+k.height+") to ("+Ye+"x"+He+")."),ye}else return"data"in k&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+k.width+"x"+k.height+")."),k;return k}function w(k){return o1(k.width)&&o1(k.height)}function C(k){return a?!1:k.wrapS!==ur||k.wrapT!==ur||k.minFilter!==Dn&&k.minFilter!==un}function b(k,N){return k.generateMipmaps&&N&&k.minFilter!==Dn&&k.minFilter!==un}function B(k){n.generateMipmap(k)}function I(k,N,de,Pe,Ie=!1){if(a===!1)return N;if(k!==null){if(n[k]!==void 0)return n[k];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+k+"'")}let ke=N;return N===n.RED&&(de===n.FLOAT&&(ke=n.R32F),de===n.HALF_FLOAT&&(ke=n.R16F),de===n.UNSIGNED_BYTE&&(ke=n.R8)),N===n.RG&&(de===n.FLOAT&&(ke=n.RG32F),de===n.HALF_FLOAT&&(ke=n.RG16F),de===n.UNSIGNED_BYTE&&(ke=n.RG8)),N===n.RGBA&&(de===n.FLOAT&&(ke=n.RGBA32F),de===n.HALF_FLOAT&&(ke=n.RGBA16F),de===n.UNSIGNED_BYTE&&(ke=Pe===Pt&&Ie===!1?n.SRGB8_ALPHA8:n.RGBA8),de===n.UNSIGNED_SHORT_4_4_4_4&&(ke=n.RGBA4),de===n.UNSIGNED_SHORT_5_5_5_1&&(ke=n.RGB5_A1)),(ke===n.R16F||ke===n.R32F||ke===n.RG16F||ke===n.RG32F||ke===n.RGBA16F||ke===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ke}function R(k,N,de){return b(k,de)===!0||k.isFramebufferTexture&&k.minFilter!==Dn&&k.minFilter!==un?Math.log2(Math.max(N.width,N.height))+1:k.mipmaps!==void 0&&k.mipmaps.length>0?k.mipmaps.length:k.isCompressedTexture&&Array.isArray(k.image)?N.mipmaps.length:1}function L(k){return k===Dn||k===Ud||k===uu?n.NEAREST:n.LINEAR}function U(k){const N=k.target;N.removeEventListener("dispose",U),$(N),N.isVideoTexture&&v.delete(N)}function j(k){const N=k.target;N.removeEventListener("dispose",j),Y(N)}function $(k){const N=r.get(k);if(N.__webglInit===void 0)return;const de=k.source,Pe=x.get(de);if(Pe){const Ie=Pe[N.__cacheKey];Ie.usedTimes--,Ie.usedTimes===0&&K(k),Object.keys(Pe).length===0&&x.delete(de)}r.remove(k)}function K(k){const N=r.get(k);n.deleteTexture(N.__webglTexture);const de=k.source,Pe=x.get(de);delete Pe[N.__cacheKey],o.memory.textures--}function Y(k){const N=k.texture,de=r.get(k),Pe=r.get(N);if(Pe.__webglTexture!==void 0&&(n.deleteTexture(Pe.__webglTexture),o.memory.textures--),k.depthTexture&&k.depthTexture.dispose(),k.isWebGLCubeRenderTarget)for(let Ie=0;Ie<6;Ie++)n.deleteFramebuffer(de.__webglFramebuffer[Ie]),de.__webglDepthbuffer&&n.deleteRenderbuffer(de.__webglDepthbuffer[Ie]);else{if(n.deleteFramebuffer(de.__webglFramebuffer),de.__webglDepthbuffer&&n.deleteRenderbuffer(de.__webglDepthbuffer),de.__webglMultisampledFramebuffer&&n.deleteFramebuffer(de.__webglMultisampledFramebuffer),de.__webglColorRenderbuffer)for(let Ie=0;Ie=l&&console.warn("THREE.WebGLTextures: Trying to use "+k+" texture units while this GPU supports only "+l),ne+=1,k}function Z(k){const N=[];return N.push(k.wrapS),N.push(k.wrapT),N.push(k.wrapR||0),N.push(k.magFilter),N.push(k.minFilter),N.push(k.anisotropy),N.push(k.internalFormat),N.push(k.format),N.push(k.type),N.push(k.generateMipmaps),N.push(k.premultiplyAlpha),N.push(k.flipY),N.push(k.unpackAlignment),N.push(k.colorSpace),N.join()}function q(k,N){const de=r.get(k);if(k.isVideoTexture&&St(k),k.isRenderTargetTexture===!1&&k.version>0&&de.__version!==k.version){const Pe=k.image;if(Pe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ut(de,k,N);return}}t.bindTexture(n.TEXTURE_2D,de.__webglTexture,n.TEXTURE0+N)}function ae(k,N){const de=r.get(k);if(k.version>0&&de.__version!==k.version){ut(de,k,N);return}t.bindTexture(n.TEXTURE_2D_ARRAY,de.__webglTexture,n.TEXTURE0+N)}function ee(k,N){const de=r.get(k);if(k.version>0&&de.__version!==k.version){ut(de,k,N);return}t.bindTexture(n.TEXTURE_3D,de.__webglTexture,n.TEXTURE0+N)}function ve(k,N){const de=r.get(k);if(k.version>0&&de.__version!==k.version){Rt(de,k,N);return}t.bindTexture(n.TEXTURE_CUBE_MAP,de.__webglTexture,n.TEXTURE0+N)}const pe={[Ta]:n.REPEAT,[ur]:n.CLAMP_TO_EDGE,[Mu]:n.MIRRORED_REPEAT},Le={[Dn]:n.NEAREST,[Ud]:n.NEAREST_MIPMAP_NEAREST,[uu]:n.NEAREST_MIPMAP_LINEAR,[un]:n.LINEAR,[b0]:n.LINEAR_MIPMAP_NEAREST,[Hs]:n.LINEAR_MIPMAP_LINEAR},we={[RI]:n.NEVER,[FI]:n.ALWAYS,[PI]:n.LESS,[BI]:n.LEQUAL,[II]:n.EQUAL,[OI]:n.GEQUAL,[LI]:n.GREATER,[DI]:n.NOTEQUAL};function Fe(k,N,de){if(de?(n.texParameteri(k,n.TEXTURE_WRAP_S,pe[N.wrapS]),n.texParameteri(k,n.TEXTURE_WRAP_T,pe[N.wrapT]),(k===n.TEXTURE_3D||k===n.TEXTURE_2D_ARRAY)&&n.texParameteri(k,n.TEXTURE_WRAP_R,pe[N.wrapR]),n.texParameteri(k,n.TEXTURE_MAG_FILTER,Le[N.magFilter]),n.texParameteri(k,n.TEXTURE_MIN_FILTER,Le[N.minFilter])):(n.texParameteri(k,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(k,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(k===n.TEXTURE_3D||k===n.TEXTURE_2D_ARRAY)&&n.texParameteri(k,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(N.wrapS!==ur||N.wrapT!==ur)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(k,n.TEXTURE_MAG_FILTER,L(N.magFilter)),n.texParameteri(k,n.TEXTURE_MIN_FILTER,L(N.minFilter)),N.minFilter!==Dn&&N.minFilter!==un&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),N.compareFunction&&(n.texParameteri(k,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(k,n.TEXTURE_COMPARE_FUNC,we[N.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const Pe=e.get("EXT_texture_filter_anisotropic");if(N.magFilter===Dn||N.minFilter!==uu&&N.minFilter!==Hs||N.type===Sr&&e.has("OES_texture_float_linear")===!1||a===!1&&N.type===kr&&e.has("OES_texture_half_float_linear")===!1)return;(N.anisotropy>1||r.get(N).__currentAnisotropy)&&(n.texParameterf(k,Pe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,i.getMaxAnisotropy())),r.get(N).__currentAnisotropy=N.anisotropy)}}function et(k,N){let de=!1;k.__webglInit===void 0&&(k.__webglInit=!0,N.addEventListener("dispose",U));const Pe=N.source;let Ie=x.get(Pe);Ie===void 0&&(Ie={},x.set(Pe,Ie));const ke=Z(N);if(ke!==k.__cacheKey){Ie[ke]===void 0&&(Ie[ke]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,de=!0),Ie[ke].usedTimes++;const Ye=Ie[k.__cacheKey];Ye!==void 0&&(Ie[k.__cacheKey].usedTimes--,Ye.usedTimes===0&&K(N)),k.__cacheKey=ke,k.__webglTexture=Ie[ke].texture}return de}function ut(k,N,de){let Pe=n.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(Pe=n.TEXTURE_2D_ARRAY),N.isData3DTexture&&(Pe=n.TEXTURE_3D);const Ie=et(k,N),ke=N.source;t.bindTexture(Pe,k.__webglTexture,n.TEXTURE0+de);const Ye=r.get(ke);if(ke.version!==Ye.__version||Ie===!0){t.activeTexture(n.TEXTURE0+de),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,N.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,N.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const He=C(N)&&w(N.image)===!1;let ye=_(N.image,He,!1,d);ye=Qt(N,ye);const te=w(ye)||a,me=s.convert(N.format,N.colorSpace);let Ce=s.convert(N.type),Be=I(N.internalFormat,me,Ce,N.colorSpace);Fe(Pe,N,te);let Ne;const nt=N.mipmaps,mt=a&&N.isVideoTexture!==!0,re=Ye.__version===void 0||Ie===!0,ue=R(N,ye,te);if(N.isDepthTexture)Be=n.DEPTH_COMPONENT,a?N.type===Sr?Be=n.DEPTH_COMPONENT32F:N.type===go?Be=n.DEPTH_COMPONENT24:N.type===_a?Be=n.DEPTH24_STENCIL8:Be=n.DEPTH_COMPONENT16:N.type===Sr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===xa&&Be===n.DEPTH_COMPONENT&&N.type!==C0&&N.type!==go&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=go,Ce=s.convert(N.type)),N.format===Fl&&Be===n.DEPTH_COMPONENT&&(Be=n.DEPTH_STENCIL,N.type!==_a&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=_a,Ce=s.convert(N.type))),re&&(mt?t.texStorage2D(n.TEXTURE_2D,1,Be,ye.width,ye.height):t.texImage2D(n.TEXTURE_2D,0,Be,ye.width,ye.height,0,me,Ce,null));else if(N.isDataTexture)if(nt.length>0&&te){mt&&re&&t.texStorage2D(n.TEXTURE_2D,ue,Be,nt[0].width,nt[0].height);for(let le=0,Ge=nt.length;le>=1,Ge>>=1}}else if(nt.length>0&&te){mt&&re&&t.texStorage2D(n.TEXTURE_2D,ue,Be,nt[0].width,nt[0].height);for(let le=0,Ge=nt.length;le0&&re++,t.texStorage2D(n.TEXTURE_CUBE_MAP,re,Ne,ye[0].width,ye[0].height));for(let le=0;le<6;le++)if(He){nt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+le,0,0,0,ye[le].width,ye[le].height,Ce,Be,ye[le].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+le,0,Ne,ye[le].width,ye[le].height,0,Ce,Be,ye[le].data);for(let Ge=0;Ge=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Ie<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Pe,Ie,r.get(de).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function J(k,N,de){if(n.bindRenderbuffer(n.RENDERBUFFER,k),N.depthBuffer&&!N.stencilBuffer){let Pe=n.DEPTH_COMPONENT16;if(de||at(N)){const Ie=N.depthTexture;Ie&&Ie.isDepthTexture&&(Ie.type===Sr?Pe=n.DEPTH_COMPONENT32F:Ie.type===go&&(Pe=n.DEPTH_COMPONENT24));const ke=je(N);at(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ke,Pe,N.width,N.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,ke,Pe,N.width,N.height)}else n.renderbufferStorage(n.RENDERBUFFER,Pe,N.width,N.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,k)}else if(N.depthBuffer&&N.stencilBuffer){const Pe=je(N);de&&at(N)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Pe,n.DEPTH24_STENCIL8,N.width,N.height):at(N)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Pe,n.DEPTH24_STENCIL8,N.width,N.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,N.width,N.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,k)}else{const Pe=N.isWebGLMultipleRenderTargets===!0?N.texture:[N.texture];for(let Ie=0;Ie0&&at(k)===!1){const He=ke?N:[N];de.__webglMultisampledFramebuffer=n.createFramebuffer(),de.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,de.__webglMultisampledFramebuffer);for(let ye=0;ye0&&at(k)===!1){const N=k.isWebGLMultipleRenderTargets?k.texture:[k.texture],de=k.width,Pe=k.height;let Ie=n.COLOR_BUFFER_BIT;const ke=[],Ye=k.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,He=r.get(k),ye=k.isWebGLMultipleRenderTargets===!0;if(ye)for(let te=0;te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function St(k){const N=o.render.frame;v.get(k)!==N&&(v.set(k,N),k.update())}function Qt(k,N){const de=k.colorSpace,Pe=k.format,Ie=k.type;return k.isCompressedTexture===!0||k.format===Vg||de!==us&&de!==Aa&&(de===Pt?a===!1?e.has("EXT_sRGB")===!0&&Pe===Ur?(k.format=Vg,k.minFilter=un,k.generateMipmaps=!1):N=cA.sRGBToLinear(N):(Pe!==Ur||Ie!==Ns)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",de)),N}this.allocateTextureUnit=z,this.resetTextureUnits=ie,this.setTexture2D=q,this.setTexture2DArray=ae,this.setTexture3D=ee,this.setTextureCube=ve,this.rebindTextures=De,this.setupRenderTarget=be,this.updateRenderTargetMipmap=tt,this.updateMultisampleRenderTarget=We,this.setupDepthRenderbuffer=Se,this.setupFrameBufferTexture=rt,this.useMultisampledRTT=at}function JI(n,e,t){const r=t.isWebGL2;function i(s,o=Aa){let a;if(s===Ns)return n.UNSIGNED_BYTE;if(s===ZE)return n.UNSIGNED_SHORT_4_4_4_4;if(s===qE)return n.UNSIGNED_SHORT_5_5_5_1;if(s===hI)return n.BYTE;if(s===pI)return n.SHORT;if(s===C0)return n.UNSIGNED_SHORT;if(s===QE)return n.INT;if(s===go)return n.UNSIGNED_INT;if(s===Sr)return n.FLOAT;if(s===kr)return r?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===mI)return n.ALPHA;if(s===Ur)return n.RGBA;if(s===gI)return n.LUMINANCE;if(s===vI)return n.LUMINANCE_ALPHA;if(s===xa)return n.DEPTH_COMPONENT;if(s===Fl)return n.DEPTH_STENCIL;if(s===Vg)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===eA)return n.RED;if(s===tA)return n.RED_INTEGER;if(s===yI)return n.RG;if(s===nA)return n.RG_INTEGER;if(s===rA)return n.RGBA_INTEGER;if(s===og||s===ag||s===lg||s===cg)if(o===Pt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===og)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===ag)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===lg)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===cg)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===og)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===ag)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===lg)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===cg)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Fx||s===Nx||s===Ux||s===kx)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Fx)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Nx)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Ux)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===kx)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===_I)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===zx||s===Hx)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===zx)return o===Pt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Hx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Gx||s===Vx||s===Wx||s===$x||s===Xx||s===jx||s===Jx||s===Kx||s===Yx||s===Qx||s===Zx||s===qx||s===e1||s===t1)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Gx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Vx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Wx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===$x)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Xx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===jx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Jx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Kx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Yx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Qx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Zx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===qx)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===e1)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===t1)return o===Pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===ug)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===ug)return o===Pt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===xI||s===n1||s===r1||s===i1)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===ug)return a.COMPRESSED_RED_RGTC1_EXT;if(s===n1)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===r1)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===i1)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===_a?r?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:i}}class KI extends Fn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class vo extends Vt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const dG={type:"move"};class Jy{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new vo,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 vo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new G,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new G),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new vo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new G,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new G),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 r of e.hand.values())this._getHandJoint(t,r)}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,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const E of e.hand.values()){const x=t.getJointPose(E,r),g=this._getHandJoint(c,E);x!==null&&(g.matrix.fromArray(x.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=x.radius),g.visible=x!==null}const d=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],p=d.position.distanceTo(h.position),m=.02,v=.005;c.inputState.pinching&&p>m+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),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&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(dG)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new vo;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class YI extends gn{constructor(e,t,r,i,s,o,a,l,c,d){if(d=d!==void 0?d:xa,d!==xa&&d!==Fl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&d===xa&&(r=go),r===void 0&&d===Fl&&(r=_a),super(null,i,s,o,a,l,d,r,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Dn,this.minFilter=l!==void 0?l:Dn,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 hG extends Ws{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,h=null,p=null,m=null,v=null;const E=t.getContextAttributes();let x=null,g=null;const A=[],_=[];let w=null;const C=new Fn;C.layers.enable(1),C.viewport=new en;const b=new Fn;b.layers.enable(2),b.viewport=new en;const B=[C,b],I=new KI;I.layers.enable(1),I.layers.enable(2);let R=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getCamera=function(){},this.setUserCamera=function(ee){w=ee},this.getController=function(ee){let ve=A[ee];return ve===void 0&&(ve=new Jy,A[ee]=ve),ve.getTargetRaySpace()},this.getControllerGrip=function(ee){let ve=A[ee];return ve===void 0&&(ve=new Jy,A[ee]=ve),ve.getGripSpace()},this.getHand=function(ee){let ve=A[ee];return ve===void 0&&(ve=new Jy,A[ee]=ve),ve.getHandSpace()};function U(ee){const ve=_.indexOf(ee.inputSource);if(ve===-1)return;const pe=A[ve];pe!==void 0&&(pe.update(ee.inputSource,ee.frame,c||o),pe.dispatchEvent({type:ee.type,data:ee.inputSource}))}function j(){i.removeEventListener("select",U),i.removeEventListener("selectstart",U),i.removeEventListener("selectend",U),i.removeEventListener("squeeze",U),i.removeEventListener("squeezestart",U),i.removeEventListener("squeezeend",U),i.removeEventListener("end",j),i.removeEventListener("inputsourceschange",$);for(let ee=0;ee=0&&(_[Le]=null,A[Le].disconnect(pe))}for(let ve=0;ve=_.length){_.push(pe),Le=Fe;break}else if(_[Fe]===null){_[Fe]=pe,Le=Fe;break}if(Le===-1)break}const we=A[Le];we&&we.connect(pe)}}const K=new G,Y=new G;function ne(ee,ve,pe){K.setFromMatrixPosition(ve.matrixWorld),Y.setFromMatrixPosition(pe.matrixWorld);const Le=K.distanceTo(Y),we=ve.projectionMatrix.elements,Fe=pe.projectionMatrix.elements,et=we[14]/(we[10]-1),ut=we[14]/(we[10]+1),Rt=(we[9]+1)/we[5],rt=(we[9]-1)/we[5],J=(we[8]-1)/we[0],Re=(Fe[8]+1)/Fe[0],Se=et*J,De=et*Re,be=Le/(-J+Re),tt=be*-J;ve.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(tt),ee.translateZ(be),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert();const We=et+be,je=ut+be,at=Se-tt,St=De+(Le-tt),Qt=Rt*ut/je*We,k=rt*ut/je*We;ee.projectionMatrix.makePerspective(at,St,Qt,k,We,je),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}function ie(ee,ve){ve===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(ve.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCameraXR=function(ee){if(i===null)return ee;w&&(ee=w),I.near=b.near=C.near=ee.near,I.far=b.far=C.far=ee.far,(R!==I.near||L!==I.far)&&(i.updateRenderState({depthNear:I.near,depthFar:I.far}),R=I.near,L=I.far);const ve=ee.parent,pe=I.cameras;ie(I,ve);for(let Le=0;Le0&&(x.alphaTest.value=g.alphaTest);const A=e.get(g).envMap;if(A&&(x.envMap.value=A,x.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=g.reflectivity,x.ior.value=g.ior,x.refractionRatio.value=g.refractionRatio),g.lightMap){x.lightMap.value=g.lightMap;const _=n.useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=g.lightMapIntensity*_,t(g.lightMap,x.lightMapTransform)}g.aoMap&&(x.aoMap.value=g.aoMap,x.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,x.aoMapTransform))}function o(x,g){x.diffuse.value.copy(g.color),x.opacity.value=g.opacity,g.map&&(x.map.value=g.map,t(g.map,x.mapTransform))}function a(x,g){x.dashSize.value=g.dashSize,x.totalSize.value=g.dashSize+g.gapSize,x.scale.value=g.scale}function l(x,g,A,_){x.diffuse.value.copy(g.color),x.opacity.value=g.opacity,x.size.value=g.size*A,x.scale.value=_*.5,g.map&&(x.map.value=g.map,t(g.map,x.uvTransform)),g.alphaMap&&(x.alphaMap.value=g.alphaMap,t(g.alphaMap,x.alphaMapTransform)),g.alphaTest>0&&(x.alphaTest.value=g.alphaTest)}function c(x,g){x.diffuse.value.copy(g.color),x.opacity.value=g.opacity,x.rotation.value=g.rotation,g.map&&(x.map.value=g.map,t(g.map,x.mapTransform)),g.alphaMap&&(x.alphaMap.value=g.alphaMap,t(g.alphaMap,x.alphaMapTransform)),g.alphaTest>0&&(x.alphaTest.value=g.alphaTest)}function d(x,g){x.specular.value.copy(g.specular),x.shininess.value=Math.max(g.shininess,1e-4)}function h(x,g){g.gradientMap&&(x.gradientMap.value=g.gradientMap)}function p(x,g){x.metalness.value=g.metalness,g.metalnessMap&&(x.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,x.metalnessMapTransform)),x.roughness.value=g.roughness,g.roughnessMap&&(x.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,x.roughnessMapTransform)),e.get(g).envMap&&(x.envMapIntensity.value=g.envMapIntensity)}function m(x,g,A){x.ior.value=g.ior,g.sheen>0&&(x.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),x.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(x.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,x.sheenColorMapTransform)),g.sheenRoughnessMap&&(x.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,x.sheenRoughnessMapTransform))),g.clearcoat>0&&(x.clearcoat.value=g.clearcoat,x.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(x.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,x.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(x.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Gr&&x.clearcoatNormalScale.value.negate())),g.iridescence>0&&(x.iridescence.value=g.iridescence,x.iridescenceIOR.value=g.iridescenceIOR,x.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(x.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,x.iridescenceMapTransform)),g.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),g.transmission>0&&(x.transmission.value=g.transmission,x.transmissionSamplerMap.value=A.texture,x.transmissionSamplerSize.value.set(A.width,A.height),g.transmissionMap&&(x.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,x.transmissionMapTransform)),x.thickness.value=g.thickness,g.thicknessMap&&(x.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=g.attenuationDistance,x.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(x.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(x.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=g.specularIntensity,x.specularColor.value.copy(g.specularColor),g.specularColorMap&&(x.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,x.specularColorMapTransform)),g.specularIntensityMap&&(x.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,x.specularIntensityMapTransform))}function v(x,g){g.matcap&&(x.matcap.value=g.matcap)}function E(x,g){const A=e.get(g).light;x.referencePosition.value.setFromMatrixPosition(A.matrixWorld),x.nearDistance.value=A.shadow.camera.near,x.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function mG(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(A,_){const w=_.program;r.uniformBlockBinding(A,w)}function c(A,_){let w=i[A.id];w===void 0&&(v(A),w=d(A),i[A.id]=w,A.addEventListener("dispose",x));const C=_.program;r.updateUBOMapping(A,C);const b=e.render.frame;s[A.id]!==b&&(p(A),s[A.id]=b)}function d(A){const _=h();A.__bindingPointIndex=_;const w=n.createBuffer(),C=A.__size,b=A.usage;return n.bindBuffer(n.UNIFORM_BUFFER,w),n.bufferData(n.UNIFORM_BUFFER,C,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,_,w),w}function h(){for(let A=0;A0){b=w%C;const j=C-b;b!==0&&j-L.boundary<0&&(w+=C-b,R.__offset=w)}w+=L.storage}return b=w%C,b>0&&(w+=C-b),A.__size=w,A.__cache={},this}function E(A){const _={boundary:0,storage:0};return typeof A=="number"?(_.boundary=4,_.storage=4):A.isVector2?(_.boundary=8,_.storage=8):A.isVector3||A.isColor?(_.boundary=16,_.storage=12):A.isVector4?(_.boundary=16,_.storage=16):A.isMatrix3?(_.boundary=48,_.storage=48):A.isMatrix4?(_.boundary=64,_.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),_}function x(A){const _=A.target;_.removeEventListener("dispose",x);const w=o.indexOf(_.__bindingPointIndex);o.splice(w,1),n.deleteBuffer(i[_.id]),delete i[_.id],delete s[_.id]}function g(){for(const A in i)n.deleteBuffer(i[A]);o=[],i={},s={}}return{bind:l,update:c,dispose:g}}function gG(){const n=Gd("canvas");return n.style.display="block",n}class vA{constructor(e={}){const{canvas:t=gG(),context:r=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let p;r!==null?p=r.getContextAttributes().alpha:p=o;const m=new Uint32Array(4),v=new Int32Array(4);let E=null,x=null;const g=[],A=[];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=Pt,this.useLegacyLights=!0,this.toneMapping=as,this.toneMappingExposure=1;const _=this;let w=!1,C=0,b=0,B=null,I=-1,R=null;const L=new en,U=new en;let j=null;const $=new Xe(0);let K=0,Y=t.width,ne=t.height,ie=1,z=null,Z=null;const q=new en(0,0,Y,ne),ae=new en(0,0,Y,ne);let ee=!1;const ve=new I0;let pe=!1,Le=!1,we=null;const Fe=new Et,et=new Me,ut=new G,Rt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function rt(){return B===null?ie:1}let J=r;function Re(T,F){for(let V=0;V0?x=A[A.length-1]:x=null,g.pop(),g.length>0?E=g[g.length-1]:E=null};function Yl(T,F,V,H){if(T.visible===!1)return;if(T.layers.test(F.layers)){if(T.isGroup)V=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(F);else if(T.isLight)x.pushLight(T),T.castShadow&&x.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||ve.intersectsSprite(T)){H&&ut.setFromMatrixPosition(T.matrixWorld).applyMatrix4(Fe);const he=N.update(T),Ee=T.material;Ee.visible&&E.push(T,he,Ee,V,ut.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||ve.intersectsObject(T))){T.isSkinnedMesh&&T.skeleton.frame!==tt.render.frame&&(T.skeleton.update(),T.skeleton.frame=tt.render.frame);const he=N.update(T),Ee=T.material;if(H&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),ut.copy(T.boundingSphere.center)):(he.boundingSphere===null&&he.computeBoundingSphere(),ut.copy(he.boundingSphere.center)),ut.applyMatrix4(T.matrixWorld).applyMatrix4(Fe)),Array.isArray(Ee)){const Ae=he.groups;for(let Te=0,_e=Ae.length;Te<_e;Te++){const Ze=Ae[Te],ze=Ee[Ze.materialIndex];ze&&ze.visible&&E.push(T,he,ze,V,ut.z,Ze)}}else Ee.visible&&E.push(T,he,Ee,V,ut.z,null)}}const ce=T.children;for(let he=0,Ee=ce.length;he0&&Xs(X,ce,F,V),H&&be.viewport(L.copy(H)),X.length>0&&xs(X,F,V),ce.length>0&&xs(ce,F,V),he.length>0&&xs(he,F,V),be.buffers.depth.setTest(!0),be.buffers.depth.setMask(!0),be.buffers.color.setMask(!0),be.setPolygonOffset(!1)}function Xs(T,F,V,H){const X=De.isWebGL2;we===null&&(we=new fs(1,1,{generateMipmaps:!0,type:Se.has("EXT_color_buffer_half_float")?kr:Ns,minFilter:Hs,samples:X&&a===!0?4:0})),_.getDrawingBufferSize(et),X?we.setSize(et.x,et.y):we.setSize(Wg(et.x),Wg(et.y));const ce=_.getRenderTarget();_.setRenderTarget(we),_.getClearColor($),K=_.getClearAlpha(),K<1&&_.setClearColor(16777215,.5),_.clear();const he=_.toneMapping;_.toneMapping=as,xs(T,V,H),je.updateMultisampleRenderTarget(we),je.updateRenderTargetMipmap(we);let Ee=!1;for(let Ae=0,Te=F.length;Ae0),Ze=!!V.morphAttributes.position,ze=!!V.morphAttributes.normal,Ve=!!V.morphAttributes.color,ht=H.toneMapped?_.toneMapping:as,gt=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,pt=gt!==void 0?gt.length:0,qe=We.get(H),_t=x.state.lights;if(pe===!0&&(Le===!0||T!==R)){const wt=T===R&&H.id===I;Ye.setState(H,T,wt)}let lt=!1;H.version===qe.__version?(qe.needsLights&&qe.lightsStateVersion!==_t.state.version||qe.outputColorSpace!==Ee||X.isInstancedMesh&&qe.instancing===!1||!X.isInstancedMesh&&qe.instancing===!0||X.isSkinnedMesh&&qe.skinning===!1||!X.isSkinnedMesh&&qe.skinning===!0||qe.envMap!==Ae||H.fog===!0&&qe.fog!==ce||qe.numClippingPlanes!==void 0&&(qe.numClippingPlanes!==Ye.numPlanes||qe.numIntersection!==Ye.numIntersection)||qe.vertexAlphas!==Te||qe.vertexTangents!==_e||qe.morphTargets!==Ze||qe.morphNormals!==ze||qe.morphColors!==Ve||qe.toneMapping!==ht||De.isWebGL2===!0&&qe.morphTargetsCount!==pt)&&(lt=!0):(lt=!0,qe.__version=H.version);let Mt=qe.currentProgram;lt===!0&&(Mt=hr(H,F,X));let Zt=!1,At=!1,qt=!1;const $t=Mt.getUniforms(),nn=qe.uniforms;if(be.useProgram(Mt.program)&&(Zt=!0,At=!0,qt=!0),H.id!==I&&(I=H.id,At=!0),Zt||R!==T){if($t.setValue(J,"projectionMatrix",T.projectionMatrix),De.logarithmicDepthBuffer&&$t.setValue(J,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),R!==T&&(R=T,At=!0,qt=!0),H.isShaderMaterial||H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshStandardMaterial||H.envMap){const wt=$t.map.cameraPosition;wt!==void 0&&wt.setValue(J,ut.setFromMatrixPosition(T.matrixWorld))}(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&$t.setValue(J,"isOrthographic",T.isOrthographicCamera===!0),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial||H.isShadowMaterial||X.isSkinnedMesh)&&$t.setValue(J,"viewMatrix",T.matrixWorldInverse)}if(X.isSkinnedMesh){$t.setOptional(J,X,"bindMatrix"),$t.setOptional(J,X,"bindMatrixInverse");const wt=X.skeleton;wt&&(De.floatVertexTextures?(wt.boneTexture===null&&wt.computeBoneTexture(),$t.setValue(J,"boneTexture",wt.boneTexture,je),$t.setValue(J,"boneTextureSize",wt.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 Un=V.morphAttributes;if((Un.position!==void 0||Un.normal!==void 0||Un.color!==void 0&&De.isWebGL2===!0)&&te.update(X,V,Mt),(At||qe.receiveShadow!==X.receiveShadow)&&(qe.receiveShadow=X.receiveShadow,$t.setValue(J,"receiveShadow",X.receiveShadow)),H.isMeshGouraudMaterial&&H.envMap!==null&&(nn.envMap.value=Ae,nn.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),At&&($t.setValue(J,"toneMappingExposure",_.toneMappingExposure),qe.needsLights&&nf(nn,qt),ce&&H.fog===!0&&Pe.refreshFogUniforms(nn,ce),Pe.refreshMaterialUniforms(nn,H,ie,ne,we),hg.upload(J,qe.uniformsList,nn,je)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(hg.upload(J,qe.uniformsList,nn,je),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&$t.setValue(J,"center",X.center),$t.setValue(J,"modelViewMatrix",X.modelViewMatrix),$t.setValue(J,"normalMatrix",X.normalMatrix),$t.setValue(J,"modelMatrix",X.matrixWorld),H.isShaderMaterial||H.isRawShaderMaterial){const wt=H.uniformsGroups;for(let En=0,Yt=wt.length;En0&&je.useMultisampledRTT(T)===!1?X=We.get(T).__webglMultisampledFramebuffer:X=_e,L.copy(T.viewport),U.copy(T.scissor),j=T.scissorTest}else L.copy(q).multiplyScalar(ie).floor(),U.copy(ae).multiplyScalar(ie).floor(),j=ee;if(be.bindFramebuffer(J.FRAMEBUFFER,X)&&De.drawBuffers&&H&&be.drawBuffers(T,X),be.viewport(L),be.scissor(U),be.setScissorTest(j),ce){const Ae=We.get(T.texture);J.framebufferTexture2D(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+F,Ae.__webglTexture,V)}else if(he){const Ae=We.get(T.texture),Te=F||0;J.framebufferTextureLayer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,Ae.__webglTexture,V||0,Te)}I=-1},this.readRenderTargetPixels=function(T,F,V,H,X,ce,he){if(!(T&&T.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ee=We.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&he!==void 0&&(Ee=Ee[he]),Ee){be.bindFramebuffer(J.FRAMEBUFFER,Ee);try{const Ae=T.texture,Te=Ae.format,_e=Ae.type;if(Te!==Ur&&Be.convert(Te)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=_e===kr&&(Se.has("EXT_color_buffer_half_float")||De.isWebGL2&&Se.has("EXT_color_buffer_float"));if(_e!==Ns&&Be.convert(_e)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&!(_e===Sr&&(De.isWebGL2||Se.has("OES_texture_float")||Se.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=T.width-H&&V>=0&&V<=T.height-X&&J.readPixels(F,V,H,X,Be.convert(Te),Be.convert(_e),ce)}finally{const Ae=B!==null?We.get(B).__webglFramebuffer:null;be.bindFramebuffer(J.FRAMEBUFFER,Ae)}}},this.copyFramebufferToTexture=function(T,F,V=0){const H=Math.pow(2,-V),X=Math.floor(F.image.width*H),ce=Math.floor(F.image.height*H);je.setTexture2D(F,0),J.copyTexSubImage2D(J.TEXTURE_2D,V,0,0,T.x,T.y,X,ce),be.unbindTexture()},this.copyTextureToTexture=function(T,F,V,H=0){const X=F.image.width,ce=F.image.height,he=Be.convert(V.format),Ee=Be.convert(V.type);je.setTexture2D(V,0),J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,V.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,V.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,V.unpackAlignment),F.isDataTexture?J.texSubImage2D(J.TEXTURE_2D,H,T.x,T.y,X,ce,he,Ee,F.image.data):F.isCompressedTexture?J.compressedTexSubImage2D(J.TEXTURE_2D,H,T.x,T.y,F.mipmaps[0].width,F.mipmaps[0].height,he,F.mipmaps[0].data):J.texSubImage2D(J.TEXTURE_2D,H,T.x,T.y,he,Ee,F.image),H===0&&V.generateMipmaps&&J.generateMipmap(J.TEXTURE_2D),be.unbindTexture()},this.copyTextureToTexture3D=function(T,F,V,H,X=0){if(_.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ce=T.max.x-T.min.x+1,he=T.max.y-T.min.y+1,Ee=T.max.z-T.min.z+1,Ae=Be.convert(H.format),Te=Be.convert(H.type);let _e;if(H.isData3DTexture)je.setTexture3D(H,0),_e=J.TEXTURE_3D;else if(H.isDataArrayTexture)je.setTexture2DArray(H,0),_e=J.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,H.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,H.unpackAlignment);const Ze=J.getParameter(J.UNPACK_ROW_LENGTH),ze=J.getParameter(J.UNPACK_IMAGE_HEIGHT),Ve=J.getParameter(J.UNPACK_SKIP_PIXELS),ht=J.getParameter(J.UNPACK_SKIP_ROWS),gt=J.getParameter(J.UNPACK_SKIP_IMAGES),pt=V.isCompressedTexture?V.mipmaps[0]:V.image;J.pixelStorei(J.UNPACK_ROW_LENGTH,pt.width),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,pt.height),J.pixelStorei(J.UNPACK_SKIP_PIXELS,T.min.x),J.pixelStorei(J.UNPACK_SKIP_ROWS,T.min.y),J.pixelStorei(J.UNPACK_SKIP_IMAGES,T.min.z),V.isDataTexture||V.isData3DTexture?J.texSubImage3D(_e,X,F.x,F.y,F.z,ce,he,Ee,Ae,Te,pt.data):V.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),J.compressedTexSubImage3D(_e,X,F.x,F.y,F.z,ce,he,Ee,Ae,pt.data)):J.texSubImage3D(_e,X,F.x,F.y,F.z,ce,he,Ee,Ae,Te,pt),J.pixelStorei(J.UNPACK_ROW_LENGTH,Ze),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,ze),J.pixelStorei(J.UNPACK_SKIP_PIXELS,Ve),J.pixelStorei(J.UNPACK_SKIP_ROWS,ht),J.pixelStorei(J.UNPACK_SKIP_IMAGES,gt),X===0&&H.generateMipmaps&&J.generateMipmap(_e),be.unbindTexture()},this.initTexture=function(T){T.isCubeTexture?je.setTextureCube(T,0):T.isData3DTexture?je.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?je.setTexture2DArray(T,0):je.setTexture2D(T,0),be.unbindTexture()},this.resetState=function(){C=0,b=0,B=null,be.reset(),Ne.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ds}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===Pt?Ea:oA}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ea?Pt:us}}class QI extends vA{}QI.prototype.isWebGL1Renderer=!0;class L0{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Xe(e),this.density=t}clone(){return new L0(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class D0{constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new Xe(e),this.near=t,this.far=r}clone(){return new D0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Vd extends Vt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class mh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=zd,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=vi()}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,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;ie.far||t.push({distance:l,point:Of.clone(),uv:qr.getInterpolation(Of,pm,Nf,mm,WT,Ky,$T,new Me),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 gm(n,e,t,r,i,s){Ic.subVectors(n,t).addScalar(.5).multiply(r),i!==void 0?(Ff.x=s*Ic.x-i*Ic.y,Ff.y=i*Ic.x+s*Ic.y):Ff.copy(Ic),n.copy(e),n.x+=Ff.x,n.y+=Ff.y,n.applyMatrix4(ZI)}const vm=new G,XT=new G;class eB extends Vt{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 r=0,i=t.length;r0){let r,i;for(r=1,i=t.length;r0){vm.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(vm);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){vm.setFromMatrixPosition(e.matrixWorld),XT.setFromMatrixPosition(this.matrixWorld);const r=vm.distanceTo(XT)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;il)continue;p.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(p);Ie.far||t.push({distance:I,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),A=Math.min(x.count,o.start+o.count);for(let _=g,w=A-1;_l)continue;p.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(p);be.far||t.push({distance:b,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class xG extends gn{constructor(e,t,r,i,s,o,a,l,c){super(e,t,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:un,this.magFilter=s!==void 0?s:un,this.generateMipmaps=!1;const d=this;function h(){d.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}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 EG extends gn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Dn,this.minFilter=Dn,this.generateMipmaps=!1,this.needsUpdate=!0}}class SA extends gn{constructor(e,t,r,i,s,o,a,l,c,d,h,p){super(null,o,a,l,c,d,i,s,h,p),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class AG extends SA{constructor(e,t,r,i,s,o){super(e,t,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ur}}class SG extends gn{constructor(e,t,r,i,s,o,a,l,c){super(e,t,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class vs{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/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 r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],p=r[i+1]-d,m=(o-d)/p;return(i+m)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new Me:new G);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new G,i=[],s=[],o=[],a=new G,l=new Et;for(let m=0;m<=e;m++){const v=m/e;i[m]=this.getTangentAt(v,new G)}s[0]=new G,o[0]=new G;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),h=Math.abs(i[0].y),p=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),h<=c&&(c=h,r.set(0,1,0)),p<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[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(i[m-1],i[m]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos(On(i[m-1].dot(i[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,v))}o[m].crossVectors(i[m],s[m])}if(t===!0){let m=Math.acos(On(s[0].dot(s[e]),-1,1));m/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(i[v],m*v)),o[v].crossVectors(i[v],s[v])}return{tangents:i,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 N0 extends vs{constructor(e=0,t=0,r=1,i=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=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const r=t||new Me,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=i[(a-1)%s]:(Am.subVectors(i[0],i[1]).add(i[0]),c=Am);const h=i[a%s],p=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return r.set(lb(a,l.x,c.x,d.x,h.x),lb(a,l.y,c.y,d.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,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 r=0,i=this.curves.length;r1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),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 Wu extends It{constructor(e=[new Me(0,-.5),new Me(.5,0),new Me(0,.5)],t=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=Math.floor(t),i=On(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/t,h=new G,p=new Me,m=new G,v=new G,E=new G;let x=0,g=0;for(let A=0;A<=e.length-1;A++)switch(A){case 0:x=e[A+1].x-e[A].x,g=e[A+1].y-e[A].y,m.x=g*1,m.y=-x,m.z=g*0,E.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(E.x,E.y,E.z);break;default:x=e[A+1].x-e[A].x,g=e[A+1].y-e[A].y,m.x=g*1,m.y=-x,m.z=g*0,v.copy(m),m.x+=E.x,m.y+=E.y,m.z+=E.z,m.normalize(),l.push(m.x,m.y,m.z),E.copy(v)}for(let A=0;A<=t;A++){const _=r+A*d*i,w=Math.sin(_),C=Math.cos(_);for(let b=0;b<=e.length-1;b++){h.x=e[b].x*w,h.y=e[b].y,h.z=e[b].x*C,o.push(h.x,h.y,h.z),p.x=A/t,p.y=b/(e.length-1),a.push(p.x,p.y);const B=l[3*b+0]*w,I=l[3*b+1],R=l[3*b+0]*C;c.push(B,I,R)}}for(let A=0;A0&&_(!0),t>0&&_(!1)),this.setIndex(d),this.setAttribute("position",new ct(h,3)),this.setAttribute("normal",new ct(p,3)),this.setAttribute("uv",new ct(m,2));function A(){const w=new G,C=new G;let b=0;const B=(t-e)/r;for(let I=0;I<=s;I++){const R=[],L=I/s,U=L*(t-e)+e;for(let j=0;j<=i;j++){const $=j/i,K=$*l+a,Y=Math.sin(K),ne=Math.cos(K);C.x=U*Y,C.y=-L*r+x,C.z=U*ne,h.push(C.x,C.y,C.z),w.set(Y,B,ne).normalize(),p.push(w.x,w.y,w.z),m.push($,1-L),R.push(v++)}E.push(R)}for(let I=0;I.9&&B<.1&&(_<.2&&(o[A+0]+=1),w<.2&&(o[A+2]+=1),C<.2&&(o[A+4]+=1))}}function p(A){s.push(A.x,A.y,A.z)}function m(A,_){const w=A*3;_.x=e[w+0],_.y=e[w+1],_.z=e[w+2]}function v(){const A=new G,_=new G,w=new G,C=new G,b=new Me,B=new Me,I=new Me;for(let R=0,L=0;R80*t){a=c=n[0],l=d=n[1];for(let v=t;vc&&(c=h),p>d&&(d=p);m=Math.max(c-a,d-l),m=m!==0?32767/m:0}return $d(s,o,t,a,l,m,0),o}};function aB(n,e,t,r,i){let s,o;if(i===jG(n,e,t,r)>0)for(s=e;s=e;s-=r)o=cb(s,n[s],n[s+1],o);return o&&k0(o,o.next)&&(jd(o),o=o.next),o}function Ul(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(k0(t,t.next)||Tn(t.prev,t,t.next)===0)){if(jd(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function $d(n,e,t,r,i,s,o){if(!n)return;!o&&s&&HG(n,r,i,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?LG(n,r,i,s):BG(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),jd(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=DG(Ul(n),e,t),$d(n,e,t,r,i,s,2)):o===2&&OG(n,e,t,r,i,s):$d(Ul(n),e,t,r,i,s,1);break}}}function BG(n){const e=n.prev,t=n,r=n.next;if(Tn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,c=r.y,d=is?i>o?i:o:s>o?s:o,m=a>l?a>c?a:c:l>c?l:c;let v=r.next;for(;v!==e;){if(v.x>=d&&v.x<=p&&v.y>=h&&v.y<=m&&nu(i,a,s,l,o,c,v.x,v.y)&&Tn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function LG(n,e,t,r){const i=n.prev,s=n,o=n.next;if(Tn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,h=s.y,p=o.y,m=al?a>c?a:c:l>c?l:c,x=d>h?d>p?d:p:h>p?h:p,g=u1(m,v,e,t,r),A=u1(E,x,e,t,r);let _=n.prevZ,w=n.nextZ;for(;_&&_.z>=g&&w&&w.z<=A;){if(_.x>=m&&_.x<=E&&_.y>=v&&_.y<=x&&_!==i&&_!==o&&nu(a,d,l,h,c,p,_.x,_.y)&&Tn(_.prev,_,_.next)>=0||(_=_.prevZ,w.x>=m&&w.x<=E&&w.y>=v&&w.y<=x&&w!==i&&w!==o&&nu(a,d,l,h,c,p,w.x,w.y)&&Tn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;_&&_.z>=g;){if(_.x>=m&&_.x<=E&&_.y>=v&&_.y<=x&&_!==i&&_!==o&&nu(a,d,l,h,c,p,_.x,_.y)&&Tn(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;w&&w.z<=A;){if(w.x>=m&&w.x<=E&&w.y>=v&&w.y<=x&&w!==i&&w!==o&&nu(a,d,l,h,c,p,w.x,w.y)&&Tn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function DG(n,e,t){let r=n;do{const i=r.prev,s=r.next.next;!k0(i,s)&&lB(i,r,r.next,s)&&Xd(i,s)&&Xd(s,i)&&(e.push(i.i/t|0),e.push(r.i/t|0),e.push(s.i/t|0),jd(r),jd(r.next),r=n=s),r=r.next}while(r!==n);return Ul(r)}function OG(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&WG(o,a)){let l=cB(o,a);o=Ul(o,o.next),l=Ul(l,l.next),$d(o,e,t,r,i,s,0),$d(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function FG(n,e,t,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const p=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=s&&p>r&&(r=p,i=t.x=t.x&&t.x>=l&&s!==t.x&&nu(oi.x||t.x===i.x&&zG(i,t)))&&(i=t,d=h)),t=t.next;while(t!==a);return i}function zG(n,e){return Tn(n.prev,n,e.prev)<0&&Tn(e.next,n,n.next)<0}function HG(n,e,t,r){let i=n;do i.z===0&&(i.z=u1(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,GG(i)}function GG(n){let e,t,r,i,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(i=t,t=t.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;t=r}s.nextZ=null,c*=2}while(o>1);return n}function u1(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|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 VG(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function WG(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!$G(n,e)&&(Xd(n,e)&&Xd(e,n)&&XG(n,e)&&(Tn(n.prev,n,e.prev)||Tn(n,e.prev,e))||k0(n,e)&&Tn(n.prev,n,n.next)>0&&Tn(e.prev,e,e.next)>0)}function Tn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function k0(n,e){return n.x===e.x&&n.y===e.y}function lB(n,e,t,r){const i=bm(Tn(n,e,t)),s=bm(Tn(n,e,r)),o=bm(Tn(t,r,n)),a=bm(Tn(t,r,e));return!!(i!==s&&o!==a||i===0&&Tm(n,t,e)||s===0&&Tm(n,r,e)||o===0&&Tm(t,n,r)||a===0&&Tm(t,e,r))}function Tm(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 bm(n){return n>0?1:n<0?-1:0}function $G(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&&lB(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Xd(n,e){return Tn(n.prev,n,n.next)<0?Tn(n,e,n.next)>=0&&Tn(n,n.prev,e)>=0:Tn(n,e,n.prev)<0||Tn(n,n.next,e)<0}function XG(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function cB(n,e){const t=new f1(n.i,n.x,n.y),r=new f1(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function cb(n,e,t,r){const i=new f1(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function jd(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 f1(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 jG(n,e,t,r){let i=0;for(let s=e,o=t-r;s2&&n[e-1].equals(n[0])&&n.pop()}function fb(n,e){for(let t=0;tNumber.EPSILON){const N=Math.sqrt(Qt),de=Math.sqrt(at*at+St*St),Pe=Re.x-je/N,Ie=Re.y+We/N,ke=Se.x-St/de,Ye=Se.y+at/de,He=((ke-Pe)*St-(Ye-Ie)*at)/(We*St-je*at);De=Pe+We*He-J.x,be=Ie+je*He-J.y;const ye=De*De+be*be;if(ye<=2)return new Me(De,be);tt=Math.sqrt(ye/2)}else{let N=!1;We>Number.EPSILON?at>Number.EPSILON&&(N=!0):We<-Number.EPSILON?at<-Number.EPSILON&&(N=!0):Math.sign(je)===Math.sign(St)&&(N=!0),N?(De=-je,be=We,tt=Math.sqrt(Qt)):(De=We,be=je,tt=Math.sqrt(Qt/2))}return new Me(De/tt,be/tt)}const Z=[];for(let J=0,Re=K.length,Se=Re-1,De=J+1;J=0;J--){const Re=J/x,Se=m*Math.cos(Re*Math.PI/2),De=v*Math.sin(Re*Math.PI/2)+E;for(let be=0,tt=K.length;be=0;){const De=Se;let be=Se-1;be<0&&(be=J.length-1);for(let tt=0,We=d+x*2;tt0)&&m.push(_,w,b),(g!==r-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 hB extends Xn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Xe(16777215),this.specular=new Xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Oa,this.normalScale=new Me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=fh,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 pB extends Xn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Oa,this.normalScale=new Me(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 mB extends Xn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Oa,this.normalScale=new Me(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 gB extends Xn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Oa,this.normalScale=new Me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=fh,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 vB extends Xn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Oa,this.normalScale=new Me(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 yB extends Tr{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 Di(n,e,t){return PA(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function _l(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 PA(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function _B(n){function e(i,s){return n[i]-n[s]}const t=n.length,r=new Array(t);for(let i=0;i!==t;++i)r[i]=i;return r.sort(e),r}function d1(n,e,t){const r=n.length,i=new n.constructor(r);for(let s=0,o=0;o!==r;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=n[a+l]}return i}function IA(n,e,t,r){let i=1,s=n[0];for(;s!==void 0&&s[r]===void 0;)s=n[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=n[i++];while(s!==void 0)}function QG(n,e,t,r,i=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l=r)){h.push(c.times[m]);for(let E=0;Es.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[v]){const g=v*h+d,A=g+h-d;E=Di(a.values,g,A)}else{const g=a.createInterpolant(),A=d,_=h-d;g.evaluate(s),E=Di(g.resultBuffer,A,_)}l==="quaternion"&&new ar().fromArray(E).normalize().conjugate().toArray(E);const x=c.times.length;for(let g=0;g=s)){const a=t[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=Di(r,s,o),this.values=Di(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 r=this.times,i=this.values,s=r.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=r[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(i!==void 0&&PA(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=Di(this.times),t=Di(this.values),r=this.getValueSize(),i=this.getInterpolation()===fg,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Di(e,0,o),this.values=Di(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=Di(this.times,0),t=Di(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}ys.prototype.TimeBufferType=Float32Array;ys.prototype.ValueBufferType=Float32Array;ys.prototype.DefaultInterpolation=Nl;class $l extends ys{}$l.prototype.ValueTypeName="bool";$l.prototype.ValueBufferType=Array;$l.prototype.DefaultInterpolation=Tu;$l.prototype.InterpolantFactoryMethodLinear=void 0;$l.prototype.InterpolantFactoryMethodSmooth=void 0;class LA extends ys{}LA.prototype.ValueTypeName="color";class Pu extends ys{}Pu.prototype.ValueTypeName="number";class AB extends Ju{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let c=e*a;for(let d=c+a;c!==d;c+=4)ar.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Ca extends ys{InterpolantFactoryMethodLinear(e){return new AB(this.times,this.values,this.getValueSize(),e)}}Ca.prototype.ValueTypeName="quaternion";Ca.prototype.DefaultInterpolation=Nl;Ca.prototype.InterpolantFactoryMethodSmooth=void 0;class Xl extends ys{}Xl.prototype.ValueTypeName="string";Xl.prototype.ValueBufferType=Array;Xl.prototype.DefaultInterpolation=Tu;Xl.prototype.InterpolantFactoryMethodLinear=void 0;Xl.prototype.InterpolantFactoryMethodSmooth=void 0;class Iu extends ys{}Iu.prototype.ValueTypeName="vector";class Bu{constructor(e,t=-1,r,i=R0){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=vi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(t5(r[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(ys.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const h=d[1];let p=i[h];p||(i[h]=p=[]),p.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(h,p,m,v,E){if(m.length!==0){const x=[],g=[];IA(m,x,g,v),x.length!==0&&E.push(new h(p,x,g))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h{t&&t(s),this.manager.itemEnd(e)},0),s;if(oo[e]!==void 0){oo[e].push({onLoad:t,onProgress:r,onError:i});return}oo[e]=[],oo[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=oo[e],h=c.body.getReader(),p=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),m=p?parseInt(p):0,v=m!==0;let E=0;const x=new ReadableStream({start(g){A();function A(){h.read().then(({done:_,value:w})=>{if(_)g.close();else{E+=w.byteLength;const C=new ProgressEvent("progress",{lengthComputable:v,loaded:E,total:m});for(let b=0,B=d.length;b{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),p=h&&h[1]?h[1].toLowerCase():void 0,m=new TextDecoder(p);return c.arrayBuffer().then(v=>m.decode(v))}}}).then(c=>{kl.add(e,c);const d=oo[e];delete oo[e];for(let h=0,p=d.length;h{const d=oo[e];if(d===void 0)throw this.manager.itemError(e),c;delete oo[e];for(let h=0,p=d.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class r5 extends $r{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new _i(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){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const t=[];for(let r=0;r0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new Xe().setHex(o.value);break;case"v2":i.uniforms[s].value=new Me().fromArray(o.value);break;case"v3":i.uniforms[s].value=new G().fromArray(o.value);break;case"v4":i.uniforms[s].value=new en().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Ot().fromArray(o.value);break;case"m4":i.uniforms[s].value=new Et().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Me().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Me().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:fB,SpriteMaterial:yA,RawShaderMaterial:dB,ShaderMaterial:ds,PointsMaterial:F0,MeshPhysicalMaterial:$s,MeshStandardMaterial:Ch,MeshPhongMaterial:hB,MeshToonMaterial:pB,MeshNormalMaterial:mB,MeshLambertMaterial:gB,MeshDepthMaterial:mA,MeshDistanceMaterial:gA,MeshBasicMaterial:pi,MeshMatcapMaterial:vB,LineDashedMaterial:yB,LineBasicMaterial:Tr,Material:Xn};return new t[e]}}class ks{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r0){const l=new DA(t);s=new Jd(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new Jd(this.manager),i.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,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=kl.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){kl.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let Cm;class zA{static getContext(){return Cm===void 0&&(Cm=new(window.AudioContext||window.webkitAudioContext)),Cm}static setContext(e){Cm=e}}class u5 extends $r{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new _i(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);zA.getContext().decodeAudioData(c,function(h){t(h)},a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}class f5 extends z0{constructor(e,t,r=1){super(void 0,r),this.isHemisphereLightProbe=!0;const i=new Xe().set(e),s=new Xe().set(t),o=new G(i.r,i.g,i.b),a=new G(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}class d5 extends z0{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const r=new Xe().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const _b=new Et,xb=new Et,Qa=new Et;class h5{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Fn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Fn,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,Qa.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(Ml*t.fov*.5)/t.zoom;let a,l;xb.elements[12]=-i,_b.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,Qa.elements[0]=2*t.near/(l-a),Qa.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Qa),a=-o*t.aspect-s,l=o*t.aspect-s,Qa.elements[0]=2*t.near/(l-a),Qa.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Qa)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(xb),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(_b)}}class HA{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Eb(),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=Eb();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Eb(){return(typeof performance>"u"?Date:performance).now()}const Za=new G,Ab=new ar,p5=new G,qa=new G;class m5 extends Vt{constructor(){super(),this.type="AudioListener",this.context=zA.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new HA}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,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Za,Ab,p5),qa.set(0,0,-1).applyQuaternion(Ab),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Za.x,i),t.positionY.linearRampToValueAtTime(Za.y,i),t.positionZ.linearRampToValueAtTime(Za.z,i),t.forwardX.linearRampToValueAtTime(qa.x,i),t.forwardY.linearRampToValueAtTime(qa.y,i),t.forwardZ.linearRampToValueAtTime(qa.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(Za.x,Za.y,Za.z),t.setOrientation(qa.x,qa.y,qa.z,r.x,r.y,r.z)}}class BB extends Vt{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(r,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let s=r,o=i;s!==o;++s)t[s]=t[i+s%r];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 r=e;r=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,i){ar.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;ar.multiplyQuaternionsFlat(e,o,e,t,e,r),ar.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,t,r,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[r+o]*i}}}const GA="\\[\\]\\.:\\/",_5=new RegExp("["+GA+"]","g"),VA="[^"+GA+"]",x5="[^"+GA.replace("\\.","")+"]",E5=/((?:WC+[\/:])*)/.source.replace("WC",VA),A5=/(WCOD+)?/.source.replace("WCOD",x5),S5=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",VA),w5=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",VA),M5=new RegExp("^"+E5+A5+S5+w5+"$"),T5=["material","materials","bones","map"];class b5{constructor(e,t,r){const i=r||Gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class Gt{constructor(e,t,r){this.path=t,this.parsedPath=r||Gt.parseTrackName(t),this.node=Gt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new Gt.Composite(e,t,r):new Gt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(_5,"")}static parseTrackName(e){const t=M5.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);T5.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o=s){const h=s++,p=e[h];t[p.uuid]=d,e[d]=p,t[c]=h,e[h]=l;for(let m=0,v=i;m!==v;++m){const E=r[m],x=E[h],g=E[d];E[d]=x,E[h]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,h=t[d];if(h!==void 0)if(delete t[d],h0&&(t[m.uuid]=h),e[h]=m,e.pop();for(let v=0,E=i;v!==E;++v){const x=r[v];x[h]=x[p],x.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,h=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(t),s.push(h);for(let p=d,m=l.length;p!==m;++p){const v=l[p];h[p]=new Gt(v,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class DB{constructor(e,t,r=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:ml,endingEnd:ml};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.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=AI,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,r){if(e.fadeOut(t),this.fadeIn(t),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}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,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?t=0:(this._startTime=null,t=r*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case iA:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case R0:default:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===SI;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===EI){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,r){const i=this._interpolantSettings;r?(i.endingStart=gl,i.endingEnd=gl):(e?i.endingStart=this.zeroSlopeAtStart?gl:ml:i.endingStart=kd,t?i.endingEnd=this.zeroSlopeAtEnd?gl:ml:i.endingEnd=kd)}_scheduleFading(e,t,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}}const R5=new Float32Array(1);class P5 extends Ws{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let h=0;h!==s;++h){const p=i[h],m=p.name;let v=d[m];if(v!==void 0)++v.referenceCount,o[h]=v;else{if(v=o[h],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,m));continue}const E=t&&t._propertyBindings[h].binding.parsedPath;v=new LB(Gt.create(r,m,E),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,m),o[h]=v}a[h].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];--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;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Mb).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 Tb=new G,Rm=new G;class N5{constructor(e=new G,t=new G){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){Tb.subVectors(e,this.start),Rm.subVectors(this.end,this.start);const r=Rm.dot(Rm);let s=Rm.dot(Tb)/r;return t&&(s=On(s,0,1)),s}closestPointToPoint(e,t,r){const i=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(i).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 bb=new G;class U5 extends Vt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const r=new It,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Bb.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Bb,t)}}setLength(e,t=e*.2,r=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),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 Q5 extends gs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new It;i.setAttribute("position",new ct(t,3)),i.setAttribute("color",new ct(r,3));const s=new Tr({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,r){const i=new Xe,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Z5{constructor(){this.type="ShapePath",this.color=new Xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Wd,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,s,o){return this.currentPath.bezierCurveTo(e,t,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const A=[];for(let _=0,w=g.length;_Number.EPSILON){if(L<0&&(B=A[b],R=-R,I=A[C],L=-L),g.yI.y)continue;if(g.y===B.y){if(g.x===B.x)return!0}else{const U=L*(g.x-B.x)-R*(g.y-B.y);if(U===0)return!0;if(U<0)continue;w=!w}}else{if(g.y!==B.y)continue;if(I.x<=g.x&&g.x<=B.x||B.x<=g.x&&g.x<=I.x)return!0}}return w}const i=Us.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new bl,l.curves=a.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const h=[],p=[];let m=[],v=0,E;p[v]=void 0,m[v]=[];for(let g=0,A=s.length;g1){let g=!1,A=0;for(let _=0,w=p.length;_0&&g===!1&&(m=h)}let x;for(let g=0,A=p.length;g{const h=typeof c=="function"?c(e):c;if(h!==e){const p=e;e=d?h:Object.assign({},e,h),t.forEach(m=>m(e,p))}},i=()=>e,s=(c,d=i,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=d(e);function m(){const v=d(e);if(!h(p,v)){const E=p;c(p=v,E)}}return t.add(m),()=>t.delete(m)},l={setState:r,getState:i,subscribe:(c,d,h)=>d||h?s(c,d,h):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return e=n(r,i,l),l}const E8=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Lb=E8?D.useEffect:D.useLayoutEffect;function XA(n){const e=typeof n=="function"?x8(n):n,t=(r=e.getState,i=Object.is)=>{const[,s]=D.useReducer(x=>x+1,0),o=e.getState(),a=D.useRef(o),l=D.useRef(r),c=D.useRef(i),d=D.useRef(!1),h=D.useRef();h.current===void 0&&(h.current=r(o));let p,m=!1;(a.current!==o||l.current!==r||c.current!==i||d.current)&&(p=r(o),m=!i(h.current,p)),Lb(()=>{m&&(h.current=p),a.current=o,l.current=r,c.current=i,d.current=!1});const v=D.useRef(o);Lb(()=>{const x=()=>{try{const A=e.getState(),_=l.current(A);c.current(h.current,_)||(a.current=A,h.current=_,s())}catch{d.current=!0,s()}},g=e.subscribe(x);return e.getState()!==v.current&&x(),g},[]);const E=m?p:h.current;return D.useDebugValue(E),E};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[t,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},t}var m1={},A8={get exports(){return m1},set exports(n){m1=n}},Kd={},S8={get exports(){return Kd},set exports(n){Kd=n}},FB={};/** - * @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(z,Z){var q=z.length;z.push(Z);e:for(;0>>1,ee=z[ae];if(0>>1;aei(Le,q))wei(Fe,Le)?(z[ae]=Fe,z[we]=q,ae=we):(z[ae]=Le,z[pe]=q,ae=pe);else if(wei(Fe,q))z[ae]=Fe,z[we]=q,ae=we;else break e}}return Z}function i(z,Z){var q=z.sortIndex-Z.sortIndex;return q!==0?q:z.id-Z.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=[],c=[],d=1,h=null,p=3,m=!1,v=!1,E=!1,x=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(z){for(var Z=t(c);Z!==null;){if(Z.callback===null)r(c);else if(Z.startTime<=z)r(c),Z.sortIndex=Z.expirationTime,e(l,Z);else break;Z=t(c)}}function w(z){if(E=!1,_(z),!v)if(t(l)!==null)v=!0,ne(C);else{var Z=t(c);Z!==null&&ie(w,Z.startTime-z)}}function C(z,Z){v=!1,E&&(E=!1,g(I),I=-1),m=!0;var q=p;try{for(_(Z),h=t(l);h!==null&&(!(h.expirationTime>Z)||z&&!U());){var ae=h.callback;if(typeof ae=="function"){h.callback=null,p=h.priorityLevel;var ee=ae(h.expirationTime<=Z);Z=n.unstable_now(),typeof ee=="function"?h.callback=ee:h===t(l)&&r(l),_(Z)}else r(l);h=t(l)}if(h!==null)var ve=!0;else{var pe=t(c);pe!==null&&ie(w,pe.startTime-Z),ve=!1}return ve}finally{h=null,p=q,m=!1}}var b=!1,B=null,I=-1,R=5,L=-1;function U(){return!(n.unstable_now()-Lz||125ae?(z.sortIndex=q,e(c,z),t(l)===null&&z===t(c)&&(E?(g(I),I=-1):E=!0,ie(w,q-ae))):(z.sortIndex=ee,e(l,z),v||m||(v=!0,ne(C))),z},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(z){var Z=p;return function(){var q=p;p=Z;try{return z.apply(this,arguments)}finally{p=q}}}})(FB);(function(n){n.exports=FB})(S8);/** - * @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 w8=function(e){var t={},r=D,i=Kd,s=Object.assign;function o(u){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+u,y=1;yse||M[W]!==P[se]){var xe=` -`+M[W].replace(" at new "," at ");return u.displayName&&xe.includes("")&&(xe=xe.replace("",u.displayName)),xe}while(1<=W&&0<=se);break}}}finally{ze=!1,Error.prepareStackTrace=y}return(u=u?u.displayName||u.name:"")?Ze(u):""}var ht=Object.prototype.hasOwnProperty,gt=[],pt=-1;function qe(u){return{current:u}}function _t(u){0>pt||(u.current=gt[pt],gt[pt]=null,pt--)}function lt(u,f){pt++,gt[pt]=u.current,u.current=f}var Mt={},Zt=qe(Mt),At=qe(!1),qt=Mt;function $t(u,f){var y=u.type.contextTypes;if(!y)return Mt;var S=u.stateNode;if(S&&S.__reactInternalMemoizedUnmaskedChildContext===f)return S.__reactInternalMemoizedMaskedChildContext;var M={},P;for(P in y)M[P]=f[P];return S&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=f,u.__reactInternalMemoizedMaskedChildContext=M),M}function nn(u){return u=u.childContextTypes,u!=null}function Un(){_t(At),_t(Zt)}function wt(u,f,y){if(Zt.current!==Mt)throw Error(o(168));lt(Zt,f),lt(At,y)}function En(u,f,y){var S=u.stateNode;if(f=f.childContextTypes,typeof S.getChildContext!="function")return y;S=S.getChildContext();for(var M in S)if(!(M in f))throw Error(o(108,I(u)||"Unknown",M));return s({},y,S)}function Yt(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||Mt,qt=Zt.current,lt(Zt,u),lt(At,At.current),!0}function zt(u,f,y){var S=u.stateNode;if(!S)throw Error(o(169));y?(u=En(u,f,qt),S.__reactInternalMemoizedMergedChildContext=u,_t(At),_t(Zt),lt(Zt,u)):_t(At),lt(At,y)}var yn=Math.clz32?Math.clz32:As,js=Math.log,Rr=Math.LN2;function As(u){return u>>>=0,u===0?32:31-(js(u)/Rr|0)|0}var kh=64,zh=4194304;function rf(u){switch(u&-u){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 u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Hh(u,f){var y=u.pendingLanes;if(y===0)return 0;var S=0,M=u.suspendedLanes,P=u.pingedLanes,W=y&268435455;if(W!==0){var se=W&~M;se!==0?S=rf(se):(P&=W,P!==0&&(S=rf(P)))}else W=y&~M,W!==0?S=rf(W):P!==0&&(S=rf(P));if(S===0)return 0;if(f!==0&&f!==S&&!(f&M)&&(M=S&-S,P=f&-f,M>=P||M===16&&(P&4194240)!==0))return f;if(S&4&&(S|=y&16),f=u.entangledLanes,f!==0)for(u=u.entanglements,f&=S;0y;y++)f.push(u);return f}function sf(u,f,y){u.pendingLanes|=f,f!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,f=31-yn(f),u[f]=y}function l3(u,f){var y=u.pendingLanes&~f;u.pendingLanes=f,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=f,u.mutableReadLanes&=f,u.entangledLanes&=f,f=u.entanglements;var S=u.eventTimes;for(u=u.expirationTimes;0>=W,M-=W,Ys=1<<32-yn(f)+M|y<jt?(nr=bt,bt=null):nr=bt.sibling;var Jt=vt(fe,bt,ge[jt],Qe);if(Jt===null){bt===null&&(bt=nr);break}u&&bt&&Jt.alternate===null&&f(fe,bt),oe=P(Jt,oe,jt),Lt===null?ft=Jt:Lt.sibling=Jt,Lt=Jt,bt=nr}if(jt===ge.length)return y(fe,bt),_n&&ka(fe,jt),ft;if(bt===null){for(;jtjt?(nr=bt,bt=null):nr=bt.sibling;var $o=vt(fe,bt,Jt.value,Qe);if($o===null){bt===null&&(bt=nr);break}u&&bt&&$o.alternate===null&&f(fe,bt),oe=P($o,oe,jt),Lt===null?ft=$o:Lt.sibling=$o,Lt=$o,bt=nr}if(Jt.done)return y(fe,bt),_n&&ka(fe,jt),ft;if(bt===null){for(;!Jt.done;jt++,Jt=ge.next())Jt=Tt(fe,Jt.value,Qe),Jt!==null&&(oe=P(Jt,oe,jt),Lt===null?ft=Jt:Lt.sibling=Jt,Lt=Jt);return _n&&ka(fe,jt),ft}for(bt=S(fe,bt);!Jt.done;jt++,Jt=ge.next())Jt=cn(bt,fe,jt,Jt.value,Qe),Jt!==null&&(u&&Jt.alternate!==null&&bt.delete(Jt.key===null?jt:Jt.key),oe=P(Jt,oe,jt),Lt===null?ft=Jt:Lt.sibling=Jt,Lt=Jt);return u&&bt.forEach(function(j3){return f(fe,j3)}),_n&&ka(fe,jt),ft}function Pi(fe,oe,ge,Qe){if(typeof ge=="object"&&ge!==null&&ge.type===d&&ge.key===null&&(ge=ge.props.children),typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case l:e:{for(var ft=ge.key,Lt=oe;Lt!==null;){if(Lt.key===ft){if(ft=ge.type,ft===d){if(Lt.tag===7){y(fe,Lt.sibling),oe=M(Lt,ge.props.children),oe.return=fe,fe=oe;break e}}else if(Lt.elementType===ft||typeof ft=="object"&&ft!==null&&ft.$$typeof===_&&OS(ft)===Lt.type){y(fe,Lt.sibling),oe=M(Lt,ge.props),oe.ref=lf(fe,Lt,ge),oe.return=fe,fe=oe;break e}y(fe,Lt);break}else f(fe,Lt);Lt=Lt.sibling}ge.type===d?(oe=Xa(ge.props.children,fe.mode,Qe,ge.key),oe.return=fe,fe=oe):(Qe=Rp(ge.type,ge.key,ge.props,null,fe.mode,Qe),Qe.ref=lf(fe,oe,ge),Qe.return=fe,fe=Qe)}return W(fe);case c:e:{for(Lt=ge.key;oe!==null;){if(oe.key===Lt)if(oe.tag===4&&oe.stateNode.containerInfo===ge.containerInfo&&oe.stateNode.implementation===ge.implementation){y(fe,oe.sibling),oe=M(oe,ge.children||[]),oe.return=fe,fe=oe;break e}else{y(fe,oe);break}else f(fe,oe);oe=oe.sibling}oe=ey(ge,fe.mode,Qe),oe.return=fe,fe=oe}return W(fe);case _:return Lt=ge._init,Pi(fe,oe,Lt(ge._payload),Qe)}if(Y(ge))return dt(fe,oe,ge,Qe);if(b(ge))return vr(fe,oe,ge,Qe);Zh(fe,ge)}return typeof ge=="string"&&ge!==""||typeof ge=="number"?(ge=""+ge,oe!==null&&oe.tag===6?(y(fe,oe.sibling),oe=M(oe,ge),oe.return=fe,fe=oe):(y(fe,oe),oe=qv(ge,fe.mode,Qe),oe.return=fe,fe=oe),W(fe)):y(fe,oe)}return Pi}var ic=FS(!0),NS=FS(!1),cf={},Ti=qe(cf),uf=qe(cf),sc=qe(cf);function bs(u){if(u===cf)throw Error(o(174));return u}function vv(u,f){lt(sc,f),lt(uf,u),lt(Ti,cf),u=ie(f),_t(Ti),lt(Ti,u)}function oc(){_t(Ti),_t(uf),_t(sc)}function US(u){var f=bs(sc.current),y=bs(Ti.current);f=z(y,u.type,f),y!==f&&(lt(uf,u),lt(Ti,f))}function yv(u){uf.current===u&&(_t(Ti),_t(uf))}var An=qe(0);function qh(u){for(var f=u;f!==null;){if(f.tag===13){var y=f.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||Xs(y)||xs(y)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var _v=[];function xv(){for(var u=0;u<_v.length;u++){var f=_v[u];Rt?f._workInProgressVersionPrimary=null:f._workInProgressVersionSecondary=null}_v.length=0}var ep=a.ReactCurrentDispatcher,bi=a.ReactCurrentBatchConfig,ac=0,In=null,pr=null,tr=null,tp=!1,ff=!1,df=0,y3=0;function mr(){throw Error(o(321))}function Ev(u,f){if(f===null)return!1;for(var y=0;yy?y:4,u(!0);var S=bi.transition;bi.transition={};try{u(!1),f()}finally{Xt=y,bi.transition=S}}function ZS(){return Cs().memoizedState}function x3(u,f,y){var S=Go(u);y={lane:S,action:y,hasEagerState:!1,eagerState:null,next:null},qS(u)?ew(f,y):(tw(u,f,y),y=Ir(),u=Ci(u,S,y),u!==null&&nw(u,f,S))}function E3(u,f,y){var S=Go(u),M={lane:S,action:y,hasEagerState:!1,eagerState:null,next:null};if(qS(u))ew(f,M);else{tw(u,f,M);var P=u.alternate;if(u.lanes===0&&(P===null||P.lanes===0)&&(P=f.lastRenderedReducer,P!==null))try{var W=f.lastRenderedState,se=P(W,y);if(M.hasEagerState=!0,M.eagerState=se,ws(se,W))return}catch{}finally{}y=Ir(),u=Ci(u,S,y),u!==null&&nw(u,f,S)}}function qS(u){var f=u.alternate;return u===In||f!==null&&f===In}function ew(u,f){ff=tp=!0;var y=u.pending;y===null?f.next=f:(f.next=y.next,y.next=f),u.pending=f}function tw(u,f,y){Gn!==null&&u.mode&1&&!(Nt&2)?(u=f.interleaved,u===null?(y.next=y,Ts===null?Ts=[f]:Ts.push(f)):(y.next=u.next,u.next=y),f.interleaved=y):(u=f.pending,u===null?y.next=y:(y.next=u.next,u.next=y),f.pending=y)}function nw(u,f,y){if(y&4194240){var S=f.lanes;S&=u.pendingLanes,y|=S,f.lanes=y,ev(u,y)}}var op={readContext:Si,useCallback:mr,useContext:mr,useEffect:mr,useImperativeHandle:mr,useInsertionEffect:mr,useLayoutEffect:mr,useMemo:mr,useReducer:mr,useRef:mr,useState:mr,useDebugValue:mr,useDeferredValue:mr,useTransition:mr,useMutableSource:mr,useSyncExternalStore:mr,useId:mr,unstable_isNewReconciler:!1},A3={readContext:Si,useCallback:function(u,f){return Zs().memoizedState=[u,f===void 0?null:f],u},useContext:Si,useEffect:Mv,useImperativeHandle:function(u,f,y){return y=y!=null?y.concat([u]):null,ip(4194308,4,JS.bind(null,f,u),y)},useLayoutEffect:function(u,f){return ip(4194308,4,u,f)},useInsertionEffect:function(u,f){return ip(4,2,u,f)},useMemo:function(u,f){var y=Zs();return f=f===void 0?null:f,u=u(),y.memoizedState=[u,f],u},useReducer:function(u,f,y){var S=Zs();return f=y!==void 0?y(f):f,S.memoizedState=S.baseState=f,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:f},S.queue=u,u=u.dispatch=x3.bind(null,In,u),[S.memoizedState,u]},useRef:function(u){var f=Zs();return u={current:u},f.memoizedState=u},useState:wv,useDebugValue:Tv,useDeferredValue:function(u){var f=wv(u),y=f[0],S=f[1];return Mv(function(){var M=bi.transition;bi.transition={};try{S(u)}finally{bi.transition=M}},[u]),y},useTransition:function(){var u=wv(!1),f=u[0];return u=_3.bind(null,u[1]),Zs().memoizedState=u,[f,u]},useMutableSource:function(){},useSyncExternalStore:function(u,f,y){var S=In,M=Zs();if(_n){if(y===void 0)throw Error(o(407));y=y()}else{if(y=f(),Gn===null)throw Error(o(349));ac&30||HS(S,f,y)}M.memoizedState=y;var P={value:y,getSnapshot:f};return M.queue=P,Mv(VS.bind(null,S,P,u),[u]),S.flags|=2048,hf(9,GS.bind(null,S,P,y,f),void 0,null),y},useId:function(){var u=Zs(),f=Gn.identifierPrefix;if(_n){var y=Qs,S=Ys;y=(S&~(1<<32-yn(S)-1)).toString(32)+y,f=":"+f+"R"+y,y=df++,0$v&&(f.flags|=128,S=!0,vf(M,!1),f.lanes=4194304)}else{if(!S)if(u=qh(P),u!==null){if(f.flags|=128,S=!0,u=u.updateQueue,u!==null&&(f.updateQueue=u,f.flags|=4),vf(M,!0),M.tail===null&&M.tailMode==="hidden"&&!P.alternate&&!_n)return gr(f),null}else 2*er()-M.renderingStartTime>$v&&y!==1073741824&&(f.flags|=128,S=!0,vf(M,!1),f.lanes=4194304);M.isBackwards?(P.sibling=f.child,f.child=P):(u=M.last,u!==null?u.sibling=P:f.child=P,M.last=P)}return M.tail!==null?(f=M.tail,M.rendering=f,M.tail=f.sibling,M.renderingStartTime=er(),f.sibling=null,u=An.current,lt(An,S?u&1|2:u&1),f):(gr(f),null);case 22:case 23:return Yv(),S=f.memoizedState!==null,u!==null&&u.memoizedState!==null!==S&&(f.flags|=8192),S&&f.mode&1?li&1073741824&&(gr(f),rt&&f.subtreeFlags&6&&(f.flags|=8192)):gr(f),null;case 24:return null;case 25:return null}throw Error(o(156,f.tag))}var b3=a.ReactCurrentOwner,ai=!1;function Pr(u,f,y,S){f.child=u===null?NS(f,null,y,S):ic(f,u.child,y,S)}function uw(u,f,y,S,M){y=y.render;var P=f.ref;return ec(f,M),S=Av(u,f,y,S,P,M),y=Sv(),u!==null&&!ai?(f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~M,qs(u,f,M)):(_n&&y&&dv(f),f.flags|=1,Pr(u,f,S,M),f.child)}function fw(u,f,y,S,M){if(u===null){var P=y.type;return typeof P=="function"&&!Zv(P)&&P.defaultProps===void 0&&y.compare===null&&y.defaultProps===void 0?(f.tag=15,f.type=P,dw(u,f,P,S,M)):(u=Rp(y.type,null,S,f,f.mode,M),u.ref=f.ref,u.return=f,f.child=u)}if(P=u.child,!(u.lanes&M)){var W=P.memoizedProps;if(y=y.compare,y=y!==null?y:Wh,y(W,S)&&u.ref===f.ref)return qs(u,f,M)}return f.flags|=1,u=Wo(P,S),u.ref=f.ref,u.return=f,f.child=u}function dw(u,f,y,S,M){if(u!==null&&Wh(u.memoizedProps,S)&&u.ref===f.ref)if(ai=!1,(u.lanes&M)!==0)u.flags&131072&&(ai=!0);else return f.lanes=u.lanes,qs(u,f,M);return Rv(u,f,y,S,M)}function hw(u,f,y){var S=f.pendingProps,M=S.children,P=u!==null?u.memoizedState:null;if(S.mode==="hidden")if(!(f.mode&1))f.memoizedState={baseLanes:0,cachePool:null},lt(lc,li),li|=y;else if(y&1073741824)f.memoizedState={baseLanes:0,cachePool:null},S=P!==null?P.baseLanes:y,lt(lc,li),li|=S;else return u=P!==null?P.baseLanes|y:y,f.lanes=f.childLanes=1073741824,f.memoizedState={baseLanes:u,cachePool:null},f.updateQueue=null,lt(lc,li),li|=u,null;else P!==null?(S=P.baseLanes|y,f.memoizedState=null):S=y,lt(lc,li),li|=S;return Pr(u,f,M,y),f.child}function pw(u,f){var y=f.ref;(u===null&&y!==null||u!==null&&u.ref!==y)&&(f.flags|=512,f.flags|=2097152)}function Rv(u,f,y,S,M){var P=nn(y)?qt:Zt.current;return P=$t(f,P),ec(f,M),y=Av(u,f,y,S,P,M),S=Sv(),u!==null&&!ai?(f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~M,qs(u,f,M)):(_n&&S&&dv(f),f.flags|=1,Pr(u,f,y,M),f.child)}function mw(u,f,y,S,M){if(nn(y)){var P=!0;Yt(f)}else P=!1;if(ec(f,M),f.stateNode===null)u!==null&&(u.alternate=null,f.alternate=null,f.flags|=2),RS(f,y,S),fv(f,y,S,M),S=!0;else if(u===null){var W=f.stateNode,se=f.memoizedProps;W.props=se;var xe=W.context,Ue=y.contextType;typeof Ue=="object"&&Ue!==null?Ue=Si(Ue):(Ue=nn(y)?qt:Zt.current,Ue=$t(f,Ue));var st=y.getDerivedStateFromProps,Tt=typeof st=="function"||typeof W.getSnapshotBeforeUpdate=="function";Tt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(se!==S||xe!==Ue)&&PS(f,W,S,Ue),Uo=!1;var vt=f.memoizedState;W.state=vt,Jh(f,S,W,M),xe=f.memoizedState,se!==S||vt!==xe||At.current||Uo?(typeof st=="function"&&(uv(f,y,st,S),xe=f.memoizedState),(se=Uo||CS(f,y,se,S,vt,xe,Ue))?(Tt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(f.flags|=4194308)):(typeof W.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=S,f.memoizedState=xe),W.props=S,W.state=xe,W.context=Ue,S=se):(typeof W.componentDidMount=="function"&&(f.flags|=4194308),S=!1)}else{W=f.stateNode,wS(u,f),se=f.memoizedProps,Ue=f.type===f.elementType?se:ji(f.type,se),W.props=Ue,Tt=f.pendingProps,vt=W.context,xe=y.contextType,typeof xe=="object"&&xe!==null?xe=Si(xe):(xe=nn(y)?qt:Zt.current,xe=$t(f,xe));var cn=y.getDerivedStateFromProps;(st=typeof cn=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(se!==Tt||vt!==xe)&&PS(f,W,S,xe),Uo=!1,vt=f.memoizedState,W.state=vt,Jh(f,S,W,M);var dt=f.memoizedState;se!==Tt||vt!==dt||At.current||Uo?(typeof cn=="function"&&(uv(f,y,cn,S),dt=f.memoizedState),(Ue=Uo||CS(f,y,Ue,S,vt,dt,xe)||!1)?(st||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(S,dt,xe),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(S,dt,xe)),typeof W.componentDidUpdate=="function"&&(f.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof W.componentDidUpdate!="function"||se===u.memoizedProps&&vt===u.memoizedState||(f.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||se===u.memoizedProps&&vt===u.memoizedState||(f.flags|=1024),f.memoizedProps=S,f.memoizedState=dt),W.props=S,W.state=dt,W.context=xe,S=Ue):(typeof W.componentDidUpdate!="function"||se===u.memoizedProps&&vt===u.memoizedState||(f.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||se===u.memoizedProps&&vt===u.memoizedState||(f.flags|=1024),S=!1)}return Pv(u,f,y,S,P,M)}function Pv(u,f,y,S,M,P){pw(u,f);var W=(f.flags&128)!==0;if(!S&&!W)return M&&zt(f,y,!1),qs(u,f,P);S=f.stateNode,b3.current=f;var se=W&&typeof y.getDerivedStateFromError!="function"?null:S.render();return f.flags|=1,u!==null&&W?(f.child=ic(f,u.child,null,P),f.child=ic(f,null,se,P)):Pr(u,f,se,P),f.memoizedState=S.state,M&&zt(f,y,!0),f.child}function gw(u){var f=u.stateNode;f.pendingContext?wt(u,f.pendingContext,f.pendingContext!==f.context):f.context&&wt(u,f.context,!1),vv(u,f.containerInfo)}function vw(u,f,y,S,M){return rc(),gv(M),f.flags|=256,Pr(u,f,y,S),f.child}var cp={dehydrated:null,treeContext:null,retryLane:0};function up(u){return{baseLanes:u,cachePool:null}}function yw(u,f,y){var S=f.pendingProps,M=An.current,P=!1,W=(f.flags&128)!==0,se;if((se=W)||(se=u!==null&&u.memoizedState===null?!1:(M&2)!==0),se?(P=!0,f.flags&=-129):(u===null||u.memoizedState!==null)&&(M|=1),lt(An,M&1),u===null)return mv(f),u=f.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?(f.mode&1?xs(u)?f.lanes=8:f.lanes=1073741824:f.lanes=1,null):(M=S.children,u=S.fallback,P?(S=f.mode,P=f.child,M={mode:"hidden",children:M},!(S&1)&&P!==null?(P.childLanes=0,P.pendingProps=M):P=Pp(M,S,0,null),u=Xa(u,S,y,null),P.return=f,u.return=f,P.sibling=u,f.child=P,f.child.memoizedState=up(y),f.memoizedState=cp,u):Iv(f,M));if(M=u.memoizedState,M!==null){if(se=M.dehydrated,se!==null){if(W)return f.flags&256?(f.flags&=-257,fp(u,f,y,Error(o(422)))):f.memoizedState!==null?(f.child=u.child,f.flags|=128,null):(P=S.fallback,M=f.mode,S=Pp({mode:"visible",children:S.children},M,0,null),P=Xa(P,M,y,null),P.flags|=2,S.return=f,P.return=f,S.sibling=P,f.child=S,f.mode&1&&ic(f,u.child,null,y),f.child.memoizedState=up(y),f.memoizedState=cp,P);if(!(f.mode&1))f=fp(u,f,y,null);else if(xs(se))f=fp(u,f,y,Error(o(419)));else if(S=(y&u.childLanes)!==0,ai||S){if(S=Gn,S!==null){switch(y&-y){case 4:P=2;break;case 16:P=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:P=32;break;case 536870912:P=268435456;break;default:P=0}S=P&(S.suspendedLanes|y)?0:P,S!==0&&S!==M.retryLane&&(M.retryLane=S,Ci(u,S,-1))}Qv(),f=fp(u,f,y,Error(o(421)))}else Xs(se)?(f.flags|=128,f.child=u.child,f=z3.bind(null,u),Es(se,f),f=null):(y=M.treeContext,Re&&(oi=nf(se),si=f,_n=!0,Ji=null,of=!1,y!==null&&(wi[Mi++]=Ys,wi[Mi++]=Qs,wi[Mi++]=Ua,Ys=y.id,Qs=y.overflow,Ua=f)),f=Iv(f,f.pendingProps.children),f.flags|=4096);return f}return P?(S=xw(u,f,S.children,S.fallback,y),P=f.child,M=u.child.memoizedState,P.memoizedState=M===null?up(y):{baseLanes:M.baseLanes|y,cachePool:null},P.childLanes=u.childLanes&~y,f.memoizedState=cp,S):(y=_w(u,f,S.children,y),f.memoizedState=null,y)}return P?(S=xw(u,f,S.children,S.fallback,y),P=f.child,M=u.child.memoizedState,P.memoizedState=M===null?up(y):{baseLanes:M.baseLanes|y,cachePool:null},P.childLanes=u.childLanes&~y,f.memoizedState=cp,S):(y=_w(u,f,S.children,y),f.memoizedState=null,y)}function Iv(u,f){return f=Pp({mode:"visible",children:f},u.mode,0,null),f.return=u,u.child=f}function _w(u,f,y,S){var M=u.child;return u=M.sibling,y=Wo(M,{mode:"visible",children:y}),!(f.mode&1)&&(y.lanes=S),y.return=f,y.sibling=null,u!==null&&(S=f.deletions,S===null?(f.deletions=[u],f.flags|=16):S.push(u)),f.child=y}function xw(u,f,y,S,M){var P=f.mode;u=u.child;var W=u.sibling,se={mode:"hidden",children:y};return!(P&1)&&f.child!==u?(y=f.child,y.childLanes=0,y.pendingProps=se,f.deletions=null):(y=Wo(u,se),y.subtreeFlags=u.subtreeFlags&14680064),W!==null?S=Wo(W,S):(S=Xa(S,P,M,null),S.flags|=2),S.return=f,y.return=f,y.sibling=S,f.child=y,S}function fp(u,f,y,S){return S!==null&&gv(S),ic(f,u.child,null,y),u=Iv(f,f.pendingProps.children),u.flags|=2,f.memoizedState=null,u}function Ew(u,f,y){u.lanes|=f;var S=u.alternate;S!==null&&(S.lanes|=f),lv(u.return,f,y)}function Bv(u,f,y,S,M){var P=u.memoizedState;P===null?u.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:S,tail:y,tailMode:M}:(P.isBackwards=f,P.rendering=null,P.renderingStartTime=0,P.last=S,P.tail=y,P.tailMode=M)}function Aw(u,f,y){var S=f.pendingProps,M=S.revealOrder,P=S.tail;if(Pr(u,f,S.children,y),S=An.current,S&2)S=S&1|2,f.flags|=128;else{if(u!==null&&u.flags&128)e:for(u=f.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&Ew(u,y,f);else if(u.tag===19)Ew(u,y,f);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===f)break e;for(;u.sibling===null;){if(u.return===null||u.return===f)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}S&=1}if(lt(An,S),!(f.mode&1))f.memoizedState=null;else switch(M){case"forwards":for(y=f.child,M=null;y!==null;)u=y.alternate,u!==null&&qh(u)===null&&(M=y),y=y.sibling;y=M,y===null?(M=f.child,f.child=null):(M=y.sibling,y.sibling=null),Bv(f,!1,M,y,P);break;case"backwards":for(y=null,M=f.child,f.child=null;M!==null;){if(u=M.alternate,u!==null&&qh(u)===null){f.child=M;break}u=M.sibling,M.sibling=y,y=M,M=u}Bv(f,!0,y,null,P);break;case"together":Bv(f,!1,null,null,void 0);break;default:f.memoizedState=null}return f.child}function qs(u,f,y){if(u!==null&&(f.dependencies=u.dependencies),cc|=f.lanes,!(y&f.childLanes))return null;if(u!==null&&f.child!==u.child)throw Error(o(153));if(f.child!==null){for(u=f.child,y=Wo(u,u.pendingProps),f.child=y,y.return=f;u.sibling!==null;)u=u.sibling,y=y.sibling=Wo(u,u.pendingProps),y.return=f;y.sibling=null}return f.child}function C3(u,f,y){switch(f.tag){case 3:gw(f),rc();break;case 5:US(f);break;case 1:nn(f.type)&&Yt(f);break;case 4:vv(f,f.stateNode.containerInfo);break;case 10:SS(f,f.type._context,f.memoizedProps.value);break;case 13:var S=f.memoizedState;if(S!==null)return S.dehydrated!==null?(lt(An,An.current&1),f.flags|=128,null):y&f.child.childLanes?yw(u,f,y):(lt(An,An.current&1),u=qs(u,f,y),u!==null?u.sibling:null);lt(An,An.current&1);break;case 19:if(S=(y&f.childLanes)!==0,u.flags&128){if(S)return Aw(u,f,y);f.flags|=128}var M=f.memoizedState;if(M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),lt(An,An.current),S)break;return null;case 22:case 23:return f.lanes=0,hw(u,f,y)}return qs(u,f,y)}function R3(u,f){switch(hv(f),f.tag){case 1:return nn(f.type)&&Un(),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return oc(),_t(At),_t(Zt),xv(),u=f.flags,u&65536&&!(u&128)?(f.flags=u&-65537|128,f):null;case 5:return yv(f),null;case 13:if(_t(An),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(o(340));rc()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return _t(An),null;case 4:return oc(),null;case 10:return av(f.type._context),null;case 22:case 23:return Yv(),null;case 24:return null;default:return null}}var dp=!1,Ha=!1,P3=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function hp(u,f){var y=u.ref;if(y!==null)if(typeof y=="function")try{y(null)}catch(S){Jr(u,f,S)}else y.current=null}function Lv(u,f,y){try{y()}catch(S){Jr(u,f,S)}}var Sw=!1;function I3(u,f){for(Z(u.containerInfo),Ke=f;Ke!==null;)if(u=Ke,f=u.child,(u.subtreeFlags&1028)!==0&&f!==null)f.return=u,Ke=f;else for(;Ke!==null;){u=Ke;try{var y=u.alternate;if(u.flags&1024)switch(u.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var S=y.memoizedProps,M=y.memoizedState,P=u.stateNode,W=P.getSnapshotBeforeUpdate(u.elementType===u.type?S:ji(u.type,S),M);P.__reactInternalSnapshotBeforeUpdate=W}break;case 3:rt&&Ge(u.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(se){Jr(u,u.return,se)}if(f=u.sibling,f!==null){f.return=u.return,Ke=f;break}Ke=u.return}return y=Sw,Sw=!1,y}function Ga(u,f,y){var S=f.updateQueue;if(S=S!==null?S.lastEffect:null,S!==null){var M=S=S.next;do{if((M.tag&u)===u){var P=M.destroy;M.destroy=void 0,P!==void 0&&Lv(f,y,P)}M=M.next}while(M!==S)}}function yf(u,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var y=f=f.next;do{if((y.tag&u)===u){var S=y.create;y.destroy=S()}y=y.next}while(y!==f)}}function Dv(u){var f=u.ref;if(f!==null){var y=u.stateNode;switch(u.tag){case 5:u=ne(y);break;default:u=y}typeof f=="function"?f(u):f.current=u}}function ww(u,f,y){if(Ss&&typeof Ss.onCommitFiberUnmount=="function")try{Ss.onCommitFiberUnmount(Gh,f)}catch{}switch(f.tag){case 0:case 11:case 14:case 15:if(u=f.updateQueue,u!==null&&(u=u.lastEffect,u!==null)){var S=u=u.next;do{var M=S,P=M.destroy;M=M.tag,P!==void 0&&(M&2||M&4)&&Lv(f,y,P),S=S.next}while(S!==u)}break;case 1:if(hp(f,y),u=f.stateNode,typeof u.componentWillUnmount=="function")try{u.props=f.memoizedProps,u.state=f.memoizedState,u.componentWillUnmount()}catch(W){Jr(f,y,W)}break;case 5:hp(f,y);break;case 4:rt?Pw(u,f,y):J&&J&&(f=f.stateNode.containerInfo,y=Ut(f),Ai(f,y))}}function Mw(u,f,y){for(var S=f;;)if(ww(u,S,y),S.child===null||rt&&S.tag===4){if(S===f)break;for(;S.sibling===null;){if(S.return===null||S.return===f)return;S=S.return}S.sibling.return=S.return,S=S.sibling}else S.child.return=S,S=S.child}function Tw(u){var f=u.alternate;f!==null&&(u.alternate=null,Tw(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&tt(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function bw(u){return u.tag===5||u.tag===3||u.tag===4}function Cw(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||bw(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function Rw(u){if(rt){e:{for(var f=u.return;f!==null;){if(bw(f))break e;f=f.return}throw Error(o(160))}var y=f;switch(y.tag){case 5:f=y.stateNode,y.flags&32&&(nt(f),y.flags&=-33),y=Cw(u),Fv(u,y,f);break;case 3:case 4:f=y.stateNode.containerInfo,y=Cw(u),Ov(u,y,f);break;default:throw Error(o(161))}}}function Ov(u,f,y){var S=u.tag;if(S===5||S===6)u=u.stateNode,f?Ce(y,u,f):Ye(y,u);else if(S!==4&&(u=u.child,u!==null))for(Ov(u,f,y),u=u.sibling;u!==null;)Ov(u,f,y),u=u.sibling}function Fv(u,f,y){var S=u.tag;if(S===5||S===6)u=u.stateNode,f?me(y,u,f):ke(y,u);else if(S!==4&&(u=u.child,u!==null))for(Fv(u,f,y),u=u.sibling;u!==null;)Fv(u,f,y),u=u.sibling}function Pw(u,f,y){for(var S=f,M=!1,P,W;;){if(!M){M=S.return;e:for(;;){if(M===null)throw Error(o(160));switch(P=M.stateNode,M.tag){case 5:W=!1;break e;case 3:P=P.containerInfo,W=!0;break e;case 4:P=P.containerInfo,W=!0;break e}M=M.return}M=!0}if(S.tag===5||S.tag===6)Mw(u,S,y),W?Ne(P,S.stateNode):Be(P,S.stateNode);else if(S.tag===18)W?he(P,S.stateNode):ce(P,S.stateNode);else if(S.tag===4){if(S.child!==null){P=S.stateNode.containerInfo,W=!0,S.child.return=S,S=S.child;continue}}else if(ww(u,S,y),S.child!==null){S.child.return=S,S=S.child;continue}if(S===f)break;for(;S.sibling===null;){if(S.return===null||S.return===f)return;S=S.return,S.tag===4&&(M=!1)}S.sibling.return=S.return,S=S.sibling}}function Nv(u,f){if(rt){switch(f.tag){case 0:case 11:case 14:case 15:Ga(3,f,f.return),yf(3,f),Ga(5,f,f.return);return;case 1:return;case 5:var y=f.stateNode;if(y!=null){var S=f.memoizedProps;u=u!==null?u.memoizedProps:S;var M=f.type,P=f.updateQueue;f.updateQueue=null,P!==null&&te(y,P,M,u,S,f)}return;case 6:if(f.stateNode===null)throw Error(o(162));y=f.memoizedProps,He(f.stateNode,u!==null?u.memoizedProps:y,y);return;case 3:Re&&u!==null&&u.memoizedState.isDehydrated&&H(f.stateNode.containerInfo);return;case 12:return;case 13:pp(f);return;case 19:pp(f);return;case 17:return}throw Error(o(163))}switch(f.tag){case 0:case 11:case 14:case 15:Ga(3,f,f.return),yf(3,f),Ga(5,f,f.return);return;case 12:return;case 13:pp(f);return;case 19:pp(f);return;case 3:Re&&u!==null&&u.memoizedState.isDehydrated&&H(f.stateNode.containerInfo);break;case 22:case 23:return}e:if(J){switch(f.tag){case 1:case 5:case 6:break e;case 3:case 4:f=f.stateNode,Ai(f.containerInfo,f.pendingChildren);break e}throw Error(o(163))}}function pp(u){var f=u.updateQueue;if(f!==null){u.updateQueue=null;var y=u.stateNode;y===null&&(y=u.stateNode=new P3),f.forEach(function(S){var M=H3.bind(null,u,S);y.has(S)||(y.add(S),S.then(M,M))})}}function B3(u,f){for(Ke=f;Ke!==null;){f=Ke;var y=f.deletions;if(y!==null)for(var S=0;S";case gp:return":has("+(zv(u)||"")+")";case vp:return'[role="'+u.value+'"]';case _p:return'"'+u.value+'"';case yp:return'[data-testname="'+u.value+'"]';default:throw Error(o(365))}}function Ow(u,f){var y=[];u=[u,0];for(var S=0;SM&&(M=W),S&=~P}if(S=M,S=er()-S,S=(120>S?120:480>S?480:1080>S?1080:1920>S?1920:3e3>S?3e3:4320>S?4320:1960*D3(S/1960))-S,10u?16:u,Ho===null)var S=!1;else{if(u=Ho,Ho=null,wp=0,Nt&6)throw Error(o(331));var M=Nt;for(Nt|=4,Ke=u.current;Ke!==null;){var P=Ke,W=P.child;if(Ke.flags&16){var se=P.deletions;if(se!==null){for(var xe=0;xeer()-Wv?Va(u,0):Vv|=y),jr(u,f)}function Ww(u,f){f===0&&(u.mode&1?(f=zh,zh<<=1,!(zh&130023424)&&(zh=4194304)):f=1);var y=Ir();u=bp(u,f),u!==null&&(sf(u,f,y),jr(u,y))}function z3(u){var f=u.memoizedState,y=0;f!==null&&(y=f.retryLane),Ww(u,y)}function H3(u,f){var y=0;switch(u.tag){case 13:var S=u.stateNode,M=u.memoizedState;M!==null&&(y=M.retryLane);break;case 19:S=u.stateNode;break;default:throw Error(o(314))}S!==null&&S.delete(f),Ww(u,y)}var $w;$w=function(u,f,y){if(u!==null)if(u.memoizedProps!==f.pendingProps||At.current)ai=!0;else{if(!(u.lanes&y)&&!(f.flags&128))return ai=!1,C3(u,f,y);ai=!!(u.flags&131072)}else ai=!1,_n&&f.flags&1048576&&IS(f,Qh,f.index);switch(f.lanes=0,f.tag){case 2:var S=f.type;u!==null&&(u.alternate=null,f.alternate=null,f.flags|=2),u=f.pendingProps;var M=$t(f,Zt.current);ec(f,y),M=Av(null,f,S,u,M,y);var P=Sv();return f.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,nn(S)?(P=!0,Yt(f)):P=!1,f.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,cv(f),M.updater=Kh,f.stateNode=M,M._reactInternals=f,fv(f,S,u,y),f=Pv(null,f,S,!0,P,y)):(f.tag=0,_n&&P&&dv(f),Pr(null,f,M,y),f=f.child),f;case 16:S=f.elementType;e:{switch(u!==null&&(u.alternate=null,f.alternate=null,f.flags|=2),u=f.pendingProps,M=S._init,S=M(S._payload),f.type=S,M=f.tag=V3(S),u=ji(S,u),M){case 0:f=Rv(null,f,S,u,y);break e;case 1:f=mw(null,f,S,u,y);break e;case 11:f=uw(null,f,S,u,y);break e;case 14:f=fw(null,f,S,ji(S.type,u),y);break e}throw Error(o(306,S,""))}return f;case 0:return S=f.type,M=f.pendingProps,M=f.elementType===S?M:ji(S,M),Rv(u,f,S,M,y);case 1:return S=f.type,M=f.pendingProps,M=f.elementType===S?M:ji(S,M),mw(u,f,S,M,y);case 3:e:{if(gw(f),u===null)throw Error(o(387));S=f.pendingProps,P=f.memoizedState,M=P.element,wS(u,f),Jh(f,S,null,y);var W=f.memoizedState;if(S=W.element,Re&&P.isDehydrated)if(P={element:S,isDehydrated:!1,cache:W.cache,transitions:W.transitions},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){M=Error(o(423)),f=vw(u,f,S,y,M);break e}else if(S!==M){M=Error(o(424)),f=vw(u,f,S,y,M);break e}else for(Re&&(oi=Zl(f.stateNode.containerInfo),si=f,_n=!0,Ji=null,of=!1),y=NS(f,null,S,y),f.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling;else{if(rc(),S===M){f=qs(u,f,y);break e}Pr(u,f,S,y)}f=f.child}return f;case 5:return US(f),u===null&&mv(f),S=f.type,M=f.pendingProps,P=u!==null?u.memoizedProps:null,W=M.children,Le(S,M)?W=null:P!==null&&Le(S,P)&&(f.flags|=32),pw(u,f),Pr(u,f,W,y),f.child;case 6:return u===null&&mv(f),null;case 13:return yw(u,f,y);case 4:return vv(f,f.stateNode.containerInfo),S=f.pendingProps,u===null?f.child=ic(f,null,S,y):Pr(u,f,S,y),f.child;case 11:return S=f.type,M=f.pendingProps,M=f.elementType===S?M:ji(S,M),uw(u,f,S,M,y);case 7:return Pr(u,f,f.pendingProps,y),f.child;case 8:return Pr(u,f,f.pendingProps.children,y),f.child;case 12:return Pr(u,f,f.pendingProps.children,y),f.child;case 10:e:{if(S=f.type._context,M=f.pendingProps,P=f.memoizedProps,W=M.value,SS(f,S,W),P!==null)if(ws(P.value,W)){if(P.children===M.children&&!At.current){f=qs(u,f,y);break e}}else for(P=f.child,P!==null&&(P.return=f);P!==null;){var se=P.dependencies;if(se!==null){W=P.child;for(var xe=se.firstContext;xe!==null;){if(xe.context===S){if(P.tag===1){xe=Ks(-1,y&-y),xe.tag=2;var Ue=P.updateQueue;if(Ue!==null){Ue=Ue.shared;var st=Ue.pending;st===null?xe.next=xe:(xe.next=st.next,st.next=xe),Ue.pending=xe}}P.lanes|=y,xe=P.alternate,xe!==null&&(xe.lanes|=y),lv(P.return,y,f),se.lanes|=y;break}xe=xe.next}}else if(P.tag===10)W=P.type===f.type?null:P.child;else if(P.tag===18){if(W=P.return,W===null)throw Error(o(341));W.lanes|=y,se=W.alternate,se!==null&&(se.lanes|=y),lv(W,y,f),W=P.sibling}else W=P.child;if(W!==null)W.return=P;else for(W=P;W!==null;){if(W===f){W=null;break}if(P=W.sibling,P!==null){P.return=W.return,W=P;break}W=W.return}P=W}Pr(u,f,M.children,y),f=f.child}return f;case 9:return M=f.type,S=f.pendingProps.children,ec(f,y),M=Si(M),S=S(M),f.flags|=1,Pr(u,f,S,y),f.child;case 14:return S=f.type,M=ji(S,f.pendingProps),M=ji(S.type,M),fw(u,f,S,M,y);case 15:return dw(u,f,f.type,f.pendingProps,y);case 17:return S=f.type,M=f.pendingProps,M=f.elementType===S?M:ji(S,M),u!==null&&(u.alternate=null,f.alternate=null,f.flags|=2),f.tag=1,nn(S)?(u=!0,Yt(f)):u=!1,ec(f,y),RS(f,S,M),fv(f,S,M,y),Pv(null,f,S,!0,u,y);case 19:return Aw(u,f,y);case 22:return hw(u,f,y)}throw Error(o(156,f.tag))};function Xw(u,f){return tv(u,f)}function G3(u,f,y,S){this.tag=u,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ri(u,f,y,S){return new G3(u,f,y,S)}function Zv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function V3(u){if(typeof u=="function")return Zv(u)?1:0;if(u!=null){if(u=u.$$typeof,u===E)return 11;if(u===A)return 14}return 2}function Wo(u,f){var y=u.alternate;return y===null?(y=Ri(u.tag,f,u.key,u.mode),y.elementType=u.elementType,y.type=u.type,y.stateNode=u.stateNode,y.alternate=u,u.alternate=y):(y.pendingProps=f,y.type=u.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=u.flags&14680064,y.childLanes=u.childLanes,y.lanes=u.lanes,y.child=u.child,y.memoizedProps=u.memoizedProps,y.memoizedState=u.memoizedState,y.updateQueue=u.updateQueue,f=u.dependencies,y.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},y.sibling=u.sibling,y.index=u.index,y.ref=u.ref,y}function Rp(u,f,y,S,M,P){var W=2;if(S=u,typeof u=="function")Zv(u)&&(W=1);else if(typeof u=="string")W=5;else e:switch(u){case d:return Xa(y.children,M,P,f);case h:W=8,M|=8;break;case p:return u=Ri(12,y,f,M|2),u.elementType=p,u.lanes=P,u;case x:return u=Ri(13,y,f,M),u.elementType=x,u.lanes=P,u;case g:return u=Ri(19,y,f,M),u.elementType=g,u.lanes=P,u;case w:return Pp(y,M,P,f);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case m:W=10;break e;case v:W=9;break e;case E:W=11;break e;case A:W=14;break e;case _:W=16,S=null;break e}throw Error(o(130,u==null?u:typeof u,""))}return f=Ri(W,y,f,M),f.elementType=u,f.type=S,f.lanes=P,f}function Xa(u,f,y,S){return u=Ri(7,u,S,f),u.lanes=y,u}function Pp(u,f,y,S){return u=Ri(22,u,S,f),u.elementType=w,u.lanes=y,u.stateNode={},u}function qv(u,f,y){return u=Ri(6,u,null,f),u.lanes=y,u}function ey(u,f,y){return f=Ri(4,u.children!==null?u.children:[],u.key,f),f.lanes=y,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}function W3(u,f,y,S,M){this.tag=f,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ut,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=q0(0),this.expirationTimes=q0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=q0(0),this.identifierPrefix=S,this.onRecoverableError=M,Re&&(this.mutableSourceEagerHydrationData=null)}function jw(u,f,y,S,M,P,W,se,xe){return u=new W3(u,f,y,se,xe),f===1?(f=1,P===!0&&(f|=8)):f=0,P=Ri(3,null,null,f),u.current=P,P.stateNode=u,P.memoizedState={element:S,isDehydrated:y,cache:null,transitions:null},cv(P),u}function Jw(u){if(!u)return Mt;u=u._reactInternals;e:{if(R(u)!==u||u.tag!==1)throw Error(o(170));var f=u;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(nn(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(o(171))}if(u.tag===1){var y=u.type;if(nn(y))return En(u,y,f)}return f}function Kw(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(o(188)):(u=Object.keys(u).join(","),Error(o(268,u)));return u=j(f),u===null?null:u.stateNode}function Yw(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var y=u.retryLane;u.retryLane=y!==0&&y=Ue&&P>=Tt&&M<=st&&W<=vt){u.splice(f,1);break}else if(S!==Ue||y.width!==xe.width||vtW){if(!(P!==Tt||y.height!==xe.height||stM)){Ue>S&&(xe.width+=Ue-S,xe.x=S),stP&&(xe.height+=Tt-P,xe.y=P),vty&&(y=W)),W ")+` - -No matching component was found for: - `)+u.join(" > ")}return null},t.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return ne(u.child.stateNode);default:return u.child.stateNode}},t.injectIntoDevTools=function(u){if(u={bundleType:u.bundleType,version:u.version,rendererPackageName:u.rendererPackageName,rendererConfig:u.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:$3,findFiberByHostInstance:u.findFiberByHostInstance||X3,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)u=!0;else{try{Gh=f.inject(u),Ss=f}catch{}u=!!f.checkDCE}}return u},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(u,f,y,S){if(!at)throw Error(o(363));u=Hv(u,f);var M=Ie(u,y,S).disconnect;return{disconnect:function(){M()}}},t.registerMutableSourceForHydration=function(u,f){var y=f._getVersion;y=y(f._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[f,y]:u.mutableSourceEagerHydrationData.push(f,y)},t.runWithPriority=function(u,f){var y=Xt;try{return Xt=u,f()}finally{Xt=y}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(u,f,y,S){var M=f.current,P=Ir(),W=Go(M);return y=Jw(y),f.context===null?f.context=y:f.pendingContext=y,f=Ks(P,W),f.payload={element:u},S=S===void 0?null:S,S!==null&&(f.callback=S),ko(M,f),u=Ci(M,W,P),u!==null&&jh(u,M,W),W},t};(function(n){n.exports=w8})(A8);const M8=q1(m1),T8=n=>typeof n=="object"&&typeof n.then=="function",xl=[];function NB(n,e,t=(r,i)=>r===i){if(n===e)return!0;if(!n||!e)return!1;const r=n.length;if(e.length!==r)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,r.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:r.equal,remove:()=>{const s=xl.indexOf(i);s!==-1&&xl.splice(s,1)},promise:(T8(n)?n:n(...e)).then(s=>{i.response=s,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(s=>i.error=s)};if(xl.push(i),!t)throw i.promise}const b8=(n,e,t)=>UB(n,e,!1,t),C8=(n,e,t)=>void UB(n,e,!0,t),R8=n=>{if(n===void 0||n.length===0)xl.splice(0,xl.length);else{const e=xl.find(t=>NB(n,t.keys,t.equal));e&&e.remove()}},jA={},kB=n=>void Object.assign(jA,n);function P8(n,e){function t(d,{args:h=[],attach:p,...m},v){let E=`${d[0].toUpperCase()}${d.slice(1)}`,x;if(d==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=m.object;x=kc(g,{type:d,root:v,attach:p,primitive:!0})}else{const g=jA[E];if(!g)throw new Error(`R3F: ${E} 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(h))throw new Error("R3F: The args prop must be an array!");x=kc(new g(...h),{type:d,root:v,attach:p,memoizedProps:{args:h}})}return x.__r3f.attach===void 0&&(x instanceof It?x.__r3f.attach="geometry":x instanceof Xn&&(x.__r3f.attach="material")),E!=="inject"&&c_(x,m),x}function r(d,h){let p=!1;if(h){var m,v;(m=h.__r3f)!=null&&m.attach?l_(d,h,h.__r3f.attach):h.isObject3D&&d.isObject3D&&(d.add(h),p=!0),p||(v=d.__r3f)==null||v.objects.push(h),h.__r3f||kc(h,{}),h.__r3f.parent=d,v1(h),zc(h)}}function i(d,h,p){let m=!1;if(h){var v,E;if((v=h.__r3f)!=null&&v.attach)l_(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){h.parent=d,h.dispatchEvent({type:"added"});const x=d.children.filter(A=>A!==h),g=x.indexOf(p);d.children=[...x.slice(0,g),h,...x.slice(g)],m=!0}m||(E=d.__r3f)==null||E.objects.push(h),h.__r3f||kc(h,{}),h.__r3f.parent=d,v1(h),zc(h)}}function s(d,h,p=!1){d&&[...d].forEach(m=>o(h,m,p))}function o(d,h,p){if(h){var m,v,E;if(h.__r3f&&(h.__r3f.parent=null),(m=d.__r3f)!=null&&m.objects&&(d.__r3f.objects=d.__r3f.objects.filter(w=>w!==h)),(v=h.__r3f)!=null&&v.attach)Ub(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){var x;d.remove(h),(x=h.__r3f)!=null&&x.root&&N8(h.__r3f.root,h)}const A=(E=h.__r3f)==null?void 0:E.primitive,_=p===void 0?h.dispose!==null&&!A:p;if(!A){var g;s((g=h.__r3f)==null?void 0:g.objects,h,_),s(h.children,h,_)}delete h.__r3f,_&&h.dispose&&h.type!=="Scene"&&Kd.unstable_scheduleCallback(Kd.unstable_IdlePriority,()=>{try{h.dispose()}catch{}}),zc(d)}}function a(d,h,p,m){var v;const E=(v=d.__r3f)==null?void 0:v.parent;if(!E)return;const x=t(h,p,d.__r3f.root);if(d.children){for(const g of d.children)g.__r3f&&r(x,g);d.children=d.children.filter(g=>!g.__r3f)}d.__r3f.objects.forEach(g=>r(x,g)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(E,d),x.parent&&(x.__r3f.autoRemovedBeforeAppend=!0),r(E,x),x.raycast&&x.__r3f.eventCount&&x.__r3f.root.getState().internal.interaction.push(x),[m,m.alternate].forEach(g=>{g!==null&&(g.stateNode=x,g.ref&&(typeof g.ref=="function"?g.ref(x):g.ref.current=x))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:M8({createInstance:t,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,h)=>{if(!h)return;const p=d.getState().scene;p.__r3f&&(p.__r3f.root=d,r(p,h))},removeChildFromContainer:(d,h)=>{h&&o(d.getState().scene,h)},insertInContainerBefore:(d,h,p)=>{if(!h||!p)return;const m=d.getState().scene;m.__r3f&&i(m,h,p)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var h;const p=(h=d==null?void 0:d.__r3f)!=null?h:{};return Boolean(p.handlers)},prepareUpdate(d,h,p,m){if(d.__r3f.primitive&&m.object&&m.object!==d)return[!0];{const{args:v=[],children:E,...x}=m,{args:g=[],children:A,..._}=p;if(!Array.isArray(v))throw new Error("R3F: the args prop must be an array!");if(v.some((C,b)=>C!==g[b]))return[!0];const w=XB(d,x,_,!0);return w.changes.length?[!1,w]:null}},commitUpdate(d,[h,p],m,v,E,x){h?a(d,m,E,x):c_(d,p)},commitMount(d,h,p,m){var v;const E=(v=d.__r3f)!=null?v:{};d.raycast&&E.handlers&&E.eventCount&&d.__r3f.root.getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>kc(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var h;const{attach:p,parent:m}=(h=d.__r3f)!=null?h:{};p&&m&&Ub(m,d,p),d.isObject3D&&(d.visible=!1),zc(d)},unhideInstance(d,h){var p;const{attach:m,parent:v}=(p=d.__r3f)!=null?p:{};m&&v&&l_(v,d,m),(d.isObject3D&&h.visible==null||h.visible)&&(d.visible=!0),zc(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():ca.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&hn.fun(performance.now)?performance.now:hn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:hn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:hn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:c_}}var Db,Ob;const a_=n=>"colorSpace"in n||"outputColorSpace"in n,zB=()=>{var n;return(n=jA.ColorManagement)!=null?n:null},HB=n=>n&&n.isOrthographicCamera,I8=n=>n&&n.hasOwnProperty("current"),Ph=typeof window<"u"&&((Db=window.document)!=null&&Db.createElement||((Ob=window.navigator)==null?void 0:Ob.product)==="ReactNative")?D.useLayoutEffect:D.useEffect;function GB(n){const e=D.useRef(n);return Ph(()=>void(e.current=n),[n]),e}function B8({set:n}){return Ph(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class VB extends D.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}VB.getDerivedStateFromError=()=>({error:!0});const WB="__default",Fb=new Map,L8=n=>n&&!!n.memoized&&!!n.changes;function $B(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 Hf=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},hn={obj:n=>n===Object(n)&&!hn.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:r="reference",strict:i=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(hn.str(n)||hn.num(n))return n===e;const s=hn.obj(n);if(s&&r==="reference")return n===e;const o=hn.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"&&r==="shallow"){for(a in i?e:n)if(!hn.equ(n[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:n)if(n[a]!==e[a])return!1;if(hn.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 D8(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function O8(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function kc(n,e){const t=n;return(e!=null&&e.primitive||!t.__r3f)&&(t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e}),n}function g1(n,e){let t=n;if(e.includes("-")){const r=e.split("-"),i=r.pop();return t=r.reduce((s,o)=>s[o],n),{target:t,key:i}}else return{target:t,key:e}}const Nb=/-\d+$/;function l_(n,e,t){if(hn.str(t)){if(Nb.test(t)){const s=t.replace(Nb,""),{target:o,key:a}=g1(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=g1(n,t);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=t(n,e)}function Ub(n,e,t){var r,i;if(hn.str(t)){const{target:s,key:o}=g1(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(n,e);(i=e.__r3f)==null||delete i.previousAttach}function XB(n,{children:e,key:t,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){var d;const h=(d=n==null?void 0:n.__r3f)!=null?d:{},p=Object.entries(i),m=[];if(c){const E=Object.keys(l);for(let x=0;x{var g;if((g=n.__r3f)!=null&&g.primitive&&E==="object"||hn.equ(x,l[E]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(E))return m.push([E,x,!0,[]]);let A=[];E.includes("-")&&(A=E.split("-")),m.push([E,x,!1,A]);for(const _ in i){const w=i[_];_.startsWith(`${E}-`)&&m.push([_,w,!1,_.split("-")])}});const v={...i};return h.memoizedProps&&h.memoizedProps.args&&(v.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(v.attach=h.memoizedProps.attach),{memoized:v,changes:m}}function c_(n,e){var t,r,i;const s=(t=n.__r3f)!=null?t:{},o=s.root,a=(r=o==null||o.getState==null?void 0:o.getState())!=null?r:{},{memoized:l,changes:c}=L8(e)?e:XB(n,e),d=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let p=0;p_[w],n),!(A&&A.set))){const[_,...w]=x.reverse();g=w.reverse().reduce((C,b)=>C[b],n),m=_}if(v===WB+"remove")if(g.constructor){let _=Fb.get(g.constructor);_||(_=new g.constructor,Fb.set(g.constructor,_)),v=_[m]}else v=0;if(E)v?s.handlers[m]=v:delete s.handlers[m],s.eventCount=Object.keys(s.handlers).length;else if(A&&A.set&&(A.copy||A instanceof Tl)){if(Array.isArray(v))A.fromArray?A.fromArray(v):A.set(...v);else if(A.copy&&v&&v.constructor&&A.constructor===v.constructor)A.copy(v);else if(v!==void 0){const _=A instanceof Xe;!_&&A.setScalar?A.setScalar(v):A instanceof Tl&&v instanceof Tl?A.mask=v.mask:A.set(v),!zB()&&!a.linear&&_&&A.convertSRGBToLinear()}}else if(g[m]=v,g[m]instanceof gn&&g[m].format===Ur&&g[m].type===Ns){const _=g[m];a_(_)&&a_(a.gl)?_.colorSpace=a.gl.outputColorSpace:_.encoding=a.gl.outputEncoding}zc(n)}if(s.parent&&a.internal&&n.raycast&&d!==s.eventCount){const p=a.internal.interaction.indexOf(n);p>-1&&a.internal.interaction.splice(p,1),s.eventCount&&a.internal.interaction.push(n)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(i=n.__r3f)!=null&&i.parent&&v1(n),n}function zc(n){var e,t;const r=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();r&&r.internal.frames===0&&r.invalidate()}function v1(n){n.onUpdate==null||n.onUpdate(n)}function jB(n,e){n.manual||(HB(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 Om(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function F8(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return ca.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return ca.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return ca.ContinuousEventPriority;default:return ca.DefaultEventPriority}}function JB(n,e,t,r){const i=t.get(e);i&&(t.delete(e),t.size===0&&(n.delete(r),i.target.releasePointerCapture(r)))}function N8(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(r=>r!==e),t.initialHits=t.initialHits.filter(r=>r!==e),t.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((r,i)=>{JB(t.capturedMap,e,r,i)})}function U8(n){function e(l){const{internal:c}=n.getState(),d=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+h*h))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+d]}))}function r(l,c){const d=n.getState(),h=new Set,p=[],m=c?c(d.internal.interaction):d.internal.interaction;for(let g=0;g{const _=Hf(g.object),w=Hf(A.object);return!_||!w?g.distance-A.distance:w.events.priority-_.events.priority||g.distance-A.distance}).filter(g=>{const A=Om(g);return h.has(A)?!1:(h.add(A),!0)});d.events.filter&&(E=d.events.filter(E,d));for(const g of E){let A=g.object;for(;A;){var x;(x=A.__r3f)!=null&&x.eventCount&&p.push({...g,eventObject:A}),A=A.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let g of d.internal.capturedMap.get(l.pointerId).values())h.has(Om(g.intersection))||p.push(g.intersection);return p}function i(l,c,d,h){const p=n.getState();if(l.length){const m={stopped:!1};for(const v of l){const E=Hf(v.object)||p,{raycaster:x,pointer:g,camera:A,internal:_}=E,w=new G(g.x,g.y,0).unproject(A),C=L=>{var U,j;return(U=(j=_.capturedMap.get(L))==null?void 0:j.has(v.eventObject))!=null?U:!1},b=L=>{const U={intersection:v,target:c.target};_.capturedMap.has(L)?_.capturedMap.get(L).set(v.eventObject,U):_.capturedMap.set(L,new Map([[v.eventObject,U]])),c.target.setPointerCapture(L)},B=L=>{const U=_.capturedMap.get(L);U&&JB(_.capturedMap,v.eventObject,U,L)};let I={};for(let L in c){let U=c[L];typeof U!="function"&&(I[L]=U)}let R={...v,...I,pointer:g,intersections:l,stopped:m.stopped,delta:d,unprojectedPoint:w,ray:x.ray,camera:A,stopPropagation(){const L="pointerId"in c&&_.capturedMap.get(c.pointerId);if((!L||L.has(v.eventObject))&&(R.stopped=m.stopped=!0,_.hovered.size&&Array.from(_.hovered.values()).find(U=>U.eventObject===v.eventObject))){const U=l.slice(0,l.indexOf(v));s([...U,v])}},target:{hasPointerCapture:C,setPointerCapture:b,releasePointerCapture:B},currentTarget:{hasPointerCapture:C,setPointerCapture:b,releasePointerCapture:B},nativeEvent:c};if(h(R),m.stopped===!0)break}}return l}function s(l){const{internal:c}=n.getState();for(const d of c.hovered.values())if(!l.length||!l.find(h=>h.object===d.object&&h.index===d.index&&h.instanceId===d.instanceId)){const p=d.eventObject.__r3f,m=p==null?void 0:p.handlers;if(c.hovered.delete(Om(d)),p!=null&&p.eventCount){const v={...d,intersections:l};m.onPointerOut==null||m.onPointerOut(v),m.onPointerLeave==null||m.onPointerLeave(v)}}}function o(l,c){for(let d=0;ds([]);case"onLostPointerCapture":return c=>{const{internal:d}=n.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:h,internal:p}=n.getState();p.lastEvent.current=d;const m=l==="onPointerMove",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",x=r(d,m?t:void 0),g=v?e(d):0;l==="onPointerDown"&&(p.initialClick=[d.offsetX,d.offsetY],p.initialHits=x.map(_=>_.eventObject)),v&&!x.length&&g<=2&&(o(d,p.interaction),h&&h(d)),m&&s(x);function A(_){const w=_.eventObject,C=w.__r3f,b=C==null?void 0:C.handlers;if(C!=null&&C.eventCount)if(m){if(b.onPointerOver||b.onPointerEnter||b.onPointerOut||b.onPointerLeave){const B=Om(_),I=p.hovered.get(B);I?I.stopped&&_.stopPropagation():(p.hovered.set(B,_),b.onPointerOver==null||b.onPointerOver(_),b.onPointerEnter==null||b.onPointerEnter(_))}b.onPointerMove==null||b.onPointerMove(_)}else{const B=b[l];B?(!v||p.initialHits.includes(w))&&(o(d,p.interaction.filter(I=>!p.initialHits.includes(I))),B(_)):v&&p.initialHits.includes(w)&&o(d,p.interaction.filter(I=>!p.initialHits.includes(I)))}}i(x,d,g,A)}}return{handlePointer:a}}const k8=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],KB=n=>!!(n!=null&&n.render),JA=D.createContext(null),z8=(n,e)=>{const t=XA((a,l)=>{const c=new G,d=new G,h=new G;function p(g=l().camera,A=d,_=l().size){const{width:w,height:C,top:b,left:B}=_,I=w/C;A instanceof G?h.copy(A):h.set(...A);const R=g.getWorldPosition(c).distanceTo(h);if(HB(g))return{width:w/g.zoom,height:C/g.zoom,top:b,left:B,factor:1,distance:R,aspect:I};{const L=g.fov*Math.PI/180,U=2*Math.tan(L/2)*R,j=U*(w/C);return{width:j,height:U,top:b,left:B,factor:w/j,distance:R,aspect:I}}}let m;const v=g=>a(A=>({performance:{...A.performance,current:g}})),E=new Me;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,A)=>e(g,A,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new HA,pointer:E,mouse:E,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:p},setEvents:g=>a(A=>({...A,events:{...A.events,...g}})),setSize:(g,A,_,w,C)=>{const b=l().camera,B={width:g,height:A,top:w||0,left:C||0,updateStyle:_};a(I=>({size:B,viewport:{...I.viewport,...p(b,d,B)}}))},setDpr:g=>a(A=>{const _=$B(g);return{viewport:{...A.viewport,dpr:_,initialDpr:A.viewport.initialDpr||_}}}),setFrameloop:(g="always")=>{const A=l().clock;A.stop(),A.elapsedTime=0,g!=="never"&&(A.start(),A.elapsedTime=0),a(()=>({frameloop:g}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:D.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(g,A,_)=>{const w=l().internal;return w.priority=w.priority+(A>0?1:0),w.subscribers.push({ref:g,priority:A,store:_}),w.subscribers=w.subscribers.sort((C,b)=>C.priority-b.priority),()=>{const C=l().internal;C!=null&&C.subscribers&&(C.priority=C.priority-(A>0?1:0),C.subscribers=C.subscribers.filter(b=>b.ref!==g))}}}}}),r=t.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:h}=t.getState();if(l!==i||c.dpr!==s){var p;i=l,s=c.dpr,jB(a,l),d.setPixelRatio(c.dpr);const m=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,m)}a!==o&&(o=a,h(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let Fm,H8=new Set,G8=new Set,V8=new Set;function u_(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function Gf(n,e){switch(n){case"before":return u_(H8,e);case"after":return u_(G8,e);case"tail":return u_(V8,e)}}let f_,d_;function h_(n,e,t){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(r=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),f_=e.internal.subscribers,Fm=0;Fm0)&&!((c=i.gl.xr)!=null&&c.isPresenting)&&(t+=h_(l,i))}if(Gf("after",l),t===0)return Gf("tail",l),e=!1,cancelAnimationFrame(r)}function o(l,c=1){var d;if(!l)return n.forEach(h=>o(h.store.getState()),c);(d=l.gl.xr)!=null&&d.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+c),e||(e=!0,requestAnimationFrame(s)))}function a(l,c=!0,d,h){if(c&&Gf("before",l),d)h_(l,d,h);else for(const p of n.values())h_(l,p.store.getState());c&&Gf("after",l)}return{loop:s,invalidate:o,advance:a}}function KA(){const n=D.useContext(JA);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function Qr(n=t=>t,e){return KA()(n,e)}function $g(n,e=0){const t=KA(),r=t.getState().internal.subscribe,i=GB(n);return Ph(()=>r(i,e,t),[e,r,t]),null}function YB(n,e){return function(t,...r){const i=new t;return n&&n(i),Promise.all(r.map(s=>new Promise((o,a)=>i.load(s,l=>{l.scene&&Object.assign(l,D8(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l.message})`))))))}}function Fo(n,e,t,r){const i=Array.isArray(e)?e:[e],s=b8(YB(t,r),[n,...i],{equal:hn.equ});return Array.isArray(e)?s:s[0]}Fo.preload=function(n,e,t){const r=Array.isArray(e)?e:[e];return C8(YB(t),[n,...r])};Fo.clear=function(n,e){const t=Array.isArray(e)?e:[e];return R8([n,...t])};const Lu=new Map,{invalidate:kb,advance:zb}=W8(Lu),{reconciler:Yd,applyProps:Dc}=P8(Lu,F8),Oc={objects:"shallow",strict:!1},$8=(n,e)=>{const t=typeof n=="function"?n(e):n;return KB(t)?t:new vA({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function X8(n,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:r,top:i,left:s}=n.parentElement.getBoundingClientRect();return{width:t,height:r,top:i,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 j8(n){const e=Lu.get(n),t=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||z8(kb,zb),o=t||Yd.createContainer(s,ca.ConcurrentRoot,null,!1,null,"",i,null);e||Lu.set(n,{fiber:o,store:s});let a,l=!1,c;return{configure(d={}){let{gl:h,size:p,scene:m,events:v,onCreated:E,shadows:x=!1,linear:g=!1,flat:A=!1,legacy:_=!1,orthographic:w=!1,frameloop:C="always",dpr:b=[1,2],performance:B,raycaster:I,camera:R,onPointerMissed:L}=d,U=s.getState(),j=U.gl;U.gl||U.set({gl:j=$8(h,n)});let $=U.raycaster;$||U.set({raycaster:$=new $A});const{params:K,...Y}=I||{};if(hn.equ(Y,$,Oc)||Dc($,{...Y}),hn.equ(K,$.params,Oc)||Dc($,{params:{...$.params,...K}}),!U.camera||U.camera===c&&!hn.equ(c,R,Oc)){c=R;const ae=R instanceof hh,ee=ae?R:w?new xo(0,0,0,0,.1,1e3):new Fn(75,0,.1,1e3);ae||(ee.position.z=5,R&&Dc(ee,R),!U.camera&&!(R!=null&&R.rotation)&&ee.lookAt(0,0,0)),U.set({camera:ee})}if(!U.scene){let ae;m instanceof Vd?ae=m:(ae=new Vd,m&&Dc(ae,m)),U.set({scene:kc(ae)})}if(!U.xr){const ae=(pe,Le)=>{const we=s.getState();we.frameloop!=="never"&&zb(pe,!0,we,Le)},ee=()=>{const pe=s.getState();pe.gl.xr.enabled=pe.gl.xr.isPresenting,pe.gl.xr.setAnimationLoop(pe.gl.xr.isPresenting?ae:null),pe.gl.xr.isPresenting||kb(pe)},ve={connect(){const pe=s.getState().gl;pe.xr.addEventListener("sessionstart",ee),pe.xr.addEventListener("sessionend",ee)},disconnect(){const pe=s.getState().gl;pe.xr.removeEventListener("sessionstart",ee),pe.xr.removeEventListener("sessionend",ee)}};j.xr&&ve.connect(),U.set({xr:ve})}if(j.shadowMap){const ae=j.shadowMap.enabled,ee=j.shadowMap.type;if(j.shadowMap.enabled=!!x,hn.boo(x))j.shadowMap.type=ud;else if(hn.str(x)){var ne;const ve={basic:H2,percentage:M0,soft:ud,variance:ts};j.shadowMap.type=(ne=ve[x])!=null?ne:ud}else hn.obj(x)&&Object.assign(j.shadowMap,x);(ae!==j.shadowMap.enabled||ee!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}const ie=zB();ie&&("enabled"in ie?ie.enabled=!_:"legacyMode"in ie&&(ie.legacyMode=_)),Dc(j,{outputEncoding:g?3e3:3001,toneMapping:A?as:YE}),U.legacy!==_&&U.set(()=>({legacy:_})),U.linear!==g&&U.set(()=>({linear:g})),U.flat!==A&&U.set(()=>({flat:A})),h&&!hn.fun(h)&&!KB(h)&&!hn.equ(h,j,Oc)&&Dc(j,h),v&&!U.events.handlers&&U.set({events:v(s)});const q=X8(n,p);return hn.equ(q,U.size,Oc)||U.setSize(q.width,q.height,q.updateStyle,q.top,q.left),b&&U.viewport.dpr!==$B(b)&&U.setDpr(b),U.frameloop!==C&&U.setFrameloop(C),U.onPointerMissed||U.set({onPointerMissed:L}),B&&!hn.equ(B,U.performance,Oc)&&U.set(ae=>({performance:{...ae.performance,...B}})),a=E,l=!0,this},render(d){return l||this.configure(),Yd.updateContainer(D.createElement(J8,{store:s,children:d,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){QB(n)}}}function J8({store:n,children:e,onCreated:t,rootElement:r}){return Ph(()=>{const i=n.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),n.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),D.createElement(JA.Provider,{value:n},e)}function QB(n,e){const t=Lu.get(n),r=t==null?void 0:t.fiber;if(r){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),Yd.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),O8(i),Lu.delete(n),e&&e(n)}catch{}},500)})}}function K8(n,e,t){return D.createElement(Y8,{key:e.uuid,children:n,container:e,state:t})}function Y8({state:n={},children:e,container:t}){const{events:r,size:i,...s}=n,o=KA(),[a]=D.useState(()=>new $A),[l]=D.useState(()=>new Me),c=D.useCallback((h,p)=>{const m={...h};Object.keys(h).forEach(E=>{(k8.includes(E)||h[E]!==p[E]&&p[E])&&delete m[E]});let v;if(p&&i){const E=p.camera;v=h.viewport.getCurrentViewport(E,new G,i),E!==h.camera&&jB(E,i)}return{...m,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...h.events,...p==null?void 0:p.events,...r},size:{...h.size,...i},viewport:{...h.viewport,...v},...s}},[n]),[d]=D.useState(()=>{const h=o.getState();return XA((m,v)=>({...h,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...h.events,...r},size:{...h.size,...i},...s,set:m,get:v,setEvents:E=>m(x=>({...x,events:{...x.events,...E}}))}))});return D.useEffect(()=>{const h=o.subscribe(p=>d.setState(m=>c(p,m)));return()=>{h(),d.destroy()}},[]),D.useEffect(()=>{d.setState(h=>c(o.getState(),h))},[c]),D.createElement(D.Fragment,null,Yd.createPortal(D.createElement(JA.Provider,{value:d},e),d,null))}Yd.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:D.version});function Pn(){return Pn=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?r=setTimeout(l,e-d):(r=null,t||(a=n.apply(s,i),s=i=null))}var c=function(){s=this,i=arguments,o=Date.now();var d=t&&!r;return r||(r=setTimeout(l,e)),d&&(a=n.apply(s,i),s=i=null),a};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(a=n.apply(s,i),s=i=null,clearTimeout(r),r=null)},c}y1.debounce=y1;var Hb=y1;function Q8(n){let{debounce:e,scroll:t,polyfill:r,offsetSize:i}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const s=r||(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]=D.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=D.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),c=e?typeof e=="number"?e:e.scroll:null,d=e?typeof e=="number"?e:e.resize:null,h=D.useRef(!1);D.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[p,m,v]=D.useMemo(()=>{const A=()=>{if(!l.current.element)return;const{left:_,top:w,width:C,height:b,bottom:B,right:I,x:R,y:L}=l.current.element.getBoundingClientRect(),U={left:_,top:w,width:C,height:b,bottom:B,right:I,x:R,y:L};l.current.element instanceof HTMLElement&&i&&(U.height=l.current.element.offsetHeight,U.width=l.current.element.offsetWidth),Object.freeze(U),h.current&&!t9(l.current.lastBounds,U)&&a(l.current.lastBounds=U)};return[A,d?Hb(A,d):A,c?Hb(A,c):A]},[a,i,c,d]);function E(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(A=>A.removeEventListener("scroll",v,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function x(){l.current.element&&(l.current.resizeObserver=new s(v),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(A=>A.addEventListener("scroll",v,{capture:!0,passive:!0})))}const g=A=>{!A||A===l.current.element||(E(),l.current.element=A,l.current.scrollContainers=ZB(A),x())};return q8(v,Boolean(t)),Z8(m),D.useEffect(()=>{E(),x()},[t,v,m]),D.useEffect(()=>E,[]),[g,o,p]}function Z8(n){D.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function q8(n,e){D.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function ZB(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:r,overflowY:i}=window.getComputedStyle(n);return[t,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...ZB(n.parentElement)]}const e9=["x","y","top","bottom","left","right","width","height"],t9=(n,e)=>e9.every(t=>n[t]===e[t]);var n9=Object.defineProperty,r9=Object.defineProperties,i9=Object.getOwnPropertyDescriptors,Gb=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,o9=Object.prototype.propertyIsEnumerable,Vb=(n,e,t)=>e in n?n9(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Wb=(n,e)=>{for(var t in e||(e={}))s9.call(e,t)&&Vb(n,t,e[t]);if(Gb)for(var t of Gb(e))o9.call(e,t)&&Vb(n,t,e[t]);return n},a9=(n,e)=>r9(n,i9(e));function qB(n,e,t){if(!n)return;if(t(n)===!0)return n;let r=e?n.return:n.child;for(;r;){const i=qB(r,e,t);if(i)return i;r=e?null:r.sibling}}function eL(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const YA=eL(D.createContext(null));class tL extends D.Component{render(){return D.createElement(YA.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:$b,ReactCurrentDispatcher:Xb}=D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function l9(){const n=D.useContext(YA);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=D.useId();return D.useMemo(()=>{for(const r of[$b==null?void 0:$b.current,n,n==null?void 0:n.alternate]){if(!r)continue;const i=qB(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[n,e])}function c9(){var n,e;const t=l9(),[r]=D.useState(()=>new Map);r.clear();let i=t;for(;i;){const s=(n=i.type)==null?void 0:n._context;s&&s!==YA&&!r.has(s)&&r.set(s,(e=Xb==null?void 0:Xb.current)==null?void 0:e.readContext(eL(s))),i=i.return}return r}function u9(){const n=c9();return D.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>r=>D.createElement(e,null,D.createElement(t.Provider,a9(Wb({},r),{value:n.get(t)}))),e=>D.createElement(tL,Wb({},e))),[n])}const p_={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}=U8(n);return{priority:1,enabled:!0,compute(t,r,i){r.pointer.set(t.offsetX/r.size.width*2-1,-(t.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(p_).reduce((t,r)=>({...t,[r]:e(r)}),{}),update:()=>{var t;const{events:r,internal:i}=n.getState();(t=i.lastEvent)!=null&&t.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var r;const{set:i,events:s}=n.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:t}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,c]=p_[o];t.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:t,events:r}=n.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=p_[s];r.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const d9=D.forwardRef(function({children:e,fallback:t,resize:r,style:i,gl:s,events:o=f9,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:h,legacy:p,orthographic:m,frameloop:v,dpr:E,performance:x,raycaster:g,camera:A,onPointerMissed:_,onCreated:w,...C},b){D.useMemo(()=>kB(y8),[]);const B=u9(),[I,R]=Q8({scroll:!0,debounce:{scroll:50,resize:0},...r}),L=D.useRef(null),U=D.useRef(null);D.useImperativeHandle(b,()=>L.current);const j=GB(_),[$,K]=D.useState(!1),[Y,ne]=D.useState(!1);if($)throw $;if(Y)throw Y;const ie=D.useRef(null);Ph(()=>{const Z=L.current;R.width>0&&R.height>0&&Z&&(ie.current||(ie.current=j8(Z)),ie.current.configure({gl:s,events:o,shadows:c,linear:d,flat:h,legacy:p,orthographic:m,frameloop:v,dpr:E,performance:x,raycaster:g,camera:A,size:R,onPointerMissed:(...q)=>j.current==null?void 0:j.current(...q),onCreated:q=>{q.events.connect==null||q.events.connect(a?I8(a)?a.current:a:U.current),l&&q.setEvents({compute:(ae,ee)=>{const ve=ae[l+"X"],pe=ae[l+"Y"];ee.pointer.set(ve/ee.size.width*2-1,-(pe/ee.size.height)*2+1),ee.raycaster.setFromCamera(ee.pointer,ee.camera)}}),w==null||w(q)}}),ie.current.render(D.createElement(B,null,D.createElement(VB,{set:ne},D.createElement(D.Suspense,{fallback:D.createElement(B8,{set:K})},e)))))}),D.useEffect(()=>{const Z=L.current;if(Z)return()=>QB(Z)},[]);const z=a?"none":"auto";return D.createElement("div",Pn({ref:U,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:z,...i}},C),D.createElement("div",{ref:I,style:{width:"100%",height:"100%"}},D.createElement("canvas",{ref:L,style:{display:"block"}},t)))}),QK=D.forwardRef(function(e,t){return D.createElement(tL,null,D.createElement(d9,Pn({},e,{ref:t})))});function h9(n,e,t){return Math.max(e,Math.min(n,t))}const wr={toVector(n,e){return n===void 0&&(n=e),Array.isArray(n)?n:[n,n]},add(n,e){return[n[0]+e[0],n[1]+e[1]]},sub(n,e){return[n[0]-e[0],n[1]-e[1]]},addTo(n,e){n[0]+=e[0],n[1]+=e[1]},subTo(n,e){n[0]-=e[0],n[1]-=e[1]}};function jb(n,e,t){return e===0||Math.abs(e)===1/0?Math.pow(n,t*5):n*e*t/(e+t*n)}function Jb(n,e,t,r=.15){return r===0?h9(n,e,t):nt?+jb(n-t,t-e,r)+t:n}function p9(n,[e,t],[r,i]){const[[s,o],[a,l]]=n;return[Jb(e,s,o,r),Jb(t,a,l,i)]}function m9(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function g9(n){var e=m9(n,"string");return typeof e=="symbol"?e:String(e)}function Yr(n,e,t){return e=g9(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kb(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bn(n){for(var e=1;e{var t,r;return e.target===n.currentTarget||((t=n.currentTarget)===null||t===void 0||(r=t.contains)===null||r===void 0?void 0:r.call(t,e.target))})}function w9(n){return n.type==="touchend"||n.type==="touchcancel"?n.changedTouches:n.targetTouches}function iL(n){return G0(n)?w9(n)[0]:n}function M9(n){return S9(n).map(e=>e.identifier)}function m_(n){const e=iL(n);return G0(n)?e.identifier:e.pointerId}function Qb(n){const e=iL(n);return[e.clientX,e.clientY]}function T9(n){const e={};if("buttons"in n&&(e.buttons=n.buttons),"shiftKey"in n){const{shiftKey:t,altKey:r,metaKey:i,ctrlKey:s}=n;Object.assign(e,{shiftKey:t,altKey:r,metaKey:i,ctrlKey:s})}return e}function Xg(n,...e){return typeof n=="function"?n(...e):n}function b9(){}function C9(...n){return n.length===0?b9:n.length===1?n[0]:function(){let e;for(const t of n)e=t.apply(this,arguments)||e;return e}}function Zb(n,e){return Object.assign({},e,n||{})}const R9=32;class P9{constructor(e,t,r){this.ctrl=e,this.args=t,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:r,args:i}=this;t[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,r=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=r.from?Xg(r.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:r,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,r.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,T9(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const b=t._delta.map(Math.abs);wr.addTo(t._distance,b)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[l,c]=r.threshold,{_step:d,values:h}=t;if(r.hasCustomTransform?(d[0]===!1&&(d[0]=Math.abs(o)>=l&&h[0]),d[1]===!1&&(d[1]=Math.abs(a)>=c&&h[1])):(d[0]===!1&&(d[0]=Math.abs(o)>=l&&Math.sign(o)*l),d[1]===!1&&(d[1]=Math.abs(a)>=c&&Math.sign(a)*c)),t.intentional=d[0]!==!1||d[1]!==!1,!t.intentional)return;const p=[0,0];if(r.hasCustomTransform){const[b,B]=h;p[0]=d[0]!==!1?b-d[0]:0,p[1]=d[1]!==!1?B-d[1]:0}else p[0]=d[0]!==!1?o-d[0]:0,p[1]=d[1]!==!1?a-d[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(p);const m=t.offset,v=t._active&&!t._blocked||t.active;v&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in r&&(t._bounds=Xg(r.bounds,t)),this.setup&&this.setup()),t.movement=p,this.computeOffset()));const[E,x]=t.offset,[[g,A],[_,w]]=t._bounds;t.overflow=[EA?1:0,x<_?-1:x>w?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const C=t._active?r.rubberband||[0,0]:[0,0];if(t.offset=p9(t._bounds,t.offset,C),t.delta=wr.sub(t.offset,m),this.computeMovement(),v&&(!t.last||s>R9)){t.delta=wr.sub(t.offset,m);const b=t.delta.map(Math.abs);wr.addTo(t.distance,b),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[b[0]/s,b[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const i=this.handler(bn(bn(bn({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function I9([n,e],t){const r=Math.abs(n),i=Math.abs(e);if(r>i&&r>t)return"x";if(i>r&&i>t)return"y"}class B9 extends P9{constructor(...e){super(...e),Yr(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=wr.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=wr.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,r=this.config;if(!t.axis&&e){const i=typeof r.axisThreshold=="object"?r.axisThreshold[rL(e)]:r.axisThreshold;t.axis=I9(t._movement,i)}t._blocked=(r.lockDirection||!!r.axis)&&!t.axis||!!r.axis&&r.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const L9=n=>n,qb=.15,sL={enabled(n=!0){return n},eventOptions(n,e,t){return bn(bn({},t.shared.eventOptions),n)},preventDefault(n=!1){return n},triggerAllEvents(n=!1){return n},rubberband(n=0){switch(n){case!0:return[qb,qb];case!1:return[0,0];default:return wr.toVector(n)}},from(n){if(typeof n=="function")return n;if(n!=null)return wr.toVector(n)},transform(n,e,t){const r=n||t.shared.transform;return this.hasCustomTransform=!!r,r||L9},threshold(n){return wr.toVector(n,0)}},D9=0,Ih=bn(bn({},sL),{},{axis(n,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(n=D9){return n},bounds(n={}){if(typeof n=="function")return s=>Ih.bounds(n(s));if("current"in n)return()=>n.current;if(typeof HTMLElement=="function"&&n instanceof HTMLElement)return n;const{left:e=-1/0,right:t=1/0,top:r=-1/0,bottom:i=1/0}=n;return[[e,t],[r,i]]}}),eC={ArrowRight:(n,e=1)=>[n*e,0],ArrowLeft:(n,e=1)=>[-1*n*e,0],ArrowUp:(n,e=1)=>[0,-1*n*e],ArrowDown:(n,e=1)=>[0,n*e]};class O9 extends B9{constructor(...e){super(...e),Yr(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),i={left:t.left-r.left+e.offset[0],right:t.right-r.right+e.offset[0],top:t.top-r.top+e.offset[1],bottom:t.bottom-r.bottom+e.offset[1]};e._bounds=Ih.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=m_(e),r._pointerActive=!0,this.computeValues(Qb(e)),this.computeInitial(),t.preventScrollAxis&&rL(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,r=this.config;if(!t._pointerActive)return;const i=m_(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=Qb(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=wr.sub(s,t._values),this.computeValues(s)),wr.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,r=this.config;if(!t._active||!t._pointerActive)return;const i=m_(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=r.tapsThreshold&&o<=r.tapsThreshold,t.tap&&r.filterTaps)t._force=!0;else{const[a,l]=t._delta,[c,d]=t._movement,[h,p]=r.swipe.velocity,[m,v]=r.swipe.distance,E=r.swipe.duration;if(t.elapsedTimeh&&Math.abs(c)>m&&(t.swipe[0]=Math.sign(a)),g>p&&Math.abs(d)>v&&(t.swipe[1]=Math.sign(l))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,r=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,F9(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=eC[e.key];if(t){const r=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=t(this.config.keyboardDisplacement,i),r._keyboardActive=!0,wr.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in eC&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function F9(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}const Bh=typeof window<"u"&&window.document&&window.document.createElement;function N9(){return Bh&&"ontouchstart"in window}function tC(){return N9()||Bh&&window.navigator.maxTouchPoints>1}function U9(){return Bh&&"onpointerdown"in window}function k9(){return Bh&&"exitPointerLock"in window.document}function z9(){try{return"constructor"in GestureEvent}catch{return!1}}const Ni={isBrowser:Bh,gesture:z9(),touch:tC(),touchscreen:tC(),pointer:U9(),pointerLock:k9()},H9=250,G9=180,V9=.5,W9=50,$9=250,X9=10,nC={mouse:0,touch:0,pen:8},j9=bn(bn({},Ih),{},{device(n,e,{pointer:{touch:t=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&Ni.pointerLock,Ni.touch&&t?"touch":this.pointerLock?"mouse":Ni.pointer&&!i?"pointer":Ni.touch?"touch":"mouse"},preventScrollAxis(n,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&n?H9:void 0,!(!Ni.touchscreen||t===!1))return n||(t!==void 0?"y":void 0)},pointerCapture(n,e,{pointer:{capture:t=!0,buttons:r=1,keys:i=!0}={}}){return this.pointerButtons=r,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(n,e,{filterTaps:t=!1,tapsThreshold:r=3,axis:i=void 0}){const s=wr.toVector(n,t?r:i?1:0);return this.filterTaps=t,this.tapsThreshold=r,s},swipe({velocity:n=V9,distance:e=W9,duration:t=$9}={}){return{velocity:this.transform(wr.toVector(n)),distance:this.transform(wr.toVector(e)),duration:t}},delay(n=0){switch(n){case!0:return G9;case!1:return 0;default:return n}},axisThreshold(n){return n?bn(bn({},nC),n):nC},keyboardDisplacement(n=X9){return n}});bn(bn({},sL),{},{device(n,e,{shared:t,pointer:{touch:r=!1}={}}){if(t.target&&!Ni.touch&&Ni.gesture)return"gesture";if(Ni.touch&&r)return"touch";if(Ni.touchscreen){if(Ni.pointer)return"pointer";if(Ni.touch)return"touch"}},bounds(n,e,{scaleBounds:t={},angleBounds:r={}}){const i=o=>{const a=Zb(Xg(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=Zb(Xg(r,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof r!="function"?[i(),s()]:o=>[i(o),s(o)]},threshold(n,e,t){return this.lockDirection=t.axis==="lock",wr.toVector(n,this.lockDirection?[.1,3]:0)},modifierKey(n){return n===void 0?"ctrlKey":n},pinchOnWheel(n=!0){return n}});bn(bn({},Ih),{},{mouseOnly:(n=!0)=>n});bn(bn({},Ih),{},{mouseOnly:(n=!0)=>n});const oL=new Map,_1=new Map;function J9(n){oL.set(n.key,n.engine),_1.set(n.key,n.resolver)}const K9={key:"drag",engine:O9,resolver:j9};function Y9(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s=0)&&(t[i]=n[i]);return t}function Q9(n,e){if(n==null)return{};var t=Y9(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}const Z9={target(n){if(n)return()=>"current"in n?n.current:n},enabled(n=!0){return n},window(n=Ni.isBrowser?window:void 0){return n},eventOptions({passive:n=!0,capture:e=!1}={}){return{passive:n,capture:e}},transform(n){return n}},q9=["target","eventOptions","window","enabled","transform"];function pg(n={},e){const t={};for(const[r,i]of Object.entries(e))switch(typeof i){case"function":t[r]=i.call(t,n[r],r,n);break;case"object":t[r]=pg(n[r],i);break;case"boolean":i&&(t[r]=n[r]);break}return t}function e6(n,e,t={}){const r=n,{target:i,eventOptions:s,window:o,enabled:a,transform:l}=r,c=Q9(r,q9);if(t.shared=pg({target:i,eventOptions:s,window:o,enabled:a,transform:l},Z9),e){const d=_1.get(e);t[e]=pg(bn({shared:t.shared},c),d)}else for(const d in c){const h=_1.get(d);h&&(t[d]=pg(bn({shared:t.shared},c[d]),h))}return t}class aL{constructor(e,t){Yr(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,i,s){const o=this._listeners,a=A9(t,r),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},c=bn(bn({},l),s);e.addEventListener(a,i,c);const d=()=>{e.removeEventListener(a,i,c),o.delete(d)};return o.add(d),d}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class t6{constructor(){Yr(this,"_timeouts",new Map)}add(e,t,r=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,r,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class n6{constructor(e){Yr(this,"gestures",new Set),Yr(this,"_targetEventStore",new aL(this)),Yr(this,"gestureEventStores",{}),Yr(this,"gestureTimeoutStores",{}),Yr(this,"handlers",{}),Yr(this,"config",{}),Yr(this,"pointerIds",new Set),Yr(this,"touchIds",new Set),Yr(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),r6(this,e)}setEventIds(e){if(G0(e))return this.touchIds=new Set(M9(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=e6(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,r={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],l=rC(r,a.eventOptions,!!i);if(a.enabled){const c=oL.get(o);new c(this,e,o).bind(l)}}const s=rC(r,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](bn(bn({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in r)r[s]=C9(...r[s]);if(!i)return r;for(const s in r){const{device:o,capture:a,passive:l}=E9(s);this._targetEventStore.add(i,o,"",r[s],{capture:a,passive:l})}}}}function Fc(n,e){n.gestures.add(e),n.gestureEventStores[e]=new aL(n,e),n.gestureTimeoutStores[e]=new t6}function r6(n,e){e.drag&&Fc(n,"drag"),e.wheel&&Fc(n,"wheel"),e.scroll&&Fc(n,"scroll"),e.move&&Fc(n,"move"),e.pinch&&Fc(n,"pinch"),e.hover&&Fc(n,"hover")}const rC=(n,e,t)=>(r,i,s,o={},a=!1)=>{var l,c;const d=(l=o.capture)!==null&&l!==void 0?l:e.capture,h=(c=o.passive)!==null&&c!==void 0?c:e.passive;let p=a?r:_9(r,i,d);t&&h&&(p+="Passive"),n[p]=n[p]||[],n[p].push(s)};function i6(n,e={},t,r){const i=Q.useMemo(()=>new n6(n),[]);if(i.applyHandlers(n,r),i.applyConfig(e,t),Q.useEffect(i.effect.bind(i)),Q.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function s6(n,e){return J9(K9),i6({drag:n},e||{},"drag")}const o6=n=>(e,t,r)=>{const i=r.subscribe;return r.subscribe=(o,a,l)=>{let c=o;if(a){const d=(l==null?void 0:l.equalityFn)||Object.is;let h=o(r.getState());c=p=>{const m=o(p);if(!d(h,m)){const v=h;a(h=m,v)}},l!=null&&l.fireImmediately&&a(h,h)}return i(c)},n(e,t,r)};function iC(n,e){if(e===wI)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===Gg||e===sA){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let l=0;l>>1|(pn&21845)<<1;Zo=(Zo&52428)>>>2|(Zo&13107)<<2,Zo=(Zo&61680)>>>4|(Zo&3855)<<4,E1[pn]=((Zo&65280)>>>8|(Zo&255)<<8)>>>1}var md=function(n,e,t){for(var r=n.length,i=0,s=new ua(e);i>>l]=c}else for(a=new ua(r),i=0;i>>15-n[i]);return a},Lh=new ki(288);for(var pn=0;pn<144;++pn)Lh[pn]=8;for(var pn=144;pn<256;++pn)Lh[pn]=9;for(var pn=256;pn<280;++pn)Lh[pn]=7;for(var pn=280;pn<288;++pn)Lh[pn]=8;var hL=new ki(32);for(var pn=0;pn<32;++pn)hL[pn]=5;var f6=md(Lh,9,1),d6=md(hL,5,1),g_=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},qi=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},v_=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},h6=function(n){return(n/8|0)+(n&7&&1)},p6=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof ua?ua:n instanceof x1?x1:ki)(t-e);return r.set(n.subarray(e,t)),r},m6=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new ki(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new ki(r*3));var o=function(we){var Fe=e.length;if(we>Fe){var et=new ki(Math.max(Fe*2,we));et.set(e),e=et}},a=t.f||0,l=t.p||0,c=t.b||0,d=t.l,h=t.d,p=t.m,m=t.n,v=r*8;do{if(!d){t.f=a=qi(n,l,1);var E=qi(n,l+1,3);if(l+=3,E)if(E==1)d=f6,h=d6,p=9,m=5;else if(E==2){var _=qi(n,l,31)+257,w=qi(n,l+10,15)+4,C=_+qi(n,l+5,31)+1;l+=14;for(var b=new ki(C),B=new ki(19),I=0;I>>4;if(x<16)b[I++]=x;else{var $=0,K=0;for(x==16?(K=3+qi(n,l,3),l+=2,$=b[I-1]):x==17?(K=3+qi(n,l,7),l+=3):x==18&&(K=11+qi(n,l,127),l+=7);K--;)b[I++]=$}}var Y=b.subarray(0,_),ne=b.subarray(_);p=g_(Y),m=g_(ne),d=md(Y,p,1),h=md(ne,m,1)}else throw"invalid block type";else{var x=h6(l)+4,g=n[x-4]|n[x-3]<<8,A=x+g;if(A>r){if(s)throw"unexpected EOF";break}i&&o(c+g),e.set(n.subarray(x,A),c),t.b=c+=g,t.p=l=A*8;continue}if(l>v){if(s)throw"unexpected EOF";break}}i&&o(c+131072);for(var ie=(1<>>4;if(l+=$&15,l>v){if(s)throw"unexpected EOF";break}if(!$)throw"invalid length/literal";if(q<256)e[c++]=q;else if(q==256){Z=l,d=null;break}else{var ae=q-254;if(q>264){var I=q-257,ee=lL[I];ae=qi(n,l,(1<>>4;if(!ve)throw"invalid distance";l+=ve&15;var ne=u6[pe];if(pe>3){var ee=cL[pe];ne+=v_(n,l)&(1<v){if(s)throw"unexpected EOF";break}i&&o(c+131072);for(var Le=c+ae;c>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Nm(n,e){return m6((v6(n),n.subarray(2,-4)),e)}var y6=typeof TextDecoder<"u"&&new TextDecoder,_6=0;try{y6.decode(g6,{stream:!0}),_6=1}catch{}const x6=n=>n&&n.isCubeTexture;class E6 extends Qn{constructor(e,t){var r,i;const s=x6(e),a=((i=s?(r=e.image[0])==null?void 0:r.width:e.image.width)!=null?i:1024)/4,l=Math.floor(Math.log2(a)),c=Math.pow(2,l),d=3*Math.max(c,16*7),h=4*c,p=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/d}`,`#define CUBEUV_TEXEL_HEIGHT ${1/h}`,`#define CUBEUV_MAX_MIP ${l}.0`],m=` - varying vec3 vWorldPosition; - void main() - { - vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); - vWorldPosition = worldPosition.xyz; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - } - `,v=p.join(` -`)+` - #define ENVMAP_TYPE_CUBE_UV - varying vec3 vWorldPosition; - uniform float radius; - uniform float height; - uniform float angle; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube map; - #else - uniform sampler2D map; - #endif - // From: https://www.shadertoy.com/view/4tsBD7 - float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) - { - float d = dot ( rd, n ); - - if( d > 0.0 ) { return 1e6; } - - vec3 o = ro - c; - float t = - dot( n, o ) / d; - vec3 q = o + rd * t; - - return ( dot( q, q ) < r * r ) ? t : 1e6; - } - // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm - float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) - { - vec3 oc = ro - ce; - float b = dot( oc, rd ); - float c = dot( oc, oc ) - ra * ra; - float h = b * b - c; - - if( h < 0.0 ) { return -1.0; } - - h = sqrt( h ); - - return - b + h; - } - vec3 project() - { - vec3 p = normalize( vWorldPosition ); - vec3 camPos = cameraPosition; - camPos.y -= height; - float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); - if( intersection > 0.0 ) { - - vec3 h = vec3( 0.0, - height, 0.0 ); - float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); - p = ( camPos + min( intersection, intersection2 ) * p ) / radius; - } else { - p = vec3( 0.0, 1.0, 0.0 ); - } - return p; - } - #include - #include - void main() - { - vec3 projectedWorldPosition = project(); - - #ifdef ENVMAP_TYPE_CUBE - vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; - #else - vec3 direction = normalize( projectedWorldPosition ); - vec2 uv = equirectUv( direction ); - vec3 outcolor = texture2D( map, uv ).rgb; - #endif - gl_FragColor = vec4( outcolor, 1.0 ); - #include - #include - } - `,E={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},x=new $u(1,16),g=new ds({uniforms:E,fragmentShader:v,vertexShader:m,side:Ui});super(x,g)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}var A6=Object.defineProperty,S6=(n,e,t)=>e in n?A6(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ct=(n,e,t)=>(S6(n,typeof e!="symbol"?e+"":e,t),t);const sC=(n,e)=>(n%e+e)%e;let w6=class extends Ws{constructor(e,t){super(),Ct(this,"object"),Ct(this,"domElement"),Ct(this,"enabled",!0),Ct(this,"target",new G),Ct(this,"minDistance",0),Ct(this,"maxDistance",1/0),Ct(this,"minZoom",0),Ct(this,"maxZoom",1/0),Ct(this,"minPolarAngle",0),Ct(this,"maxPolarAngle",Math.PI),Ct(this,"minAzimuthAngle",-1/0),Ct(this,"maxAzimuthAngle",1/0),Ct(this,"enableDamping",!1),Ct(this,"dampingFactor",.05),Ct(this,"enableZoom",!0),Ct(this,"zoomSpeed",1),Ct(this,"enableRotate",!0),Ct(this,"rotateSpeed",1),Ct(this,"enablePan",!0),Ct(this,"panSpeed",1),Ct(this,"screenSpacePanning",!0),Ct(this,"keyPanSpeed",7),Ct(this,"autoRotate",!1),Ct(this,"autoRotateSpeed",2),Ct(this,"reverseOrbit",!1),Ct(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Ct(this,"mouseButtons",{LEFT:ol.ROTATE,MIDDLE:ol.DOLLY,RIGHT:ol.PAN}),Ct(this,"touches",{ONE:al.ROTATE,TWO:al.DOLLY_PAN}),Ct(this,"target0"),Ct(this,"position0"),Ct(this,"zoom0"),Ct(this,"_domElementKeyEvents",null),Ct(this,"getPolarAngle"),Ct(this,"getAzimuthalAngle"),Ct(this,"setPolarAngle"),Ct(this,"setAzimuthalAngle"),Ct(this,"getDistance"),Ct(this,"listenToKeyEvents"),Ct(this,"saveState"),Ct(this,"reset"),Ct(this,"update"),Ct(this,"connect"),Ct(this,"dispose"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=te=>{let me=sC(te,2*Math.PI),Ce=d.phi;Ce<0&&(Ce+=2*Math.PI),me<0&&(me+=2*Math.PI);let Be=Math.abs(me-Ce);2*Math.PI-Be{let me=sC(te,2*Math.PI),Ce=d.theta;Ce<0&&(Ce+=2*Math.PI),me<0&&(me+=2*Math.PI);let Be=Math.abs(me-Ce);2*Math.PI-Ber.object.position.distanceTo(r.target),this.listenToKeyEvents=te=>{te.addEventListener("keydown",N),this._domElementKeyEvents=te},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const te=new G,me=new ar().setFromUnitVectors(e.up,new G(0,1,0)),Ce=me.clone().invert(),Be=new G,Ne=new ar,nt=2*Math.PI;return function(){const re=r.object.position;te.copy(re).sub(r.target),te.applyQuaternion(me),d.setFromVector3(te),r.autoRotate&&l===a.NONE&&j(L()),r.enableDamping?(d.theta+=h.theta*r.dampingFactor,d.phi+=h.phi*r.dampingFactor):(d.theta+=h.theta,d.phi+=h.phi);let ue=r.minAzimuthAngle,le=r.maxAzimuthAngle;return isFinite(ue)&&isFinite(le)&&(ue<-Math.PI?ue+=nt:ue>Math.PI&&(ue-=nt),le<-Math.PI?le+=nt:le>Math.PI&&(le-=nt),ue<=le?d.theta=Math.max(ue,Math.min(le,d.theta)):d.theta=d.theta>(ue+le)/2?Math.max(ue,d.theta):Math.min(le,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),d.radius*=p,d.radius=Math.max(r.minDistance,Math.min(r.maxDistance,d.radius)),r.enableDamping===!0?r.target.addScaledVector(m,r.dampingFactor):r.target.add(m),te.setFromSpherical(d),te.applyQuaternion(Ce),re.copy(r.target).add(te),r.object.lookAt(r.target),r.enableDamping===!0?(h.theta*=1-r.dampingFactor,h.phi*=1-r.dampingFactor,m.multiplyScalar(1-r.dampingFactor)):(h.set(0,0,0),m.set(0,0,0)),p=1,v||Be.distanceToSquared(r.object.position)>c||8*(1-Ne.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Be.copy(r.object.position),Ne.copy(r.object.quaternion),v=!1,!0):!1}})(),this.connect=te=>{te===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),r.domElement=te,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",Ie),r.domElement.addEventListener("pointerdown",tt),r.domElement.addEventListener("pointercancel",at),r.domElement.addEventListener("wheel",k)},this.dispose=()=>{var te,me,Ce,Be,Ne,nt;(te=r.domElement)==null||te.removeEventListener("contextmenu",Ie),(me=r.domElement)==null||me.removeEventListener("pointerdown",tt),(Ce=r.domElement)==null||Ce.removeEventListener("pointercancel",at),(Be=r.domElement)==null||Be.removeEventListener("wheel",k),(Ne=r.domElement)==null||Ne.ownerDocument.removeEventListener("pointermove",We),(nt=r.domElement)==null||nt.ownerDocument.removeEventListener("pointerup",je),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",N)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new p1,h=new p1;let p=1;const m=new G;let v=!1;const E=new Me,x=new Me,g=new Me,A=new Me,_=new Me,w=new Me,C=new Me,b=new Me,B=new Me,I=[],R={};function L(){return 2*Math.PI/60/60*r.autoRotateSpeed}function U(){return Math.pow(.95,r.zoomSpeed)}function j(te){r.reverseOrbit?h.theta+=te:h.theta-=te}function $(te){r.reverseOrbit?h.phi+=te:h.phi-=te}const K=(()=>{const te=new G;return function(Ce,Be){te.setFromMatrixColumn(Be,0),te.multiplyScalar(-Ce),m.add(te)}})(),Y=(()=>{const te=new G;return function(Ce,Be){r.screenSpacePanning===!0?te.setFromMatrixColumn(Be,1):(te.setFromMatrixColumn(Be,0),te.crossVectors(r.object.up,te)),te.multiplyScalar(Ce),m.add(te)}})(),ne=(()=>{const te=new G;return function(Ce,Be){const Ne=r.domElement;if(Ne&&r.object instanceof Fn&&r.object.isPerspectiveCamera){const nt=r.object.position;te.copy(nt).sub(r.target);let mt=te.length();mt*=Math.tan(r.object.fov/2*Math.PI/180),K(2*Ce*mt/Ne.clientHeight,r.object.matrix),Y(2*Be*mt/Ne.clientHeight,r.object.matrix)}else Ne&&r.object instanceof xo&&r.object.isOrthographicCamera?(K(Ce*(r.object.right-r.object.left)/r.object.zoom/Ne.clientWidth,r.object.matrix),Y(Be*(r.object.top-r.object.bottom)/r.object.zoom/Ne.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function ie(te){r.object instanceof Fn&&r.object.isPerspectiveCamera?p/=te:r.object instanceof xo&&r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*te)),r.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function z(te){r.object instanceof Fn&&r.object.isPerspectiveCamera?p*=te:r.object instanceof xo&&r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/te)),r.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Z(te){E.set(te.clientX,te.clientY)}function q(te){C.set(te.clientX,te.clientY)}function ae(te){A.set(te.clientX,te.clientY)}function ee(te){x.set(te.clientX,te.clientY),g.subVectors(x,E).multiplyScalar(r.rotateSpeed);const me=r.domElement;me&&(j(2*Math.PI*g.x/me.clientHeight),$(2*Math.PI*g.y/me.clientHeight)),E.copy(x),r.update()}function ve(te){b.set(te.clientX,te.clientY),B.subVectors(b,C),B.y>0?ie(U()):B.y<0&&z(U()),C.copy(b),r.update()}function pe(te){_.set(te.clientX,te.clientY),w.subVectors(_,A).multiplyScalar(r.panSpeed),ne(w.x,w.y),A.copy(_),r.update()}function Le(te){te.deltaY<0?z(U()):te.deltaY>0&&ie(U()),r.update()}function we(te){let me=!1;switch(te.code){case r.keys.UP:ne(0,r.keyPanSpeed),me=!0;break;case r.keys.BOTTOM:ne(0,-r.keyPanSpeed),me=!0;break;case r.keys.LEFT:ne(r.keyPanSpeed,0),me=!0;break;case r.keys.RIGHT:ne(-r.keyPanSpeed,0),me=!0;break}me&&(te.preventDefault(),r.update())}function Fe(){if(I.length==1)E.set(I[0].pageX,I[0].pageY);else{const te=.5*(I[0].pageX+I[1].pageX),me=.5*(I[0].pageY+I[1].pageY);E.set(te,me)}}function et(){if(I.length==1)A.set(I[0].pageX,I[0].pageY);else{const te=.5*(I[0].pageX+I[1].pageX),me=.5*(I[0].pageY+I[1].pageY);A.set(te,me)}}function ut(){const te=I[0].pageX-I[1].pageX,me=I[0].pageY-I[1].pageY,Ce=Math.sqrt(te*te+me*me);C.set(0,Ce)}function Rt(){r.enableZoom&&ut(),r.enablePan&&et()}function rt(){r.enableZoom&&ut(),r.enableRotate&&Fe()}function J(te){if(I.length==1)x.set(te.pageX,te.pageY);else{const Ce=ye(te),Be=.5*(te.pageX+Ce.x),Ne=.5*(te.pageY+Ce.y);x.set(Be,Ne)}g.subVectors(x,E).multiplyScalar(r.rotateSpeed);const me=r.domElement;me&&(j(2*Math.PI*g.x/me.clientHeight),$(2*Math.PI*g.y/me.clientHeight)),E.copy(x)}function Re(te){if(I.length==1)_.set(te.pageX,te.pageY);else{const me=ye(te),Ce=.5*(te.pageX+me.x),Be=.5*(te.pageY+me.y);_.set(Ce,Be)}w.subVectors(_,A).multiplyScalar(r.panSpeed),ne(w.x,w.y),A.copy(_)}function Se(te){const me=ye(te),Ce=te.pageX-me.x,Be=te.pageY-me.y,Ne=Math.sqrt(Ce*Ce+Be*Be);b.set(0,Ne),B.set(0,Math.pow(b.y/C.y,r.zoomSpeed)),ie(B.y),C.copy(b)}function De(te){r.enableZoom&&Se(te),r.enablePan&&Re(te)}function be(te){r.enableZoom&&Se(te),r.enableRotate&&J(te)}function tt(te){var me,Ce;r.enabled!==!1&&(I.length===0&&((me=r.domElement)==null||me.ownerDocument.addEventListener("pointermove",We),(Ce=r.domElement)==null||Ce.ownerDocument.addEventListener("pointerup",je)),ke(te),te.pointerType==="touch"?de(te):St(te))}function We(te){r.enabled!==!1&&(te.pointerType==="touch"?Pe(te):Qt(te))}function je(te){var me,Ce,Be;Ye(te),I.length===0&&((me=r.domElement)==null||me.releasePointerCapture(te.pointerId),(Ce=r.domElement)==null||Ce.ownerDocument.removeEventListener("pointermove",We),(Be=r.domElement)==null||Be.ownerDocument.removeEventListener("pointerup",je)),r.dispatchEvent(o),l=a.NONE}function at(te){Ye(te)}function St(te){let me;switch(te.button){case 0:me=r.mouseButtons.LEFT;break;case 1:me=r.mouseButtons.MIDDLE;break;case 2:me=r.mouseButtons.RIGHT;break;default:me=-1}switch(me){case ol.DOLLY:if(r.enableZoom===!1)return;q(te),l=a.DOLLY;break;case ol.ROTATE:if(te.ctrlKey||te.metaKey||te.shiftKey){if(r.enablePan===!1)return;ae(te),l=a.PAN}else{if(r.enableRotate===!1)return;Z(te),l=a.ROTATE}break;case ol.PAN:if(te.ctrlKey||te.metaKey||te.shiftKey){if(r.enableRotate===!1)return;Z(te),l=a.ROTATE}else{if(r.enablePan===!1)return;ae(te),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Qt(te){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;ee(te);break;case a.DOLLY:if(r.enableZoom===!1)return;ve(te);break;case a.PAN:if(r.enablePan===!1)return;pe(te);break}}function k(te){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(te.preventDefault(),r.dispatchEvent(s),Le(te),r.dispatchEvent(o))}function N(te){r.enabled===!1||r.enablePan===!1||we(te)}function de(te){switch(He(te),I.length){case 1:switch(r.touches.ONE){case al.ROTATE:if(r.enableRotate===!1)return;Fe(),l=a.TOUCH_ROTATE;break;case al.PAN:if(r.enablePan===!1)return;et(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case al.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Rt(),l=a.TOUCH_DOLLY_PAN;break;case al.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;rt(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Pe(te){switch(He(te),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;J(te),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;Re(te),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;De(te),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;be(te),r.update();break;default:l=a.NONE}}function Ie(te){r.enabled!==!1&&te.preventDefault()}function ke(te){I.push(te)}function Ye(te){delete R[te.pointerId];for(let me=0;me=2.0 are supported."));return}const l=new tV(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&a[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function M6(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Ht={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class T6{constructor(e){this.parser=e,this.name=Ht.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class U6{constructor(e){this.parser=e,this.name=Ht.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class k6{constructor(e){this.parser=e,this.name=Ht.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class z6{constructor(e){this.name=Ht.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,h=i.byteStride,p=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,h,p,i.mode,i.filter).then(function(m){return m.buffer}):o.ready.then(function(){const m=new ArrayBuffer(d*h);return o.decodeGltfBuffer(new Uint8Array(m),d,h,p,i.mode,i.filter),m})})}else return null}}class H6{constructor(e){this.name=Ht.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=t.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==Li.TRIANGLES&&c.mode!==Li.TRIANGLE_STRIP&&c.mode!==Li.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),h=d.isGroup?d.children:[d],p=c[0].count,m=[];for(const v of h){const E=new Et,x=new G,g=new ar,A=new G(1,1,1),_=new xA(v.geometry,v.material,p);for(let w=0;w=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},qo={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},J6={CUBICSPLINE:void 0,LINEAR:Nl,STEP:Tu},__={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function K6(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new Ch({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:zs})),n.DefaultMaterial}function nl(n,e,t){for(const r in t.extensions)n[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=t.extensions[r])}function ia(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Y6(n,e,t){let r=!1,i=!1,s=!1;for(let c=0,d=e.length;c0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const eV=new Et;class tV{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new M6,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||i&&s<98?this.textureLoader=new Rh(this.options.manager):this.textureLoader=new IB(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new _i(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};nl(s,a,i),ia(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&x.setY(R,b[B*l+1]),l>=3&&x.setZ(R,b[B*l+2]),l>=4&&x.setW(R,b[B*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,r){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,r).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const p=(s.samplers||{})[o.sampler]||{};return d.magFilter=aC[p.magFilter]||un,d.minFilter=aC[p.minFilter]||Hs,d.wrapS=lC[p.wrapS]||Ta,d.wrapT=lC[p.wrapT]||Ta,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(h){c=!0;const p=new Blob([h],{type:o.mimeType});return l=a.createObjectURL(p),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(h){return new Promise(function(p,m){let v=p;t.isImageBitmapLoader===!0&&(v=function(E){const x=new gn(E);x.needsUpdate=!0,p(x)}),t.load(ks.resolveURL(h,s.path),v,void 0,m)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),h.userData.mimeType=o.mimeType||q6(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=d,d}assignTexture(e,t,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[Ht.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[Ht.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Ht.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&("colorSpace"in o?o.colorSpace=i===3001?"srgb":"srgb-linear":o.encoding=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new F0,Xn.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Tr,Xn.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return Ch}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Ht.KHR_MATERIALS_UNLIT]){const h=i[Ht.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{const h=s.pbrMetallicRoughness||{};if(a.color=new Xe(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const p=h.baseColorFactor;a.color.fromArray(p),a.opacity=p[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,3001)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=Ui);const d=s.alphaMode||__.OPAQUE;if(d===__.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===__.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==pi&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Me(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;a.normalScale.set(h,h)}return s.occlusionTexture!==void 0&&o!==pi&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==pi&&(a.emissive=new Xe().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==pi&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,3001)),Promise.all(c).then(function(){const h=new o(a);return s.name&&(h.name=s.name),ia(h,s),t.associations.set(h,{materials:e}),s.extensions&&nl(i,h,s),h})}createUniqueName(e){const t=Gt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[Ht.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return cC(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Q6(g,s),g.name=t.createUniqueName(s.name||"mesh_"+e),ia(g,s),x.extensions&&nl(i,g,x),t.assignFinalMaterial(g),h.push(g)}for(let m=0,v=h.length;m1?d=new vo:c.length===1?d=c[0]:d=new Vt,d!==c[0])for(let h=0,p=c.length;h{const h=new Map;for(const[p,m]of i.associations)(p instanceof Xn||p instanceof gn)&&h.set(p,m);return d.traverse(p=>{const m=i.associations.get(p);m!=null&&h.set(p,m)}),h};return i.associations=c(s),s})}}function nV(n,e,t){const r=e.attributes,i=new ms;if(r.POSITION!==void 0){const a=t.json.accessors[r.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(i.set(new G(l[0],l[1],l[2]),new G(c[0],c[1],c[2])),a.normalized){const d=S1(hu[a.componentType]);i.min.multiplyScalar(d),i.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new G,l=new G;for(let c=0,d=s.length;c(I=U.indexOf(h))&&R=_.byteLength||!(L=p(_)))return a(1,"no header found");if(!(U=L.match(w)))return a(3,"bad initial token");for(R.valid|=1,R.programtype=U[1],R.string+=L+` -`;L=p(_),L!==!1;){if(R.string+=L+` -`,L.charAt(0)==="#"){R.comments+=L+` -`;continue}if((U=L.match(C))&&(R.gamma=parseFloat(U[1])),(U=L.match(b))&&(R.exposure=parseFloat(U[1])),(U=L.match(B))&&(R.valid|=2,R.format=U[1]),(U=L.match(I))&&(R.valid|=4,R.height=parseInt(U[1],10),R.width=parseInt(U[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2?R.valid&4?R:a(3,"missing image size specifier"):a(3,"missing format specifier")},v=function(_,w,C){const b=w;if(b<8||b>32767||_[0]!==2||_[1]!==2||_[2]&128)return new Uint8Array(_);if(b!==(_[2]<<8|_[3]))return a(3,"wrong scanline width");const B=new Uint8Array(4*w*C);if(!B.length)return a(4,"unable to allocate buffer space");let I=0,R=0;const L=4*b,U=new Uint8Array(4),j=new Uint8Array(L);let $=C;for(;$>0&&R<_.byteLength;){if(R+4>_.byteLength)return a(1);if(U[0]=_[R++],U[1]=_[R++],U[2]=_[R++],U[3]=_[R++],U[0]!=2||U[1]!=2||(U[2]<<8|U[3])!=b)return a(3,"bad rgbe scanline format");let K=0,Y;for(;K128;if(ie&&(Y-=128),Y===0||K+Y>L)return a(3,"bad scanline data");if(ie){const z=_[R++];for(let Z=0;Z>3]&1<<(V&7))&&(T[F++]=V);for(var H=F-1;F<65536;)T[F++]=0;return H}function U(O){for(var T=0;T<16384;T++)O[T]={},O[T].len=0,O[T].lit=0,O[T].p=null}const j={l:0,c:0,lc:0};function $(O,T,F,V,H){for(;F>F&(1<0;--T){var V=F+K[T]>>1;K[T]=F,F=V}for(var T=0;T<65537;++T){var H=O[T];H>0&&(O[T]=H|K[H]++<<6)}}function ne(O,T,F,V,H,X,ce){for(var he=F,Ee=0,Ae=0;H<=X;H++){if(he.value-F.value>V)return!1;$(6,Ee,Ae,O,he);var Te=j.l;if(Ee=j.c,Ae=j.lc,ce[H]=Te,Te==63){if(he.value-F.value>V)throw"Something wrong with hufUnpackEncTable";$(8,Ee,Ae,O,he);var _e=j.l+6;if(Ee=j.c,Ae=j.lc,H+_e>X+1)throw"Something wrong with hufUnpackEncTable";for(;_e--;)ce[H++]=0;H--}else if(Te>=59){var _e=Te-59+2;if(H+_e>X+1)throw"Something wrong with hufUnpackEncTable";for(;_e--;)ce[H++]=0;H--}}Y(ce)}function ie(O){return O&63}function z(O){return O>>6}function Z(O,T,F,V){for(;T<=F;T++){var H=z(O[T]),X=ie(O[T]);if(H>>X)throw"Invalid table entry";if(X>14){var ce=V[H>>X-14];if(ce.len)throw"Invalid table entry";if(ce.lit++,ce.p){var he=ce.p;ce.p=new Array(ce.lit);for(var Ee=0;Ee0;Ee--){var ce=V[(H<<14-X)+Ae];if(ce.len||ce.p)throw"Invalid table entry";ce.len=X,ce.lit=T,Ae++}}return!0}const q={c:0,lc:0};function ae(O,T,F,V){O=O<<8|Be(F,V),T+=8,q.c=O,q.lc=T}const ee={c:0,lc:0};function ve(O,T,F,V,H,X,ce,he,Ee,Ae){if(O==T){V<8&&(ae(F,V,H,ce),F=q.c,V=q.lc),V-=8;var Te=F>>V,Te=new Uint8Array([Te])[0];if(Ee.value+Te>Ae)return!1;for(var _e=he[Ee.value-1];Te-- >0;)he[Ee.value++]=_e}else if(Ee.value32767?T-65536:T}const we={a:0,b:0};function Fe(O,T){var F=Le(O),V=Le(T),H=V,X=F+(H&1)+(H>>1),ce=X,he=X-H;we.a=ce,we.b=he}function et(O,T){var F=pe(O),V=pe(T),H=F-(V>>1)&65535,X=V+H-32768&65535;we.a=X,we.b=H}function ut(O,T,F,V,H,X,ce){for(var he=ce<16384,Ee=F>H?H:F,Ae=1,Te;Ae<=Ee;)Ae<<=1;for(Ae>>=1,Te=Ae,Ae>>=1;Ae>=1;){for(var _e=0,Ze=_e+X*(H-Te),ze=X*Ae,Ve=X*Te,ht=V*Ae,gt=V*Te,pt,qe,_t,lt;_e<=Ze;_e+=Ve){for(var Mt=_e,Zt=_e+V*(F-Te);Mt<=Zt;Mt+=gt){var At=Mt+ht,qt=Mt+ze,$t=qt+ht;he?(Fe(O[Mt+T],O[qt+T]),pt=we.a,_t=we.b,Fe(O[At+T],O[$t+T]),qe=we.a,lt=we.b,Fe(pt,qe),O[Mt+T]=we.a,O[At+T]=we.b,Fe(_t,lt),O[qt+T]=we.a,O[$t+T]=we.b):(et(O[Mt+T],O[qt+T]),pt=we.a,_t=we.b,et(O[At+T],O[$t+T]),qe=we.a,lt=we.b,et(pt,qe),O[Mt+T]=we.a,O[At+T]=we.b,et(_t,lt),O[qt+T]=we.a,O[$t+T]=we.b)}if(F&Ae){var qt=Mt+ze;he?Fe(O[Mt+T],O[qt+T]):et(O[Mt+T],O[qt+T]),pt=we.a,O[qt+T]=we.b,O[Mt+T]=pt}}if(H&Ae)for(var Mt=_e,Zt=_e+V*(F-Te);Mt<=Zt;Mt+=gt){var At=Mt+ht;he?Fe(O[Mt+T],O[At+T]):et(O[Mt+T],O[At+T]),pt=we.a,O[At+T]=we.b,O[Mt+T]=pt}Te=Ae,Ae>>=1}return _e}function Rt(O,T,F,V,H,X,ce,he,Ee,Ae){for(var Te=0,_e=0,Ze=he,ze=Math.trunc(H.value+(X+7)/8);H.value=14;){var Ve=Te>>_e-14&16383,ht=T[Ve];if(ht.len)_e-=ht.len,ve(ht.lit,ce,Te,_e,F,V,H,Ee,Ae,Ze),Te=ee.c,_e=ee.lc;else{if(!ht.p)throw"hufDecode issues";var gt;for(gt=0;gt=pt&&z(O[ht.p[gt]])==(Te>>_e-pt&(1<>=qe,_e-=qe;_e>0;){var ht=T[Te<<14-_e&16383];if(ht.len)_e-=ht.len,ve(ht.lit,ce,Te,_e,F,V,H,Ee,Ae,Ze),Te=ee.c,_e=ee.lc;else throw"hufDecode issues"}return!0}function rt(O,T,F,V,H,X){var ce={value:0},he=F.value,Ee=Ce(T,F),Ae=Ce(T,F);F.value+=4;var Te=Ce(T,F);if(F.value+=4,Ee<0||Ee>=65537||Ae<0||Ae>=65537)throw"Something wrong with HUF_ENCSIZE";var _e=new Array(65537),Ze=new Array(16384);U(Ze);var ze=V-(F.value-he);if(ne(O,T,F,ze,Ee,Ae,_e),Te>8*(V-(F.value-he)))throw"Something wrong with hufUncompress";Z(_e,Ee,Ae,Ze),Rt(_e,Ze,O,T,F,Te,Ae,X,H,ce)}function J(O,T,F){for(var V=0;VX||(T[H++]=O[F++],H>X));)T[H++]=O[V++]}function De(O){for(var T=O.byteLength,F=new Array,V=0,H=new DataView(O);T>0;){var X=H.getInt8(V++);if(X<0){var ce=-X;T-=ce+1;for(var he=0;he>8==255?H+=V&255:(F[H]=V,H++),O.value++}function We(O,T){T[0]=ue(O[0]),T[1]=ue(O[1]),T[2]=ue(O[5]),T[3]=ue(O[6]),T[4]=ue(O[14]),T[5]=ue(O[15]),T[6]=ue(O[27]),T[7]=ue(O[28]),T[8]=ue(O[2]),T[9]=ue(O[4]),T[10]=ue(O[7]),T[11]=ue(O[13]),T[12]=ue(O[16]),T[13]=ue(O[26]),T[14]=ue(O[29]),T[15]=ue(O[42]),T[16]=ue(O[3]),T[17]=ue(O[8]),T[18]=ue(O[12]),T[19]=ue(O[17]),T[20]=ue(O[25]),T[21]=ue(O[30]),T[22]=ue(O[41]),T[23]=ue(O[43]),T[24]=ue(O[9]),T[25]=ue(O[11]),T[26]=ue(O[18]),T[27]=ue(O[24]),T[28]=ue(O[31]),T[29]=ue(O[40]),T[30]=ue(O[44]),T[31]=ue(O[53]),T[32]=ue(O[10]),T[33]=ue(O[19]),T[34]=ue(O[23]),T[35]=ue(O[32]),T[36]=ue(O[39]),T[37]=ue(O[45]),T[38]=ue(O[52]),T[39]=ue(O[54]),T[40]=ue(O[20]),T[41]=ue(O[22]),T[42]=ue(O[33]),T[43]=ue(O[38]),T[44]=ue(O[46]),T[45]=ue(O[51]),T[46]=ue(O[55]),T[47]=ue(O[60]),T[48]=ue(O[21]),T[49]=ue(O[34]),T[50]=ue(O[37]),T[51]=ue(O[47]),T[52]=ue(O[50]),T[53]=ue(O[56]),T[54]=ue(O[59]),T[55]=ue(O[61]),T[56]=ue(O[35]),T[57]=ue(O[36]),T[58]=ue(O[48]),T[59]=ue(O[49]),T[60]=ue(O[57]),T[61]=ue(O[58]),T[62]=ue(O[62]),T[63]=ue(O[63])}function je(O){const T=.5*Math.cos(.7853975),F=.5*Math.cos(3.14159/16),V=.5*Math.cos(3.14159/8),H=.5*Math.cos(3*3.14159/16),X=.5*Math.cos(5*3.14159/16),ce=.5*Math.cos(3*3.14159/8),he=.5*Math.cos(7*3.14159/16);for(var Ee=new Array(4),Ae=new Array(4),Te=new Array(4),_e=new Array(4),Ze=0;Ze<8;++Ze){var ze=Ze*8;Ee[0]=V*O[ze+2],Ee[1]=ce*O[ze+2],Ee[2]=V*O[ze+6],Ee[3]=ce*O[ze+6],Ae[0]=F*O[ze+1]+H*O[ze+3]+X*O[ze+5]+he*O[ze+7],Ae[1]=H*O[ze+1]-he*O[ze+3]-F*O[ze+5]-X*O[ze+7],Ae[2]=X*O[ze+1]-F*O[ze+3]+he*O[ze+5]+H*O[ze+7],Ae[3]=he*O[ze+1]-X*O[ze+3]+H*O[ze+5]-F*O[ze+7],Te[0]=T*(O[ze+0]+O[ze+4]),Te[3]=T*(O[ze+0]-O[ze+4]),Te[1]=Ee[0]+Ee[3],Te[2]=Ee[1]-Ee[2],_e[0]=Te[0]+Te[1],_e[1]=Te[3]+Te[2],_e[2]=Te[3]-Te[2],_e[3]=Te[0]-Te[1],O[ze+0]=_e[0]+Ae[0],O[ze+1]=_e[1]+Ae[1],O[ze+2]=_e[2]+Ae[2],O[ze+3]=_e[3]+Ae[3],O[ze+4]=_e[3]-Ae[3],O[ze+5]=_e[2]-Ae[2],O[ze+6]=_e[1]-Ae[1],O[ze+7]=_e[0]-Ae[0]}for(var Ve=0;Ve<8;++Ve)Ee[0]=V*O[16+Ve],Ee[1]=ce*O[16+Ve],Ee[2]=V*O[48+Ve],Ee[3]=ce*O[48+Ve],Ae[0]=F*O[8+Ve]+H*O[24+Ve]+X*O[40+Ve]+he*O[56+Ve],Ae[1]=H*O[8+Ve]-he*O[24+Ve]-F*O[40+Ve]-X*O[56+Ve],Ae[2]=X*O[8+Ve]-F*O[24+Ve]+he*O[40+Ve]+H*O[56+Ve],Ae[3]=he*O[8+Ve]-X*O[24+Ve]+H*O[40+Ve]-F*O[56+Ve],Te[0]=T*(O[Ve]+O[32+Ve]),Te[3]=T*(O[Ve]-O[32+Ve]),Te[1]=Ee[0]+Ee[3],Te[2]=Ee[1]-Ee[2],_e[0]=Te[0]+Te[1],_e[1]=Te[3]+Te[2],_e[2]=Te[3]-Te[2],_e[3]=Te[0]-Te[1],O[0+Ve]=_e[0]+Ae[0],O[8+Ve]=_e[1]+Ae[1],O[16+Ve]=_e[2]+Ae[2],O[24+Ve]=_e[3]+Ae[3],O[32+Ve]=_e[3]-Ae[3],O[40+Ve]=_e[2]-Ae[2],O[48+Ve]=_e[1]-Ae[1],O[56+Ve]=_e[0]-Ae[0]}function at(O){for(var T=0;T<64;++T){var F=O[0][T],V=O[1][T],H=O[2][T];O[0][T]=F+1.5747*H,O[1][T]=F-.1873*V-.4682*H,O[2][T]=F+1.8556*V}}function St(O,T,F){for(var V=0;V<64;++V)T[F+V]=yl.toHalfFloat(Qt(O[V]))}function Qt(O){return O<=1?Math.sign(O)*Math.pow(Math.abs(O),2.2):Math.sign(O)*Math.pow(R,Math.abs(O)-1)}function k(O){return new DataView(O.array.buffer,O.offset.value,O.size)}function N(O){var T=O.viewer.buffer.slice(O.offset.value,O.offset.value+O.size),F=new Uint8Array(De(T)),V=new Uint8Array(F.length);return Re(F),Se(F,V),new DataView(V.buffer)}function de(O){var T=O.array.slice(O.offset.value,O.offset.value+O.size),F=Nm(T),V=new Uint8Array(F.length);return Re(F),Se(F,V),new DataView(V.buffer)}function Pe(O){for(var T=O.viewer,F={value:O.offset.value},V=new Uint16Array(O.width*O.scanlineBlockSize*(O.channels*O.type)),H=new Uint8Array(8192),X=0,ce=new Array(O.channels),he=0;he=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(Ee<=Ae)for(var he=0;he0;){var he=Ye(T.buffer,F),Ee=Ne(T,F),Ae=Ee>>2&3,Te=(Ee>>4)-1,_e=new Int8Array([Te])[0],Ze=Ne(T,F);X.push({name:he,index:_e,type:Ze,compression:Ae}),ce-=he.length+3}for(var ze=hr.channels,Ve=new Array(O.channels),ht=0;ht=0&&(qe.idx[lt.index]=_t),gt.offset=_t)}if(H.acCompressedSize>0)switch(H.acCompression){case 0:var At=new Uint16Array(H.totalAcUncompressedCount);rt(O.array,T,F,H.acCompressedSize,At,H.totalAcUncompressedCount);break;case 1:var Mt=O.array.slice(F.value,F.value+H.totalAcUncompressedCount),Zt=Nm(Mt),At=new Uint16Array(Zt.buffer);F.value+=H.totalAcUncompressedCount;break}if(H.dcCompressedSize>0){var qt={array:O.array,offset:F,size:H.dcCompressedSize},$t=new Uint16Array(de(qt).buffer);F.value+=H.dcCompressedSize}if(H.rleRawSize>0){var Mt=O.array.slice(F.value,F.value+H.rleCompressedSize),Zt=Nm(Mt),nn=De(Zt.buffer);F.value+=H.rleCompressedSize}for(var Un=0,wt=new Array(Ve.length),ht=0;ht>10,F=O&1023;return(O>>15?-1:1)*(T?T===31?F?NaN:1/0:Math.pow(2,T-15)*(1+F/1024):6103515625e-14*(F/1024))}function le(O,T){var F=O.getUint16(T.value,!0);return T.value+=2,F}function Ge(O,T){return ue(le(O,T))}function Je(O,T,F,V){for(var H=F.value,X=[];F.valueBt.height?Bt.height-T:Bt.scanlineBlockSize;const V=Bt.size=Bt.height)break;for(let ce=0;ce{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(i)},r,i)}decodeDracoFile(e,t,r,i){const s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}const r=JSON.stringify(t);if(E_.has(e)){const l=E_.get(e);if(l.key===r)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(i=l,new Promise((c,d)=>{i._callbacks[s]={resolve:c,reject:d},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),E_.set(e,{key:r,promise:a}),a}_createGeometry(e){const t=new It;e.index&&t.setIndex(new Kt(e.index.array,1));for(let r=0;r{r.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(r=>{const i=r[0];e||(this.decoderConfig.wasmBinary=r[1]);const s=oV.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(` -`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengths._taskLoad?-1:1});const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const h=d.draco,p=new h.Decoder,m=new h.DecoderBuffer;m.Init(new Int8Array(l),l.byteLength);try{const v=t(h,p,m,c),E=v.attributes.map(x=>x.array.buffer);v.index&&E.push(v.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:v},E)}catch(v){console.error(v),self.postMessage({type:"error",id:a.id,error:v.message})}finally{h.destroy(m),h.destroy(p)}});break}};function t(o,a,l,c){const d=c.attributeIDs,h=c.attributeTypes;let p,m;const v=a.GetEncodedGeometryType(l);if(v===o.TRIANGULAR_MESH)p=new o.Mesh,m=a.DecodeBufferToMesh(l,p);else if(v===o.POINT_CLOUD)p=new o.PointCloud,m=a.DecodeBufferToPointCloud(l,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!m.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+m.error_msg());const E={index:null,attributes:[]};for(const x in d){const g=self[h[x]];let A,_;if(c.useUniqueIDs)_=d[x],A=a.GetAttributeByUniqueId(p,_);else{if(_=a.GetAttributeId(p,o[d[x]]),_===-1)continue;A=a.GetAttribute(p,_)}E.attributes.push(i(o,a,p,x,g,A))}return v===o.TRIANGULAR_MESH&&(E.index=r(o,a,p)),o.destroy(p),E}function r(o,a,l){const d=l.num_faces()*3,h=d*4,p=o._malloc(h);a.GetTrianglesUInt32Array(l,h,p);const m=new Uint32Array(o.HEAPF32.buffer,p,d).slice();return o._free(p),{array:m,itemSize:1}}function i(o,a,l,c,d,h){const p=h.num_components(),v=l.num_points()*p,E=v*d.BYTES_PER_ELEMENT,x=s(o,d),g=o._malloc(E);a.GetAttributeDataArrayForAllPoints(l,h,x,E,g);const A=new d(o.HEAPF32.buffer,g,v).slice();return o._free(g),{name:c,array:A,itemSize:p}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}let Um;const A_=()=>{if(Um)return Um;const n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let i=n;WebAssembly.validate(t)&&(i=e);let s;const o=WebAssembly.instantiate(a(i),{}).then(h=>{s=h.instance,s.exports.__wasm_call_ctors()});function a(h){const p=new Uint8Array(h.length);for(let v=0;v96?E-71:E>64?E-65:E>47?E+4:E>46?63:62}let m=0;for(let v=0;vn===Object(n)&&!Array.isArray(n)&&typeof n!="function";function ZA(n,e){const t=Qr(i=>i.gl),r=Fo(Rh,uC(n)?Object.values(n):n);if(D.useLayoutEffect(()=>{e==null||e(r)},[e]),D.useEffect(()=>{(Array.isArray(r)?r:[r]).forEach(t.initTexture)},[t,r]),uC(n)){const i=Object.keys(n),s={};return i.forEach(o=>Object.assign(s,{[o]:r[i.indexOf(o)]})),s}else return r}ZA.preload=n=>Fo.preload(Rh,n);ZA.clear=n=>Fo.clear(Rh,n);let km=null;function gL(n,e,t){return r=>{t&&t(r),n&&(km||(km=new sV),km.setDecoderPath(typeof n=="string"?n:"https://www.gstatic.com/draco/versioned/decoders/1.5.5/"),r.setDRACOLoader(km)),e&&r.setMeshoptDecoder(typeof A_=="function"?A_():A_)}}function V0(n,e=!0,t=!0,r){return Fo(QA,n,gL(e,t,r))}V0.preload=(n,e=!0,t=!0,r)=>Fo.preload(QA,n,gL(e,t,r));V0.clear=n=>Fo.clear(QA,n);const aV=D.forwardRef(({makeDefault:n,camera:e,regress:t,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const h=Qr(b=>b.invalidate),p=Qr(b=>b.camera),m=Qr(b=>b.gl),v=Qr(b=>b.events),E=Qr(b=>b.setEvents),x=Qr(b=>b.set),g=Qr(b=>b.get),A=Qr(b=>b.performance),_=e||p,w=r||v.connected||m.domElement,C=D.useMemo(()=>new w6(_),[_]);return $g(()=>{C.enabled&&C.update()},-1),D.useEffect(()=>(s&&C.connect(s===!0?w:s),C.connect(w),()=>void C.dispose()),[s,w,t,C,h]),D.useEffect(()=>{const b=R=>{h(),t&&A.regress(),o&&o(R)},B=R=>{a&&a(R)},I=R=>{l&&l(R)};return C.addEventListener("change",b),C.addEventListener("start",B),C.addEventListener("end",I),()=>{C.removeEventListener("start",B),C.removeEventListener("end",I),C.removeEventListener("change",b)}},[o,a,l,C,h,E]),D.useEffect(()=>{if(n){const b=g().controls;return x({controls:C}),()=>x({controls:b})}},[n,C]),D.createElement("primitive",Pn({ref:d,object:C,enableDamping:i},c))}),S_={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},lV="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",fC=n=>Array.isArray(n);function vL({files:n=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"],path:e="",preset:t=void 0,encoding:r=void 0,extensions:i}={}){var s;let o=null,a=!1,l;if(t){if(!(t in S_))throw new Error("Preset must be one of: "+Object.keys(S_).join(", "));n=S_[t],e=lV}if(a=fC(n),l=fC(n)?"cube":n.startsWith("data:application/exr")?"exr":n.startsWith("data:application/hdr")?"hdr":(s=n.split(".").pop())==null?void 0:s.toLowerCase(),o=a?wB:l==="hdr"?rV:l==="exr"?iV:null,!o)throw new Error("useEnvironment: Unrecognized file extension: "+n);const c=Fo(o,a?[n]:n,m=>{m.setPath==null||m.setPath(e),i&&i(m)}),d=a?c[0]:c;d.mapping=a?Po:wu;const h=3001,p=3e3;return"colorSpace"in d?d.colorSpace=r??a?"srgb":"srgb-linear":d.encoding=r??a?h:p,d}const cV=n=>n.current&&n.current.isScene,uV=n=>cV(n)?n.current:n;function qA(n,e,t,r,i=0){const s=uV(e||t),o=s.background,a=s.environment,l=s.backgroundBlurriness||0;return n!=="only"&&(s.environment=r),n&&(s.background=r),n&&s.backgroundBlurriness!==void 0&&(s.backgroundBlurriness=i),()=>{n!=="only"&&(s.environment=a),n&&(s.background=o),n&&s.backgroundBlurriness!==void 0&&(s.backgroundBlurriness=l)}}function eS({scene:n,background:e=!1,blur:t,map:r}){const i=Qr(s=>s.scene);return D.useLayoutEffect(()=>{if(r)return qA(e,n,i,r,t)},[i,n,r,e,t]),null}function yL({background:n=!1,scene:e,blur:t,...r}){const i=vL(r),s=Qr(o=>o.scene);return D.useLayoutEffect(()=>qA(n,e,s,i,t),[i,n,e,s,t]),null}function fV({children:n,near:e=1,far:t=1e3,resolution:r=256,frames:i=1,map:s,background:o=!1,blur:a,scene:l,files:c,path:d,preset:h=void 0,extensions:p}){const m=Qr(_=>_.gl),v=Qr(_=>_.scene),E=D.useRef(null),[x]=D.useState(()=>new Vd),g=D.useMemo(()=>{const _=new hA(r);return _.texture.type=kr,_},[r]);D.useLayoutEffect(()=>(i===1&&E.current.update(m,x),qA(o,l,v,g.texture,a)),[n,x,g.texture,l,v,o,i,m]);let A=1;return $g(()=>{(i===1/0||AkB({GroundProjectedEnvImpl:E6}),[]);const a=D.useMemo(()=>[o],[o]),l=(e=n.ground)==null?void 0:e.height,c=(t=n.ground)==null?void 0:t.radius,d=(r=(i=n.ground)==null?void 0:i.scale)!==null&&r!==void 0?r:1e3;return D.createElement(D.Fragment,null,D.createElement(eS,Pn({},n,{map:o})),D.createElement("groundProjectedEnvImpl",{args:a,scale:d,height:l,radius:c}))}function hV(n){return n.ground?D.createElement(dV,n):n.map?D.createElement(eS,n):n.children?D.createElement(fV,n):D.createElement(yL,n)}var sn={},pV={get exports(){return sn},set exports(n){sn=n}},mV="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",gV=mV,vV=gV;function _L(){}function xL(){}xL.resetWarningCache=_L;var yV=function(){function n(r,i,s,o,a,l){if(l!==vV){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}n.isRequired=n;function e(){return n}var t={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:e,element:n,elementType:n,instanceOf:e,node:n,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:xL,resetWarningCache:_L};return t.PropTypes=t,t};pV.exports=yV();function _V(n,e){typeof n=="function"?n(e):n!=null&&(n.current=e)}function EL(...n){return e=>n.forEach(t=>_V(t,e))}function Ku(...n){return D.useCallback(EL(...n),n)}const AL=D.forwardRef((n,e)=>{const{children:t,...r}=n,i=D.Children.toArray(t),s=i.find(xV);if(s){const o=s.props.children,a=i.map(l=>l===s?D.Children.count(o)>1?D.Children.only(null):D.isValidElement(o)?o.props.children:null:l);return D.createElement(w1,Pn({},r,{ref:e}),D.isValidElement(o)?D.cloneElement(o,void 0,a):null)}return D.createElement(w1,Pn({},r,{ref:e}),t)});AL.displayName="Slot";const w1=D.forwardRef((n,e)=>{const{children:t,...r}=n;return D.isValidElement(t)?D.cloneElement(t,{...EV(r,t.props),ref:e?EL(e,t.ref):t.ref}):D.Children.count(t)>1?D.Children.only(null):null});w1.displayName="SlotClone";const SL=({children:n})=>D.createElement(D.Fragment,null,n);function xV(n){return D.isValidElement(n)&&n.type===SL}function EV(n,e){const t={...e};for(const r in e){const i=n[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?t[r]=(...a)=>{s(...a),i(...a)}:i&&(t[r]=i):r==="style"?t[r]={...i,...s}:r==="className"&&(t[r]=[i,s].filter(Boolean).join(" "))}return{...n,...t}}const AV=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Jl=AV.reduce((n,e)=>{const t=D.forwardRef((r,i)=>{const{asChild:s,...o}=r,a=s?AL:e;return D.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),D.createElement(a,Pn({},o,{ref:i}))});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function SV(n,e){n&&Pl.flushSync(()=>n.dispatchEvent(e))}const wV=D.forwardRef((n,e)=>{var t;const{container:r=globalThis==null||(t=globalThis.document)===null||t===void 0?void 0:t.body,...i}=n;return r?U2.createPortal(D.createElement(Jl.div,Pn({},i,{ref:e})),r):null}),MV=wV;var dC=Object.prototype.hasOwnProperty;function Qd(n,e){var t,r;if(n===e)return!0;if(n&&e&&(t=n.constructor)===e.constructor){if(t===Date)return n.getTime()===e.getTime();if(t===RegExp)return n.toString()===e.toString();if(t===Array){if((r=n.length)===e.length)for(;r--&&Qd(n[r],e[r]););return r===-1}if(!t||typeof n=="object"){r=0;for(t in n)if(dC.call(n,t)&&++r&&!dC.call(e,t)||!(t in e)||!Qd(n[t],e[t]))return!1;return Object.keys(e).length===r}}return n!==n&&e!==e}var W0=function(e,t,r,i){this.name=e,this.fn=t,this.args=r,this.modifiers=i};W0.prototype._test=function(e){var t=this.fn;try{pu(this.modifiers.slice(),t,this)(e)}catch{t=function(){return!1}}try{return pu(this.modifiers.slice(),t,this)(e)}catch{return!1}};W0.prototype._check=function(e){try{pu(this.modifiers.slice(),this.fn,this)(e)}catch{if(pu(this.modifiers.slice(),function(r){return r},this)(!1))return}if(!pu(this.modifiers.slice(),this.fn,this)(e))throw null};W0.prototype._testAsync=function(e){var t=this;return new Promise(function(r,i){ML(t.modifiers.slice(),t.fn,t)(e).then(function(s){s?r(e):i(null)}).catch(function(s){return i(s)})})};function wL(n,e){return e===void 0&&(e="simple"),typeof n=="object"?n[e]:n}function pu(n,e,t){if(n.length){var r=n.shift(),i=pu(n,e,t);return r.perform(i,t)}else return wL(e)}function ML(n,e,t){if(n.length){var r=n.shift(),i=ML(n,e,t);return r.performAsync(i,t)}else return function(s){return Promise.resolve(wL(e,"async")(s))}}var TV=function(e,t,r){this.name=e,this.perform=t,this.performAsync=r},tS=function(n){function e(t,r,i,s){for(var o=[],a=arguments.length-4;a-- >0;)o[a]=arguments[a+4];n.call(this,o),n.captureStackTrace&&n.captureStackTrace(this,e),this.rule=t,this.value=r,this.cause=i,this.target=s}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(Error),Gs=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=[]),this.chain=e,this.nextRuleModifiers=t};Gs.prototype._applyRule=function(e,t){var r=this;return function(){for(var i=[],s=arguments.length;s--;)i[s]=arguments[s];return r.chain.push(new W0(t,e.apply(r,i),i,r.nextRuleModifiers)),r.nextRuleModifiers=[],r}};Gs.prototype._applyModifier=function(e,t){return this.nextRuleModifiers.push(new TV(t,e.simple,e.async)),this};Gs.prototype._clone=function(){return new Gs(this.chain.slice(),this.nextRuleModifiers.slice())};Gs.prototype.test=function(e){return this.chain.every(function(t){return t._test(e)})};Gs.prototype.testAll=function(e){var t=[];return this.chain.forEach(function(r){try{r._check(e)}catch(i){t.push(new tS(r,e,i))}}),t};Gs.prototype.check=function(e){this.chain.forEach(function(t){try{t._check(e)}catch(r){throw new tS(t,e,r)}})};Gs.prototype.testAsync=function(e){var t=this;return new Promise(function(r,i){TL(e,t.chain.slice(),r,i)})};function TL(n,e,t,r){if(e.length){var i=e.shift();i._testAsync(n).then(function(){TL(n,e,t,r)},function(s){r(new tS(i,n,s))})}else t(n)}var hC=function(n,e){return e&&typeof n=="string"&&n.trim().length===0?!0:n==null};function bV(n,e){return e===void 0&&(e=!1),{simple:function(t){return hC(t,e)||n.check(t)===void 0},async:function(t){return hC(t,e)||n.testAsync(t)}}}function ti(){return typeof Proxy<"u"?bL(new Gs):M1(new Gs)}var Zd={};ti.extend=function(n){Object.assign(Zd,n)};ti.clearCustomRules=function(){Zd={}};function bL(n){return new Proxy(n,{get:function(t,r){if(r in t)return t[r];var i=bL(n._clone());if(r in jg)return i._applyModifier(jg[r],r);if(r in Zd)return i._applyRule(Zd[r],r);if(r in T1)return i._applyRule(T1[r],r)}})}function M1(n){var e=function(i,s){return Object.keys(i).forEach(function(o){s[o]=function(){for(var a=[],l=arguments.length;l--;)a[l]=arguments[l];var c=M1(s._clone()),d=c._applyRule(i[o],o).apply(void 0,a);return d}}),s},t=e(T1,n),r=e(Zd,t);return Object.keys(jg).forEach(function(i){Object.defineProperty(r,i,{get:function(){var s=M1(r._clone());return s._applyModifier(jg[i],i)}})}),r}var jg={not:{simple:function(n){return function(e){return!n(e)}},async:function(n){return function(e){return Promise.resolve(n(e)).then(function(t){return!t}).catch(function(){return!0})}}},some:{simple:function(n){return function(e){return zm(e).some(function(t){try{return n(t)}catch{return!1}})}},async:function(n){return function(e){return Promise.all(zm(e).map(function(t){try{return n(t).catch(function(){return!1})}catch{return!1}})).then(function(t){return t.some(Boolean)})}}},every:{simple:function(n){return function(e){return e!==!1&&zm(e).every(n)}},async:function(n){return function(e){return Promise.all(zm(e).map(n)).then(function(t){return t.every(Boolean)})}}},strict:{simple:function(n,e){return function(t){return pC(e)&&t&&typeof t=="object"?Object.keys(e.args[0]).length===Object.keys(t).length&&n(t):n(t)}},async:function(n,e){return function(t){return Promise.resolve(n(t)).then(function(r){return pC(e)&&t&&typeof t=="object"?Object.keys(e.args[0]).length===Object.keys(t).length&&r:r}).catch(function(){return!1})}}}};function pC(n){return n&&n.name==="schema"&&n.args.length>0&&typeof n.args[0]=="object"}function zm(n){return typeof n=="string"?n.split(""):n}var T1={equal:function(n){return function(e){return e==n}},exact:function(n){return function(e){return e===n}},number:function(n){return n===void 0&&(n=!0),function(e){return typeof e=="number"&&(n||isFinite(e))}},integer:function(){return function(n){var e=Number.isInteger||CV;return e(n)}},numeric:function(){return function(n){return!isNaN(parseFloat(n))&&isFinite(n)}},string:function(){return Nc("string")},boolean:function(){return Nc("boolean")},undefined:function(){return Nc("undefined")},null:function(){return Nc("null")},array:function(){return Nc("array")},object:function(){return Nc("object")},instanceOf:function(n){return function(e){return e instanceof n}},pattern:function(n){return function(e){return n.test(e)}},lowercase:function(){return function(n){return typeof n=="boolean"||n===n.toLowerCase()&&n.trim()!==""}},uppercase:function(){return function(n){return n===n.toUpperCase()&&n.trim()!==""}},vowel:function(){return function(n){return/^[aeiou]+$/i.test(n)}},consonant:function(){return function(n){return/^(?=[^aeiou])([a-z]+)$/i.test(n)}},first:function(n){return function(e){return e[0]==n}},last:function(n){return function(e){return e[e.length-1]==n}},empty:function(){return function(n){return n.length===0}},length:function(n,e){return function(t){return t.length>=n&&t.length<=(e||n)}},minLength:function(n){return function(e){return e.length>=n}},maxLength:function(n){return function(e){return e.length<=n}},negative:function(){return function(n){return n<0}},positive:function(){return function(n){return n>=0}},between:function(n,e){return function(t){return t>=n&&t<=e}},range:function(n,e){return function(t){return t>=n&&t<=e}},lessThan:function(n){return function(e){return en}},greaterThanOrEqual:function(n){return function(e){return e>=n}},even:function(){return function(n){return n%2===0}},odd:function(){return function(n){return n%2!==0}},includes:function(n){return function(e){return~e.indexOf(n)}},schema:function(n){return RV(n)},passesAnyOf:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];return function(t){return n.some(function(r){return r.test(t)})}},optional:bV};function Nc(n){return function(e){return Array.isArray(e)&&n==="array"||e===null&&n==="null"||typeof e===n}}function CV(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n}function RV(n){return{simple:function(e){var t=[];if(Object.keys(n).forEach(function(r){var i=n[r];try{i.check((e||{})[r])}catch(s){s.target=r,t.push(s)}}),t.length>0)throw t;return!0},async:function(e){var t=[],r=Object.keys(n).map(function(i){var s=n[i];return s.testAsync((e||{})[i]).catch(function(o){o.target=i,t.push(o)})});return Promise.all(r).then(function(){if(t.length>0)throw t;return!0})}}}var rn="colors",Lr="sizes",ot="space",PV={gap:ot,gridGap:ot,columnGap:ot,gridColumnGap:ot,rowGap:ot,gridRowGap:ot,inset:ot,insetBlock:ot,insetBlockEnd:ot,insetBlockStart:ot,insetInline:ot,insetInlineEnd:ot,insetInlineStart:ot,margin:ot,marginTop:ot,marginRight:ot,marginBottom:ot,marginLeft:ot,marginBlock:ot,marginBlockEnd:ot,marginBlockStart:ot,marginInline:ot,marginInlineEnd:ot,marginInlineStart:ot,padding:ot,paddingTop:ot,paddingRight:ot,paddingBottom:ot,paddingLeft:ot,paddingBlock:ot,paddingBlockEnd:ot,paddingBlockStart:ot,paddingInline:ot,paddingInlineEnd:ot,paddingInlineStart:ot,top:ot,right:ot,bottom:ot,left:ot,scrollMargin:ot,scrollMarginTop:ot,scrollMarginRight:ot,scrollMarginBottom:ot,scrollMarginLeft:ot,scrollMarginX:ot,scrollMarginY:ot,scrollMarginBlock:ot,scrollMarginBlockEnd:ot,scrollMarginBlockStart:ot,scrollMarginInline:ot,scrollMarginInlineEnd:ot,scrollMarginInlineStart:ot,scrollPadding:ot,scrollPaddingTop:ot,scrollPaddingRight:ot,scrollPaddingBottom:ot,scrollPaddingLeft:ot,scrollPaddingX:ot,scrollPaddingY:ot,scrollPaddingBlock:ot,scrollPaddingBlockEnd:ot,scrollPaddingBlockStart:ot,scrollPaddingInline:ot,scrollPaddingInlineEnd:ot,scrollPaddingInlineStart:ot,fontSize:"fontSizes",background:rn,backgroundColor:rn,backgroundImage:rn,borderImage:rn,border:rn,borderBlock:rn,borderBlockEnd:rn,borderBlockStart:rn,borderBottom:rn,borderBottomColor:rn,borderColor:rn,borderInline:rn,borderInlineEnd:rn,borderInlineStart:rn,borderLeft:rn,borderLeftColor:rn,borderRight:rn,borderRightColor:rn,borderTop:rn,borderTopColor:rn,caretColor:rn,color:rn,columnRuleColor:rn,fill:rn,outline:rn,outlineColor:rn,stroke:rn,textDecorationColor:rn,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:Lr,minBlockSize:Lr,maxBlockSize:Lr,inlineSize:Lr,minInlineSize:Lr,maxInlineSize:Lr,width:Lr,minWidth:Lr,maxWidth:Lr,height:Lr,minHeight:Lr,maxHeight:Lr,flexBasis:Lr,gridTemplateColumns:Lr,gridTemplateRows:Lr,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},IV=(n,e)=>typeof e=="function"?{"()":Function.prototype.toString.call(e)}:e,Yu=()=>{const n=Object.create(null);return(e,t,...r)=>{const i=(s=>JSON.stringify(s,IV))(e);return i in n?n[i]:n[i]=t(e,...r)}},Cl=Symbol.for("sxs.internal"),nS=(n,e)=>Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)),mC=n=>{for(const e in n)return!0;return!1},{hasOwnProperty:BV}=Object.prototype,b1=n=>n.includes("-")?n:n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()),LV=/\s+(?![^()]*\))/,Uc=n=>e=>n(...typeof e=="string"?String(e).split(LV):[e]),gC={appearance:n=>({WebkitAppearance:n,appearance:n}),backfaceVisibility:n=>({WebkitBackfaceVisibility:n,backfaceVisibility:n}),backdropFilter:n=>({WebkitBackdropFilter:n,backdropFilter:n}),backgroundClip:n=>({WebkitBackgroundClip:n,backgroundClip:n}),boxDecorationBreak:n=>({WebkitBoxDecorationBreak:n,boxDecorationBreak:n}),clipPath:n=>({WebkitClipPath:n,clipPath:n}),content:n=>({content:n.includes('"')||n.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(n)?n:`"${n}"`}),hyphens:n=>({WebkitHyphens:n,hyphens:n}),maskImage:n=>({WebkitMaskImage:n,maskImage:n}),maskSize:n=>({WebkitMaskSize:n,maskSize:n}),tabSize:n=>({MozTabSize:n,tabSize:n}),textSizeAdjust:n=>({WebkitTextSizeAdjust:n,textSizeAdjust:n}),userSelect:n=>({WebkitUserSelect:n,userSelect:n}),marginBlock:Uc((n,e)=>({marginBlockStart:n,marginBlockEnd:e||n})),marginInline:Uc((n,e)=>({marginInlineStart:n,marginInlineEnd:e||n})),maxSize:Uc((n,e)=>({maxBlockSize:n,maxInlineSize:e||n})),minSize:Uc((n,e)=>({minBlockSize:n,minInlineSize:e||n})),paddingBlock:Uc((n,e)=>({paddingBlockStart:n,paddingBlockEnd:e||n})),paddingInline:Uc((n,e)=>({paddingInlineStart:n,paddingInlineEnd:e||n}))},w_=/([\d.]+)([^]*)/,DV=(n,e)=>n.length?n.reduce((t,r)=>(t.push(...e.map(i=>i.includes("&")?i.replace(/&/g,/[ +>|~]/.test(r)&&/&.*&/.test(i)?`:is(${r})`:r):r+" "+i)),t),[]):e,OV=(n,e)=>n in FV&&typeof e=="string"?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,(t,r,i,s)=>r+(i==="stretch"?`-moz-available${s};${b1(n)}:${r}-webkit-fill-available`:`-moz-fit-content${s};${b1(n)}:${r}fit-content`)+s):String(e),FV={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},Bo=n=>n?n+"-":"",CL=(n,e,t)=>n.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,(r,i,s,o,a)=>o=="$"==!!s?r:(i||o=="--"?"calc(":"")+"var(--"+(o==="$"?Bo(e)+(a.includes("$")?"":Bo(t))+a.replace(/\$/g,"-"):a)+")"+(i||o=="--"?"*"+(i||"")+(s||"1")+")":"")),NV=/\s*,\s*(?![^()]*\))/,UV=Object.prototype.toString,ru=(n,e,t,r,i)=>{let s,o,a;const l=(c,d,h)=>{let p,m;const v=E=>{for(p in E){const A=p.charCodeAt(0)===64,_=A&&Array.isArray(E[p])?E[p]:[E[p]];for(m of _){const w=/[A-Z]/.test(g=p)?g:g.replace(/-[^]/g,b=>b[1].toUpperCase()),C=typeof m=="object"&&m&&m.toString===UV&&(!r.utils[w]||!d.length);if(w in r.utils&&!C){const b=r.utils[w];if(b!==o){o=b,v(b(m)),o=null;continue}}else if(w in gC){const b=gC[w];if(b!==a){a=b,v(b(m)),a=null;continue}}if(A&&(x=p.slice(1)in r.media?"@media "+r.media[p.slice(1)]:p,p=x.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,(b,B,I,R,L,U)=>{const j=w_.test(B),$=.0625*(j?-1:1),[K,Y]=j?[R,B]:[B,R];return"("+(I[0]==="="?"":I[0]===">"===j?"max-":"min-")+K+":"+(I[0]!=="="&&I.length===1?Y.replace(w_,(ne,ie,z)=>Number(ie)+$*(I===">"?1:-1)+z):Y)+(L?") and ("+(L[0]===">"?"min-":"max-")+K+":"+(L.length===1?U.replace(w_,(ne,ie,z)=>Number(ie)+$*(L===">"?-1:1)+z):U):"")+")"})),C){const b=A?h.concat(p):[...h],B=A?[...d]:DV(d,p.split(NV));s!==void 0&&i(vC(...s)),s=void 0,l(m,B,b)}else s===void 0&&(s=[[],d,h]),p=A||p.charCodeAt(0)!==36?p:`--${Bo(r.prefix)}${p.slice(1).replace(/\$/g,"-")}`,m=C?m:typeof m=="number"?m&&w in kV?String(m)+"px":String(m):CL(OV(w,m??""),r.prefix,r.themeMap[w]),s[0].push(`${A?`${p} `:`${b1(p)}:`}${m}`)}}var x,g};v(c),s!==void 0&&i(vC(...s)),s=void 0};l(n,e,t)},vC=(n,e,t)=>`${t.map(r=>`${r}{`).join("")}${e.length?`${e.join(",")}{`:""}${n.join(";")}${e.length?"}":""}${Array(t.length?t.length+1:0).join("}")}`,kV={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},yC=n=>String.fromCharCode(n+(n>25?39:97)),Rl=n=>(e=>{let t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=yC(t%52)+r;return yC(t%52)+r})(((e,t)=>{let r=t.length;for(;r;)e=33*e^t.charCodeAt(--r);return e})(5381,JSON.stringify(n))>>>0),ed=["themed","global","styled","onevar","resonevar","allvar","inline"],zV=n=>{if(n.href&&!n.href.startsWith(location.origin))return!1;try{return!!n.cssRules}catch{return!1}},HV=n=>{let e;const t=()=>{const{cssRules:i}=e.sheet;return[].map.call(i,(s,o)=>{const{cssText:a}=s;let l="";if(a.startsWith("--sxs"))return"";if(i[o-1]&&(l=i[o-1].cssText).startsWith("--sxs")){if(!s.cssRules.length)return"";for(const c in e.rules)if(e.rules[c].group===s)return`--sxs{--sxs:${[...e.rules[c].cache].join(" ")}}${a}`;return s.cssRules.length?`${l}${a}`:""}return a}).join("")},r=()=>{if(e){const{rules:a,sheet:l}=e;if(!l.deleteRule){for(;Object(Object(l.cssRules)[0]).type===3;)l.cssRules.splice(0,1);l.cssRules=[]}for(const c in a)delete a[c]}const i=Object(n).styleSheets||[];for(const a of i)if(zV(a)){for(let l=0,c=a.cssRules;c[l];++l){const d=Object(c[l]);if(d.type!==1)continue;const h=Object(c[l+1]);if(h.type!==4)continue;++l;const{cssText:p}=d;if(!p.startsWith("--sxs"))continue;const m=p.slice(14,-3).trim().split(/\s+/),v=ed[m[0]];v&&(e||(e={sheet:a,reset:r,rules:{},toString:t}),e.rules[v]={group:h,index:l,cache:new Set(m)})}if(e)break}if(!e){const a=(l,c)=>({type:c,cssRules:[],insertRule(d,h){this.cssRules.splice(h,0,a(d,{import:3,undefined:1}[(d.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return l==="@media{}"?`@media{${[].map.call(this.cssRules,d=>d.cssText).join("")}}`:l}});e={sheet:n?(n.head||n).appendChild(document.createElement("style")).sheet:a("","text/css"),rules:{},reset:r,toString:t}}const{sheet:s,rules:o}=e;for(let a=ed.length-1;a>=0;--a){const l=ed[a];if(!o[l]){const c=ed[a+1],d=o[c]?o[c].index:s.cssRules.length;s.insertRule("@media{}",d),s.insertRule(`--sxs{--sxs:${a}}`,d),o[l]={group:s.cssRules[d+1],index:d,cache:new Set([a])}}GV(o[l])}};return r(),e},GV=n=>{const e=n.group;let t=e.cssRules.length;n.apply=r=>{try{e.insertRule(r,t),++t}catch{}}},$f=Symbol(),VV=Yu(),_C=(n,e)=>VV(n,()=>(...t)=>{let r={type:null,composers:new Set};for(const i of t)if(i!=null)if(i[Cl]){r.type==null&&(r.type=i[Cl].type);for(const s of i[Cl].composers)r.composers.add(s)}else i.constructor!==Object||i.$$typeof?r.type==null&&(r.type=i):r.composers.add(WV(i,n));return r.type==null&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),$V(n,r,e)}),WV=({variants:n,compoundVariants:e,defaultVariants:t,...r},i)=>{const s=`${Bo(i.prefix)}c-${Rl(r)}`,o=[],a=[],l=Object.create(null),c=[];for(const p in t)l[p]=String(t[p]);if(typeof n=="object"&&n)for(const p in n){d=l,h=p,BV.call(d,h)||(l[p]="undefined");const m=n[p];for(const v in m){const E={[p]:String(v)};String(v)==="undefined"&&c.push(p);const x=m[v],g=[E,x,!mC(x)];o.push(g)}}var d,h;if(typeof e=="object"&&e)for(const p of e){let{css:m,...v}=p;m=typeof m=="object"&&m||{};for(const x in v)v[x]=String(v[x]);const E=[v,m,!mC(m)];a.push(E)}return[s,r,o,a,l,c]},$V=(n,e,t)=>{const[r,i,s,o]=XV(e.composers),a=typeof e.type=="function"||e.type.$$typeof?(h=>{function p(){for(let m=0;mp.rules[m]={apply:v=>p[$f].push([m,v])}),p})(t):null,l=(a||t).rules,c=`.${r}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,d=h=>{h=typeof h=="object"&&h||jV;const{css:p,...m}=h,v={};for(const g in s)if(delete m[g],g in h){let A=h[g];typeof A=="object"&&A?v[g]={"@initial":s[g],...A}:(A=String(A),v[g]=A!=="undefined"||o.has(g)?A:s[g])}else v[g]=s[g];const E=new Set([...i]);for(const[g,A,_,w]of e.composers){t.rules.styled.cache.has(g)||(t.rules.styled.cache.add(g),ru(A,[`.${g}`],[],n,B=>{l.styled.apply(B)}));const C=xC(_,v,n.media),b=xC(w,v,n.media,!0);for(const B of C)if(B!==void 0)for(const[I,R,L]of B){const U=`${g}-${Rl(R)}-${I}`;E.add(U);const j=(L?t.rules.resonevar:t.rules.onevar).cache,$=L?l.resonevar:l.onevar;j.has(U)||(j.add(U),ru(R,[`.${U}`],[],n,K=>{$.apply(K)}))}for(const B of b)if(B!==void 0)for(const[I,R]of B){const L=`${g}-${Rl(R)}-${I}`;E.add(L),t.rules.allvar.cache.has(L)||(t.rules.allvar.cache.add(L),ru(R,[`.${L}`],[],n,U=>{l.allvar.apply(U)}))}}if(typeof p=="object"&&p){const g=`${r}-i${Rl(p)}-css`;E.add(g),t.rules.inline.cache.has(g)||(t.rules.inline.cache.add(g),ru(p,[`.${g}`],[],n,A=>{l.inline.apply(A)}))}for(const g of String(h.className||"").trim().split(/\s+/))g&&E.add(g);const x=m.className=[...E].join(" ");return{type:e.type,className:x,selector:c,props:m,toString:()=>x,deferredInjector:a}};return nS(d,{className:r,selector:c,[Cl]:e,toString:()=>(t.rules.styled.cache.has(r)||d(),r)})},XV=n=>{let e="";const t=[],r={},i=[];for(const[s,,,,o,a]of n){e===""&&(e=s),t.push(s),i.push(...a);for(const l in o){const c=o[l];(r[l]===void 0||c!=="undefined"||a.includes(c))&&(r[l]=c)}}return[e,t,r,new Set(i)]},xC=(n,e,t,r)=>{const i=[];e:for(let[s,o,a]of n){if(a)continue;let l,c=0,d=!1;for(l in s){const h=s[l];let p=e[l];if(p!==h){if(typeof p!="object"||!p)continue e;{let m,v,E=0;for(const x in p){if(h===String(p[x])){if(x!=="@initial"){const g=x.slice(1);(v=v||[]).push(g in t?t[g]:x.replace(/^@media ?/,"")),d=!0}c+=E,m=!0}++E}if(v&&v.length&&(o={["@media "+v.join(", ")]:o}),!m)continue e}}}(i[c]=i[c]||[]).push([r?"cv":`${l}-${s[l]}`,o,d])}return i},jV={},JV=Yu(),KV=(n,e)=>JV(n,()=>(...t)=>{const r=()=>{for(let i of t){i=typeof i=="object"&&i||{};let s=Rl(i);if(!e.rules.global.cache.has(s)){if(e.rules.global.cache.add(s),"@import"in i){let o=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let a of[].concat(i["@import"]))a=a.includes('"')||a.includes("'")?a:`"${a}"`,e.sheet.insertRule(`@import ${a};`,o++);delete i["@import"]}ru(i,[],[],n,o=>{e.rules.global.apply(o)})}}return""};return nS(r,{toString:r})}),YV=Yu(),QV=(n,e)=>YV(n,()=>t=>{const r=`${Bo(n.prefix)}k-${Rl(t)}`,i=()=>{if(!e.rules.global.cache.has(r)){e.rules.global.cache.add(r);const s=[];ru(t,[],[],n,a=>s.push(a));const o=`@keyframes ${r}{${s.join("")}}`;e.rules.global.apply(o)}return r};return nS(i,{get name(){return i()},toString:i})}),ZV=class{constructor(n,e,t,r){this.token=n==null?"":String(n),this.value=e==null?"":String(e),this.scale=t==null?"":String(t),this.prefix=r==null?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+Bo(this.prefix)+Bo(this.scale)+this.token}toString(){return this.computedValue}},qV=Yu(),eW=(n,e)=>qV(n,()=>(t,r)=>{r=typeof t=="object"&&t||Object(r);const i=`.${t=(t=typeof t=="string"?t:"")||`${Bo(n.prefix)}t-${Rl(r)}`}`,s={},o=[];for(const l in r){s[l]={};for(const c in r[l]){const d=`--${Bo(n.prefix)}${l}-${c}`,h=CL(String(r[l][c]),n.prefix,l);s[l][c]=new ZV(c,h,l,n.prefix),o.push(`${d}:${h}`)}}const a=()=>{if(o.length&&!e.rules.themed.cache.has(t)){e.rules.themed.cache.add(t);const l=`${r===n.theme?":root,":""}.${t}{${o.join(";")}}`;e.rules.themed.apply(l)}return t};return{...s,get className(){return a()},selector:i,toString:a}}),tW=Yu(),nW=Yu(),rW=n=>{const e=(t=>{let r=!1;const i=tW(t,s=>{r=!0;const o="prefix"in(s=typeof s=="object"&&s||{})?String(s.prefix):"",a=typeof s.media=="object"&&s.media||{},l=typeof s.root=="object"?s.root||null:globalThis.document||null,c=typeof s.theme=="object"&&s.theme||{},d={prefix:o,media:a,theme:c,themeMap:typeof s.themeMap=="object"&&s.themeMap||{...PV},utils:typeof s.utils=="object"&&s.utils||{}},h=HV(l),p={css:_C(d,h),globalCss:KV(d,h),keyframes:QV(d,h),createTheme:eW(d,h),reset(){h.reset(),p.theme.toString()},theme:{},sheet:h,config:d,prefix:o,getCssText:h.toString,toString:h.toString};return String(p.theme=p.createTheme(c)),p});return r||i.reset(),i})(n);return e.styled=(({config:t,sheet:r})=>nW(t,()=>{const i=_C(t,r);return(...s)=>{const o=i(...s),a=o[Cl].type,l=Q.forwardRef((c,d)=>{const h=c&&c.as||a,{props:p,deferredInjector:m}=o(c);return delete p.as,p.ref=d,m?Q.createElement(Q.Fragment,null,Q.createElement(h,p),Q.createElement(m,null)):Q.createElement(h,p)});return l.className=o.className,l.displayName=`Styled.${a.displayName||a.name||a}`,l.selector=o.selector,l.toString=()=>o.selector,l[Cl]=o[Cl],l}}))(e),e};function uo(n,e,{checkForDefaultPrevented:t=!0}={}){return function(i){if(n==null||n(i),t===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function RL(n,e=[]){let t=[];function r(s,o){const a=D.createContext(o),l=t.length;t=[...t,o];function c(h){const{scope:p,children:m,...v}=h,E=(p==null?void 0:p[n][l])||a,x=D.useMemo(()=>v,Object.values(v));return D.createElement(E.Provider,{value:x},m)}function d(h,p){const m=(p==null?void 0:p[n][l])||a,v=D.useContext(m);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,d]}const i=()=>{const s=t.map(o=>D.createContext(o));return function(a){const l=(a==null?void 0:a[n])||s;return D.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return i.scopeName=n,[r,iW(i,...e)]}function iW(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return D.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function Qu(n){const e=D.useRef(n);return D.useEffect(()=>{e.current=n}),D.useMemo(()=>(...t)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...t)},[])}function sW(n,e=globalThis==null?void 0:globalThis.document){const t=Qu(n);D.useEffect(()=>{const r=i=>{i.key==="Escape"&&t(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[t,e])}const C1="dismissableLayer.update",oW="dismissableLayer.pointerDownOutside",aW="dismissableLayer.focusOutside";let EC;const lW=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cW=D.forwardRef((n,e)=>{var t;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=n,d=D.useContext(lW),[h,p]=D.useState(null),m=(t=h==null?void 0:h.ownerDocument)!==null&&t!==void 0?t:globalThis==null?void 0:globalThis.document,[,v]=D.useState({}),E=Ku(e,I=>p(I)),x=Array.from(d.layers),[g]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),A=x.indexOf(g),_=h?x.indexOf(h):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,C=_>=A,b=uW(I=>{const R=I.target,L=[...d.branches].some(U=>U.contains(R));!C||L||(s==null||s(I),a==null||a(I),I.defaultPrevented||l==null||l())},m),B=fW(I=>{const R=I.target;[...d.branches].some(U=>U.contains(R))||(o==null||o(I),a==null||a(I),I.defaultPrevented||l==null||l())},m);return sW(I=>{_===d.layers.size-1&&(i==null||i(I),!I.defaultPrevented&&l&&(I.preventDefault(),l()))},m),D.useEffect(()=>{if(h)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(EC=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),AC(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=EC)}},[h,m,r,d]),D.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),AC())},[h,d]),D.useEffect(()=>{const I=()=>v({});return document.addEventListener(C1,I),()=>document.removeEventListener(C1,I)},[]),D.createElement(Jl.div,Pn({},c,{ref:E,style:{pointerEvents:w?C?"auto":"none":void 0,...n.style},onFocusCapture:uo(n.onFocusCapture,B.onFocusCapture),onBlurCapture:uo(n.onBlurCapture,B.onBlurCapture),onPointerDownCapture:uo(n.onPointerDownCapture,b.onPointerDownCapture)}))});function uW(n,e=globalThis==null?void 0:globalThis.document){const t=Qu(n),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){PL(oW,t,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,t]),{onPointerDownCapture:()=>r.current=!0}}function fW(n,e=globalThis==null?void 0:globalThis.document){const t=Qu(n),r=D.useRef(!1);return D.useEffect(()=>{const i=s=>{s.target&&!r.current&&PL(aW,t,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,t]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function AC(){const n=new CustomEvent(C1);document.dispatchEvent(n)}function PL(n,e,t,{discrete:r}){const i=t.originalEvent.target,s=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&i.addEventListener(n,e,{once:!0}),r?SV(i,s):i.dispatchEvent(s)}const Du=Boolean(globalThis==null?void 0:globalThis.document)?D.useLayoutEffect:()=>{},dW=dO["useId".toString()]||(()=>{});let hW=0;function pW(n){const[e,t]=D.useState(dW());return Du(()=>{n||t(r=>r??String(hW++))},[n]),n||(e?`radix-${e}`:"")}function Zu(n){return n.split("-")[1]}function rS(n){return n==="y"?"height":"width"}function Eo(n){return n.split("-")[0]}function Kl(n){return["top","bottom"].includes(Eo(n))?"x":"y"}function SC(n,e,t){let{reference:r,floating:i}=n;const s=r.x+r.width/2-i.width/2,o=r.y+r.height/2-i.height/2,a=Kl(e),l=rS(a),c=r[l]/2-i[l]/2,d=a==="x";let h;switch(Eo(e)){case"top":h={x:s,y:r.y-i.height};break;case"bottom":h={x:s,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:o};break;case"left":h={x:r.x-i.width,y:o};break;default:h={x:r.x,y:r.y}}switch(Zu(e)){case"start":h[a]-=c*(t&&d?-1:1);break;case"end":h[a]+=c*(t&&d?-1:1)}return h}const mW=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:h}=SC(c,r,l),p=r,m={},v=0;for(let E=0;E({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:s,platform:o,elements:a}=e,{element:l,padding:c=0}=Lo(n,e)||{};if(l==null)return{};const d=IL(c),h={x:t,y:r},p=Kl(i),m=rS(p),v=await o.getDimensions(l),E=p==="y",x=E?"top":"left",g=E?"bottom":"right",A=E?"clientHeight":"clientWidth",_=s.reference[m]+s.reference[p]-h[p]-s.floating[m],w=h[p]-s.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let b=C?C[A]:0;b&&await(o.isElement==null?void 0:o.isElement(C))||(b=a.floating[A]||s.floating[m]);const B=_/2-w/2,I=b/2-v[m]/2-1,R=eh(d[x],I),L=eh(d[g],I),U=R,j=b-v[m]-L,$=b/2-v[m]/2+B,K=R1(U,$,j),Y=Zu(i)!=null&&$!=K&&s.reference[m]/2-($n.concat(e,e+"-start",e+"-end"),[]);const gW={left:"right",right:"left",bottom:"top",top:"bottom"};function Kg(n){return n.replace(/left|right|bottom|top/g,e=>gW[e])}function vW(n,e,t){t===void 0&&(t=!1);const r=Zu(n),i=Kl(n),s=rS(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Kg(o)),{main:o,cross:Kg(o)}}const yW={start:"end",end:"start"};function M_(n){return n.replace(/start|end/g,e=>yW[e])}const _W=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t;const{placement:r,middlewareData:i,rects:s,initialPlacement:o,platform:a,elements:l}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...E}=Lo(n,e),x=Eo(r),g=Eo(o)===o,A=await(a.isRTL==null?void 0:a.isRTL(l.floating)),_=h||(g||!v?[Kg(o)]:function(U){const j=Kg(U);return[M_(U),j,M_(j)]}(o));h||m==="none"||_.push(...function(U,j,$,K){const Y=Zu(U);let ne=function(ie,z,Z){const q=["left","right"],ae=["right","left"],ee=["top","bottom"],ve=["bottom","top"];switch(ie){case"top":case"bottom":return Z?z?ae:q:z?q:ae;case"left":case"right":return z?ee:ve;default:return[]}}(Eo(U),$==="start",K);return Y&&(ne=ne.map(ie=>ie+"-"+Y),j&&(ne=ne.concat(ne.map(M_)))),ne}(o,v,m,A));const w=[o,..._],C=await qd(e,E),b=[];let B=((t=i.flip)==null?void 0:t.overflows)||[];if(c&&b.push(C[x]),d){const{main:U,cross:j}=vW(r,s,A);b.push(C[U],C[j])}if(B=[...B,{placement:r,overflows:b}],!b.every(U=>U<=0)){var I,R;const U=(((I=i.flip)==null?void 0:I.index)||0)+1,j=w[U];if(j)return{data:{index:U,overflows:B},reset:{placement:j}};let $=(R=B.filter(K=>K.overflows[0]<=0).sort((K,Y)=>K.overflows[1]-Y.overflows[1])[0])==null?void 0:R.placement;if(!$)switch(p){case"bestFit":{var L;const K=(L=B.map(Y=>[Y.placement,Y.overflows.filter(ne=>ne>0).reduce((ne,ie)=>ne+ie,0)]).sort((Y,ne)=>Y[1]-ne[1])[0])==null?void 0:L[0];K&&($=K);break}case"initialPlacement":$=o}if(r!==$)return{reset:{placement:$}}}return{}}}};function MC(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function TC(n){return BL.some(e=>n[e]>=0)}const xW=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=Lo(n,e);switch(r){case"referenceHidden":{const s=MC(await qd(e,{...i,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:TC(s)}}}case"escaped":{const s=MC(await qd(e,{...i,altBoundary:!0}),t.floating);return{data:{escapedOffsets:s,escaped:TC(s)}}}default:return{}}}}},EW=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){const{x:t,y:r}=e,i=await async function(s,o){const{placement:a,platform:l,elements:c}=s,d=await(l.isRTL==null?void 0:l.isRTL(c.floating)),h=Eo(a),p=Zu(a),m=Kl(a)==="x",v=["left","top"].includes(h)?-1:1,E=d&&m?-1:1,x=Lo(o,s);let{mainAxis:g,crossAxis:A,alignmentAxis:_}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...x};return p&&typeof _=="number"&&(A=p==="end"?-1*_:_),m?{x:A*E,y:g*v}:{x:g*v,y:A*E}}(e,n);return{x:t+i.x,y:r+i.y,data:i}}}};function LL(n){return n==="x"?"y":"x"}const AW=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:x=>{let{x:g,y:A}=x;return{x:g,y:A}}},...l}=Lo(n,e),c={x:t,y:r},d=await qd(e,l),h=Kl(Eo(i)),p=LL(h);let m=c[h],v=c[p];if(s){const x=h==="y"?"bottom":"right";m=R1(m+d[h==="y"?"top":"left"],m,m-d[x])}if(o){const x=p==="y"?"bottom":"right";v=R1(v+d[p==="y"?"top":"left"],v,v-d[x])}const E=a.fn({...e,[h]:m,[p]:v});return{...E,data:{x:E.x-t,y:E.y-r}}}}},SW=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Lo(n,e),d={x:t,y:r},h=Kl(i),p=LL(h);let m=d[h],v=d[p];const E=Lo(a,e),x=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:0,crossAxis:0,...E};if(l){const _=h==="y"?"height":"width",w=s.reference[h]-s.floating[_]+x.mainAxis,C=s.reference[h]+s.reference[_]-x.mainAxis;mC&&(m=C)}if(c){var g,A;const _=h==="y"?"width":"height",w=["top","left"].includes(Eo(i)),C=s.reference[p]-s.floating[_]+(w&&((g=o.offset)==null?void 0:g[p])||0)+(w?0:x.crossAxis),b=s.reference[p]+s.reference[_]+(w?0:((A=o.offset)==null?void 0:A[p])||0)-(w?x.crossAxis:0);vb&&(v=b)}return{[h]:m,[p]:v}}}},wW=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:r,platform:i,elements:s}=e,{apply:o=()=>{},...a}=Lo(n,e),l=await qd(e,a),c=Eo(t),d=Zu(t),h=Kl(t)==="x",{width:p,height:m}=r.floating;let v,E;c==="top"||c==="bottom"?(v=c,E=d===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(E=c,v=d==="end"?"top":"bottom");const x=m-l[v],g=p-l[E],A=!e.middlewareData.shift;let _=x,w=g;if(h){const b=p-l.left-l.right;w=d||A?eh(g,b):b}else{const b=m-l.top-l.bottom;_=d||A?eh(x,b):b}if(A&&!d){const b=cl(l.left,0),B=cl(l.right,0),I=cl(l.top,0),R=cl(l.bottom,0);h?w=p-2*(b!==0||B!==0?b+B:cl(l.left,l.right)):_=m-2*(I!==0||R!==0?I+R:cl(l.top,l.bottom))}await o({...e,availableWidth:w,availableHeight:_});const C=await i.getDimensions(s.floating);return p!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}};function mi(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Vs(n){return mi(n).getComputedStyle(n)}function DL(n){return n instanceof mi(n).Node}function Ra(n){return DL(n)?(n.nodeName||"").toLowerCase():"#document"}function hs(n){return n instanceof HTMLElement||n instanceof mi(n).HTMLElement}function bC(n){return typeof ShadowRoot<"u"&&(n instanceof mi(n).ShadowRoot||n instanceof ShadowRoot)}function th(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=Vs(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(i)}function MW(n){return["table","td","th"].includes(Ra(n))}function P1(n){const e=iS(),t=Vs(n);return t.transform!=="none"||t.perspective!=="none"||!!t.containerType&&t.containerType!=="normal"||!e&&!!t.backdropFilter&&t.backdropFilter!=="none"||!e&&!!t.filter&&t.filter!=="none"||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function iS(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function $0(n){return["html","body","#document"].includes(Ra(n))}const I1=Math.min,mu=Math.max,Yg=Math.round,Hm=Math.floor,Pa=n=>({x:n,y:n});function OL(n){const e=Vs(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=hs(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,a=Yg(t)!==s||Yg(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function Ao(n){return n instanceof Element||n instanceof mi(n).Element}function sS(n){return Ao(n)?n:n.contextElement}function gu(n){const e=sS(n);if(!hs(e))return Pa(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=OL(e);let o=(s?Yg(t.width):t.width)/r,a=(s?Yg(t.height):t.height)/i;return o&&Number.isFinite(o)||(o=1),a&&Number.isFinite(a)||(a=1),{x:o,y:a}}const TW=Pa(0);function FL(n){const e=mi(n);return iS()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:TW}function zl(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=sS(n);let o=Pa(1);e&&(r?Ao(r)&&(o=gu(r)):o=gu(n));const a=function(p,m,v){return m===void 0&&(m=!1),!(!v||m&&v!==mi(p))&&m}(s,t,r)?FL(s):Pa(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,d=i.width/o.x,h=i.height/o.y;if(s){const p=mi(s),m=r&&Ao(r)?mi(r):r;let v=p.frameElement;for(;v&&r&&m!==p;){const E=gu(v),x=v.getBoundingClientRect(),g=getComputedStyle(v),A=x.left+(v.clientLeft+parseFloat(g.paddingLeft))*E.x,_=x.top+(v.clientTop+parseFloat(g.paddingTop))*E.y;l*=E.x,c*=E.y,d*=E.x,h*=E.y,l+=A,c+=_,v=mi(v).frameElement}}return Jg({width:d,height:h,x:l,y:c})}function X0(n){return Ao(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function So(n){var e;return(e=(DL(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function NL(n){return zl(So(n)).left+X0(n).scrollLeft}function Ou(n){if(Ra(n)==="html")return n;const e=n.assignedSlot||n.parentNode||bC(n)&&n.host||So(n);return bC(e)?e.host:e}function UL(n){const e=Ou(n);return $0(e)?n.ownerDocument?n.ownerDocument.body:n.body:hs(e)&&th(e)?e:UL(e)}function Qg(n,e){var t;e===void 0&&(e=[]);const r=UL(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),s=mi(r);return i?e.concat(s,s.visualViewport||[],th(r)?r:[]):e.concat(r,Qg(r))}function CC(n,e,t){let r;if(e==="viewport")r=function(i,s){const o=mi(i),a=So(i),l=o.visualViewport;let c=a.clientWidth,d=a.clientHeight,h=0,p=0;if(l){c=l.width,d=l.height;const m=iS();(!m||m&&s==="fixed")&&(h=l.offsetLeft,p=l.offsetTop)}return{width:c,height:d,x:h,y:p}}(n,t);else if(e==="document")r=function(i){const s=So(i),o=X0(i),a=i.ownerDocument.body,l=mu(s.scrollWidth,s.clientWidth,a.scrollWidth,a.clientWidth),c=mu(s.scrollHeight,s.clientHeight,a.scrollHeight,a.clientHeight);let d=-o.scrollLeft+NL(i);const h=-o.scrollTop;return Vs(a).direction==="rtl"&&(d+=mu(s.clientWidth,a.clientWidth)-l),{width:l,height:c,x:d,y:h}}(So(n));else if(Ao(e))r=function(i,s){const o=zl(i,!0,s==="fixed"),a=o.top+i.clientTop,l=o.left+i.clientLeft,c=hs(i)?gu(i):Pa(1);return{width:i.clientWidth*c.x,height:i.clientHeight*c.y,x:l*c.x,y:a*c.y}}(e,t);else{const i=FL(n);r={...e,x:e.x-i.x,y:e.y-i.y}}return Jg(r)}function kL(n,e){const t=Ou(n);return!(t===e||!Ao(t)||$0(t))&&(Vs(t).position==="fixed"||kL(t,e))}function bW(n,e,t){const r=hs(e),i=So(e),s=t==="fixed",o=zl(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Pa(0);if(r||!r&&!s)if((Ra(e)!=="body"||th(i))&&(a=X0(e)),hs(e)){const c=zl(e,!0,s,e);l.x=c.x+e.clientLeft,l.y=c.y+e.clientTop}else i&&(l.x=NL(i));return{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function RC(n,e){return hs(n)&&Vs(n).position!=="fixed"?e?e(n):n.offsetParent:null}function PC(n,e){const t=mi(n);if(!hs(n))return t;let r=RC(n,e);for(;r&&MW(r)&&Vs(r).position==="static";)r=RC(r,e);return r&&(Ra(r)==="html"||Ra(r)==="body"&&Vs(r).position==="static"&&!P1(r))?t:r||function(i){let s=Ou(i);for(;hs(s)&&!$0(s);){if(P1(s))return s;s=Ou(s)}return null}(n)||t}const CW={convertOffsetParentRelativeRectToViewportRelativeRect:function(n){let{rect:e,offsetParent:t,strategy:r}=n;const i=hs(t),s=So(t);if(t===s)return e;let o={scrollLeft:0,scrollTop:0},a=Pa(1);const l=Pa(0);if((i||!i&&r!=="fixed")&&((Ra(t)!=="body"||th(s))&&(o=X0(t)),hs(t))){const c=zl(t);a=gu(t),l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}return{width:e.width*a.x,height:e.height*a.y,x:e.x*a.x-o.scrollLeft*a.x+l.x,y:e.y*a.y-o.scrollTop*a.y+l.y}},getDocumentElement:So,getClippingRect:function(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const s=[...t==="clippingAncestors"?function(l,c){const d=c.get(l);if(d)return d;let h=Qg(l).filter(E=>Ao(E)&&Ra(E)!=="body"),p=null;const m=Vs(l).position==="fixed";let v=m?Ou(l):l;for(;Ao(v)&&!$0(v);){const E=Vs(v),x=P1(v);x||E.position!=="fixed"||(p=null),(m?!x&&!p:!x&&E.position==="static"&&p&&["absolute","fixed"].includes(p.position)||th(v)&&!x&&kL(l,v))?h=h.filter(g=>g!==v):p=E,v=Ou(v)}return c.set(l,h),h}(e,this._c):[].concat(t),r],o=s[0],a=s.reduce((l,c)=>{const d=CC(e,c,i);return l.top=mu(d.top,l.top),l.right=I1(d.right,l.right),l.bottom=I1(d.bottom,l.bottom),l.left=mu(d.left,l.left),l},CC(e,o,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:PC,getElementRects:async function(n){let{reference:e,floating:t,strategy:r}=n;const i=this.getOffsetParent||PC,s=this.getDimensions;return{reference:bW(e,await i(t),r),floating:{x:0,y:0,...await s(t)}}},getClientRects:function(n){return Array.from(n.getClientRects())},getDimensions:function(n){return OL(n)},getScale:gu,isElement:Ao,isRTL:function(n){return getComputedStyle(n).direction==="rtl"}};function RW(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=sS(n),d=i||s?[...c?Qg(c):[],...Qg(e)]:[];d.forEach(x=>{i&&x.addEventListener("scroll",t,{passive:!0}),s&&x.addEventListener("resize",t)});const h=c&&a?function(x,g){let A,_=null;const w=So(x);function C(){clearTimeout(A),_&&_.disconnect(),_=null}return function b(B,I){B===void 0&&(B=!1),I===void 0&&(I=1),C();const{left:R,top:L,width:U,height:j}=x.getBoundingClientRect();if(B||g(),!U||!j)return;const $={rootMargin:-Hm(L)+"px "+-Hm(w.clientWidth-(R+U))+"px "+-Hm(w.clientHeight-(L+j))+"px "+-Hm(R)+"px",threshold:mu(0,I1(1,I))||1};let K=!0;function Y(ne){const ie=ne[0].intersectionRatio;if(ie!==I){if(!K)return b();ie?b(!1,ie):A=setTimeout(()=>{b(!1,1e-7)},100)}K=!1}try{_=new IntersectionObserver(Y,{...$,root:w.ownerDocument})}catch{_=new IntersectionObserver(Y,$)}_.observe(x)}(!0),C}(c,t):null;let p,m=-1,v=null;o&&(v=new ResizeObserver(x=>{let[g]=x;g&&g.target===c&&v&&(v.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{v&&v.observe(e)})),t()}),c&&!l&&v.observe(c),v.observe(e));let E=l?zl(n):null;return l&&function x(){const g=zl(n);!E||g.x===E.x&&g.y===E.y&&g.width===E.width&&g.height===E.height||t(),E=g,p=requestAnimationFrame(x)}(),t(),()=>{d.forEach(x=>{i&&x.removeEventListener("scroll",t),s&&x.removeEventListener("resize",t)}),h&&h(),v&&v.disconnect(),v=null,l&&cancelAnimationFrame(p)}}const PW=(n,e,t)=>{const r=new Map,i={platform:CW,...t},s={...i.platform,_c:r};return mW(n,e,{...i,platform:s})},IW=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:i}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?wC({element:r.current,padding:i}).fn(t):{}:r?wC({element:r,padding:i}).fn(t):{}}}};var mg=typeof document<"u"?D.useLayoutEffect:D.useEffect;function Zg(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,i;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!=e.length)return!1;for(r=t;r--!==0;)if(!Zg(n[r],e[r]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=t;r--!==0;){const s=i[r];if(!(s==="_owner"&&n.$$typeof)&&!Zg(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function zL(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function IC(n,e){const t=zL(n);return Math.round(e*t)/t}function BC(n){const e=D.useRef(n);return mg(()=>{e.current=n}),e}function BW(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[d,h]=D.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[p,m]=D.useState(r);Zg(p,r)||m(r);const[v,E]=D.useState(null),[x,g]=D.useState(null),A=D.useCallback(ne=>{ne!=b.current&&(b.current=ne,E(ne))},[E]),_=D.useCallback(ne=>{ne!==B.current&&(B.current=ne,g(ne))},[g]),w=s||v,C=o||x,b=D.useRef(null),B=D.useRef(null),I=D.useRef(d),R=BC(l),L=BC(i),U=D.useCallback(()=>{if(!b.current||!B.current)return;const ne={placement:e,strategy:t,middleware:p};L.current&&(ne.platform=L.current),PW(b.current,B.current,ne).then(ie=>{const z={...ie,isPositioned:!0};j.current&&!Zg(I.current,z)&&(I.current=z,Pl.flushSync(()=>{h(z)}))})},[p,e,t,L]);mg(()=>{c===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,h(ne=>({...ne,isPositioned:!1})))},[c]);const j=D.useRef(!1);mg(()=>(j.current=!0,()=>{j.current=!1}),[]),mg(()=>{if(w&&(b.current=w),C&&(B.current=C),w&&C){if(R.current)return R.current(w,C,U);U()}},[w,C,U,R]);const $=D.useMemo(()=>({reference:b,floating:B,setReference:A,setFloating:_}),[A,_]),K=D.useMemo(()=>({reference:w,floating:C}),[w,C]),Y=D.useMemo(()=>{const ne={position:t,left:0,top:0};if(!K.floating)return ne;const ie=IC(K.floating,d.x),z=IC(K.floating,d.y);return a?{...ne,transform:"translate("+ie+"px, "+z+"px)",...zL(K.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ie,top:z}},[t,a,K.floating,d.x,d.y]);return D.useMemo(()=>({...d,update:U,refs:$,elements:K,floatingStyles:Y}),[d,U,$,K,Y])}const LW=D.forwardRef((n,e)=>{const{children:t,width:r=10,height:i=5,...s}=n;return D.createElement(Jl.svg,Pn({},s,{ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),n.asChild?t:D.createElement("polygon",{points:"0,0 30,0 15,10"}))}),DW=LW;function OW(n){const[e,t]=D.useState(void 0);return Du(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}const HL="Popper",[GL,VL]=RL(HL),[FW,WL]=GL(HL),NW=n=>{const{__scopePopper:e,children:t}=n,[r,i]=D.useState(null);return D.createElement(FW,{scope:e,anchor:r,onAnchorChange:i},t)},UW="PopperAnchor",kW=D.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...i}=n,s=WL(UW,t),o=D.useRef(null),a=Ku(e,o);return D.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:D.createElement(Jl.div,Pn({},i,{ref:a}))}),$L="PopperContent",[zW,HW]=GL($L),GW=D.forwardRef((n,e)=>{var t,r,i,s,o,a,l,c;const{__scopePopper:d,side:h="bottom",sideOffset:p=0,align:m="center",alignOffset:v=0,arrowPadding:E=0,collisionBoundary:x=[],collisionPadding:g=0,sticky:A="partial",hideWhenDetached:_=!1,avoidCollisions:w=!0,onPlaced:C,...b}=n,B=WL($L,d),[I,R]=D.useState(null),L=Ku(e,Se=>R(Se)),[U,j]=D.useState(null),$=OW(U),K=(t=$==null?void 0:$.width)!==null&&t!==void 0?t:0,Y=(r=$==null?void 0:$.height)!==null&&r!==void 0?r:0,ne=h+(m!=="center"?"-"+m:""),ie=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},z=Array.isArray(x)?x:[x],Z=z.length>0,q={padding:ie,boundary:z.filter(XW),altBoundary:Z},{refs:ae,floatingStyles:ee,placement:ve,isPositioned:pe,middlewareData:Le}=BW({strategy:"fixed",placement:ne,whileElementsMounted:RW,elements:{reference:B.anchor},middleware:[EW({mainAxis:p+Y,alignmentAxis:v}),w&&AW({mainAxis:!0,crossAxis:!1,limiter:A==="partial"?SW():void 0,...q}),w&&_W({...q}),wW({...q,apply:({elements:Se,rects:De,availableWidth:be,availableHeight:tt})=>{const{width:We,height:je}=De.reference,at=Se.floating.style;at.setProperty("--radix-popper-available-width",`${be}px`),at.setProperty("--radix-popper-available-height",`${tt}px`),at.setProperty("--radix-popper-anchor-width",`${We}px`),at.setProperty("--radix-popper-anchor-height",`${je}px`)}}),U&&IW({element:U,padding:E}),jW({arrowWidth:K,arrowHeight:Y}),_&&xW({strategy:"referenceHidden"})]}),[we,Fe]=XL(ve),et=Qu(C);Du(()=>{pe&&(et==null||et())},[pe,et]);const ut=(i=Le.arrow)===null||i===void 0?void 0:i.x,Rt=(s=Le.arrow)===null||s===void 0?void 0:s.y,rt=((o=Le.arrow)===null||o===void 0?void 0:o.centerOffset)!==0,[J,Re]=D.useState();return Du(()=>{I&&Re(window.getComputedStyle(I).zIndex)},[I]),D.createElement("div",{ref:ae.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:pe?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,["--radix-popper-transform-origin"]:[(a=Le.transformOrigin)===null||a===void 0?void 0:a.x,(l=Le.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:n.dir},D.createElement(zW,{scope:d,placedSide:we,onArrowChange:j,arrowX:ut,arrowY:Rt,shouldHideArrow:rt},D.createElement(Jl.div,Pn({"data-side":we,"data-align":Fe},b,{ref:L,style:{...b.style,animation:pe?void 0:"none",opacity:(c=Le.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))}),VW="PopperArrow",WW={top:"bottom",right:"left",bottom:"top",left:"right"},$W=D.forwardRef(function(e,t){const{__scopePopper:r,...i}=e,s=HW(VW,r),o=WW[s.placedSide];return D.createElement("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0}},D.createElement(DW,Pn({},i,{ref:t,style:{...i.style,display:"block"}})))});function XW(n){return n!==null}const jW=n=>({name:"transformOrigin",options:n,fn(e){var t,r,i,s,o;const{placement:a,rects:l,middlewareData:c}=e,h=((t=c.arrow)===null||t===void 0?void 0:t.centerOffset)!==0,p=h?0:n.arrowWidth,m=h?0:n.arrowHeight,[v,E]=XL(a),x={start:"0%",center:"50%",end:"100%"}[E],g=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+p/2,A=((s=(o=c.arrow)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)+m/2;let _="",w="";return v==="bottom"?(_=h?x:`${g}px`,w=`${-m}px`):v==="top"?(_=h?x:`${g}px`,w=`${l.floating.height+m}px`):v==="right"?(_=`${-m}px`,w=h?x:`${A}px`):v==="left"&&(_=`${l.floating.width+m}px`,w=h?x:`${A}px`),{data:{x:_,y:w}}}});function XL(n){const[e,t="center"]=n.split("-");return[e,t]}const JW=NW,KW=kW,YW=GW,QW=$W;function ZW(n,e){return D.useReducer((t,r)=>{const i=e[t][r];return i??t},n)}const jL=n=>{const{present:e,children:t}=n,r=qW(e),i=typeof t=="function"?t({present:r.isPresent}):D.Children.only(t),s=Ku(r.ref,i.ref);return typeof t=="function"||r.isPresent?D.cloneElement(i,{ref:s}):null};jL.displayName="Presence";function qW(n){const[e,t]=D.useState(),r=D.useRef({}),i=D.useRef(n),s=D.useRef("none"),o=n?"mounted":"unmounted",[a,l]=ZW(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return D.useEffect(()=>{const c=Gm(r.current);s.current=a==="mounted"?c:"none"},[a]),Du(()=>{const c=r.current,d=i.current;if(d!==n){const p=s.current,m=Gm(c);n?l("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=n}},[n,l]),Du(()=>{if(e){const c=h=>{const m=Gm(r.current).includes(h.animationName);h.target===e&&m&&Pl.flushSync(()=>l("ANIMATION_END"))},d=h=>{h.target===e&&(s.current=Gm(r.current))};return e.addEventListener("animationstart",d),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",d),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:D.useCallback(c=>{c&&(r.current=getComputedStyle(c)),t(c)},[])}}function Gm(n){return(n==null?void 0:n.animationName)||"none"}function e$({prop:n,defaultProp:e,onChange:t=()=>{}}){const[r,i]=t$({defaultProp:e,onChange:t}),s=n!==void 0,o=s?n:r,a=Qu(t),l=D.useCallback(c=>{if(s){const h=typeof c=="function"?c(n):c;h!==n&&a(h)}else i(c)},[s,n,i,a]);return[o,l]}function t$({defaultProp:n,onChange:e}){const t=D.useState(n),[r]=t,i=D.useRef(r),s=Qu(e);return D.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),t}const n$=D.forwardRef((n,e)=>D.createElement(Jl.span,Pn({},n,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...n.style}}))),r$=n$,[j0,qK]=RL("Tooltip",[VL]),J0=VL(),i$="TooltipProvider",B1="tooltip.open",[eY,oS]=j0(i$),aS="Tooltip",[s$,K0]=j0(aS),o$=n=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:i=!1,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=n,l=oS(aS,n.__scopeTooltip),c=J0(e),[d,h]=D.useState(null),p=pW(),m=D.useRef(0),v=o??l.disableHoverableContent,E=a??l.delayDuration,x=D.useRef(!1),[g=!1,A]=e$({prop:r,defaultProp:i,onChange:B=>{B?(l.onOpen(),document.dispatchEvent(new CustomEvent(B1))):l.onClose(),s==null||s(B)}}),_=D.useMemo(()=>g?x.current?"delayed-open":"instant-open":"closed",[g]),w=D.useCallback(()=>{window.clearTimeout(m.current),x.current=!1,A(!0)},[A]),C=D.useCallback(()=>{window.clearTimeout(m.current),A(!1)},[A]),b=D.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{x.current=!0,A(!0)},E)},[E,A]);return D.useEffect(()=>()=>window.clearTimeout(m.current),[]),D.createElement(JW,c,D.createElement(s$,{scope:e,contentId:p,open:g,stateAttribute:_,trigger:d,onTriggerChange:h,onTriggerEnter:D.useCallback(()=>{l.isOpenDelayed?b():w()},[l.isOpenDelayed,b,w]),onTriggerLeave:D.useCallback(()=>{v?C():window.clearTimeout(m.current)},[C,v]),onOpen:w,onClose:C,disableHoverableContent:v},t))},LC="TooltipTrigger",a$=D.forwardRef((n,e)=>{const{__scopeTooltip:t,...r}=n,i=K0(LC,t),s=oS(LC,t),o=J0(t),a=D.useRef(null),l=Ku(e,a,i.onTriggerChange),c=D.useRef(!1),d=D.useRef(!1),h=D.useCallback(()=>c.current=!1,[]);return D.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),D.createElement(KW,Pn({asChild:!0},o),D.createElement(Jl.button,Pn({"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute},r,{ref:l,onPointerMove:uo(n.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:uo(n.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:uo(n.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:uo(n.onFocus,()=>{c.current||i.onOpen()}),onBlur:uo(n.onBlur,i.onClose),onClick:uo(n.onClick,i.onClose)})))}),l$="TooltipPortal",[tY,c$]=j0(l$,{forceMount:void 0}),nh="TooltipContent",u$=D.forwardRef((n,e)=>{const t=c$(nh,n.__scopeTooltip),{forceMount:r=t.forceMount,side:i="top",...s}=n,o=K0(nh,n.__scopeTooltip);return D.createElement(jL,{present:r||o.open},o.disableHoverableContent?D.createElement(JL,Pn({side:i},s,{ref:e})):D.createElement(f$,Pn({side:i},s,{ref:e})))}),f$=D.forwardRef((n,e)=>{const t=K0(nh,n.__scopeTooltip),r=oS(nh,n.__scopeTooltip),i=D.useRef(null),s=Ku(e,i),[o,a]=D.useState(null),{trigger:l,onClose:c}=t,d=i.current,{onPointerInTransitChange:h}=r,p=D.useCallback(()=>{a(null),h(!1)},[h]),m=D.useCallback((v,E)=>{const x=v.currentTarget,g={x:v.clientX,y:v.clientY},A=g$(g,x.getBoundingClientRect()),_=v$(g,A),w=y$(E.getBoundingClientRect()),C=x$([..._,...w]);a(C),h(!0)},[h]);return D.useEffect(()=>()=>p(),[p]),D.useEffect(()=>{if(l&&d){const v=x=>m(x,d),E=x=>m(x,l);return l.addEventListener("pointerleave",v),d.addEventListener("pointerleave",E),()=>{l.removeEventListener("pointerleave",v),d.removeEventListener("pointerleave",E)}}},[l,d,m,p]),D.useEffect(()=>{if(o){const v=E=>{const x=E.target,g={x:E.clientX,y:E.clientY},A=(l==null?void 0:l.contains(x))||(d==null?void 0:d.contains(x)),_=!_$(g,o);A?p():_&&(p(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,d,o,c,p]),D.createElement(JL,Pn({},n,{ref:s}))}),[d$,h$]=j0(aS,{isInside:!1}),JL=D.forwardRef((n,e)=>{const{__scopeTooltip:t,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=n,l=K0(nh,t),c=J0(t),{onClose:d}=l;return D.useEffect(()=>(document.addEventListener(B1,d),()=>document.removeEventListener(B1,d)),[d]),D.useEffect(()=>{if(l.trigger){const h=p=>{const m=p.target;m!=null&&m.contains(l.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,d]),D.createElement(cW,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d},D.createElement(YW,Pn({"data-state":l.stateAttribute},c,a,{ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),D.createElement(SL,null,r),D.createElement(d$,{scope:t,isInside:!0},D.createElement(r$,{id:l.contentId,role:"tooltip"},i||r))))}),p$="TooltipArrow",m$=D.forwardRef((n,e)=>{const{__scopeTooltip:t,...r}=n,i=J0(t);return h$(p$,t).isInside?null:D.createElement(QW,Pn({},i,r,{ref:e}))});function g$(n,e){const t=Math.abs(e.top-n.y),r=Math.abs(e.bottom-n.y),i=Math.abs(e.right-n.x),s=Math.abs(e.left-n.x);switch(Math.min(t,r,i,s)){case s:return"left";case i:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function v$(n,e,t=5){const r=[];switch(e){case"top":r.push({x:n.x-t,y:n.y+t},{x:n.x+t,y:n.y+t});break;case"bottom":r.push({x:n.x-t,y:n.y-t},{x:n.x+t,y:n.y-t});break;case"left":r.push({x:n.x+t,y:n.y-t},{x:n.x+t,y:n.y+t});break;case"right":r.push({x:n.x-t,y:n.y-t},{x:n.x-t,y:n.y+t});break}return r}function y$(n){const{top:e,right:t,bottom:r,left:i}=n;return[{x:i,y:e},{x:t,y:e},{x:t,y:r},{x:i,y:r}]}function _$(n,e){const{x:t,y:r}=n;let i=!1;for(let s=0,o=e.length-1;sr!=d>r&&t<(c-a)*(r-l)/(d-l)+a&&(i=!i)}return i}function x$(n){const e=n.slice();return e.sort((t,r)=>t.xr.x?1:t.yr.y?1:0),E$(e)}function E$(n){if(n.length<=1)return n.slice();const e=[];for(let r=0;r=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))e.pop();else break}e.push(i)}e.pop();const t=[];for(let r=n.length-1;r>=0;r--){const i=n[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}const A$=o$,S$=a$,w$=u$,M$=m$;function T$(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s=0)&&(t[i]=n[i]);return t}function on(n,e){if(n==null)return{};var t=T$(n,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}let wn;(function(n){n[n.UNSUPPORTED_INPUT=0]="UNSUPPORTED_INPUT",n[n.NO_COMPONENT_FOR_TYPE=1]="NO_COMPONENT_FOR_TYPE",n[n.UNKNOWN_INPUT=2]="UNKNOWN_INPUT",n[n.DUPLICATE_KEYS=3]="DUPLICATE_KEYS",n[n.ALREADY_REGISTERED_TYPE=4]="ALREADY_REGISTERED_TYPE",n[n.CLIPBOARD_ERROR=5]="CLIPBOARD_ERROR",n[n.THEME_ERROR=6]="THEME_ERROR",n[n.PATH_DOESNT_EXIST=7]="PATH_DOESNT_EXIST",n[n.INPUT_TYPE_OVERRIDE=8]="INPUT_TYPE_OVERRIDE",n[n.EMPTY_KEY=9]="EMPTY_KEY"})(wn||(wn={}));const b$={[wn.UNSUPPORTED_INPUT]:(n,e)=>[`An input with type \`${n}\` input was found at path \`${e}\` but it's not supported yet.`],[wn.NO_COMPONENT_FOR_TYPE]:(n,e)=>[`Type \`${n}\` found at path \`${e}\` can't be displayed in panel because no component supports it yet.`],[wn.UNKNOWN_INPUT]:(n,e)=>[`input at path \`${n}\` is not recognized.`,e],[wn.DUPLICATE_KEYS]:(n,e,t)=>[`Key \`${n}\` of path \`${e}\` already exists at path \`${t}\`. Even nested keys need to be unique. Rename one of the keys.`],[wn.ALREADY_REGISTERED_TYPE]:n=>[`Type ${n} has already been registered. You can't register a component with the same type.`],[wn.CLIPBOARD_ERROR]:n=>["Error copying the value",n],[wn.THEME_ERROR]:(n,e)=>[`Error accessing the theme \`${n}.${e}\` value.`],[wn.PATH_DOESNT_EXIST]:n=>[`Error getting the value at path \`${n}\`. There is probably an error in your \`render\` function.`],[wn.PATH_DOESNT_EXIST]:n=>[`Error accessing the value at path \`${n}\``],[wn.INPUT_TYPE_OVERRIDE]:(n,e,t)=>[`Input at path \`${n}\` already exists with type: \`${e}\`. Its type cannot be overridden with type \`${t}\`.`],[wn.EMPTY_KEY]:()=>["Keys can not be empty, if you want to hide a label use whitespace."]};function KL(n,e,...t){const[r,...i]=b$[e](...t);console[n]("LEVA: "+r,...i)}const ho=KL.bind(null,"warn"),C$=KL.bind(null,"log"),R$=["value"],P$=["schema"],I$=["value"],YL=[],Hl={};function DC(n){let{value:e}=n,t=on(n,R$);for(let r of YL){const i=r(e,t);if(i)return i}}function No(n,e){let{schema:t}=e,r=on(e,P$);if(n in Hl){ho(wn.ALREADY_REGISTERED_TYPE,n);return}YL.push((i,s)=>t(i,s)&&n),Hl[n]=r}function T_(n,e,t,r){const{normalize:i}=Hl[n];if(i)return i(e,t,r);if(typeof e!="object"||!("value"in e))return{value:e};const{value:s}=e,o=on(e,I$);return{value:s,settings:o}}function B$(n,e,t,r,i,s){const{sanitize:o}=Hl[n];return o?o(e,t,r,i,s):e}function OC(n,e,t){const{format:r}=Hl[n];return r?r(e,t):e}function L$(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function FC(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function xt(n){for(var e=1;en>t?t:n{if(n===""||typeof n=="number")return n;try{const e=ea(n);if(!isNaN(e))return e}catch{}return parseFloat(n)},O$=Math.log(10);function NC(n){let e=Math.abs(+String(n).replace(".",""));if(e===0)return .01;for(;e!==0&&e%10===0;)e/=10;const t=Math.floor(Math.log(e)/O$)+1,r=Math.floor(Math.log10(Math.abs(n))),i=Math.pow(10,r-t);return Math.max(i,.001)}const qg=(n,e,t)=>t===e?0:(Ia(n,e,t)-e)/(t-e),e0=(n,e,t)=>n*(t-e)+e,F$=()=>"_"+Math.random().toString(36).substr(2,9),UC=/\(([0-9+\-*/^ .]+)\)/,kC=/(\d+(?:\.\d+)?) ?\^ ?(\d+(?:\.\d+)?)/,zC=/(\d+(?:\.\d+)?) ?\* ?(\d+(?:\.\d+)?)/,HC=/(\d+(?:\.\d+)?) ?\/ ?(\d+(?:\.\d+)?)/,GC=/(\d+(?:\.\d+)?) ?\+ ?(\d+(?:\.\d+)?)/,VC=/(\d+(?:\.\d+)?) ?- ?(\d+(?:\.\d+)?)/;function ea(n){if(isNaN(Number(n)))if(UC.test(n)){const e=n.replace(UC,(t,r)=>String(ea(r)));return ea(e)}else if(kC.test(n)){const e=n.replace(kC,(t,r,i)=>String(Math.pow(Number(r),Number(i))));return ea(e)}else if(zC.test(n)){const e=n.replace(zC,(t,r,i)=>String(Number(r)*Number(i)));return ea(e)}else if(HC.test(n)){const e=n.replace(HC,(t,r,i)=>{if(i!=0)return String(Number(r)/Number(i));throw new Error("Division by zero")});return ea(e)}else if(GC.test(n)){const e=n.replace(GC,(t,r,i)=>String(Number(r)+Number(i)));return ea(e)}else if(VC.test(n)){const e=n.replace(VC,(t,r,i)=>String(Number(r)-Number(i)));return ea(e)}else return Number(n);return Number(n)}function N$(n,e){return e.reduce((t,r)=>(n&&n.hasOwnProperty(r)&&(t[r]=n[r]),t),{})}function U$(n,e){const t=xt({},n);return e.forEach(r=>r in n&&delete t[r]),t}function k$(n,e){return n.reduce((t,r,i)=>Object.assign(t,{[e[i]]:r}),{})}function QL(n){return Object.prototype.toString.call(n)==="[object Object]"}const z$=n=>QL(n)&&Object.keys(n).length===0;let ls;(function(n){n.BUTTON="BUTTON",n.BUTTON_GROUP="BUTTON_GROUP",n.MONITOR="MONITOR",n.FOLDER="FOLDER"})(ls||(ls={}));let ps;(function(n){n.SELECT="SELECT",n.IMAGE="IMAGE",n.NUMBER="NUMBER",n.COLOR="COLOR",n.STRING="STRING",n.BOOLEAN="BOOLEAN",n.INTERVAL="INTERVAL",n.VECTOR3D="VECTOR3D",n.VECTOR2D="VECTOR2D"})(ps||(ps={}));const H$=["type","__customInput"],G$=["render","label","optional","order","disabled","hint","onChange","onEditStart","onEditEnd","transient"],V$=["type"];function ZL(n,e,t={},r){var i,s;if(typeof n!="object"||Array.isArray(n))return{type:r,input:n,options:xt({key:e,label:e,optional:!1,disabled:!1,order:0},t)};if("__customInput"in n){const{type:C,__customInput:b}=n,B=on(n,H$);return ZL(b,e,B,C)}const{render:o,label:a,optional:l,order:c=0,disabled:d,hint:h,onChange:p,onEditStart:m,onEditEnd:v,transient:E}=n,x=on(n,G$),g=xt({render:o,key:e,label:a??e,hint:h,transient:E??!!p,onEditStart:m,onEditEnd:v,disabled:d,optional:l,order:c},t);let{type:A}=x,_=on(x,V$);if(A=r??A,A in ls)return{type:A,input:_,options:g};let w;return r&&QL(_)&&"value"in _?w=_.value:w=z$(_)?void 0:_,{type:A,input:w,options:xt(xt({},g),{},{onChange:p,optional:(i=g.optional)!==null&&i!==void 0?i:!1,disabled:(s=g.disabled)!==null&&s!==void 0?s:!1})}}function W$(n,e,t,r){const i=ZL(n,e),{type:s,input:o,options:a}=i;if(s)return s in ls?i:{type:s,input:T_(s,o,t,r),options:a};let l=DC(o);return l?{type:l,input:T_(l,o,t,r),options:a}:(l=DC({value:o}),l?{type:l,input:T_(l,{value:o},t,r),options:a}:!1)}function WC(n,e,t,r,i){const{value:s,type:o,settings:a}=n;n.value=qL({type:o,value:s,settings:a},e,t,r),n.fromPanel=i}const $$=function(e,t,r){this.type="LEVA_ERROR",this.message="LEVA: "+e,this.previousValue=t,this.error=r};function qL({type:n,value:e,settings:t},r,i,s){const o=n!=="SELECT"&&typeof r=="function"?r(e):r;let a;try{a=B$(n,o,t,e,i,s)}catch(l){throw new $$(`The value \`${r}\` did not result in a correct value.`,e,l)}return Qd(a,e)?e:a}const eD=(n,e,t=!1)=>{let r=0;return function(){const i=arguments,s=t&&!r,o=()=>n.apply(this,i);window.clearTimeout(r),r=window.setTimeout(o,e),s&&o()}},tD=n=>n.shiftKey?5:n.altKey?1/5:1;function X$(n,e){const t=console.error;console.error=()=>{},U2.render(n,e),console.error=t}const j$=["value"],J$=["min","max"],K$=n=>{if(typeof n=="number")return!0;if(typeof n=="string"){const e=parseFloat(n);return isNaN(e)?!1:n.substring((""+e).length).trim().length<4}return!1},nD=(n,{min:e=-1/0,max:t=1/0,suffix:r})=>{const i=parseFloat(n);if(n===""||isNaN(i))throw Error("Invalid number");const s=Ia(i,e,t);return r?s+r:s},Y$=(n,{pad:e=0,suffix:t})=>{const r=parseFloat(n).toFixed(e);return t?r+t:r},rD=n=>{let{value:e}=n,t=on(n,j$);const{min:r=-1/0,max:i=1/0}=t,s=on(t,J$);let o=parseFloat(e);const a=typeof e=="string"?e.substring((""+o).length):void 0;o=Ia(o,r,i);let l=t.step;l||(Number.isFinite(r)?Number.isFinite(i)?l=+(Math.abs(i-r)/100).toPrecision(1):l=+(Math.abs(o-r)/100).toPrecision(1):Number.isFinite(i)&&(l=+(Math.abs(i-o)/100).toPrecision(1)));const c=l?NC(l)*10:NC(o);l=l||c/10;const d=Math.round(Ia(Math.log10(1/c),0,2));return{value:a?o+a:o,settings:xt({initialValue:o,step:l,pad:d,min:r,max:i,suffix:a},s)}},iD=(n,{step:e,initialValue:t})=>{const r=Math.round((n-t)/e);return t+r*e};var sD=Object.freeze({__proto__:null,schema:K$,sanitize:nD,format:Y$,normalize:rD,sanitizeStep:iD});function Nn(){return Nn=Object.assign?Object.assign.bind():function(n){for(var e=1;e({colors:{elevation1:"#292d39",elevation2:"#181c20",elevation3:"#373c4b",accent1:"#0066dc",accent2:"#007bff",accent3:"#3c93ff",highlight1:"#535760",highlight2:"#8c92a4",highlight3:"#fefefe",vivid1:"#ffcc00",folderWidgetColor:"$highlight2",folderTextColor:"$highlight3",toolTipBackground:"$highlight3",toolTipText:"$elevation2"},radii:{xs:"2px",sm:"3px",lg:"10px"},space:{xs:"3px",sm:"6px",md:"10px",rowGap:"7px",colGap:"7px"},fonts:{mono:"ui-monospace, SFMono-Regular, Menlo, 'Roboto Mono', monospace",sans:"system-ui, sans-serif"},fontSizes:{root:"11px",toolTip:"$root"},sizes:{rootWidth:"280px",controlWidth:"160px",numberInputMinWidth:"38px",scrubberWidth:"8px",scrubberHeight:"16px",rowHeight:"24px",folderTitleHeight:"20px",checkboxSize:"16px",joystickWidth:"100px",joystickHeight:"100px",colorPickerWidth:"$controlWidth",colorPickerHeight:"100px",imagePreviewWidth:"$controlWidth",imagePreviewHeight:"100px",monitorHeight:"60px",titleBarHeight:"39px"},shadows:{level1:"0 0 9px 0 #00000088",level2:"0 4px 14px #00000033"},borderWidths:{root:"0px",input:"1px",focus:"1px",hover:"1px",active:"1px",folder:"1px"},fontWeights:{label:"normal",folder:"normal",button:"normal"}});function Vm(n,e){const[t,r]=n.split(" "),i={};return t!=="none"&&(i.boxShadow=`${e.inset?"inset ":""}0 0 0 $borderWidths${[e.key]} $colors${t!=="default"&&t||e.borderColor}`),r&&(i.backgroundColor=r),i}const Xf={$inputStyle:()=>n=>Vm(n,{key:"$input",borderColor:"$highlight1",inset:!0}),$focusStyle:()=>n=>Vm(n,{key:"$focus",borderColor:"$accent2"}),$hoverStyle:()=>n=>Vm(n,{key:"$hover",borderColor:"$accent1",inset:!0}),$activeStyle:()=>n=>Vm(n,{key:"$active",borderColor:"$accent1",inset:!0})},{styled:yt,css:nY,createTheme:Z$,globalCss:q$,keyframes:rY}=rW({prefix:"leva",theme:cD(),utils:xt(xt({},Xf),{},{$flex:()=>({display:"flex",alignItems:"center"}),$flexCenter:()=>({display:"flex",alignItems:"center",justifyContent:"center"}),$reset:()=>({outline:"none",fontSize:"inherit",fontWeight:"inherit",color:"inherit",fontFamily:"inherit",border:"none",backgroundColor:"transparent",appearance:"none"}),$draggable:()=>({touchAction:"none",WebkitUserDrag:"none",userSelect:"none"}),$focus:n=>({"&:focus":Xf.$focusStyle()(n)}),$focusWithin:n=>({"&:focus-within":Xf.$focusStyle()(n)}),$hover:n=>({"&:hover":Xf.$hoverStyle()(n)}),$active:n=>({"&:active":Xf.$activeStyle()(n)})})}),e7=q$({".leva__panel__dragged":{WebkitUserDrag:"none",userSelect:"none",input:{userSelect:"none"},"*":{cursor:"ew-resize !important"}}});function t7(n){const e=cD();if(!n)return{theme:e,className:""};Object.keys(n).forEach(r=>{Object.assign(e[r],n[r])});const t=Z$(e);return{theme:e,className:t.className}}function wo(n,e){const{theme:t}=D.useContext(lS);if(!(n in t)||!(e in t[n]))return ho(wn.THEME_ERROR,n,e),"";let r=e;for(;;){let i=t[n][r];if(typeof i=="string"&&i.charAt(0)==="$")r=i.substr(1);else return i}}const uD=yt("input",{$reset:"",padding:"0 $sm",width:0,minWidth:0,flex:1,height:"100%",variants:{levaType:{number:{textAlign:"right"}},as:{textarea:{padding:"$sm"}}}}),fD=yt("div",{$draggable:"",height:"100%",$flexCenter:"",position:"relative",padding:"0 $xs",fontSize:"0.8em",opacity:.8,cursor:"default",touchAction:"none",[`& + ${uD}`]:{paddingLeft:0}}),n7=yt(fD,{cursor:"ew-resize",marginRight:"-$xs",textTransform:"uppercase",opacity:.3,"&:hover":{opacity:1},variants:{dragging:{true:{backgroundColor:"$accent2",opacity:1}}}}),r7=yt("div",{$flex:"",position:"relative",borderRadius:"$sm",overflow:"hidden",color:"inherit",height:"$rowHeight",backgroundColor:"$elevation3",$inputStyle:"$elevation1",$hover:"",$focusWithin:"",variants:{textArea:{true:{height:"auto"}}}}),i7=["innerLabel","value","onUpdate","onChange","onKeyDown","type","id","inputType","rows"],s7=["onUpdate"];function cS(n){let{innerLabel:e,value:t,onUpdate:r,onChange:i,onKeyDown:s,type:o,id:a,inputType:l="text",rows:c=0}=n,d=on(n,i7);const{id:h,emitOnEditStart:p,emitOnEditEnd:m,disabled:v}=br(),E=a||h,x=D.useRef(null),g=c>0,A=g?"textarea":"input",_=D.useCallback(b=>B=>{const I=B.currentTarget.value;b(I)},[]);Q.useEffect(()=>{const b=x.current,B=_(I=>{r(I),m()});return b==null||b.addEventListener("blur",B),()=>b==null?void 0:b.removeEventListener("blur",B)},[_,r,m]);const w=D.useCallback(b=>{b.key==="Enter"&&_(r)(b)},[_,r]),C=Object.assign({as:A},g?{rows:c}:{},d);return Q.createElement(r7,{textArea:g},e&&typeof e=="string"?Q.createElement(fD,null,e):e,Q.createElement(uD,Nn({levaType:o,ref:x,id:E,type:l,autoComplete:"off",spellCheck:"false",value:t,onChange:_(i),onFocus:()=>p(),onKeyPress:w,onKeyDown:s,disabled:v},C)))}function o7(n){let{onUpdate:e}=n,t=on(n,s7);const r=D.useCallback(s=>e(D$(s)),[e]),i=D.useCallback(s=>{const o=s.key==="ArrowUp"?1:s.key==="ArrowDown"?-1:0;if(o){s.preventDefault();const a=s.altKey?.1:s.shiftKey?10:1;e(l=>parseFloat(l)+o*a)}},[e]);return Q.createElement(cS,Nn({},t,{onUpdate:r,onKeyDown:i,type:"number"}))}const t0=yt("div",{}),L1=yt("div",{position:"relative",background:"$elevation2",transition:"height 300ms ease",variants:{fill:{true:{},false:{}},flat:{false:{},true:{}},isRoot:{true:{},false:{paddingLeft:"$md","&::after":{content:'""',position:"absolute",left:0,top:0,width:"$borderWidths$folder",height:"100%",backgroundColor:"$folderWidgetColor",opacity:.4,transform:"translateX(-50%)"}}}},compoundVariants:[{isRoot:!0,fill:!1,css:{overflowY:"auto",maxHeight:"calc(100vh - 20px - $$titleBarHeight)"}},{isRoot:!0,flat:!1,css:{borderRadius:"$lg"}}]}),a7=yt("div",{$flex:"",color:"$folderTextColor",userSelect:"none",cursor:"pointer",height:"$folderTitleHeight",fontWeight:"$folder","> svg":{marginLeft:-4,marginRight:4,cursor:"pointer",fill:"$folderWidgetColor",opacity:.6},"&:hover > svg":{fill:"$folderWidgetColor"},[`&:hover + ${L1}::after`]:{opacity:.6},[`${t0}:hover > & + ${L1}::after`]:{opacity:.6},[`${t0}:hover > & > svg`]:{opacity:1}}),dD=yt("div",{position:"relative",display:"grid",gridTemplateColumns:"100%",rowGap:"$rowGap",transition:"opacity 250ms ease",variants:{toggled:{true:{opacity:1,transitionDelay:"250ms"},false:{opacity:0,transitionDelay:"0ms",pointerEvents:"none"}},isRoot:{true:{"& > div":{paddingLeft:"$md",paddingRight:"$md"},"& > div:first-of-type":{paddingTop:"$sm"},"& > div:last-of-type":{paddingBottom:"$sm"},[`> ${t0}:not(:first-of-type)`]:{paddingTop:"$sm",marginTop:"$md",borderTop:"$borderWidths$folder solid $colors$elevation1"}}}}}),hD=yt("div",{position:"relative",zIndex:100,display:"grid",rowGap:"$rowGap",gridTemplateRows:"minmax($sizes$rowHeight, max-content)",alignItems:"center",color:"$highlight2",[`${dD} > &`]:{"&:first-of-type":{marginTop:"$rowGap"},"&:last-of-type":{marginBottom:"$rowGap"}},variants:{disabled:{true:{pointerEvents:"none"},false:{"&:hover,&:focus-within":{color:"$highlight3"}}}}}),pD=yt(hD,{gridTemplateColumns:"auto $sizes$controlWidth",columnGap:"$colGap"}),l7=yt("div",{$flex:"",height:"100%",position:"relative",overflow:"hidden","& > div":{marginLeft:"$colGap",padding:"0 $xs",opacity:.4},"& > div:hover":{opacity:.8},"& > div > svg":{display:"none",cursor:"pointer",width:13,minWidth:13,height:13,backgroundColor:"$elevation2"},"&:hover > div > svg":{display:"block"},variants:{align:{top:{height:"100%",alignItems:"flex-start",paddingTop:"$sm"}}}}),c7=yt("input",{$reset:"",height:0,width:0,opacity:0,margin:0,"& + label":{position:"relative",$flexCenter:"",height:"100%",userSelect:"none",cursor:"pointer",paddingLeft:2,paddingRight:"$sm",pointerEvents:"auto"},"& + label:after":{content:'""',width:6,height:6,backgroundColor:"$elevation3",borderRadius:"50%",$activeStyle:""},"&:focus + label:after":{$focusStyle:""},"& + label:active:after":{backgroundColor:"$accent1",$focusStyle:""},"&:checked + label:after":{backgroundColor:"$accent1"}}),D1=yt("label",{fontWeight:"$label",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","& > svg":{display:"block"}}),u7=yt("div",{opacity:1,variants:{disabled:{true:{opacity:.6,pointerEvents:"none",[`& ${D1}`]:{pointerEvents:"auto"}}}}}),mD=yt("div",{position:"fixed",top:0,bottom:0,right:0,left:0,zIndex:1e3,userSelect:"none"}),f7=yt("div",{background:"$toolTipBackground",fontFamily:"$sans",fontSize:"$toolTip",padding:"$xs $sm",color:"$toolTipText",borderRadius:"$xs",boxShadow:"$level2",maxWidth:260}),d7=yt(M$,{fill:"$toolTipBackground"});function uS({children:n}){const{className:e}=D.useContext(lS);return Q.createElement(MV,{className:e},n)}const h7=["align"];function p7(){const{id:n,disable:e,disabled:t}=br();return Q.createElement(Q.Fragment,null,Q.createElement(c7,{id:n+"__disable",type:"checkbox",checked:!t,onChange:()=>e(!t)}),Q.createElement("label",{htmlFor:n+"__disable"}))}function m7(n){const{id:e,optional:t,hint:r}=br(),i=n.htmlFor||(e?{htmlFor:e}:null),s=!r&&typeof n.children=="string"?{title:n.children}:null;return Q.createElement(Q.Fragment,null,t&&Q.createElement(p7,null),r!==void 0?Q.createElement(A$,null,Q.createElement(S$,{asChild:!0},Q.createElement(D1,Nn({},i,n))),Q.createElement(w$,{side:"top",sideOffset:2},Q.createElement(f7,null,r,Q.createElement(d7,null)))):Q.createElement(D1,Nn({},i,s,n)))}function _s(n){let{align:e}=n,t=on(n,h7);const{value:r,label:i,key:s,disabled:o}=br(),{hideCopyButton:a}=Q$(),l=!a&&s!==void 0,[c,d]=D.useState(!1),h=async()=>{try{await navigator.clipboard.writeText(JSON.stringify({[s]:r??""})),d(!0)}catch{ho(wn.CLIPBOARD_ERROR,{[s]:r})}};return Q.createElement(l7,{align:e,onPointerLeave:()=>d(!1)},Q.createElement(m7,t),l&&!o&&Q.createElement("div",{title:`Click to copy ${typeof i=="string"?i:s} value`},c?Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Q.createElement("path",{d:"M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"}),Q.createElement("path",{fillRule:"evenodd",d:"M4 5a2 2 0 012-2 3 3 0 003 3h2a3 3 0 003-3 2 2 0 012 2v11a2 2 0 01-2 2H6a2 2 0 01-2-2V5zm9.707 5.707a1 1 0 00-1.414-1.414L9 12.586l-1.293-1.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})):Q.createElement("svg",{onClick:h,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},Q.createElement("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),Q.createElement("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"}))))}const g7=["toggled"],v7=yt("svg",{fill:"currentColor",transition:"transform 350ms ease, fill 250ms ease"});function fS(n){let{toggled:e}=n,t=on(n,g7);return Q.createElement(v7,Nn({width:"9",height:"5",viewBox:"0 0 9 5",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${e?0:-90}deg)`}},t),Q.createElement("path",{d:"M3.8 4.4c.4.3 1 .3 1.4 0L8 1.7A1 1 0 007.4 0H1.6a1 1 0 00-.7 1.7l3 2.7z"}))}const y7=["input"];function Xi(n){let{input:e}=n,t=on(n,y7);return e?Q.createElement(pD,t):Q.createElement(hD,t)}function gD({value:n,type:e,settings:t,setValue:r}){const[i,s]=D.useState(OC(e,n,t)),o=D.useRef(n),a=D.useRef(t);a.current=t;const l=D.useCallback(d=>s(OC(e,d,a.current)),[e]),c=D.useCallback(d=>{try{r(d)}catch(h){const{type:p,previousValue:m}=h;if(p!=="LEVA_ERROR")throw h;l(m)}},[l,r]);return D.useEffect(()=>{Qd(n,o.current)||l(n),o.current=n},[n,l]),{displayValue:i,onChange:s,onUpdate:c}}function Fh(n,e){const{emitOnEditStart:t,emitOnEditEnd:r}=br();return s6(i=>{i.first&&(document.body.classList.add("leva__panel__dragged"),t==null||t());const s=n(i);return i.last&&(document.body.classList.remove("leva__panel__dragged"),r==null||r()),s},e)}function _7(n){const e=D.useRef(null),t=D.useRef(null),r=D.useRef(!1);return D.useEffect(()=>{const i=eD(()=>{e.current.width=e.current.offsetWidth*window.devicePixelRatio,e.current.height=e.current.offsetHeight*window.devicePixelRatio,n(e.current,t.current)},250);return window.addEventListener("resize",i),r.current||(i(),r.current=!0),()=>window.removeEventListener("resize",i)},[n]),D.useEffect(()=>{t.current=e.current.getContext("2d")},[]),[e,t]}function vD(){const n=D.useRef(null),e=D.useRef({x:0,y:0}),t=D.useCallback(r=>{Object.assign(e.current,r),n.current&&(n.current.style.transform=`translate3d(${e.current.x}px, ${e.current.y}px, 0)`)},[]);return[n,t]}const x7=["__refCount"],b_=(n,e)=>{if(!n[e])return null;const t=n[e];return on(t,x7)};function E7(n){const e=Oh(),[t,r]=D.useState(b_(e.getData(),n)),i=D.useCallback(c=>e.setValueAtPath(n,c,!0),[n,e]),s=D.useCallback(c=>e.setSettingsAtPath(n,c),[n,e]),o=D.useCallback(c=>e.disableInputAtPath(n,c),[n,e]),a=D.useCallback(()=>e.emitOnEditStart(n),[n,e]),l=D.useCallback(()=>e.emitOnEditEnd(n),[n,e]);return D.useEffect(()=>{r(b_(e.getData(),n));const c=e.useStore.subscribe(d=>b_(d.data,n),r,{equalityFn:Dh});return()=>c()},[e,n]),[t,{set:i,setSettings:s,disable:o,storeId:e.storeId,emitOnEditStart:a,emitOnEditEnd:l}]}const A7=yt("div",{variants:{hasRange:{true:{position:"relative",display:"grid",gridTemplateColumns:"auto $sizes$numberInputMinWidth",columnGap:"$colGap",alignItems:"center"}}}}),yD=yt("div",{position:"relative",width:"100%",height:2,borderRadius:"$xs",backgroundColor:"$elevation1"}),O1=yt("div",{position:"absolute",width:"$scrubberWidth",height:"$scrubberHeight",borderRadius:"$xs",boxShadow:"0 0 0 2px $colors$elevation2",backgroundColor:"$accent2",cursor:"pointer",$active:"none $accent1",$hover:"none $accent3",variants:{position:{left:{borderTopRightRadius:0,borderBottomRightRadius:0,transform:"translateX(calc(-0.5 * ($sizes$scrubberWidth + 4px)))"},right:{borderTopLeftRadius:0,borderBottomLeftRadius:0,transform:"translateX(calc(0.5 * ($sizes$scrubberWidth + 4px)))"}}}}),_D=yt("div",{position:"relative",$flex:"",height:"100%",cursor:"pointer",touchAction:"none"}),xD=yt("div",{position:"absolute",height:"100%",backgroundColor:"$accent2"});function S7({value:n,min:e,max:t,onDrag:r,step:i,initialValue:s}){const o=D.useRef(null),a=D.useRef(null),l=D.useRef(0),c=wo("sizes","scrubberWidth"),d=Fh(({event:p,first:m,xy:[v],movement:[E],memo:x})=>{if(m){const{width:A,left:_}=o.current.getBoundingClientRect();l.current=A-parseFloat(c),x=(p==null?void 0:p.target)===a.current?n:e0((v-_)/A,e,t)}const g=x+e0(E/l.current,0,t-e);return r(iD(g,{step:i,initialValue:s})),x}),h=qg(n,e,t);return Q.createElement(_D,Nn({ref:o},d()),Q.createElement(yD,null,Q.createElement(xD,{style:{left:0,right:`${(1-h)*100}%`}})),Q.createElement(O1,{ref:a,style:{left:`calc(${h} * (100% - ${c}))`}}))}const w7=Q.memo(({label:n,onUpdate:e,step:t,innerLabelTrim:r})=>{const[i,s]=D.useState(!1),o=Fh(({active:a,delta:[l],event:c,memo:d=0})=>(s(a),d+=l/2,Math.abs(d)>=1&&(e(h=>parseFloat(h)+Math.floor(d)*t*tD(c)),d=0),d));return Q.createElement(n7,Nn({dragging:i,title:n.length>1?n:""},o()),n.slice(0,r))});function ED({label:n,id:e,displayValue:t,onUpdate:r,onChange:i,settings:s,innerLabelTrim:o=1}){const a=o>0&&Q.createElement(w7,{label:n,step:s.step,onUpdate:r,innerLabelTrim:o});return Q.createElement(o7,{id:e,value:String(t),onUpdate:r,onChange:i,innerLabel:a})}function M7(){const n=br(),{label:e,value:t,onUpdate:r,settings:i,id:s}=n,{min:o,max:a}=i,l=a!==1/0&&o!==-1/0;return Q.createElement(Xi,{input:!0},Q.createElement(_s,null,e),Q.createElement(A7,{hasRange:l},l&&Q.createElement(S7,Nn({value:parseFloat(t),onDrag:r},i)),Q.createElement(ED,Nn({},n,{id:s,label:"value",innerLabelTrim:l?0:1}))))}const{sanitizeStep:T7}=sD,b7=on(sD,["sanitizeStep"]);var C7=xt({component:M7},b7);const R7=(n,e)=>ti().schema({options:ti().passesAnyOf(ti().object(),ti().array())}).test(e),P7=(n,{values:e})=>{if(e.indexOf(n)<0)throw Error("Selected value doesn't match Select options");return n},I7=(n,{values:e})=>e.indexOf(n),B7=n=>{let{value:e,options:t}=n,r,i;return Array.isArray(t)?(i=t,r=t.map(s=>String(s))):(i=Object.values(t),r=Object.keys(t)),"value"in n?i.includes(e)||(r.unshift(String(e)),i.unshift(e)):e=i[0],Object.values(t).includes(e)||(t[String(e)]=e),{value:e,settings:{keys:r,values:i}}};var L7=Object.freeze({__proto__:null,schema:R7,sanitize:P7,format:I7,normalize:B7});const D7=yt("div",{$flexCenter:"",position:"relative","> svg":{pointerEvents:"none",position:"absolute",right:"$md"}}),F1=yt("select",{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:0}),O7=yt("div",{display:"flex",alignItems:"center",width:"100%",height:"$rowHeight",backgroundColor:"$elevation3",borderRadius:"$sm",padding:"0 $sm",cursor:"pointer",[`${F1}:focus + &`]:{$focusStyle:""},[`${F1}:hover + &`]:{$hoverStyle:""}});function F7({displayValue:n,value:e,onUpdate:t,id:r,settings:i,disabled:s}){const{keys:o,values:a}=i,l=D.useRef();return e===a[n]&&(l.current=o[n]),Q.createElement(D7,null,Q.createElement(F1,{id:r,value:n,onChange:c=>t(a[Number(c.currentTarget.value)]),disabled:s},o.map((c,d)=>Q.createElement("option",{key:c,value:d},c))),Q.createElement(O7,null,l.current),Q.createElement(fS,{toggled:!0}))}function N7(){const{label:n,value:e,displayValue:t,onUpdate:r,id:i,disabled:s,settings:o}=br();return Q.createElement(Xi,{input:!0},Q.createElement(_s,null,n),Q.createElement(F7,{id:i,value:e,displayValue:t,onUpdate:r,settings:o,disabled:s}))}var U7=xt({component:N7},L7);const k7=n=>ti().string().test(n),z7=n=>{if(typeof n!="string")throw Error("Invalid string");return n},H7=({value:n,editable:e=!0,rows:t=!1})=>({value:n,settings:{editable:e,rows:typeof t=="number"?t:t?5:0}});var G7=Object.freeze({__proto__:null,schema:k7,sanitize:z7,normalize:H7});const V7=["displayValue","onUpdate","onChange","editable"],W7=yt("div",{whiteSpace:"pre-wrap"});function $7(n){let{displayValue:e,onUpdate:t,onChange:r,editable:i=!0}=n,s=on(n,V7);return i?Q.createElement(cS,Nn({value:e,onUpdate:t,onChange:r},s)):Q.createElement(W7,null,e)}function X7(){const{label:n,settings:e,displayValue:t,onUpdate:r,onChange:i}=br();return Q.createElement(Xi,{input:!0},Q.createElement(_s,null,n),Q.createElement($7,Nn({displayValue:t,onUpdate:r,onChange:i},e)))}var j7=xt({component:X7},G7);const J7=n=>ti().boolean().test(n),K7=n=>{if(typeof n!="boolean")throw Error("Invalid boolean");return n};var Y7=Object.freeze({__proto__:null,schema:J7,sanitize:K7});const Q7=yt("div",{position:"relative",$flex:"",height:"$rowHeight",input:{$reset:"",height:0,width:0,opacity:0,margin:0},label:{position:"relative",$flexCenter:"",userSelect:"none",cursor:"pointer",height:"$checkboxSize",width:"$checkboxSize",backgroundColor:"$elevation3",borderRadius:"$sm",$hover:""},"input:focus + label":{$focusStyle:""},"input:focus:checked + label, input:checked + label:hover":{$hoverStyle:"$accent3"},"input + label:active":{backgroundColor:"$accent1"},"input:checked + label:active":{backgroundColor:"$accent1"},"label > svg":{display:"none",width:"90%",height:"90%",stroke:"$highlight3"},"input:checked + label":{backgroundColor:"$accent2"},"input:checked + label > svg":{display:"block"}});function Z7({value:n,onUpdate:e,id:t,disabled:r}){return Q.createElement(Q7,null,Q.createElement("input",{id:t,type:"checkbox",checked:n,onChange:i=>e(i.currentTarget.checked),disabled:r}),Q.createElement("label",{htmlFor:t},Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Q.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))))}function q7(){const{label:n,value:e,onUpdate:t,disabled:r,id:i}=br();return Q.createElement(Xi,{input:!0},Q.createElement(_s,null,n),Q.createElement(Z7,{value:e,onUpdate:t,id:i,disabled:r}))}var eX=xt({component:q7},Y7);const tX=["locked"];function nX({value:n,id:e,valueKey:t,settings:r,onUpdate:i,innerLabelTrim:s}){const o=D.useRef(n[t]);o.current=n[t];const a=D.useCallback(c=>i({[t]:qL({type:"NUMBER",value:o.current,settings:r},c)}),[i,r,t]),l=gD({type:"NUMBER",value:n[t],settings:r,setValue:a});return Q.createElement(ED,{id:e,label:t,value:n[t],displayValue:l.displayValue,onUpdate:l.onUpdate,onChange:l.onChange,settings:r,innerLabelTrim:s})}const rX=yt("div",{display:"grid",columnGap:"$colGap",gridAutoFlow:"column dense",alignItems:"center",variants:{withLock:{true:{gridTemplateColumns:"10px auto","> svg":{cursor:"pointer"}}}}});function iX(n){let{locked:e}=n,t=on(n,tX);return Q.createElement("svg",Nn({width:"10",height:"10",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),e?Q.createElement("path",{d:"M5 4.63601C5 3.76031 5.24219 3.1054 5.64323 2.67357C6.03934 2.24705 6.64582 1.9783 7.5014 1.9783C8.35745 1.9783 8.96306 2.24652 9.35823 2.67208C9.75838 3.10299 10 3.75708 10 4.63325V5.99999H5V4.63601ZM4 5.99999V4.63601C4 3.58148 4.29339 2.65754 4.91049 1.99307C5.53252 1.32329 6.42675 0.978302 7.5014 0.978302C8.57583 0.978302 9.46952 1.32233 10.091 1.99162C10.7076 2.65557 11 3.57896 11 4.63325V5.99999H12C12.5523 5.99999 13 6.44771 13 6.99999V13C13 13.5523 12.5523 14 12 14H3C2.44772 14 2 13.5523 2 13V6.99999C2 6.44771 2.44772 5.99999 3 5.99999H4ZM3 6.99999H12V13H3V6.99999Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}):Q.createElement("path",{d:"M9 3.63601C9 2.76044 9.24207 2.11211 9.64154 1.68623C10.0366 1.26502 10.6432 1 11.5014 1C12.4485 1 13.0839 1.30552 13.4722 1.80636C13.8031 2.23312 14 2.84313 14 3.63325H15C15 2.68242 14.7626 1.83856 14.2625 1.19361C13.6389 0.38943 12.6743 0 11.5014 0C10.4294 0 9.53523 0.337871 8.91218 1.0021C8.29351 1.66167 8 2.58135 8 3.63601V6H1C0.447715 6 0 6.44772 0 7V13C0 13.5523 0.447715 14 1 14H10C10.5523 14 11 13.5523 11 13V7C11 6.44772 10.5523 6 10 6H9V3.63601ZM1 7H10V13H1V7Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}function dS({value:n,onUpdate:e,settings:t,innerLabelTrim:r}){const{id:i,setSettings:s}=br(),{lock:o,locked:a}=t;return Q.createElement(rX,{withLock:o},o&&Q.createElement(iX,{locked:a,onClick:()=>s({locked:!a})}),Object.keys(n).map((l,c)=>Q.createElement(nX,{id:c===0?i:`${i}.${l}`,key:l,valueKey:l,value:n,settings:t[l],onUpdate:e,innerLabelTrim:r})))}const AD=(n,e)=>{const t={};let r=0,i=1/0;Object.entries(n).forEach(([s,o])=>{t[s]=rD(xt({value:o},e[s])).settings,r=Math.max(r,t[s].step),i=Math.min(i,t[s].pad)});for(let s in t){const{step:o,min:a,max:l}=e[s]||{};!isFinite(o)&&(!isFinite(a)||!isFinite(l))&&(t[s].step=r,t[s].pad=i)}return t},sX=["lock"],oX=["value"];function aX(n){const e=ti().array().length(n).every.number(),t=r=>{if(!r||typeof r!="object")return!1;const i=Object.values(r);return i.length===n&&i.every(s=>isFinite(s))};return r=>e.test(r)||t(r)}function lX(n){return Array.isArray(n)?"array":"object"}function gd(n,e,t){return lX(n)===e?n:e==="array"?Object.values(n):k$(n,t)}const cX=(n,e,t)=>{const r=gd(n,"object",e.keys);for(let o in r)r[o]=nD(r[o],e[o]);const i=Object.keys(r);let s={};if(i.length===e.keys.length)s=r;else{const o=gd(t,"object",e.keys);if(i.length===1&&e.locked){const a=i[0],l=r[a],c=o[a],d=c!==0?l/c:1;for(let h in o)h===a?s[a]=l:s[h]=o[h]*d}else s=xt(xt({},o),r)}return gd(s,e.format,e.keys)},uX=(n,e)=>gd(n,"object",e.keys),fX=n=>!!n&&("step"in n||"min"in n||"max"in n);function dX(n,e,t=[]){const{lock:r=!1}=e,i=on(e,sX),s=Array.isArray(n)?"array":"object",o=s==="object"?Object.keys(n):t,a=gd(n,"object",o),l=fX(i)?o.reduce((d,h)=>Object.assign(d,{[h]:i}),{}):i,c=AD(a,l);return{value:s==="array"?n:a,settings:xt(xt({},c),{},{format:s,keys:o,lock:r,locked:!1})}}function SD(n){return{schema:aX(n.length),normalize:e=>{let{value:t}=e,r=on(e,oX);return dX(t,r,n)},format:(e,t)=>uX(e,t),sanitize:(e,t,r)=>cX(e,t,r)}}var hX={grad:.9,turn:360,rad:360/(2*Math.PI)},ao=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},sr=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t+0},Hi=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n>e?n:e},wD=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},$C=function(n){return{r:Hi(n.r,0,255),g:Hi(n.g,0,255),b:Hi(n.b,0,255),a:Hi(n.a)}},C_=function(n){return{r:sr(n.r),g:sr(n.g),b:sr(n.b),a:sr(n.a,3)}},pX=/^#([0-9a-f]{3,8})$/i,Wm=function(n){var e=n.toString(16);return e.length<2?"0"+e:e},MD=function(n){var e=n.r,t=n.g,r=n.b,i=n.a,s=Math.max(e,t,r),o=s-Math.min(e,t,r),a=o?s===e?(t-r)/o:s===t?2+(r-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:s?o/s*100:0,v:s/255*100,a:i}},TD=function(n){var e=n.h,t=n.s,r=n.v,i=n.a;e=e/360*6,t/=100,r/=100;var s=Math.floor(e),o=r*(1-t),a=r*(1-(e-s)*t),l=r*(1-(1-e+s)*t),c=s%6;return{r:255*[r,a,o,o,l,r][c],g:255*[l,r,r,a,o,o][c],b:255*[o,o,l,r,r,a][c],a:i}},XC=function(n){return{h:wD(n.h),s:Hi(n.s,0,100),l:Hi(n.l,0,100),a:Hi(n.a)}},jC=function(n){return{h:sr(n.h),s:sr(n.s),l:sr(n.l),a:sr(n.a,3)}},JC=function(n){return TD((t=(e=n).s,{h:e.h,s:(t*=((r=e.l)<50?r:100-r)/100)>0?2*t/(r+t)*100:0,v:r+t,a:e.a}));var e,t,r},vd=function(n){return{h:(e=MD(n)).h,s:(i=(200-(t=e.s))*(r=e.v)/100)>0&&i<200?t*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,t,r,i},mX=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gX=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vX=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yX=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,N1={string:[[function(n){var e=pX.exec(n);return e?(n=e[1]).length<=4?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?sr(parseInt(n[3]+n[3],16)/255,2):1}:n.length===6||n.length===8?{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16),a:n.length===8?sr(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var e=vX.exec(n)||yX.exec(n);return e?e[2]!==e[4]||e[4]!==e[6]?null:$C({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(n){var e=mX.exec(n)||gX.exec(n);if(!e)return null;var t,r,i=XC({h:(t=e[1],r=e[2],r===void 0&&(r="deg"),Number(t)*(hX[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return JC(i)},"hsl"]],object:[[function(n){var e=n.r,t=n.g,r=n.b,i=n.a,s=i===void 0?1:i;return ao(e)&&ao(t)&&ao(r)?$C({r:Number(e),g:Number(t),b:Number(r),a:Number(s)}):null},"rgb"],[function(n){var e=n.h,t=n.s,r=n.l,i=n.a,s=i===void 0?1:i;if(!ao(e)||!ao(t)||!ao(r))return null;var o=XC({h:Number(e),s:Number(t),l:Number(r),a:Number(s)});return JC(o)},"hsl"],[function(n){var e=n.h,t=n.s,r=n.v,i=n.a,s=i===void 0?1:i;if(!ao(e)||!ao(t)||!ao(r))return null;var o=function(a){return{h:wD(a.h),s:Hi(a.s,0,100),v:Hi(a.v,0,100),a:Hi(a.a)}}({h:Number(e),s:Number(t),v:Number(r),a:Number(s)});return TD(o)},"hsv"]]},KC=function(n,e){for(var t=0;t=.5},n.prototype.toHex=function(){return e=C_(this.rgba),t=e.r,r=e.g,i=e.b,o=(s=e.a)<1?Wm(sr(255*s)):"","#"+Wm(t)+Wm(r)+Wm(i)+o;var e,t,r,i,s,o},n.prototype.toRgb=function(){return C_(this.rgba)},n.prototype.toRgbString=function(){return e=C_(this.rgba),t=e.r,r=e.g,i=e.b,(s=e.a)<1?"rgba("+t+", "+r+", "+i+", "+s+")":"rgb("+t+", "+r+", "+i+")";var e,t,r,i,s},n.prototype.toHsl=function(){return jC(vd(this.rgba))},n.prototype.toHslString=function(){return e=jC(vd(this.rgba)),t=e.h,r=e.s,i=e.l,(s=e.a)<1?"hsla("+t+", "+r+"%, "+i+"%, "+s+")":"hsl("+t+", "+r+"%, "+i+"%)";var e,t,r,i,s},n.prototype.toHsv=function(){return e=MD(this.rgba),{h:sr(e.h),s:sr(e.s),v:sr(e.v),a:sr(e.a,3)};var e},n.prototype.invert=function(){return Nr({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},n.prototype.saturate=function(e){return e===void 0&&(e=.1),Nr(R_(this.rgba,e))},n.prototype.desaturate=function(e){return e===void 0&&(e=.1),Nr(R_(this.rgba,-e))},n.prototype.grayscale=function(){return Nr(R_(this.rgba,-1))},n.prototype.lighten=function(e){return e===void 0&&(e=.1),Nr(YC(this.rgba,e))},n.prototype.darken=function(e){return e===void 0&&(e=.1),Nr(YC(this.rgba,-e))},n.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},n.prototype.alpha=function(e){return typeof e=="number"?Nr({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):sr(this.rgba.a,3);var t},n.prototype.hue=function(e){var t=vd(this.rgba);return typeof e=="number"?Nr({h:e,s:t.s,l:t.l,a:t.a}):sr(t.h)},n.prototype.isEqual=function(e){return this.toHex()===Nr(e).toHex()},n}(),Nr=function(n){return n instanceof U1?n:new U1(n)},QC=[],xX=function(n){n.forEach(function(e){QC.indexOf(e)<0&&(e(U1,N1),QC.push(e))})};function EX(n,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var i in t)r[t[i]]=i;var s={};n.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=r[this.toHex()];if(c)return c;if(o!=null&&o.closest){var d=this.toRgb(),h=1/0,p="black";if(!s.length)for(var m in t)s[m]=new n(t[m]).toRgb();for(var v in t){var E=(a=d,l=s[v],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));E=0||(i[t]=n[t]);return i}function k1(n){var e=D.useRef(n),t=D.useRef(function(r){e.current&&e.current(r)});return e.current=n,t.current}var Fu=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n0:x.buttons>0)&&i.current?s(ZC(i.current,x,a.current)):E(!1)},v=function(){return E(!1)};function E(x){var g=l.current,A=z1(i.current),_=x?A.addEventListener:A.removeEventListener;_(g?"touchmove":"mousemove",m),_(g?"touchend":"mouseup",v)}return[function(x){var g=x.nativeEvent,A=i.current;if(A&&(qC(g),!function(w,C){return C&&!yd(w)}(g,l.current)&&A)){if(yd(g)){l.current=!0;var _=g.changedTouches||[];_.length&&(a.current=_[0].identifier)}A.focus(),s(ZC(A,g,a.current)),E(!0)}},function(x){var g=x.which||x.keyCode;g<37||g>40||(x.preventDefault(),o({left:g===39?.05:g===37?-.05:0,top:g===40?.05:g===38?-.05:0}))},E]},[o,s]),d=c[0],h=c[1],p=c[2];return D.useEffect(function(){return p},[p]),Q.createElement("div",qu({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:i,onKeyDown:h,tabIndex:0,role:"slider"}))}),Nh=function(n){return n.filter(Boolean).join(" ")},mS=function(n){var e=n.color,t=n.left,r=n.top,i=r===void 0?.5:r,s=Nh(["react-colorful__pointer",n.className]);return Q.createElement("div",{className:s,style:{top:100*i+"%",left:100*t+"%"}},Q.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},zr=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t},CD=function(n){var e=n.s,t=n.v,r=n.a,i=(200-e)*t/100;return{h:zr(n.h),s:zr(i>0&&i<200?e*t/100/(i<=100?i:200-i)*100:0),l:zr(i/2),a:zr(r,2)}},H1=function(n){var e=CD(n);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},I_=function(n){var e=CD(n);return"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"},RD=function(n){var e=n.h,t=n.s,r=n.v,i=n.a;e=e/360*6,t/=100,r/=100;var s=Math.floor(e),o=r*(1-t),a=r*(1-(e-s)*t),l=r*(1-(1-e+s)*t),c=s%6;return{r:zr(255*[r,a,o,o,l,r][c]),g:zr(255*[l,r,r,a,o,o][c]),b:zr(255*[o,o,l,r,r,a][c]),a:zr(i,2)}},PD=function(n){var e=n.r,t=n.g,r=n.b,i=n.a,s=Math.max(e,t,r),o=s-Math.min(e,t,r),a=o?s===e?(t-r)/o:s===t?2+(r-e)/o:4+(e-t)/o:0;return{h:zr(60*(a<0?a+6:a)),s:zr(s?o/s*100:0),v:zr(s/255*100),a:i}},ID=Q.memo(function(n){var e=n.hue,t=n.onChange,r=Nh(["react-colorful__hue",n.className]);return Q.createElement("div",{className:r},Q.createElement(pS,{onMove:function(i){t({h:360*i.left})},onKey:function(i){t({h:Fu(e+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":zr(e),"aria-valuemax":"360","aria-valuemin":"0"},Q.createElement(mS,{className:"react-colorful__hue-pointer",left:e/360,color:H1({h:e,s:100,v:100,a:1})})))}),BD=Q.memo(function(n){var e=n.hsva,t=n.onChange,r={backgroundColor:H1({h:e.h,s:100,v:100,a:1})};return Q.createElement("div",{className:"react-colorful__saturation",style:r},Q.createElement(pS,{onMove:function(i){t({s:100*i.left,v:100-100*i.top})},onKey:function(i){t({s:Fu(e.s+100*i.left,0,100),v:Fu(e.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+zr(e.s)+"%, Brightness "+zr(e.v)+"%"},Q.createElement(mS,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:H1(e)})))}),gS=function(n,e){if(n===e)return!0;for(var t in n)if(n[t]!==e[t])return!1;return!0};function LD(n,e,t){var r=k1(t),i=D.useState(function(){return n.toHsva(e)}),s=i[0],o=i[1],a=D.useRef({color:e,hsva:s});D.useEffect(function(){if(!n.equal(e,a.current.color)){var c=n.toHsva(e);a.current={hsva:c,color:e},o(c)}},[e,n]),D.useEffect(function(){var c;gS(s,a.current.hsva)||n.equal(c=n.fromHsva(s),a.current.color)||(a.current={hsva:s,color:c},r(c))},[s,n,r]);var l=D.useCallback(function(c){o(function(d){return Object.assign({},d,c)})},[]);return[s,l]}var AX=typeof window<"u"?D.useLayoutEffect:D.useEffect,SX=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},eR=new Map,DD=function(n){AX(function(){var e=n.current?n.current.ownerDocument:document;if(e!==void 0&&!eR.has(e)){var t=e.createElement("style");t.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,eR.set(e,t);var r=SX();r&&t.setAttribute("nonce",r),e.head.appendChild(t)}},[])},wX=function(n){var e=n.className,t=n.colorModel,r=n.color,i=r===void 0?t.defaultColor:r,s=n.onChange,o=hS(n,["className","colorModel","color","onChange"]),a=D.useRef(null);DD(a);var l=LD(t,i,s),c=l[0],d=l[1],h=Nh(["react-colorful",e]);return Q.createElement("div",qu({},o,{ref:a,className:h}),Q.createElement(BD,{hsva:c,onChange:d}),Q.createElement(ID,{hue:c.h,onChange:d,className:"react-colorful__last-control"}))},MX=function(n){var e=n.className,t=n.hsva,r=n.onChange,i={backgroundImage:"linear-gradient(90deg, "+I_(Object.assign({},t,{a:0}))+", "+I_(Object.assign({},t,{a:1}))+")"},s=Nh(["react-colorful__alpha",e]),o=zr(100*t.a);return Q.createElement("div",{className:s},Q.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),Q.createElement(pS,{onMove:function(a){r({a:a.left})},onKey:function(a){r({a:Fu(t.a+a.left)})},"aria-label":"Alpha","aria-valuetext":o+"%","aria-valuenow":o,"aria-valuemin":"0","aria-valuemax":"100"},Q.createElement(mS,{className:"react-colorful__alpha-pointer",left:t.a,color:I_(t)})))},TX=function(n){var e=n.className,t=n.colorModel,r=n.color,i=r===void 0?t.defaultColor:r,s=n.onChange,o=hS(n,["className","colorModel","color","onChange"]),a=D.useRef(null);DD(a);var l=LD(t,i,s),c=l[0],d=l[1],h=Nh(["react-colorful",e]);return Q.createElement("div",qu({},o,{ref:a,className:h}),Q.createElement(BD,{hsva:c,onChange:d}),Q.createElement(ID,{hue:c.h,onChange:d}),Q.createElement(MX,{hsva:c,onChange:d,className:"react-colorful__last-control"}))},bX={defaultColor:{r:0,g:0,b:0,a:1},toHsva:PD,fromHsva:RD,equal:gS},CX=function(n){return Q.createElement(TX,qu({},n,{colorModel:bX}))},RX={defaultColor:{r:0,g:0,b:0},toHsva:function(n){return PD({r:n.r,g:n.g,b:n.b,a:1})},fromHsva:function(n){return{r:(e=RD(n)).r,g:e.g,b:e.b};var e},equal:gS},PX=function(n){return Q.createElement(wX,qu({},n,{colorModel:RX}))},G1=function(n,e){return G1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},G1(n,e)};function Y0(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");G1(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var tR=function(){return tR=Object.assign||function(e){for(var t,r=1,i=arguments.length;r0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ih(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function IX(){for(var n=[],e=0;e1||a(p,m)})})}function a(p,m){try{l(r[p](m))}catch(v){h(s[0][3],v)}}function l(p){p.value instanceof V1?Promise.resolve(p.value.v).then(c,d):h(s[0][2],p)}function c(p){a("next",p)}function d(p){a("throw",p)}function h(p,m){p(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function sY(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof rh=="function"?rh(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(o){return new Promise(function(a,l){o=n[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(c){s({value:c,done:a})},o)}}var BX=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Uh(n,e){var t=LX(n);if(typeof t.path!="string"){var r=n.webkitRelativePath;Object.defineProperty(t,"path",{value:typeof e=="string"?e:typeof r=="string"&&r.length>0?r:n.name,writable:!1,configurable:!1,enumerable:!0})}return t}function LX(n){var e=n.name,t=e&&e.lastIndexOf(".")!==-1;if(t&&!n.type){var r=e.split(".").pop().toLowerCase(),i=BX.get(r);i&&Object.defineProperty(n,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return n}var DX=[".DS_Store","Thumbs.db"];function OX(n){return ef(this,void 0,void 0,function(){return tf(this,function(e){return r0(n)&&FX(n)?[2,zX(n.dataTransfer,n.type)]:NX(n)?[2,UX(n)]:Array.isArray(n)&&n.every(function(t){return"getFile"in t&&typeof t.getFile=="function"})?[2,kX(n)]:[2,[]]})})}function FX(n){return r0(n.dataTransfer)}function NX(n){return r0(n)&&r0(n.target)}function r0(n){return typeof n=="object"&&n!==null}function UX(n){return W1(n.target.files).map(function(e){return Uh(e)})}function kX(n){return ef(this,void 0,void 0,function(){var e;return tf(this,function(t){switch(t.label){case 0:return[4,Promise.all(n.map(function(r){return r.getFile()}))];case 1:return e=t.sent(),[2,e.map(function(r){return Uh(r)})]}})})}function zX(n,e){return ef(this,void 0,void 0,function(){var t,r;return tf(this,function(i){switch(i.label){case 0:return n===null?[2,[]]:n.items?(t=W1(n.items).filter(function(s){return s.kind==="file"}),e!=="drop"?[2,t]:[4,Promise.all(t.map(HX))]):[3,2];case 1:return r=i.sent(),[2,nR(OD(r))];case 2:return[2,nR(W1(n.files).map(function(s){return Uh(s)}))]}})})}function nR(n){return n.filter(function(e){return DX.indexOf(e.name)===-1})}function W1(n){if(n===null)return[];for(var e=[],t=0;tn.length)&&(e=n.length);for(var t=0,r=new Array(e);tt)return[!1,lR(t)];if(n.sizet)return[!1,lR(t)]}return[!0,null]}function jf(n){return n!=null}function tj(n){var e=n.files,t=n.accept,r=n.minSize,i=n.maxSize,s=n.multiple,o=n.maxFiles;return!s&&e.length>1||s&&o>=1&&e.length>o?!1:e.every(function(a){var l=UD(a,t),c=oR(l,1),d=c[0],h=kD(a,r,i),p=oR(h,1),m=p[0];return d&&m})}function i0(n){return typeof n.isPropagationStopped=="function"?n.isPropagationStopped():typeof n.cancelBubble<"u"?n.cancelBubble:!1}function $m(n){return n.dataTransfer?Array.prototype.some.call(n.dataTransfer.types,function(e){return e==="Files"||e==="application/x-moz-file"}):!!n.target&&!!n.target.files}function uR(n){n.preventDefault()}function nj(n){return n.indexOf("MSIE")!==-1||n.indexOf("Trident/")!==-1}function rj(n){return n.indexOf("Edge/")!==-1}function ij(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return nj(n)||rj(n)}function Is(){for(var n=arguments.length,e=new Array(n),t=0;t1?i-1:0),o=1;on.length)&&(e=n.length);for(var t=0,r=new Array(e);t=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function xj(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,s;for(s=0;s=0)&&(t[i]=n[i]);return t}var vS=D.forwardRef(function(n,e){var t=n.children,r=s0(n,cj),i=GD(r),s=i.open,o=s0(i,uj);return D.useImperativeHandle(e,function(){return{open:s}},[s]),Q.createElement(D.Fragment,null,t(Sn(Sn({},o),{},{open:s})))});vS.displayName="Dropzone";var HD={disabled:!1,getFilesFromEvent:OX,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0};vS.defaultProps=HD;vS.propTypes={children:sn.func,accept:sn.oneOfType([sn.string,sn.arrayOf(sn.string)]),multiple:sn.bool,preventDropOnDocument:sn.bool,noClick:sn.bool,noKeyboard:sn.bool,noDrag:sn.bool,noDragEventsBubbling:sn.bool,minSize:sn.number,maxSize:sn.number,maxFiles:sn.number,disabled:sn.bool,getFilesFromEvent:sn.func,onFileDialogCancel:sn.func,onFileDialogOpen:sn.func,useFsAccessApi:sn.bool,onDragEnter:sn.func,onDragLeave:sn.func,onDragOver:sn.func,onDrop:sn.func,onDropAccepted:sn.func,onDropRejected:sn.func,validator:sn.func};var j1={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,draggedFiles:[],acceptedFiles:[],fileRejections:[]};function GD(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Sn(Sn({},HD),n),t=e.accept,r=e.disabled,i=e.getFilesFromEvent,s=e.maxSize,o=e.minSize,a=e.multiple,l=e.maxFiles,c=e.onDragEnter,d=e.onDragLeave,h=e.onDragOver,p=e.onDrop,m=e.onDropAccepted,v=e.onDropRejected,E=e.onFileDialogCancel,x=e.onFileDialogOpen,g=e.useFsAccessApi,A=e.preventDropOnDocument,_=e.noClick,w=e.noKeyboard,C=e.noDrag,b=e.noDragEventsBubbling,B=e.validator,I=D.useMemo(function(){return typeof x=="function"?x:dR},[x]),R=D.useMemo(function(){return typeof E=="function"?E:dR},[E]),L=D.useRef(null),U=D.useRef(null),j=D.useReducer(Ej,j1),$=B_(j,2),K=$[0],Y=$[1],ne=K.isFocused,ie=K.isFileDialogActive,z=K.draggedFiles,Z=D.useRef(typeof window<"u"&&window.isSecureContext&&g&&sj()),q=function(){!Z.current&&ie&&setTimeout(function(){if(U.current){var N=U.current.files;N.length||(Y({type:"closeDialog"}),R())}},300)};D.useEffect(function(){return window.addEventListener("focus",q,!1),function(){window.removeEventListener("focus",q,!1)}},[U,ie,R,Z]);var ae=D.useRef([]),ee=function(N){L.current&&L.current.contains(N.target)||(N.preventDefault(),ae.current=[])};D.useEffect(function(){return A&&(document.addEventListener("dragover",uR,!1),document.addEventListener("drop",ee,!1)),function(){A&&(document.removeEventListener("dragover",uR),document.removeEventListener("drop",ee))}},[L,A]);var ve=D.useCallback(function(k){k.preventDefault(),k.persist(),be(k),ae.current=[].concat(hj(ae.current),[k.target]),$m(k)&&Promise.resolve(i(k)).then(function(N){i0(k)&&!b||(Y({draggedFiles:N,isDragActive:!0,type:"setDraggedFiles"}),c&&c(k))})},[i,c,b]),pe=D.useCallback(function(k){k.preventDefault(),k.persist(),be(k);var N=$m(k);if(N&&k.dataTransfer)try{k.dataTransfer.dropEffect="copy"}catch{}return N&&h&&h(k),!1},[h,b]),Le=D.useCallback(function(k){k.preventDefault(),k.persist(),be(k);var N=ae.current.filter(function(Pe){return L.current&&L.current.contains(Pe)}),de=N.indexOf(k.target);de!==-1&&N.splice(de,1),ae.current=N,!(N.length>0)&&(Y({isDragActive:!1,type:"setDraggedFiles",draggedFiles:[]}),$m(k)&&d&&d(k))},[L,d,b]),we=D.useCallback(function(k,N){var de=[],Pe=[];k.forEach(function(Ie){var ke=UD(Ie,t),Ye=B_(ke,2),He=Ye[0],ye=Ye[1],te=kD(Ie,o,s),me=B_(te,2),Ce=me[0],Be=me[1],Ne=B?B(Ie):null;if(He&&Ce&&!Ne)de.push(Ie);else{var nt=[ye,Be];Ne&&(nt=nt.concat(Ne)),Pe.push({file:Ie,errors:nt.filter(function(mt){return mt})})}}),(!a&&de.length>1||a&&l>=1&&de.length>l)&&(de.forEach(function(Ie){Pe.push({file:Ie,errors:[ej]})}),de.splice(0)),Y({acceptedFiles:de,fileRejections:Pe,type:"setFiles"}),p&&p(de,Pe,N),Pe.length>0&&v&&v(Pe,N),de.length>0&&m&&m(de,N)},[Y,a,t,o,s,l,p,m,v,B]),Fe=D.useCallback(function(k){k.preventDefault(),k.persist(),be(k),ae.current=[],$m(k)&&Promise.resolve(i(k)).then(function(N){i0(k)&&!b||we(N,k)}),Y({type:"reset"})},[i,we,b]),et=D.useCallback(function(){if(Z.current){Y({type:"openDialog"}),I();var k={multiple:a,types:oj(t)};window.showOpenFilePicker(k).then(function(N){return i(N)}).then(function(N){we(N,null),Y({type:"closeDialog"})}).catch(function(N){aj(N)?(R(N),Y({type:"closeDialog"})):lj(N)&&(Z.current=!1,U.current&&(U.current.value=null,U.current.click()))});return}U.current&&(Y({type:"openDialog"}),I(),U.current.value=null,U.current.click())},[Y,I,R,g,we,t,a]),ut=D.useCallback(function(k){!L.current||!L.current.isEqualNode(k.target)||(k.key===" "||k.key==="Enter"||k.keyCode===32||k.keyCode===13)&&(k.preventDefault(),et())},[L,et]),Rt=D.useCallback(function(){Y({type:"focus"})},[]),rt=D.useCallback(function(){Y({type:"blur"})},[]),J=D.useCallback(function(){_||(ij()?setTimeout(et,0):et())},[_,et]),Re=function(N){return r?null:N},Se=function(N){return w?null:Re(N)},De=function(N){return C?null:Re(N)},be=function(N){b&&N.stopPropagation()},tt=D.useMemo(function(){return function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},N=k.refKey,de=N===void 0?"ref":N,Pe=k.role,Ie=k.onKeyDown,ke=k.onFocus,Ye=k.onBlur,He=k.onClick,ye=k.onDragEnter,te=k.onDragOver,me=k.onDragLeave,Ce=k.onDrop,Be=s0(k,fj);return Sn(Sn(X1({onKeyDown:Se(Is(Ie,ut)),onFocus:Se(Is(ke,Rt)),onBlur:Se(Is(Ye,rt)),onClick:Re(Is(He,J)),onDragEnter:De(Is(ye,ve)),onDragOver:De(Is(te,pe)),onDragLeave:De(Is(me,Le)),onDrop:De(Is(Ce,Fe)),role:typeof Pe=="string"&&Pe!==""?Pe:"button"},de,L),!r&&!w?{tabIndex:0}:{}),Be)}},[L,ut,Rt,rt,J,ve,pe,Le,Fe,w,C,r]),We=D.useCallback(function(k){k.stopPropagation()},[]),je=D.useMemo(function(){return function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},N=k.refKey,de=N===void 0?"ref":N,Pe=k.onChange,Ie=k.onClick,ke=s0(k,dj),Ye=X1({accept:t,multiple:a,type:"file",style:{display:"none"},onChange:Re(Is(Pe,Fe)),onClick:Re(Is(Ie,We)),tabIndex:-1},de,U);return Sn(Sn({},Ye),ke)}},[U,t,a,Fe,r]),at=z.length,St=at>0&&tj({files:z,accept:t,minSize:o,maxSize:s,multiple:a,maxFiles:l}),Qt=at>0&&!St;return Sn(Sn({},K),{},{isDragAccept:St,isDragReject:Qt,isFocused:ne&&!r,getRootProps:tt,getInputProps:je,rootRef:L,inputRef:U,open:Re(et)})}function Ej(n,e){switch(e.type){case"focus":return Sn(Sn({},n),{},{isFocused:!0});case"blur":return Sn(Sn({},n),{},{isFocused:!1});case"openDialog":return Sn(Sn({},j1),{},{isFileDialogActive:!0});case"closeDialog":return Sn(Sn({},n),{},{isFileDialogActive:!1});case"setDraggedFiles":var t=e.isDragActive,r=e.draggedFiles;return Sn(Sn({},n),{},{draggedFiles:r,isDragActive:t});case"setFiles":return Sn(Sn({},n),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections});case"reset":return Sn({},j1);default:return n}}function dR(){}/*! - * isobject - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */var Aj=function(e){return e!=null&&typeof e=="object"&&Array.isArray(e)===!1};/*! - * is-plain-object - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */var Sj=Aj;function hR(n){return Sj(n)===!0&&Object.prototype.toString.call(n)==="[object Object]"}var VD=function(e){var t,r;return!(hR(e)===!1||(t=e.constructor,typeof t!="function")||(r=t.prototype,hR(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*! - * is-extendable - * - * Copyright (c) 2015-2017, Jon Schlinkert. - * Released under the MIT License. - */var wj=VD,yS=function(e){return wj(e)||typeof e=="function"||Array.isArray(e)};/*! - * for-in - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */var Mj=function(e,t,r){for(var i in e)if(t.call(r,e[i],i,e)===!1)break},Tj=yS,bj=Mj;function WD(n,e){for(var t=arguments.length,r=0;++r - * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. - */var Ij=function(n,e,t,r,i){if(!Bj(n)||!e)return n;if(e=Xm(e),t&&(e+="."+Xm(t)),r&&(e+="."+Xm(r)),i&&(e+="."+Xm(i)),e in n)return n[e];for(var s=e.split("."),o=s.length,a=-1;n&&++a - * - * Copyright (c) 2015, Jon Schlinkert. - * Licensed under the MIT License. - */var Lj=function(n,e){if(n===null||typeof n>"u")throw new TypeError("expected first argument to be an object.");if(typeof e>"u"||typeof Symbol>"u"||typeof Object.getOwnPropertySymbols!="function")return n;for(var t=Object.prototype.propertyIsEnumerable,r=Object(n),i=arguments.length,s=0;++s"u")throw new TypeError("Cannot convert undefined or null to object");pR(n)||(n={});for(var e=1;e - * - * Copyright (c) 2015-2017, Jon Schlinkert. - * Released under the MIT License. - */var Hj=Fj,Gj=function(n,e,t){if(typeof n!="string")throw new TypeError("expected a string");typeof e=="function"&&(t=e,e=null),typeof e=="string"&&(e={sep:e});var r=Hj({sep:"."},e),i=r.quotes||['"',"'","`"],s;r.brackets===!0?s={"<":">","(":")","[":"]","{":"}"}:r.brackets&&(s=r.brackets);var o=[],a=[],l=[""],c=r.sep,d=n.length,h=-1,p;function m(){if(s&&a.length)return s[a[a.length-1]]}for(;++h - * - * Copyright (c) 2015, Jon Schlinkert. - * Licensed under the MIT License. - */var $j=function(e){return typeof e<"u"&&e!==null&&(typeof e=="object"||typeof e=="function")},mR=$j,Xj=function(e){mR(e)||(e={});for(var t=arguments.length,r=1;r - * - * Copyright (c) 2015, Jon Schlinkert. - * Licensed under the MIT License. - */var Kj=function(e){return typeof e<"u"&&e!==null&&(typeof e=="object"||typeof e=="function")};/*! - * set-value - * - * Copyright (c) 2014-2015, 2017, Jon Schlinkert. - * Released under the MIT License. - */var Yj=Gj,Qj=Xj,gR=VD,vR=Kj,Zj=function(n,e,t){if(!vR(n)||(Array.isArray(e)&&(e=[].concat.apply([],e).join(".")),typeof e!="string"))return n;for(var r=Yj(e,{sep:".",brackets:!0}).filter(qj),i=r.length,s=-1,o=n;++sn.filter(Boolean).join(".");function nJ(n){const e=n.split(".");return[e.pop(),e.join(".")||void 0]}function rJ(n,e){return Object.entries(N$(n,e)).reduce((t,[,{value:r,disabled:i,key:s}])=>(t[s]=i?void 0:r,t),{})}function iJ(n,e){const t=D.useRef();return(e?Qd:Dh)(n,t.current)||(t.current=n),t.current}function $D(n,e){return D.useMemo(n,iJ(e,!0))}function sJ(n){const e=D.useRef(null),t=D.useRef(null),r=D.useRef(!0);return D.useLayoutEffect(()=>{n||(e.current.style.height="0px",e.current.style.overflow="hidden")},[]),D.useEffect(()=>{if(r.current){r.current=!1;return}let i;const s=e.current,o=()=>{n&&(s.style.removeProperty("height"),s.style.removeProperty("overflow"),t.current.scrollIntoView({behavior:"smooth",block:"nearest"}))};s.addEventListener("transitionend",o,{once:!0});const{height:a}=t.current.getBoundingClientRect();return s.style.height=a+"px",n||(s.style.overflow="hidden",i=window.setTimeout(()=>s.style.height="0px",50)),()=>{s.removeEventListener("transitionend",o),clearTimeout(i)}},[n]),{wrapperRef:e,contentRef:t}}const oJ=n=>{const[e,t]=D.useState(n.getVisiblePaths());return D.useEffect(()=>{t(n.getVisiblePaths());const r=n.useStore.subscribe(n.getVisiblePaths,t,{equalityFn:Dh});return()=>r()},[n]),e};function aJ(n,e,t){return n.useStore(i=>{const s=xt(xt({},t),i.data);return rJ(s,e)},Dh)}function XD(n=3){const e=D.useRef(null),t=D.useRef(null),[r,i]=D.useState(!1),s=D.useCallback(()=>i(!0),[]),o=D.useCallback(()=>i(!1),[]);return D.useLayoutEffect(()=>{if(r){const{bottom:a,top:l,left:c}=e.current.getBoundingClientRect(),{height:d}=t.current.getBoundingClientRect(),h=a+d>window.innerHeight-40?"up":"down";t.current.style.position="fixed",t.current.style.zIndex="10000",t.current.style.left=c+"px",h==="down"?t.current.style.top=a+n+"px":t.current.style.bottom=window.innerHeight-l+n+"px"}},[n,r]),{popinRef:e,wrapperRef:t,shown:r,show:s,hide:o}}xX([EX]);const lJ={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};ti.extend({color:()=>n=>Nr(n).isValid()});const cJ=n=>ti().color().test(n);function jD(n,{format:e,hasAlpha:t,isString:r}){const i=lJ[e]+(r&&e!=="hex"?"String":""),s=n[i]();return typeof s=="object"&&!t?U$(s,["a"]):s}const JD=(n,e)=>{const t=Nr(n);if(!t.isValid())throw Error("Invalid color");return jD(t,e)},uJ=(n,e)=>jD(Nr(n),xt(xt({},e),{},{isString:!0,format:"hex"})),fJ=({value:n})=>{const e=_X(n),t=e==="name"?"hex":e,r=typeof n=="object"?"a"in n:e==="hex"&&n.length===8||/^(rgba)|(hsla)|(hsva)/.test(n),i={format:t,hasAlpha:r,isString:typeof n=="string"};return{value:JD(n,i),settings:i}};var dJ=Object.freeze({__proto__:null,schema:cJ,sanitize:JD,format:uJ,normalize:fJ});const hJ=yt("div",{position:"relative",boxSizing:"border-box",borderRadius:"$sm",overflow:"hidden",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",backgroundColor:"#fff",backgroundImage:`url('data:image/svg+xml;charset=utf-8,')`,$inputStyle:"",$hover:"",zIndex:1,variants:{active:{true:{$inputStyle:"$accent1"}}},"&::before":{content:'""',position:"absolute",top:0,bottom:0,right:0,left:0,backgroundColor:"currentColor",zIndex:1}}),pJ=yt("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto",columnGap:"$colGap",alignItems:"center"}),mJ=yt("div",{width:"$colorPickerWidth",height:"$colorPickerHeight",".react-colorful":{width:"100%",height:"100%",boxShadow:"$level2",cursor:"crosshair"},".react-colorful__saturation":{borderRadius:"$sm $sm 0 0"},".react-colorful__alpha, .react-colorful__hue":{height:10},".react-colorful__last-control":{borderRadius:"0 0 $sm $sm"},".react-colorful__pointer":{height:12,width:12}});function xR(n,e){return e!=="rgb"?Nr(n).toRgb():n}function gJ({value:n,displayValue:e,settings:t,onUpdate:r}){const{emitOnEditStart:i,emitOnEditEnd:s}=br(),{format:o,hasAlpha:a}=t,{popinRef:l,wrapperRef:c,shown:d,show:h,hide:p}=XD(),m=D.useRef(0),[v,E]=D.useState(()=>xR(n,o)),x=a?CX:PX,g=()=>{E(xR(n,o)),h(),i()},A=()=>{p(),s(),window.clearTimeout(m.current)},_=()=>{m.current=window.setTimeout(A,500)};return D.useEffect(()=>()=>window.clearTimeout(m.current),[]),Q.createElement(Q.Fragment,null,Q.createElement(hJ,{ref:l,active:d,onClick:()=>g(),style:{color:e}}),d&&Q.createElement(uS,null,Q.createElement(mD,{onPointerUp:A}),Q.createElement(mJ,{ref:c,onMouseEnter:()=>window.clearTimeout(m.current),onMouseLeave:w=>w.buttons===0&&_()},Q.createElement(x,{color:v,onChange:r}))))}function vJ(){const{value:n,displayValue:e,label:t,onChange:r,onUpdate:i,settings:s}=br();return Q.createElement(Xi,{input:!0},Q.createElement(_s,null,t),Q.createElement(pJ,null,Q.createElement(gJ,{value:n,displayValue:e,onChange:r,onUpdate:i,settings:s}),Q.createElement(cS,{value:e,onChange:r,onUpdate:i})))}var yJ=xt({component:vJ},dJ);function _J(){const{label:n,displayValue:e,onUpdate:t,settings:r}=br();return Q.createElement(Xi,{input:!0},Q.createElement(_s,null,n),Q.createElement(dS,{value:e,settings:r,onUpdate:t}))}var xJ=xt({component:_J},SD(["x","y","z"]));const EJ=yt("div",{$flexCenter:"",position:"relative",backgroundColor:"$elevation3",borderRadius:"$sm",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",touchAction:"none",$draggable:"",$hover:"","&:active":{cursor:"none"},"&::after":{content:'""',backgroundColor:"$accent2",height:4,width:4,borderRadius:2}}),AJ=yt("div",{$flexCenter:"",width:"$joystickWidth",height:"$joystickHeight",borderRadius:"$sm",boxShadow:"$level2",position:"fixed",zIndex:1e4,overflow:"hidden",$draggable:"",transform:"translate(-50%, -50%)",variants:{isOutOfBounds:{true:{backgroundColor:"$elevation1"},false:{backgroundColor:"$elevation3"}}},"> div":{position:"absolute",$flexCenter:"",borderStyle:"solid",borderWidth:1,borderColor:"$highlight1",backgroundColor:"$elevation3",width:"80%",height:"80%","&::after,&::before":{content:'""',position:"absolute",zindex:10,backgroundColor:"$highlight1"},"&::before":{width:"100%",height:1},"&::after":{height:"100%",width:1}},"> span":{position:"relative",zindex:100,width:10,height:10,backgroundColor:"$accent2",borderRadius:"50%"}});function SJ({value:n,settings:e,onUpdate:t}){const r=D.useRef(),i=D.useRef(0),s=D.useRef(0),o=D.useRef(1),[a,l]=D.useState(!1),[c,d]=D.useState(!1),[h,p]=vD(),m=D.useRef(null),v=D.useRef(null);D.useLayoutEffect(()=>{if(a){const{top:j,left:$,width:K,height:Y}=m.current.getBoundingClientRect();v.current.style.left=$+K/2+"px",v.current.style.top=j+Y/2+"px"}},[a]);const{keys:[E,x],joystick:g}=e,A=g==="invertY"?1:-1,{[E]:{step:_},[x]:{step:w}}=e,C=wo("sizes","joystickWidth"),b=wo("sizes","joystickHeight"),B=parseFloat(C)*.8/2,I=parseFloat(b)*.8/2,R=D.useCallback(()=>{r.current||(d(!0),i.current&&p({x:i.current*B}),s.current&&p({y:s.current*-I}),r.current=window.setInterval(()=>{t(j=>{const $=_*i.current*o.current,K=A*w*s.current*o.current;return Array.isArray(j)?{[E]:j[0]+$,[x]:j[1]+K}:{[E]:j[E]+$,[x]:j[x]+K}})},16))},[B,I,t,p,_,w,E,x,A]),L=D.useCallback(()=>{window.clearTimeout(r.current),r.current=void 0,d(!1)},[]);D.useEffect(()=>{function j($){o.current=tD($)}return window.addEventListener("keydown",j),window.addEventListener("keyup",j),()=>{window.clearTimeout(r.current),window.removeEventListener("keydown",j),window.removeEventListener("keyup",j)}},[]);const U=Fh(({first:j,active:$,delta:[K,Y],movement:[ne,ie]})=>{j&&l(!0);const z=Ia(ne,-B,B),Z=Ia(ie,-I,I);i.current=Math.abs(ne)>Math.abs(z)?Math.sign(ne-z):0,s.current=Math.abs(ie)>Math.abs(Z)?Math.sign(Z-ie):0;let q=n[E],ae=n[x];$?(i.current||(q+=K*_*o.current,p({x:z})),s.current||(ae-=A*Y*w*o.current,p({y:Z})),i.current||s.current?R():L(),t({[E]:q,[x]:ae})):(l(!1),i.current=0,s.current=0,p({x:0,y:0}),L())});return Q.createElement(EJ,Nn({ref:m},U()),a&&Q.createElement(uS,null,Q.createElement(AJ,{ref:v,isOutOfBounds:c},Q.createElement("div",null),Q.createElement("span",{ref:h}))))}const wJ=yt("div",{display:"grid",columnGap:"$colGap",variants:{withJoystick:{true:{gridTemplateColumns:"$sizes$rowHeight auto"},false:{gridTemplateColumns:"auto"}}}});function MJ(){const{label:n,displayValue:e,onUpdate:t,settings:r}=br();return Q.createElement(Xi,{input:!0},Q.createElement(_s,null,n),Q.createElement(wJ,{withJoystick:!!r.joystick},r.joystick&&Q.createElement(SJ,{value:e,settings:r,onUpdate:t}),Q.createElement(dS,{value:e,settings:r,onUpdate:t})))}const TJ=["joystick"],KD=SD(["x","y"]),bJ=n=>{let{joystick:e=!0}=n,t=on(n,TJ);const{value:r,settings:i}=KD.normalize(t);return{value:r,settings:xt(xt({},i),{},{joystick:e})}};var CJ=xt(xt({component:MJ},KD),{},{normalize:bJ});const RJ=n=>{if(n!==void 0){if(n instanceof File)try{return URL.createObjectURL(n)}catch{return}if(typeof n=="string"&&n.indexOf("blob:")===0)return n;throw Error("Invalid image format [undefined | blob | File].")}},PJ=(n,e)=>typeof e=="object"&&"image"in e,IJ=({image:n})=>({value:n});var BJ=Object.freeze({__proto__:null,sanitize:RJ,schema:PJ,normalize:IJ});const LJ=yt("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto 20px",columnGap:"$colGap",alignItems:"center"}),DJ=yt("div",{$flexCenter:"",overflow:"hidden",height:"$rowHeight",background:"$elevation3",textAlign:"center",color:"inherit",borderRadius:"$sm",outline:"none",userSelect:"none",cursor:"pointer",$inputStyle:"",$hover:"",$focusWithin:"",$active:"$accent1 $elevation1",variants:{isDragAccept:{true:{$inputStyle:"$accent1",backgroundColor:"$elevation1"}}}}),OJ=yt("div",{boxSizing:"border-box",borderRadius:"$sm",height:"$rowHeight",width:"$rowHeight",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center",variants:{hasImage:{true:{cursor:"pointer",$hover:"",$active:""}}}}),FJ=yt("div",{$flexCenter:"",width:"$imagePreviewWidth",height:"$imagePreviewHeight",borderRadius:"$sm",boxShadow:"$level2",pointerEvents:"none",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center"}),NJ=yt("div",{fontSize:"0.8em",height:"100%",padding:"$rowGap $md"}),UJ=yt("div",{$flexCenter:"",top:"0",right:"0",marginRight:"$sm",height:"100%",cursor:"pointer",variants:{disabled:{true:{color:"$elevation3",cursor:"default"}}},"&::after,&::before":{content:'""',position:"absolute",height:2,width:10,borderRadius:1,backgroundColor:"currentColor"},"&::after":{transform:"rotate(45deg)"},"&::before":{transform:"rotate(-45deg)"}});function kJ(){const{label:n,value:e,onUpdate:t,disabled:r}=br(),{popinRef:i,wrapperRef:s,shown:o,show:a,hide:l}=XD(),c=D.useCallback(v=>{v.length&&t(v[0])},[t]),d=D.useCallback(v=>{v.stopPropagation(),t(void 0)},[t]),{getRootProps:h,getInputProps:p,isDragAccept:m}=GD({maxFiles:1,accept:"image/*",onDrop:c,disabled:r});return Q.createElement(Xi,{input:!0},Q.createElement(_s,null,n),Q.createElement(LJ,null,Q.createElement(OJ,{ref:i,hasImage:!!e,onPointerDown:()=>!!e&&a(),onPointerUp:l,style:{backgroundImage:e?`url(${e})`:"none"}}),o&&!!e&&Q.createElement(uS,null,Q.createElement(mD,{onPointerUp:l,style:{cursor:"pointer"}}),Q.createElement(FJ,{ref:s,style:{backgroundImage:`url(${e})`}})),Q.createElement(DJ,h({isDragAccept:m}),Q.createElement("input",p()),Q.createElement(NJ,null,m?"drop image":"click or drop")),Q.createElement(UJ,{onClick:d,disabled:!e})))}var zJ=xt({component:kJ},BJ);const ER=ti().number(),HJ=(n,e)=>ti().array().length(2).every.number().test(n)&&ti().schema({min:ER,max:ER}).test(e),o0=n=>({min:n[0],max:n[1]}),YD=(n,{bounds:[e,t]},r)=>{const i=Array.isArray(n)?o0(n):n,s={min:r[0],max:r[1]},{min:o,max:a}=xt(xt({},s),i);return[Ia(Number(o),e,Math.max(e,a)),Ia(Number(a),Math.min(t,o),t)]},GJ=({value:n,min:e,max:t})=>{const r={min:e,max:t},i=AD(o0(n),{min:r,max:r}),s=[e,t],o=xt(xt({},i),{},{bounds:s});return{value:YD(o0(n),o,n),settings:o}};var VJ=Object.freeze({__proto__:null,schema:HJ,format:o0,sanitize:YD,normalize:GJ});const WJ=["value","bounds","onDrag"],$J=["bounds"],XJ=yt("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function jJ(n){let{value:e,bounds:[t,r],onDrag:i}=n,s=on(n,WJ);const o=D.useRef(null),a=D.useRef(null),l=D.useRef(null),c=D.useRef(0),d=wo("sizes","scrubberWidth"),h=Fh(({event:v,first:E,xy:[x],movement:[g],memo:A={}})=>{if(E){const{width:w,left:C}=o.current.getBoundingClientRect();c.current=w-parseFloat(d);const b=(v==null?void 0:v.target)===a.current||(v==null?void 0:v.target)===l.current;A.pos=e0((x-C)/w,t,r);const B=Math.abs(A.pos-e.min)-Math.abs(A.pos-e.max);A.key=B<0||B===0&&A.pos<=e.min?"min":"max",b&&(A.pos=e[A.key])}const _=A.pos+e0(g/c.current,0,r-t);return i({[A.key]:T7(_,s[A.key])}),A}),p=`calc(${qg(e.min,t,r)} * (100% - ${d} - 8px) + 4px)`,m=`calc(${1-qg(e.max,t,r)} * (100% - ${d} - 8px) + 4px)`;return Q.createElement(_D,Nn({ref:o},h()),Q.createElement(yD,null,Q.createElement(xD,{style:{left:p,right:m}})),Q.createElement(O1,{position:"left",ref:a,style:{left:p}}),Q.createElement(O1,{position:"right",ref:l,style:{right:m}}))}function JJ(){const{label:n,displayValue:e,onUpdate:t,settings:r}=br(),i=on(r,$J);return Q.createElement(Q.Fragment,null,Q.createElement(Xi,{input:!0},Q.createElement(_s,null,n),Q.createElement(XJ,null,Q.createElement(jJ,Nn({value:e},r,{onDrag:t})),Q.createElement(dS,{value:e,settings:i,onUpdate:t,innerLabelTrim:0}))))}var KJ=xt({component:JJ},VJ);const YJ=()=>{const n=new Map;return{on:(e,t)=>{let r=n.get(e);r===void 0&&(r=new Set,n.set(e,r)),r.add(t)},off:(e,t)=>{const r=n.get(e);r!==void 0&&(r.delete(t),r.size===0&&n.delete(e))},emit:(e,...t)=>{const r=n.get(e);if(r!==void 0)for(const i of r)i(...t)}}},QJ=["type","value"],ZJ=["onChange","transient","onEditStart","onEditEnd"],qJ=function(){const e=XA(o6(()=>({data:{}}))),t=YJ();this.storeId=F$(),this.useStore=e;const r={},i=new Set;this.getVisiblePaths=()=>{const o=this.getData(),a=Object.keys(o),l=[];Object.entries(r).forEach(([d,h])=>{h.render&&a.some(p=>p.indexOf(d)===0)&&!h.render(this.get)&&l.push(d+".")});const c=[];return i.forEach(d=>{d in o&&o[d].__refCount>0&&l.every(h=>d.indexOf(h)===-1)&&(!o[d].render||o[d].render(this.get))&&c.push(d)}),c},this.setOrderedPaths=o=>{o.forEach(a=>i.add(a))},this.orderPaths=o=>(this.setOrderedPaths(o),o),this.disposePaths=o=>{e.setState(a=>{const l=a.data;return o.forEach(c=>{if(c in l){const d=l[c];d.__refCount--,d.__refCount===0&&d.type in ls&&delete l[c]}}),{data:l}})},this.dispose=()=>{e.setState(()=>({data:{}}))},this.getFolderSettings=o=>r[o]||{},this.getData=()=>e.getState().data,this.addData=(o,a)=>{e.setState(l=>{const c=l.data;return Object.entries(o).forEach(([d,h])=>{let p=c[d];if(p){const{type:m,value:v}=h,E=on(h,QJ);m!==p.type?ho(wn.INPUT_TYPE_OVERRIDE,m):((p.__refCount===0||a)&&Object.assign(p,E),p.__refCount++)}else c[d]=xt(xt({},h),{},{__refCount:1})}),{data:c}})},this.setValueAtPath=(o,a,l)=>{e.setState(c=>{const d=c.data;return WC(d[o],a,o,this,l),{data:d}})},this.setSettingsAtPath=(o,a)=>{e.setState(l=>{const c=l.data;return c[o].settings=xt(xt({},c[o].settings),a),{data:c}})},this.disableInputAtPath=(o,a)=>{e.setState(l=>{const c=l.data;return c[o].disabled=a,{data:c}})},this.set=(o,a)=>{e.setState(l=>{const c=l.data;return Object.entries(o).forEach(([d,h])=>{try{WC(c[d],h,void 0,void 0,a)}catch{}}),{data:c}})},this.getInput=o=>{try{return this.getData()[o]}catch{ho(wn.PATH_DOESNT_EXIST,o)}},this.get=o=>{var a;return(a=this.getInput(o))===null||a===void 0?void 0:a.value},this.emitOnEditStart=o=>{t.emit(`onEditStart:${o}`,this.get(o),o,xt(xt({},this.getInput(o)),{},{get:this.get}))},this.emitOnEditEnd=o=>{t.emit(`onEditEnd:${o}`,this.get(o),o,xt(xt({},this.getInput(o)),{},{get:this.get}))},this.subscribeToEditStart=(o,a)=>{const l=`onEditStart:${o}`;return t.on(l,a),()=>t.off(l,a)},this.subscribeToEditEnd=(o,a)=>{const l=`onEditEnd:${o}`;return t.on(l,a),()=>t.off(l,a)};const s=(o,a,l)=>{const c={};return Object.entries(o).forEach(([d,h])=>{if(d==="")return ho(wn.EMPTY_KEY);let p=_S(a,d);if(h.type===ls.FOLDER){const m=s(h.schema,p,l);Object.assign(c,m),p in r||(r[p]=h.settings)}else if(d in l)ho(wn.DUPLICATE_KEYS,d,p,l[d].path);else{const m=W$(h,d,p,c);if(m){const{type:v,options:E,input:x}=m,{onChange:g,transient:A,onEditStart:_,onEditEnd:w}=E,C=on(E,ZJ);c[p]=xt(xt(xt({type:v},C),x),{},{fromPanel:!0}),l[d]={path:p,onChange:g,transient:A,onEditStart:_,onEditEnd:w}}else ho(wn.UNKNOWN_INPUT,p,h)}}),c};this.getDataFromSchema=o=>{const a={};return[s(o,"",a),a]}},QD=new qJ,eK={collapsed:!1};function tK(n,e){return{type:ls.FOLDER,schema:n,settings:xt(xt({},eK),e)}}const AR=n=>"__levaInput"in n,nK=(n,e)=>{const t={},r=e?e.toLowerCase():null;return n.forEach(i=>{const[s,o]=nJ(i);(!r||s.toLowerCase().indexOf(r)>-1)&&tJ(t,o,{[s]:{__levaInput:!0,path:i}})}),t},rK=["type","label","path","valueKey","value","settings","setValue","disabled"];function iK(n){let{type:e,label:t,path:r,valueKey:i,value:s,settings:o,setValue:a,disabled:l}=n,c=on(n,rK);const{displayValue:d,onChange:h,onUpdate:p}=gD({type:e,value:s,settings:o,setValue:a}),m=Hl[e].component;return m?Q.createElement(oD.Provider,{value:xt({key:i,path:r,id:""+r,label:t,displayValue:d,value:s,onChange:h,onUpdate:p,settings:o,setValue:a,disabled:l},c)},Q.createElement(u7,{disabled:l},Q.createElement(m,null))):(ho(wn.NO_COMPONENT_FOR_TYPE,e,r),null)}const sK=yt("button",{display:"block",$reset:"",fontWeight:"$button",height:"$rowHeight",borderStyle:"none",borderRadius:"$sm",backgroundColor:"$elevation1",color:"$highlight1","&:not(:disabled)":{color:"$highlight3",backgroundColor:"$accent2",cursor:"pointer",$hover:"$accent3",$active:"$accent3 $accent1",$focus:""}});function oK({onClick:n,settings:e,label:t}){const r=Oh();return Q.createElement(Xi,null,Q.createElement(sK,{disabled:e.disabled,onClick:()=>n(r.get)},t))}const aK=yt("div",{$flex:"",justifyContent:"flex-end",gap:"$colGap"}),lK=yt("button",{$reset:"",cursor:"pointer",borderRadius:"$xs","&:hover":{backgroundColor:"$elevation3"}}),cK=({label:n,opts:e})=>{let t=typeof n=="string"&&n.trim()===""?null:n,r=e;return typeof e.opts=="object"&&(r.label!==void 0&&(t=e.label),r=e.opts),{label:t,opts:r}};function uK(n){const{label:e,opts:t}=cK(n),r=Oh();return Q.createElement(Xi,{input:!!e},e&&Q.createElement(_s,null,e),Q.createElement(aK,null,Object.entries(t).map(([i,s])=>Q.createElement(lK,{key:i,onClick:()=>s(r.get)},i))))}const fK=yt("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),ZD=100;function dK(n,e){n.push(e),n.length>ZD&&n.shift()}const hK=D.forwardRef(function({initialValue:n},e){const t=wo("colors","highlight3"),r=wo("colors","elevation2"),i=wo("colors","highlight1"),[s,o]=D.useMemo(()=>[Nr(i).alpha(.4).toRgbString(),Nr(i).alpha(.1).toRgbString()],[i]),a=D.useRef([n]),l=D.useRef(n),c=D.useRef(n),d=D.useRef(),h=D.useCallback((v,E)=>{if(!v)return;const{width:x,height:g}=v,A=new Path2D,_=x/ZD,w=g*.05;for(let B=0;B({frame:v=>{(l.current===void 0||vc.current)&&(c.current=v),dK(a.current,v),d.current=requestAnimationFrame(()=>h(p.current,m.current))}}),[p,m,h]),D.useEffect(()=>()=>cancelAnimationFrame(d.current),[]),Q.createElement(fK,{ref:p})}),SR=n=>Number.isFinite(n)?n.toPrecision(2):n.toString(),pK=D.forwardRef(function({initialValue:n},e){const[t,r]=D.useState(SR(n));return D.useImperativeHandle(e,()=>({frame:i=>r(SR(i))}),[]),Q.createElement("div",null,t)});function wR(n){return typeof n=="function"?n():n.current}function mK({label:n,objectOrFn:e,settings:t}){const r=D.useRef(),i=D.useRef(wR(e));return D.useEffect(()=>{const s=window.setInterval(()=>{var o;document.hidden||(o=r.current)===null||o===void 0||o.frame(wR(e))},t.interval);return()=>window.clearInterval(s)},[e,t.interval]),Q.createElement(Xi,{input:!0},Q.createElement(_s,{align:"top"},n),t.graph?Q.createElement(hK,{ref:r,initialValue:i.current}):Q.createElement(pK,{ref:r,initialValue:i.current}))}const gK=["type","label","key"],vK={[ls.BUTTON]:oK,[ls.BUTTON_GROUP]:uK,[ls.MONITOR]:mK},yK=Q.memo(({path:n})=>{const[e,{set:t,setSettings:r,disable:i,storeId:s,emitOnEditStart:o,emitOnEditEnd:a}]=E7(n);if(!e)return null;const{type:l,label:c,key:d}=e,h=on(e,gK);if(l in ls){const p=vK[l];return Q.createElement(p,Nn({label:c,path:n},h))}return l in Hl?Q.createElement(iK,Nn({key:s+n,type:l,label:c,storeId:s,path:n,valueKey:d,setValue:t,setSettings:r,disable:i,emitOnEditStart:o,emitOnEditEnd:a},h)):(C$(wn.UNSUPPORTED_INPUT,l,n),null)});function _K({toggle:n,toggled:e,name:t}){return Q.createElement(a7,{onClick:()=>n()},Q.createElement(fS,{toggled:e}),Q.createElement("div",null,t))}const xK=({name:n,path:e,tree:t})=>{const r=Oh(),i=_S(e,n),{collapsed:s,color:o}=r.getFolderSettings(i),[a,l]=D.useState(!s),c=D.useRef(null),d=wo("colors","folderWidgetColor"),h=wo("colors","folderTextColor");return D.useLayoutEffect(()=>{c.current.style.setProperty("--leva-colors-folderWidgetColor",o||d),c.current.style.setProperty("--leva-colors-folderTextColor",o||h)},[o,d,h]),Q.createElement(t0,{ref:c},Q.createElement(_K,{name:n,toggled:a,toggle:()=>l(p=>!p)}),Q.createElement(qD,{parent:i,tree:t,toggled:a}))},qD=Q.memo(({isRoot:n=!1,fill:e=!1,flat:t=!1,parent:r,tree:i,toggled:s})=>{const{wrapperRef:o,contentRef:a}=sJ(s),l=Oh(),c=([h,p])=>{var m;return(AR(p)?(m=l.getInput(p.path))===null||m===void 0?void 0:m.order:l.getFolderSettings(_S(r,h)).order)||0},d=Object.entries(i).sort((h,p)=>c(h)-c(p));return Q.createElement(L1,{ref:o,isRoot:n,fill:e,flat:t},Q.createElement(dD,{ref:a,isRoot:n,toggled:s},d.map(([h,p])=>AR(p)?Q.createElement(yK,{key:p.path,valueKey:p.valueKey,path:p.path}):Q.createElement(xK,{key:h,name:h,path:r,tree:p}))))}),EK=yt("div",{position:"relative",fontFamily:"$mono",fontSize:"$root",color:"$rootText",backgroundColor:"$elevation1",variants:{fill:{false:{position:"fixed",top:"10px",right:"10px",zIndex:1e3,width:"$rootWidth"},true:{position:"relative",width:"100%"}},flat:{false:{borderRadius:"$lg",boxShadow:"$level1"}},oneLineLabels:{true:{[`${pD}`]:{gridTemplateColumns:"auto",gridAutoColumns:"minmax(max-content, 1fr)",gridAutoRows:"minmax($sizes$rowHeight), auto)",rowGap:0,columnGap:0,marginTop:"$rowGap"}}},hideTitleBar:{true:{$$titleBarHeight:"0px"},false:{$$titleBarHeight:"$sizes$titleBarHeight"}}},"&,*,*:after,*:before":{boxSizing:"border-box"},"*::selection":{backgroundColor:"$accent2"}}),e3=40,a0=yt("i",{$flexCenter:"",width:e3,userSelect:"none",cursor:"pointer","> svg":{fill:"$highlight1",transition:"transform 350ms ease, fill 250ms ease"},"&:hover > svg":{fill:"$highlight3"},variants:{active:{true:{"> svg":{fill:"$highlight2"}}}}}),AK=yt("div",{display:"flex",alignItems:"stretch",justifyContent:"space-between",height:"$titleBarHeight",variants:{mode:{drag:{cursor:"grab"}}}}),SK=yt("div",{$flex:"",position:"relative",width:"100%",overflow:"hidden",transition:"height 250ms ease",color:"$highlight3",paddingLeft:"$md",[`> ${a0}`]:{height:30},variants:{toggled:{true:{height:30},false:{height:0}}}}),wK=yt("input",{$reset:"",flex:1,position:"relative",height:30,width:"100%",backgroundColor:"transparent",fontSize:"10px",borderRadius:"$root","&:focus":{},"&::placeholder":{color:"$highlight2"}}),MK=yt("div",{touchAction:"none",$flexCenter:"",flex:1,"> svg":{fill:"$highlight1"},color:"$highlight1",variants:{drag:{true:{$draggable:"","> svg":{transition:"fill 250ms ease"},"&:hover":{color:"$highlight3"},"&:hover > svg":{fill:"$highlight3"}}},filterEnabled:{false:{paddingRight:e3}}}}),TK=Q.forwardRef(({setFilter:n,toggle:e},t)=>{const[r,i]=D.useState(""),s=D.useMemo(()=>eD(n,250),[n]),o=()=>{n(""),i("")},a=l=>{const c=l.currentTarget.value;e(!0),i(c)};return D.useEffect(()=>{s(r)},[r,s]),Q.createElement(Q.Fragment,null,Q.createElement(wK,{ref:t,value:r,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:l=>l.stopPropagation(),onChange:a}),Q.createElement(a0,{onClick:()=>o(),style:{visibility:r?"visible":"hidden"}},Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"14",width:"14",viewBox:"0 0 20 20",fill:"currentColor"},Q.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}))))});function bK({setFilter:n,onDrag:e,onDragStart:t,onDragEnd:r,toggle:i,toggled:s,title:o,drag:a,filterEnabled:l,from:c}){const[d,h]=D.useState(!1),p=D.useRef(null);D.useEffect(()=>{var v,E;d?(v=p.current)===null||v===void 0||v.focus():(E=p.current)===null||E===void 0||E.blur()},[d]);const m=Fh(({offset:[v,E],first:x,last:g})=>{e({x:v,y:E}),x&&t({x:v,y:E}),g&&r({x:v,y:E})},{filterTaps:!0,from:({offset:[v,E]})=>[(c==null?void 0:c.x)||v,(c==null?void 0:c.y)||E]});return D.useEffect(()=>{const v=E=>{E.key==="L"&&E.shiftKey&&E.metaKey&&h(x=>!x)};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[]),Q.createElement(Q.Fragment,null,Q.createElement(AK,{mode:a?"drag":void 0},Q.createElement(a0,{active:!s,onClick:()=>i()},Q.createElement(fS,{toggled:s,width:12,height:8})),Q.createElement(MK,Nn({},a?m():{},{drag:a,filterEnabled:l}),o===void 0&&a?Q.createElement("svg",{width:"20",height:"10",viewBox:"0 0 28 14",xmlns:"http://www.w3.org/2000/svg"},Q.createElement("circle",{cx:"2",cy:"2",r:"2"}),Q.createElement("circle",{cx:"14",cy:"2",r:"2"}),Q.createElement("circle",{cx:"26",cy:"2",r:"2"}),Q.createElement("circle",{cx:"2",cy:"12",r:"2"}),Q.createElement("circle",{cx:"14",cy:"12",r:"2"}),Q.createElement("circle",{cx:"26",cy:"12",r:"2"})):o),l&&Q.createElement(a0,{active:d,onClick:()=>h(v=>!v)},Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20",viewBox:"0 0 20 20"},Q.createElement("path",{d:"M9 9a2 2 0 114 0 2 2 0 01-4 0z"}),Q.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-13a4 4 0 00-3.446 6.032l-2.261 2.26a1 1 0 101.414 1.415l2.261-2.261A4 4 0 1011 5z",clipRule:"evenodd"})))),Q.createElement(SK,{toggled:d},Q.createElement(TK,{ref:p,setFilter:n,toggle:i})))}const CK=["store","hidden","theme","collapsed"];function RK(n){let{store:e,hidden:t=!1,theme:r,collapsed:i=!1}=n,s=on(n,CK);const o=$D(()=>t7(r),[r]),[a,l]=D.useState(!i),c=typeof i=="object"?!i.collapsed:a,d=D.useMemo(()=>typeof i=="object"?h=>{typeof h=="function"?i.onChange(!h(!i.collapsed)):i.onChange(!h)}:l,[i]);return!e||t?null:Q.createElement(lS.Provider,{value:o},Q.createElement(PK,Nn({store:e},s,{toggled:c,setToggle:d,rootClass:o.className})))}const PK=Q.memo(({store:n,rootClass:e,fill:t=!1,flat:r=!1,neverHide:i=!1,oneLineLabels:s=!1,titleBar:o={title:void 0,drag:!0,filter:!0,position:void 0,onDrag:void 0,onDragStart:void 0,onDragEnd:void 0},hideCopyButton:a=!1,toggled:l,setToggle:c})=>{var d,h;const p=oJ(n),[m,v]=D.useState(""),E=D.useMemo(()=>nK(p,m),[p,m]),[x,g]=vD(),A=i||p.length>0,_=typeof o=="object"&&o.title||void 0,w=typeof o=="object"&&(d=o.drag)!==null&&d!==void 0?d:!0,C=typeof o=="object"&&(h=o.filter)!==null&&h!==void 0?h:!0,b=typeof o=="object"&&o.position||void 0,B=typeof o=="object"&&o.onDrag||void 0,I=typeof o=="object"&&o.onDragStart||void 0,R=typeof o=="object"&&o.onDragEnd||void 0;return Q.useEffect(()=>{g({x:b==null?void 0:b.x,y:b==null?void 0:b.y})},[b,g]),e7(),Q.createElement(lD.Provider,{value:{hideCopyButton:a}},Q.createElement(EK,{ref:x,className:e,fill:t,flat:r,oneLineLabels:s,hideTitleBar:!o,style:{display:A?"block":"none"}},o&&Q.createElement(bK,{onDrag:L=>{g(L),B==null||B(L)},onDragStart:L=>I==null?void 0:I(L),onDragEnd:L=>R==null?void 0:R(L),setFilter:v,toggle:L=>c(U=>L??!U),toggled:l,title:_,drag:w,filterEnabled:C,from:b}),A&&Q.createElement(aD.Provider,{value:n},Q.createElement(qD,{isRoot:!0,fill:t,flat:r,tree:E,toggled:l}))))}),IK=["isRoot"];let l0=!1,El=null;function BK(n){let{isRoot:e=!1}=n,t=on(n,IK);return D.useEffect(()=>(l0=!0,!e&&El&&(El.remove(),El=null),()=>{e||(l0=!1)}),[e]),Q.createElement(RK,Nn({store:QD},t))}function LK(n){D.useEffect(()=>{n&&!l0&&(El||(El=document.getElementById("leva__root")||Object.assign(document.createElement("div"),{id:"leva__root"}),document.body&&(document.body.appendChild(El),X$(Q.createElement(BK,{isRoot:!0}),El))),l0=!0)},[n])}function DK(n,e,t,r,i){let s,o,a,l,c;return typeof n=="string"?(o=n,s=e,Array.isArray(t)?c=t:t&&("store"in t?(l=t,c=r):(a=t,Array.isArray(r)?c=r:(l=r,c=i)))):(s=n,Array.isArray(e)?c=e:(l=e,c=t)),{schema:s,folderName:o,folderSettings:a,hookSettings:l,deps:c||[]}}function OK(n,e,t,r,i){const{folderName:s,schema:o,folderSettings:a,hookSettings:l,deps:c}=DK(n,e,t,r,i),d=typeof o=="function",h=D.useRef(!1),p=D.useRef(!0),m=$D(()=>{h.current=!0;const U=typeof o=="function"?o():o;return s?{[s]:tK(U,a)}:U},c),v=!(l!=null&&l.store);LK(v);const[E]=D.useState(()=>(l==null?void 0:l.store)||QD),[x,g]=D.useMemo(()=>E.getDataFromSchema(m),[E,m]),[A,_,w,C,b]=D.useMemo(()=>{const U=[],j=[],$={},K={},Y={};return Object.values(g).forEach(({path:ne,onChange:ie,onEditStart:z,onEditEnd:Z,transient:q})=>{U.push(ne),ie?($[ne]=ie,q||j.push(ne)):j.push(ne),z&&(K[ne]=z),Z&&(Y[ne]=Z)}),[U,j,$,K,Y]},[g]),B=D.useMemo(()=>E.orderPaths(A),[A,E]),I=aJ(E,_,x),R=D.useCallback(U=>{const j=Object.entries(U).reduce(($,[K,Y])=>Object.assign($,{[g[K].path]:Y}),{});E.set(j,!1)},[E,g]),L=D.useCallback(U=>E.get(g[U].path),[E,g]);return D.useEffect(()=>{const U=!p.current&&h.current;return E.addData(x,U),p.current=!1,h.current=!1,()=>E.disposePaths(B)},[E,B,x]),D.useEffect(()=>{const U=[];return Object.entries(w).forEach(([j,$])=>{$(E.get(j),j,xt({initial:!0,get:E.get},E.getInput(j)));const K=E.useStore.subscribe(Y=>{const ne=Y.data[j];return[ne.disabled?void 0:ne.value,ne]},([Y,ne])=>$(Y,j,xt({initial:!1,get:E.get},ne)),{equalityFn:Dh});U.push(K)}),()=>U.forEach(j=>j())},[E,w]),D.useEffect(()=>{const U=[];return Object.entries(C).forEach(([j,$])=>U.push(E.subscribeToEditStart(j,$))),Object.entries(b).forEach(([j,$])=>U.push(E.subscribeToEditEnd(j,$))),()=>U.forEach(j=>j())},[C,b,E]),d?[I,R,L]:I}No(ps.SELECT,U7);No(ps.IMAGE,zJ);No(ps.NUMBER,C7);No(ps.COLOR,yJ);No(ps.STRING,j7);No(ps.BOOLEAN,eX);No(ps.INTERVAL,KJ);No(ps.VECTOR3D,xJ);No(ps.VECTOR2D,CJ);function Mo(n){return typeof n=="function"}function t3(n){var e=function(r){Error.call(r),r.stack=new Error().stack},t=n(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var D_=t3(function(n){return function(t){n(this),this.message=t?t.length+` errors occurred during unsubscription: -`+t.map(function(r,i){return i+1+") "+r.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=t}});function Y1(n,e){if(n){var t=n.indexOf(e);0<=t&&n.splice(t,1)}}var Q0=function(){function n(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return n.prototype.unsubscribe=function(){var e,t,r,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=rh(o),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(E){e={error:E}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(Mo(d))try{d()}catch(E){s=E instanceof D_?E.errors:[E]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var p=rh(h),m=p.next();!m.done;m=p.next()){var v=m.value;try{MR(v)}catch(E){s=s??[],E instanceof D_?s=n0(n0([],ih(s)),ih(E.errors)):s.push(E)}}}catch(E){r={error:E}}finally{try{m&&!m.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}if(s)throw new D_(s)}},n.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)MR(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},n.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},n.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},n.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Y1(t,e)},n.prototype.remove=function(e){var t=this._finalizers;t&&Y1(t,e),e instanceof n&&e._removeParent(this)},n.EMPTY=function(){var e=new n;return e.closed=!0,e}(),n}(),n3=Q0.EMPTY;function r3(n){return n instanceof Q0||n&&"closed"in n&&Mo(n.remove)&&Mo(n.add)&&Mo(n.unsubscribe)}function MR(n){Mo(n)?n():n.unsubscribe()}var i3={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Q1={setTimeout:function(n,e){for(var t=[],r=2;r0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),n.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var r=this,i=this,s=i.hasError,o=i.isStopped,a=i.observers;return s||o?n3:(this.currentObservers=null,a.push(t),new Q0(function(){r.currentObservers=null,Y1(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var r=this,i=r.hasError,s=r.thrownError,o=r.isStopped;i?t.error(s):o&&t.complete()},e.prototype.asObservable=function(){var t=new bR;return t.source=this,t},e.create=function(t,r){return new RR(t,r)},e}(bR),RR=function(n){Y0(e,n);function e(t,r){var i=n.call(this)||this;return i.destination=t,i.source=r,i}return e.prototype.next=function(t){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,t)},e.prototype.error=function(t){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,t)},e.prototype.complete=function(){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||r===void 0||r.call(t)},e.prototype._subscribe=function(t){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(t))!==null&&i!==void 0?i:n3},e}(jK);const rl={"@":"viseme_sil",sil:"viseme_sil",p:"viseme_PP",b:"viseme_PP",m:"viseme_PP",f:"viseme_FF",v:"viseme_FF",T:"viseme_TH",dh:"viseme_TH",t:"viseme_DD",d:"viseme_DD",k:"viseme_kk",g:"viseme_kk",ng:"viseme_kk",ch:"viseme_CH",j:"viseme_CH",s:"viseme_SS",z:"viseme_SS",sh:"viseme_SS",zh:"viseme_SS",n:"viseme_nn",r:"viseme_RR",er:"viseme_RR",a:"viseme_aa",aa:"viseme_aa",ax:"viseme_aa",ah:"viseme_aa",ae:"viseme_E",ey:"viseme_E",eh:"viseme_E",ih:"viseme_I",ix:"viseme_I",aw:"viseme_O",ow:"viseme_O",ao:"viseme_O",oy:"viseme_O",uw:"viseme_U",uh:"viseme_U",w:"viseme_U",y:"viseme_U",o:"viseme_O",e:"viseme_E",S:"viseme_SS",u:"viseme_U",E:"viseme_E",i:"viseme_I"};function JK(n){const{startListening:e,headFollow:t,smoothMorphTarget:r,morphTargetSmoothing:i}=OK({startListening:!!n.startListening,headFollow:!0,smoothMorphTarget:!0,morphTargetSmoothing:.25}),[s,o]=D.useState([]),[a,l]=D.useState(Date.now());D.useEffect(()=>{if(e){const m=n.subject.subscribe({next(v){if(!(v.data instanceof Blob)){const E=JSON.parse(v.data);E.type==="translated"?console.log("translation:",E.content):E.type==="original"?console.log("transcription:",E.content):E.type==="lipSync"&&(o(E.visemes),l(Date.now()))}}});return()=>{m.unsubscribe()}}},[e]),$g(()=>{const p=Date.now()-a,m={visemes:s};Object.values(rl).forEach(v=>{r?(c.Wolf3D_Head.morphTargetInfluences[c.Wolf3D_Head.morphTargetDictionary[v]]=qc.lerp(c.Wolf3D_Head.morphTargetInfluences[c.Wolf3D_Head.morphTargetDictionary[v]],0,i),c.Wolf3D_Teeth.morphTargetInfluences[c.Wolf3D_Teeth.morphTargetDictionary[v]]=qc.lerp(c.Wolf3D_Teeth.morphTargetInfluences[c.Wolf3D_Teeth.morphTargetDictionary[v]],0,i)):(c.Wolf3D_Head.morphTargetInfluences[c.Wolf3D_Head.morphTargetDictionary[v]]=0,c.Wolf3D_Teeth.morphTargetInfluences[c.Wolf3D_Teeth.morphTargetDictionary[v]]=0)});for(let v=0;v=E.time&&p<=E.time+100){r?(c.Wolf3D_Head.morphTargetInfluences[c.Wolf3D_Head.morphTargetDictionary[rl[E.value]]]=qc.lerp(c.Wolf3D_Head.morphTargetInfluences[c.Wolf3D_Head.morphTargetDictionary[rl[E.value]]],1,i),c.Wolf3D_Teeth.morphTargetInfluences[c.Wolf3D_Teeth.morphTargetDictionary[rl[E.value]]]=qc.lerp(c.Wolf3D_Teeth.morphTargetInfluences[c.Wolf3D_Teeth.morphTargetDictionary[rl[E.value]]],1,i)):(c.Wolf3D_Head.morphTargetInfluences[c.Wolf3D_Head.morphTargetDictionary[rl[E.value]]]=1,c.Wolf3D_Teeth.morphTargetInfluences[c.Wolf3D_Teeth.morphTargetDictionary[rl[E.value]]]=1);break}}});const{nodes:c,materials:d}=V0("/models/646d9dcdc8a5f5bddbfac913.glb"),h=D.useRef();return $g(p=>{t&&h.current.getObjectByName("Head").lookAt(p.camera.position)}),F_("group",{...n,dispose:null,ref:h,children:[Or("primitive",{object:c.Hips}),Or("skinnedMesh",{geometry:c.Wolf3D_Body.geometry,material:d.Wolf3D_Body,skeleton:c.Wolf3D_Body.skeleton}),Or("skinnedMesh",{geometry:c.Wolf3D_Outfit_Bottom.geometry,material:d.Wolf3D_Outfit_Bottom,skeleton:c.Wolf3D_Outfit_Bottom.skeleton}),Or("skinnedMesh",{geometry:c.Wolf3D_Outfit_Footwear.geometry,material:d.Wolf3D_Outfit_Footwear,skeleton:c.Wolf3D_Outfit_Footwear.skeleton}),Or("skinnedMesh",{geometry:c.Wolf3D_Outfit_Top.geometry,material:d.Wolf3D_Outfit_Top,skeleton:c.Wolf3D_Outfit_Top.skeleton}),Or("skinnedMesh",{geometry:c.Wolf3D_Hair.geometry,material:d.Wolf3D_Hair,skeleton:c.Wolf3D_Hair.skeleton}),Or("skinnedMesh",{name:"EyeLeft",geometry:c.EyeLeft.geometry,material:d.Wolf3D_Eye,skeleton:c.EyeLeft.skeleton,morphTargetDictionary:c.EyeLeft.morphTargetDictionary,morphTargetInfluences:c.EyeLeft.morphTargetInfluences}),Or("skinnedMesh",{name:"EyeRight",geometry:c.EyeRight.geometry,material:d.Wolf3D_Eye,skeleton:c.EyeRight.skeleton,morphTargetDictionary:c.EyeRight.morphTargetDictionary,morphTargetInfluences:c.EyeRight.morphTargetInfluences}),Or("skinnedMesh",{name:"Wolf3D_Head",geometry:c.Wolf3D_Head.geometry,material:d.Wolf3D_Skin,skeleton:c.Wolf3D_Head.skeleton,morphTargetDictionary:c.Wolf3D_Head.morphTargetDictionary,morphTargetInfluences:c.Wolf3D_Head.morphTargetInfluences}),Or("skinnedMesh",{name:"Wolf3D_Teeth",geometry:c.Wolf3D_Teeth.geometry,material:d.Wolf3D_Teeth,skeleton:c.Wolf3D_Teeth.skeleton,morphTargetDictionary:c.Wolf3D_Teeth.morphTargetDictionary,morphTargetInfluences:c.Wolf3D_Teeth.morphTargetInfluences})]})}V0.preload("/models/646d9dcdc8a5f5bddbfac913.glb");const oY=n=>{const e=ZA("textures/youtubeBackground.jpg"),t=Qr(r=>r.viewport);return F_(_O,{children:[Or(aV,{enabled:n.orbitControl}),Or(JK,{position:[0,-3,5],scale:2,subject:n.subject,startListening:n.startListening}),Or(hV,{preset:"sunset"}),F_("mesh",{children:[Or("planeGeometry",{args:[t.width,t.height]}),Or("meshBasicMaterial",{map:e})]})]})};export{RR as A,QK as C,oY as E,BK as L,bR as O,Q as R,s3 as S,Y0 as _,jK as a,iY as b,tf as c,V1 as d,rh as e,ef as f,sY as g,tR as h,Mo as i,Q0 as j,Or as k,F_ as l,D as m,eM as n,HK as o,FK as r};