(function(Uc,qf){typeof exports=="object"&&typeof module<"u"?qf(exports):typeof define=="function"&&define.amd?define(["exports"],qf):(Uc=typeof globalThis<"u"?globalThis:Uc||self,qf(Uc.WvxVirtualAvatarWebComponent={}))})(this,function(Uc){"use strict";function qf(n,e){for(var t=0;tr[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}function py(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var D={},HO={get exports(){return D},set exports(n){D=n}},Zt={};/** * @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 ed=Symbol.for("react.element"),VO=Symbol.for("react.portal"),WO=Symbol.for("react.fragment"),$O=Symbol.for("react.strict_mode"),XO=Symbol.for("react.profiler"),jO=Symbol.for("react.provider"),JO=Symbol.for("react.context"),YO=Symbol.for("react.forward_ref"),KO=Symbol.for("react.suspense"),ZO=Symbol.for("react.memo"),QO=Symbol.for("react.lazy"),Fw=Symbol.iterator;function qO(n){return n===null||typeof n!="object"?null:(n=Fw&&n[Fw]||n["@@iterator"],typeof n=="function"?n:null)}var kw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nw=Object.assign,zw={};function Fc(n,e,t){this.props=n,this.context=e,this.refs=zw,this.updater=t||kw}Fc.prototype.isReactComponent={},Fc.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")},Fc.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Gw(){}Gw.prototype=Fc.prototype;function my(n,e,t){this.props=n,this.context=e,this.refs=zw,this.updater=t||kw}var gy=my.prototype=new Gw;gy.constructor=my,Nw(gy,Fc.prototype),gy.isPureReactComponent=!0;var Hw=Array.isArray,Vw=Object.prototype.hasOwnProperty,vy={current:null},Ww={key:!0,ref:!0,__self:!0,__source:!0};function $w(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)Vw.call(e,r)&&!Ww.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1>>1,X=G[j];if(0>>1;ji(ce,J))lei(ue,ce)?(G[j]=ue,G[le]=J,j=le):(G[j]=ce,G[se]=J,j=se);else if(lei(ue,J))G[j]=ue,G[le]=J,j=le;else break e}}return W}function i(G,W){var J=G.sortIndex-W.sortIndex;return J!==0?J:G.id-W.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=[],u=1,d=null,p=3,m=!1,v=!1,x=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(G){for(var W=t(c);W!==null;){if(W.callback===null)r(c);else if(W.startTime<=G)r(c),W.sortIndex=W.expirationTime,e(l,W);else break;W=t(c)}}function A(G){if(x=!1,E(G),!v)if(t(l)!==null)v=!0,K(M);else{var W=t(c);W!==null&&ee(A,W.startTime-G)}}function M(G,W){v=!1,x&&(x=!1,g(B),B=-1),m=!0;var J=p;try{for(E(W),d=t(l);d!==null&&(!(d.expirationTime>W)||G&&!F());){var j=d.callback;if(typeof j=="function"){d.callback=null,p=d.priorityLevel;var X=j(d.expirationTime<=W);W=n.unstable_now(),typeof X=="function"?d.callback=X:d===t(l)&&r(l),E(W)}else r(l);d=t(l)}if(d!==null)var oe=!0;else{var se=t(c);se!==null&&ee(A,se.startTime-W),oe=!1}return oe}finally{d=null,p=J,m=!1}}var T=!1,R=null,B=-1,P=5,I=-1;function F(){return!(n.unstable_now()-IG||125j?(G.sortIndex=J,e(c,G),t(l)===null&&G===t(c)&&(x?(g(B),B=-1):x=!0,ee(A,J-j))):(G.sortIndex=X,e(l,G),v||m||(v=!0,K(M))),G},n.unstable_shouldYield=F,n.unstable_wrapCallback=function(G){var W=p;return function(){var J=p;p=W;try{return G.apply(this,arguments)}finally{p=J}}}})(jw),function(n){n.exports=jw}(oU);/** * @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 Jw=D,Oi=Ey;function Ye(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"),Sy=Object.prototype.hasOwnProperty,aU=/^[: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]*$/,Kw={},Zw={};function lU(n){return Sy.call(Zw,n)?!0:Sy.call(Kw,n)?!1:aU.test(n)?Zw[n]=!0:(Kw[n]=!0,!1)}function cU(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 uU(n,e,t,r){if(e===null||typeof e>"u"||cU(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 qr(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 Rr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Rr[n]=new qr(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Rr[e]=new qr(e,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){Rr[n]=new qr(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Rr[n]=new qr(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){Rr[n]=new qr(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){Rr[n]=new qr(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){Rr[n]=new qr(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){Rr[n]=new qr(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){Rr[n]=new qr(n,5,!1,n.toLowerCase(),null,!1,!1)});var Ay=/[\-:]([a-z])/g;function wy(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(Ay,wy);Rr[e]=new qr(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(Ay,wy);Rr[e]=new qr(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(Ay,wy);Rr[e]=new qr(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){Rr[n]=new qr(n,1,!1,n.toLowerCase(),null,!1,!1)}),Rr.xlinkHref=new qr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){Rr[n]=new qr(n,1,!1,n.toLowerCase(),null,!0,!0)});function My(n,e,t,r){var i=Rr.hasOwnProperty(e)?Rr[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{Dy=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?rd(n):""}function fU(n){switch(n.tag){case 5:return rd(n.type);case 16:return rd("Lazy");case 13:return rd("Suspense");case 19:return rd("SuspenseList");case 0:case 2:case 15:return n=Ly(n.type,!1),n;case 11:return n=Ly(n.type.render,!1),n;case 1:return n=Ly(n.type,!0),n;default:return""}}function Oy(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 zc:return"Fragment";case Nc:return"Portal";case Cy:return"Profiler";case Ty:return"StrictMode";case Ry:return"Suspense";case Py:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case qw:return(n.displayName||"Context")+".Consumer";case Qw:return(n._context.displayName||"Context")+".Provider";case by:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case By:return e=n.displayName||null,e!==null?e:Oy(n.type)||"Memo";case ma:e=n._payload,n=n._init;try{return Oy(n(e))}catch{}}return null}function dU(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 Oy(e);case 8:return e===Ty?"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 ga(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function nM(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function hU(n){var e=nM(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 qp(n){n._valueTracker||(n._valueTracker=hU(n))}function rM(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=nM(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function em(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 Uy(n,e){var t=e.checked;return kn({},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=ga(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 sM(n,e){e=e.checked,e!=null&&My(n,"checked",e,!1)}function Fy(n,e){sM(n,e);var t=ga(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")?ky(n,e.type,t):e.hasOwnProperty("defaultValue")&&ky(n,e.type,ga(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function oM(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 ky(n,e,t){(e!=="number"||em(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var id=Array.isArray;function Gc(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=tm.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function sd(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var od={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},pU=["Webkit","ms","Moz","O"];Object.keys(od).forEach(function(n){pU.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),od[e]=od[n]})});function dM(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||od.hasOwnProperty(n)&&od[n]?(""+e).trim():e+"px"}function hM(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=dM(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var mU=kn({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 Gy(n,e){if(e){if(mU[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ye(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ye(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ye(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ye(62))}}function Hy(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 Vy=null;function Wy(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var $y=null,Hc=null,Vc=null;function pM(n){if(n=bd(n)){if(typeof $y!="function")throw Error(Ye(280));var e=n.stateNode;e&&(e=wm(e),$y(n.stateNode,n.type,e))}}function mM(n){Hc?Vc?Vc.push(n):Vc=[n]:Hc=n}function gM(){if(Hc){var n=Hc,e=Vc;if(Vc=Hc=null,pM(n),e)for(n=0;n>>=0,n===0?32:31-(TU(n)/CU|0)|0}var om=64,am=4194304;function ud(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function lm(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=ud(a):(s&=o,s!==0&&(r=ud(s)))}else o=t&~i,o!==0?r=ud(o):s!==0&&(r=ud(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 fd(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-bs(e),n[e]=t}function BU(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=_d),WM=String.fromCharCode(32),$M=!1;function XM(n,e){switch(n){case"keyup":return sF.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jM(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Xc=!1;function aF(n,e){switch(n){case"compositionend":return jM(e);case"keypress":return e.which!==32?null:($M=!0,WM);case"textInput":return n=e.data,n===WM&&$M?null:n;default:return null}}function lF(n,e){if(Xc)return n==="compositionend"||!c_&&XM(n,e)?(n=kM(),hm=r_=Ea=null,Xc=!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=eT(t)}}function nT(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?nT(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function rT(){for(var n=window,e=em();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=em(n.document)}return e}function d_(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 vF(n){var e=rT(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&nT(t.ownerDocument.documentElement,t)){if(r!==null&&d_(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=tT(t,s);var o=tT(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,jc=null,h_=null,Ad=null,p_=!1;function iT(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;p_||jc==null||jc!==em(r)||(r=jc,"selectionStart"in r&&d_(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}),Ad&&Sd(Ad,r)||(Ad=r,r=Em(h_,"onSelect"),0Qc||(n.current=T_[Qc],T_[Qc]=null,Qc--)}function Tn(n,e){Qc++,T_[Qc]=n.current,n.current=e}var Ma={},Ur=wa(Ma),mi=wa(!1),wl=Ma;function qc(n,e){var t=n.type.contextTypes;if(!t)return Ma;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 gi(n){return n=n.childContextTypes,n!=null}function Mm(){Bn(mi),Bn(Ur)}function _T(n,e,t){if(Ur.current!==Ma)throw Error(Ye(168));Tn(Ur,e),Tn(mi,t)}function xT(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(Ye(108,dU(n)||"Unknown",i));return kn({},t,r)}function Tm(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Ma,wl=Ur.current,Tn(Ur,n),Tn(mi,mi.current),!0}function ET(n,e,t){var r=n.stateNode;if(!r)throw Error(Ye(169));t?(n=xT(n,e,wl),r.__reactInternalMemoizedMergedChildContext=n,Bn(mi),Bn(Ur),Tn(Ur,n)):Bn(mi),Tn(mi,t)}var Co=null,Cm=!1,C_=!1;function ST(n){Co===null?Co=[n]:Co.push(n)}function RF(n){Cm=!0,ST(n)}function Ta(){if(!C_&&Co!==null){C_=!0;var n=0,e=gn;try{var t=Co;for(gn=1;n>=o,i-=o,bo=1<<32-bs(e)+i|t<B?(P=R,R=null):P=R.sibling;var I=p(g,R,E[B],A);if(I===null){R===null&&(R=P);break}n&&R&&I.alternate===null&&e(g,R),_=s(I,_,B),T===null?M=I:T.sibling=I,T=I,R=P}if(B===E.length)return t(g,R),On&&Tl(g,B),M;if(R===null){for(;BB?(P=R,R=null):P=R.sibling;var F=p(g,R,I.value,A);if(F===null){R===null&&(R=P);break}n&&R&&F.alternate===null&&e(g,R),_=s(F,_,B),T===null?M=F:T.sibling=F,T=F,R=P}if(I.done)return t(g,R),On&&Tl(g,B),M;if(R===null){for(;!I.done;B++,I=E.next())I=d(g,I.value,A),I!==null&&(_=s(I,_,B),T===null?M=I:T.sibling=I,T=I);return On&&Tl(g,B),M}for(R=r(g,R);!I.done;B++,I=E.next())I=m(R,g,B,I.value,A),I!==null&&(n&&I.alternate!==null&&R.delete(I.key===null?B:I.key),_=s(I,_,B),T===null?M=I:T.sibling=I,T=I);return n&&R.forEach(function(N){return e(g,N)}),On&&Tl(g,B),M}function y(g,_,E,A){if(typeof E=="object"&&E!==null&&E.type===zc&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case Qp:e:{for(var M=E.key,T=_;T!==null;){if(T.key===M){if(M=E.type,M===zc){if(T.tag===7){t(g,T.sibling),_=i(T,E.props.children),_.return=g,g=_;break e}}else if(T.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===ma&&UT(M)===T.type){t(g,T.sibling),_=i(T,E.props),_.ref=Rd(g,T,E),_.return=g,g=_;break e}t(g,T);break}else e(g,T);T=T.sibling}E.type===zc?(_=Ll(E.props.children,g.mode,A,E.key),_.return=g,g=_):(A=tg(E.type,E.key,E.props,null,g.mode,A),A.ref=Rd(g,_,E),A.return=g,g=A)}return o(g);case Nc:e:{for(T=E.key;_!==null;){if(_.key===T)if(_.tag===4&&_.stateNode.containerInfo===E.containerInfo&&_.stateNode.implementation===E.implementation){t(g,_.sibling),_=i(_,E.children||[]),_.return=g,g=_;break e}else{t(g,_);break}else e(g,_);_=_.sibling}_=w1(E,g.mode,A),_.return=g,g=_}return o(g);case ma:return T=E._init,y(g,_,T(E._payload),A)}if(id(E))return v(g,_,E,A);if(nd(E))return x(g,_,E,A);Um(g,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,_!==null&&_.tag===6?(t(g,_.sibling),_=i(_,E),_.return=g,g=_):(t(g,_),_=A1(E,g.mode,A),_.return=g,g=_),o(g)):t(g,_)}return y}var su=FT(!0),kT=FT(!1),Pd={},to=wa(Pd),Bd=wa(Pd),Id=wa(Pd);function bl(n){if(n===Pd)throw Error(Ye(174));return n}function G_(n,e){switch(Tn(Id,e),Tn(Bd,n),Tn(to,Pd),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:zy(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=zy(e,n)}Bn(to),Tn(to,e)}function ou(){Bn(to),Bn(Bd),Bn(Id)}function NT(n){bl(Id.current);var e=bl(to.current),t=zy(e,n.type);e!==t&&(Tn(Bd,n),Tn(to,t))}function H_(n){Bd.current===n&&(Bn(to),Bn(Bd))}var Nn=wa(0);function Fm(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 V_=[];function W_(){for(var n=0;nt?t:4,n(!0);var r=$_.transition;$_.transition={};try{n(!1),e()}finally{gn=t,$_.transition=r}}function rC(){return ss().memoizedState}function DF(n,e,t){var r=Ia(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},iC(n))sC(e,t);else if(t=bT(n,e,t,r),t!==null){var i=ti();Ls(t,n,r,i),oC(t,e,r)}}function LF(n,e,t){var r=Ia(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(iC(n))sC(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,Rs(a,o)){var l=e.interleaved;l===null?(i.next=i,F_(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=bT(n,e,i,r),t!==null&&(i=ti(),Ls(t,n,r,i),oC(t,e,r))}}function iC(n){var e=n.alternate;return n===zn||e!==null&&e===zn}function sC(n,e){Dd=Nm=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function oC(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,Qy(n,t)}}var Hm={readContext:is,useCallback:Fr,useContext:Fr,useEffect:Fr,useImperativeHandle:Fr,useInsertionEffect:Fr,useLayoutEffect:Fr,useMemo:Fr,useReducer:Fr,useRef:Fr,useState:Fr,useDebugValue:Fr,useDeferredValue:Fr,useTransition:Fr,useMutableSource:Fr,useSyncExternalStore:Fr,useId:Fr,unstable_isNewReconciler:!1},OF={readContext:is,useCallback:function(n,e){return no().memoizedState=[n,e===void 0?null:e],n},useContext:is,useEffect:YT,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,zm(4194308,4,QT.bind(null,e,n),t)},useLayoutEffect:function(n,e){return zm(4194308,4,n,e)},useInsertionEffect:function(n,e){return zm(4,2,n,e)},useMemo:function(n,e){var t=no();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=no();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=DF.bind(null,zn,n),[r.memoizedState,n]},useRef:function(n){var e=no();return n={current:n},e.memoizedState=n},useState:jT,useDebugValue:Q_,useDeferredValue:function(n){return no().memoizedState=n},useTransition:function(){var n=jT(!1),e=n[0];return n=IF.bind(null,n[1]),no().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=zn,i=no();if(On){if(t===void 0)throw Error(Ye(407));t=t()}else{if(t=e(),Er===null)throw Error(Ye(349));Rl&30||HT(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,YT(WT.bind(null,r,s,n),[n]),r.flags|=2048,Ud(9,VT.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=no(),e=Er.identifierPrefix;if(On){var t=Ro,r=bo;t=(r&~(1<<32-bs(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[eo]=e,n[Cd]=r,AC(n,e,!1,!1),e.stateNode=n;e:{switch(o=Hy(t,r),t){case"dialog":Pn("cancel",n),Pn("close",n),i=r;break;case"iframe":case"object":case"embed":Pn("load",n),i=r;break;case"video":case"audio":for(i=0;iuu&&(e.flags|=128,r=!0,Fd(s,!1),e.lanes=4194304)}else{if(!r)if(n=Fm(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Fd(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!On)return kr(e),null}else 2*tr()-s.renderingStartTime>uu&&t!==1073741824&&(e.flags|=128,r=!0,Fd(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=tr(),e.sibling=null,t=Nn.current,Tn(Nn,r?t&1|2:t&1),e):(kr(e),null);case 22:case 23:return x1(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Ni&1073741824&&(kr(e),e.subtreeFlags&6&&(e.flags|=8192)):kr(e),null;case 24:return null;case 25:return null}throw Error(Ye(156,e.tag))}function VF(n,e){switch(R_(e),e.tag){case 1:return gi(e.type)&&Mm(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return ou(),Bn(mi),Bn(Ur),W_(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return H_(e),null;case 13:if(Bn(Nn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Ye(340));nu()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return Bn(Nn),null;case 4:return ou(),null;case 10:return O_(e.type._context),null;case 22:case 23:return x1(),null;case 24:return null;default:return null}}var $m=!1,Nr=!1,WF=typeof WeakSet=="function"?WeakSet:Set,ft=null;function lu(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Jn(n,e,r)}else t.current=null}function l1(n,e,t){try{t()}catch(r){Jn(n,e,r)}}var TC=!1;function $F(n,e){if(x_=fm,n=rT(),d_(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,u=0,d=n,p=null;t:for(;;){for(var m;d!==t||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(m=d.firstChild)!==null;)p=d,d=m;for(;;){if(d===n)break t;if(p===t&&++c===i&&(a=o),p===s&&++u===r&&(l=o),(m=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=m}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(E_={focusedElem:n,selectionRange:t},fm=!1,ft=e;ft!==null;)if(e=ft,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,ft=n;else for(;ft!==null;){e=ft;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var x=v.memoizedProps,y=v.memoizedState,g=e.stateNode,_=g.getSnapshotBeforeUpdate(e.elementType===e.type?x:Bs(e.type,x),y);g.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var E=e.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ye(163))}}catch(A){Jn(e,e.return,A)}if(n=e.sibling,n!==null){n.return=e.return,ft=n;break}ft=e.return}return v=TC,TC=!1,v}function kd(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&&l1(e,t,s)}i=i.next}while(i!==r)}}function Xm(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 c1(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 CC(n){var e=n.alternate;e!==null&&(n.alternate=null,CC(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[eo],delete e[Cd],delete e[M_],delete e[CF],delete e[bF])),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 bC(n){return n.tag===5||n.tag===3||n.tag===4}function RC(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||bC(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 u1(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=Am));else if(r!==4&&(n=n.child,n!==null))for(u1(n,e,t),n=n.sibling;n!==null;)u1(n,e,t),n=n.sibling}function f1(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(f1(n,e,t),n=n.sibling;n!==null;)f1(n,e,t),n=n.sibling}var Pr=null,Is=!1;function Ra(n,e,t){for(t=t.child;t!==null;)PC(n,e,t),t=t.sibling}function PC(n,e,t){if(qs&&typeof qs.onCommitFiberUnmount=="function")try{qs.onCommitFiberUnmount(sm,t)}catch{}switch(t.tag){case 5:Nr||lu(t,e);case 6:var r=Pr,i=Is;Pr=null,Ra(n,e,t),Pr=r,Is=i,Pr!==null&&(Is?(n=Pr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Pr.removeChild(t.stateNode));break;case 18:Pr!==null&&(Is?(n=Pr,t=t.stateNode,n.nodeType===8?w_(n.parentNode,t):n.nodeType===1&&w_(n,t),gd(n)):w_(Pr,t.stateNode));break;case 4:r=Pr,i=Is,Pr=t.stateNode.containerInfo,Is=!0,Ra(n,e,t),Pr=r,Is=i;break;case 0:case 11:case 14:case 15:if(!Nr&&(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)&&l1(t,e,o),i=i.next}while(i!==r)}Ra(n,e,t);break;case 1:if(!Nr&&(lu(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Jn(t,e,a)}Ra(n,e,t);break;case 21:Ra(n,e,t);break;case 22:t.mode&1?(Nr=(r=Nr)||t.memoizedState!==null,Ra(n,e,t),Nr=r):Ra(n,e,t);break;default:Ra(n,e,t)}}function BC(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new WF),e.forEach(function(r){var i=ek.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Ds(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=tr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*jF(r/1960))-r,10n?16:n,Ba===null)var r=!1;else{if(n=Ba,Ba=null,Zm=0,an&6)throw Error(Ye(331));var i=an;for(an|=4,ft=n.current;ft!==null;){var s=ft,o=s.child;if(ft.flags&16){var a=s.deletions;if(a!==null){for(var l=0;ltr()-p1?Il(n,0):h1|=t),_i(n,e)}function WC(n,e){e===0&&(n.mode&1?(e=am,am<<=1,!(am&130023424)&&(am=4194304)):e=1);var t=ti();n=Po(n,e),n!==null&&(fd(n,e,t),_i(n,t))}function qF(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),WC(n,t)}function ek(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(Ye(314))}r!==null&&r.delete(e),WC(n,t)}var $C;$C=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||mi.current)vi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return vi=!1,GF(n,e,t);vi=!!(n.flags&131072)}else vi=!1,On&&e.flags&1048576&&AT(e,Rm,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Wm(n,e),n=e.pendingProps;var i=qc(e,Ur.current);iu(e,t),i=j_(null,e,r,n,i,t);var s=J_();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,gi(r)?(s=!0,Tm(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,k_(e),i.updater=Om,e.stateNode=i,i._reactInternals=e,z_(e,r,n,t),e=n1(null,e,r,!0,s,t)):(e.tag=0,On&&s&&b_(e),ei(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(Wm(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=nk(r),n=Bs(r,n),i){case 0:e=t1(null,e,r,n,t);break e;case 1:e=vC(null,e,r,n,t);break e;case 11:e=dC(null,e,r,n,t);break e;case 14:e=hC(null,e,r,Bs(r.type,n),t);break e}throw Error(Ye(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Bs(r,i),t1(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Bs(r,i),vC(n,e,r,i,t);case 3:e:{if(yC(e),n===null)throw Error(Ye(387));r=e.pendingProps,s=e.memoizedState,i=s.element,RT(n,e),Lm(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(Ye(423)),e),e=_C(n,e,r,t,i);break e}else if(r!==i){i=au(Error(Ye(424)),e),e=_C(n,e,r,t,i);break e}else for(ki=Aa(e.stateNode.containerInfo.firstChild),Fi=e,On=!0,Ps=null,t=kT(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(nu(),r===i){e=Io(n,e,t);break e}ei(n,e,r,t)}e=e.child}return e;case 5:return NT(e),n===null&&B_(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,S_(r,i)?o=null:s!==null&&S_(r,s)&&(e.flags|=32),gC(n,e),ei(n,e,o,t),e.child;case 6:return n===null&&B_(e),null;case 13:return xC(n,e,t);case 4:return G_(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=su(e,null,r,t):ei(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Bs(r,i),dC(n,e,r,i,t);case 7:return ei(n,e,e.pendingProps,t),e.child;case 8:return ei(n,e,e.pendingProps.children,t),e.child;case 12:return ei(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,Tn(Bm,r._currentValue),r._currentValue=o,s!==null)if(Rs(s.value,o)){if(s.children===i.children&&!mi.current){e=Io(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=Bo(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),U_(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(Ye(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),U_(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}ei(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,iu(e,t),i=is(i),r=r(i),e.flags|=1,ei(n,e,r,t),e.child;case 14:return r=e.type,i=Bs(r,e.pendingProps),i=Bs(r.type,i),hC(n,e,r,i,t);case 15:return pC(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Bs(r,i),Wm(n,e),e.tag=1,gi(r)?(n=!0,Tm(e)):n=!1,iu(e,t),LT(e,r,i),z_(e,r,i,t),n1(null,e,r,!0,n,t);case 19:return SC(n,e,t);case 22:return mC(n,e,t)}throw Error(Ye(156,e.tag))};function XC(n,e){return wM(n,e)}function tk(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 as(n,e,t,r){return new tk(n,e,t,r)}function S1(n){return n=n.prototype,!(!n||!n.isReactComponent)}function nk(n){if(typeof n=="function")return S1(n)?1:0;if(n!=null){if(n=n.$$typeof,n===by)return 11;if(n===By)return 14}return 2}function La(n,e){var t=n.alternate;return t===null?(t=as(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 tg(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")S1(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case zc:return Ll(t.children,i,s,e);case Ty:o=8,i|=8;break;case Cy:return n=as(12,t,e,i|2),n.elementType=Cy,n.lanes=s,n;case Ry:return n=as(13,t,e,i),n.elementType=Ry,n.lanes=s,n;case Py:return n=as(19,t,e,i),n.elementType=Py,n.lanes=s,n;case eM:return ng(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case Qw:o=10;break e;case qw:o=9;break e;case by:o=11;break e;case By:o=14;break e;case ma:o=16,r=null;break e}throw Error(Ye(130,n==null?n:typeof n,""))}return e=as(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function Ll(n,e,t,r){return n=as(7,n,r,e),n.lanes=t,n}function ng(n,e,t,r){return n=as(22,n,r,e),n.elementType=eM,n.lanes=t,n.stateNode={isHidden:!1},n}function A1(n,e,t){return n=as(6,n,null,e),n.lanes=t,n}function w1(n,e,t){return e=as(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function rk(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=Zy(0),this.expirationTimes=Zy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zy(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function M1(n,e,t,r,i,s,o,a,l){return n=new rk(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=as(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},k_(s),n}function ik(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=Li}(sU);const QC=py(xl);var qC=xl;xy.createRoot=qC.createRoot,xy.hydrateRoot=qC.hydrateRoot;var Vd={},ck={get exports(){return Vd},set exports(n){Vd=n}},cg={};/** * @license React * react-jsx-runtime.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 uk=D,fk=Symbol.for("react.element"),dk=Symbol.for("react.fragment"),hk=Object.prototype.hasOwnProperty,pk=uk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,mk={key:!0,ref:!0,__self:!0,__source:!0};function eb(n,e,t){var r,i={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)hk.call(e,r)&&!mk.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:fk,type:n,key:s,ref:o,props:i,_owner:pk.current}}cg.Fragment=dk,cg.jsx=eb,cg.jsxs=eb,function(n){n.exports=cg}(ck);const R1=Vd.Fragment,Cn=Vd.jsx,ug=Vd.jsxs;function du(){return du=Object.assign?Object.assign.bind():function(n){for(var e=1;e>8&255]+Gr[n>>16&255]+Gr[n>>24&255]+"-"+Gr[e&255]+Gr[e>>8&255]+"-"+Gr[e>>16&15|64]+Gr[e>>24&255]+"-"+Gr[t&63|128]+Gr[t>>8&255]+"-"+Gr[t>>16&255]+Gr[t>>24&255]+Gr[r&255]+Gr[r>>8&255]+Gr[r>>16&255]+Gr[r>>24&255]).toLowerCase()}function Kn(n,e,t){return Math.max(e,Math.min(t,n))}function Ex(n,e){return(n%e+e)%e}function jk(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function Jk(n,e,t){return n!==e?(t-n)/(e-n):0}function Zd(n,e,t){return(1-t)*n+t*e}function Yk(n,e,t,r){return Zd(n,e,1-Math.exp(-t*r))}function Kk(n,e=1){return e-Math.abs(Ex(n,e*2)-e)}function Zk(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Qk(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function qk(n,e){return n+Math.floor(Math.random()*(e-n+1))}function eN(n,e){return n+Math.random()*(e-n)}function tN(n){return n*(.5-Math.random())}function nN(n){n!==void 0&&(Qb=n);let e=Qb+=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 rN(n){return n*Gl}function iN(n){return n*_u}function Sx(n){return(n&n-1)===0&&n!==0}function qb(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Tg(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function sN(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),u=o((e+r)/2),d=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*u,l*d,l*p,a*c);break;case"YZY":n.set(l*p,a*u,l*d,a*c);break;case"ZXZ":n.set(l*d,l*p,a*u,a*c);break;case"XZX":n.set(a*u,l*v,l*m,a*c);break;case"YXY":n.set(l*m,a*u,l*v,a*c);break;case"ZYZ":n.set(l*v,l*m,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Gi(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 Gt(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 Cg={DEG2RAD:Gl,RAD2DEG:_u,generateUUID:zi,clamp:Kn,euclideanModulo:Ex,mapLinear:jk,inverseLerp:Jk,lerp:Zd,damp:Yk,pingpong:Kk,smoothstep:Zk,smootherstep:Qk,randInt:qk,randFloat:eN,randFloatSpread:tN,seededRandom:nN,degToRad:rN,radToDeg:iN,isPowerOfTwo:Sx,ceilPowerOfTwo:qb,floorPowerOfTwo:Tg,setQuaternionFromProperEuler:sN,normalize:Gt,denormalize:Gi};class Ge{constructor(e=0,t=0){Ge.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,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(Kn(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 kt{constructor(e,t,r,i,s,o,a,l,c){kt.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 u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=r,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,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],u=r[4],d=r[7],p=r[2],m=r[5],v=r[8],x=i[0],y=i[3],g=i[6],_=i[1],E=i[4],A=i[7],M=i[2],T=i[5],R=i[8];return s[0]=o*x+a*_+l*M,s[3]=o*y+a*E+l*T,s[6]=o*g+a*A+l*R,s[1]=c*x+u*_+d*M,s[4]=c*y+u*E+d*T,s[7]=c*g+u*A+d*R,s[2]=p*x+m*_+v*M,s[5]=p*y+m*E+v*T,s[8]=p*g+m*A+v*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-r*s*u+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],u=e[8],d=u*o-a*c,p=a*l-u*s,m=c*s-o*l,v=t*d+r*p+i*m;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/v;return e[0]=d*x,e[1]=(i*c-u*r)*x,e[2]=(a*r-i*o)*x,e[3]=p*x,e[4]=(u*t-i*l)*x,e[5]=(i*s-a*t)*x,e[6]=m*x,e[7]=(r*l-c*t)*x,e[8]=(o*t-r*s)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,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(Ax.makeScale(e,t)),this}rotate(e){return this.premultiply(Ax.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ax.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 Ax=new kt;function e2(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const oN={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function xu(n,e){return new oN[n](e)}function Qd(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const t2={};function qd(n){n in t2||(t2[n]=!0,console.warn(n))}function Eu(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function wx(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const aN=new kt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),lN=new kt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function cN(n){return n.convertSRGBToLinear().applyMatrix3(lN)}function uN(n){return n.applyMatrix3(aN).convertLinearToSRGB()}const fN={[ks]:n=>n,[Ut]:n=>n.convertSRGBToLinear(),[_x]:cN},dN={[ks]:n=>n,[Ut]:n=>n.convertLinearToSRGB(),[_x]:uN},ls={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 ks},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=fN[e],i=dN[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 Su;class Mx{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Su===void 0&&(Su=Qd("canvas")),Su.width=e.width,Su.height=e.height;const r=Su.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=Su}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=Qd("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!==hg)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ua:e.x=e.x-Math.floor(e.x);break;case Dr:e.x=e.x<0?0:1;break;case gu: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 Ua:e.y=e.y-Math.floor(e.y);break;case Dr:e.y=e.y<0?0:1;break;case gu: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 qd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Ut?Na:vx}set encoding(e){qd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Na?Ut:Ga}}bn.DEFAULT_IMAGE=null,bn.DEFAULT_MAPPING=hg,bn.DEFAULT_ANISOTROPY=1;class pn{constructor(e=0,t=0,r=0,i=1){pn.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],u=l[4],d=l[8],p=l[1],m=l[5],v=l[9],x=l[2],y=l[6],g=l[10];if(Math.abs(u-p)<.01&&Math.abs(d-x)<.01&&Math.abs(v-y)<.01){if(Math.abs(u+p)<.1&&Math.abs(d+x)<.1&&Math.abs(v+y)<.1&&Math.abs(c+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(c+1)/2,A=(m+1)/2,M=(g+1)/2,T=(u+p)/4,R=(d+x)/4,B=(v+y)/4;return E>A&&E>M?E<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(E),i=T/r,s=R/r):A>M?A<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(A),r=T/i,s=B/i):M<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(M),r=R/s,i=B/s),this.set(r,i,s,t),this}let _=Math.sqrt((y-v)*(y-v)+(d-x)*(d-x)+(p-u)*(p-u));return Math.abs(_)<.001&&(_=1),this.x=(y-v)/_,this.y=(d-x)/_,this.z=(p-u)/_,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 Hi extends Fo{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new pn(0,0,e,t),this.scissorTest=!1,this.viewport=new pn(0,0,e,t);const i={width:e,height:t,depth:1};r.encoding!==void 0&&(qd("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),r.colorSpace=r.encoding===Na?Ut:Ga),this.texture=new bn(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:vn,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 Hl(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 bg extends bn{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=Yn,this.minFilter=Yn,this.wrapR=Dr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class mN extends Hi{constructor(e=1,t=1,r=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new bg(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class Cx extends bn{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=Yn,this.minFilter=Yn,this.wrapR=Dr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class gN extends Hi{constructor(e=1,t=1,r=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new Cx(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class vN extends Hi{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,E=1-g*g;if(E>Number.EPSILON){const M=Math.sqrt(E),T=Math.atan2(M,g*_);y=Math.sin(y*T)/M,a=Math.sin(a*T)/M}const A=a*_;if(l=l*y+p*A,c=c*y+m*A,u=u*y+v*A,d=d*y+x*A,y===1-a){const M=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=M,c*=M,u*=M,d*=M}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],u=r[i+3],d=s[o],p=s[o+1],m=s[o+2],v=s[o+3];return e[t]=a*v+u*d+l*m-c*p,e[t+1]=l*v+u*p+c*d-a*m,e[t+2]=c*v+u*m+a*p-l*d,e[t+3]=u*v-a*d-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),u=a(i/2),d=a(s/2),p=l(r/2),m=l(i/2),v=l(s/2);switch(o){case"XYZ":this._x=p*u*d+c*m*v,this._y=c*m*d-p*u*v,this._z=c*u*v+p*m*d,this._w=c*u*d-p*m*v;break;case"YXZ":this._x=p*u*d+c*m*v,this._y=c*m*d-p*u*v,this._z=c*u*v-p*m*d,this._w=c*u*d+p*m*v;break;case"ZXY":this._x=p*u*d-c*m*v,this._y=c*m*d+p*u*v,this._z=c*u*v+p*m*d,this._w=c*u*d-p*m*v;break;case"ZYX":this._x=p*u*d-c*m*v,this._y=c*m*d+p*u*v,this._z=c*u*v-p*m*d,this._w=c*u*d+p*m*v;break;case"YZX":this._x=p*u*d+c*m*v,this._y=c*m*d+p*u*v,this._z=c*u*v-p*m*d,this._w=c*u*d-p*m*v;break;case"XZY":this._x=p*u*d-c*m*v,this._y=c*m*d-p*u*v,this._z=c*u*v+p*m*d,this._w=c*u*d+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],u=t[6],d=t[10],p=r+a+d;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(o-i)*m}else if(r>a&&r>d){const m=2*Math.sqrt(1+r-a-d);this._w=(u-l)/m,this._x=.25*m,this._y=(i+o)/m,this._z=(s+c)/m}else if(a>d){const m=2*Math.sqrt(1+a-r-d);this._w=(s-c)/m,this._x=(i+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+d-r-a);this._w=(o-i)/m,this._x=(s+c)/m,this._y=(l+u)/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(Kn(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,u=t._w;return this._x=r*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-r*c,this._z=s*u+o*c+r*l-i*a,this._w=o*u-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),u=Math.atan2(c,a),d=Math.sin((1-t)*u)/c,p=Math.sin(t*u)/c;return this._w=o*d+this._w*p,this._x=r*d+this._x*p,this._y=i*d+this._y*p,this._z=s*d+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 Q{constructor(e=0,t=0,r=0){Q.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(n2.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(n2.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,u=l*r+a*t-s*i,d=l*i+s*r-o*t,p=-s*t-o*r-a*i;return this.x=c*l+p*-s+u*-a-d*-o,this.y=u*l+p*-o+d*-s-c*-a,this.z=d*l+p*-a+c*-o-u*-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 bx.copy(this).projectOnVector(e),this.sub(bx)}reflect(e){return this.sub(bx.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(Kn(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 bx=new Q,n2=new Hr;class cs{constructor(e=new Q(1/0,1/0,1/0),t=new Q(-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,No),No.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(eh),Rg.subVectors(this.max,eh),wu.subVectors(e.a,eh),Mu.subVectors(e.b,eh),Tu.subVectors(e.c,eh),Ha.subVectors(Mu,wu),Va.subVectors(Tu,Mu),Vl.subVectors(wu,Tu);let t=[0,-Ha.z,Ha.y,0,-Va.z,Va.y,0,-Vl.z,Vl.y,Ha.z,0,-Ha.x,Va.z,0,-Va.x,Vl.z,0,-Vl.x,-Ha.y,Ha.x,0,-Va.y,Va.x,0,-Vl.y,Vl.x,0];return!Rx(t,wu,Mu,Tu,Rg)||(t=[1,0,0,0,1,0,0,0,1],!Rx(t,wu,Mu,Tu,Rg))?!1:(Pg.crossVectors(Ha,Va),t=[Pg.x,Pg.y,Pg.z],Rx(t,wu,Mu,Tu,Rg))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,No).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(No).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:(ko[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ko[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ko[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ko[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ko[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ko[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ko[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ko[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ko),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 ko=[new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q],No=new Q,Au=new cs,wu=new Q,Mu=new Q,Tu=new Q,Ha=new Q,Va=new Q,Vl=new Q,eh=new Q,Rg=new Q,Pg=new Q,Wl=new Q;function Rx(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){Wl.fromArray(n,s);const a=i.x*Math.abs(Wl.x)+i.y*Math.abs(Wl.y)+i.z*Math.abs(Wl.z),l=e.dot(Wl),c=t.dot(Wl),u=r.dot(Wl);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const yN=new cs,th=new Q,Px=new Q;class Vi{constructor(e=new Q,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):yN.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;th.subVectors(e,this.center);const t=th.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(th,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):(Px.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(th.copy(e.center).add(Px)),this.expandByPoint(th.copy(e.center).sub(Px))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const zo=new Q,Bx=new Q,Bg=new Q,Wa=new Q,Ix=new Q,Ig=new Q,Dx=new Q;class Cu{constructor(e=new Q,t=new Q(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,zo)),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=zo.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(zo.copy(this.origin).addScaledVector(this.direction,t),zo.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Bx.copy(e).add(t).multiplyScalar(.5),Bg.copy(t).sub(e).normalize(),Wa.copy(this.origin).sub(Bx);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Bg),a=Wa.dot(this.direction),l=-Wa.dot(Bg),c=Wa.lengthSq(),u=Math.abs(1-o*o);let d,p,m,v;if(u>0)if(d=o*l-a,p=o*a-l,v=s*u,d>=0)if(p>=-v)if(p<=v){const x=1/u;d*=x,p*=x,m=d*(d+o*p+2*a)+p*(o*d+p+2*l)+c}else p=s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+c;else p=-s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+c;else p<=-v?(d=Math.max(0,-(-o*s+a)),p=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c):p<=v?(d=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(d=Math.max(0,-(o*s+a)),p=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+c);else p=o>0?-s:s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(Bx).addScaledVector(Bg,p),m}intersectSphere(e,t){zo.subVectors(e.center,this.origin);const r=zo.dot(this.direction),i=zo.dot(zo)-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,u=1/this.direction.y,d=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),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-p.z)*d,l=(e.max.z-p.z)*d):(a=(e.max.z-p.z)*d,l=(e.min.z-p.z)*d),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,zo)!==null}intersectTriangle(e,t,r,i,s){Ix.subVectors(t,e),Ig.subVectors(r,e),Dx.crossVectors(Ix,Ig);let o=this.direction.dot(Dx),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Wa.subVectors(this.origin,e);const l=a*this.direction.dot(Ig.crossVectors(Wa,Ig));if(l<0)return null;const c=a*this.direction.dot(Ix.cross(Wa));if(c<0||l+c>o)return null;const u=-a*Wa.dot(Dx);return u<0?null:this.at(u/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 bt{constructor(e,t,r,i,s,o,a,l,c,u,d,p,m,v,x,y){bt.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,u,d,p,m,v,x,y)}set(e,t,r,i,s,o,a,l,c,u,d,p,m,v,x,y){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]=u,g[10]=d,g[14]=p,g[3]=m,g[7]=v,g[11]=x,g[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new bt().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/bu.setFromMatrixColumn(e,0).length(),s=1/bu.setFromMatrixColumn(e,1).length(),o=1/bu.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),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const p=o*u,m=o*d,v=a*u,x=a*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=m+v*c,t[5]=p-x*c,t[9]=-a*l,t[2]=x-p*c,t[6]=v+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*u,m=l*d,v=c*u,x=c*d;t[0]=p+x*a,t[4]=v*a-m,t[8]=o*c,t[1]=o*d,t[5]=o*u,t[9]=-a,t[2]=m*a-v,t[6]=x+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*u,m=l*d,v=c*u,x=c*d;t[0]=p-x*a,t[4]=-o*d,t[8]=v+m*a,t[1]=m+v*a,t[5]=o*u,t[9]=x-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*u,m=o*d,v=a*u,x=a*d;t[0]=l*u,t[4]=v*c-m,t[8]=p*c+x,t[1]=l*d,t[5]=x*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,x=a*c;t[0]=l*u,t[4]=x-p*d,t[8]=v*d+m,t[1]=d,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*d+v,t[10]=p-x*d}else if(e.order==="XZY"){const p=o*l,m=o*c,v=a*l,x=a*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=p*d+x,t[5]=o*u,t[9]=m*d-v,t[2]=v*d-m,t[6]=a*u,t[10]=x*d+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(_N,e,xN)}lookAt(e,t,r){const i=this.elements;return Wi.subVectors(e,t),Wi.lengthSq()===0&&(Wi.z=1),Wi.normalize(),$a.crossVectors(r,Wi),$a.lengthSq()===0&&(Math.abs(r.z)===1?Wi.x+=1e-4:Wi.z+=1e-4,Wi.normalize(),$a.crossVectors(r,Wi)),$a.normalize(),Dg.crossVectors(Wi,$a),i[0]=$a.x,i[4]=Dg.x,i[8]=Wi.x,i[1]=$a.y,i[5]=Dg.y,i[9]=Wi.y,i[2]=$a.z,i[6]=Dg.z,i[10]=Wi.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],u=r[1],d=r[5],p=r[9],m=r[13],v=r[2],x=r[6],y=r[10],g=r[14],_=r[3],E=r[7],A=r[11],M=r[15],T=i[0],R=i[4],B=i[8],P=i[12],I=i[1],F=i[5],N=i[9],H=i[13],V=i[2],Y=i[6],K=i[10],ee=i[14],G=i[3],W=i[7],J=i[11],j=i[15];return s[0]=o*T+a*I+l*V+c*G,s[4]=o*R+a*F+l*Y+c*W,s[8]=o*B+a*N+l*K+c*J,s[12]=o*P+a*H+l*ee+c*j,s[1]=u*T+d*I+p*V+m*G,s[5]=u*R+d*F+p*Y+m*W,s[9]=u*B+d*N+p*K+m*J,s[13]=u*P+d*H+p*ee+m*j,s[2]=v*T+x*I+y*V+g*G,s[6]=v*R+x*F+y*Y+g*W,s[10]=v*B+x*N+y*K+g*J,s[14]=v*P+x*H+y*ee+g*j,s[3]=_*T+E*I+A*V+M*G,s[7]=_*R+E*F+A*Y+M*W,s[11]=_*B+E*N+A*K+M*J,s[15]=_*P+E*H+A*ee+M*j,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],u=e[2],d=e[6],p=e[10],m=e[14],v=e[3],x=e[7],y=e[11],g=e[15];return v*(+s*l*d-i*c*d-s*a*p+r*c*p+i*a*m-r*l*m)+x*(+t*l*m-t*c*p+s*o*p-i*o*m+i*c*u-s*l*u)+y*(+t*c*d-t*a*m-s*o*d+r*o*m+s*a*u-r*c*u)+g*(-i*a*u-t*l*d+t*a*p+i*o*d-r*o*p+r*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,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],u=e[8],d=e[9],p=e[10],m=e[11],v=e[12],x=e[13],y=e[14],g=e[15],_=d*y*c-x*p*c+x*l*m-a*y*m-d*l*g+a*p*g,E=v*p*c-u*y*c-v*l*m+o*y*m+u*l*g-o*p*g,A=u*x*c-v*d*c+v*a*m-o*x*m-u*a*g+o*d*g,M=v*d*l-u*x*l-v*a*p+o*x*p+u*a*y-o*d*y,T=t*_+r*E+i*A+s*M;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/T;return e[0]=_*R,e[1]=(x*p*s-d*y*s-x*i*m+r*y*m+d*i*g-r*p*g)*R,e[2]=(a*y*s-x*l*s+x*i*c-r*y*c-a*i*g+r*l*g)*R,e[3]=(d*l*s-a*p*s-d*i*c+r*p*c+a*i*m-r*l*m)*R,e[4]=E*R,e[5]=(u*y*s-v*p*s+v*i*m-t*y*m-u*i*g+t*p*g)*R,e[6]=(v*l*s-o*y*s-v*i*c+t*y*c+o*i*g-t*l*g)*R,e[7]=(o*p*s-u*l*s+u*i*c-t*p*c-o*i*m+t*l*m)*R,e[8]=A*R,e[9]=(v*d*s-u*x*s-v*r*m+t*x*m+u*r*g-t*d*g)*R,e[10]=(o*x*s-v*a*s+v*r*c-t*x*c-o*r*g+t*a*g)*R,e[11]=(u*a*s-o*d*s-u*r*c+t*d*c+o*r*m-t*a*m)*R,e[12]=M*R,e[13]=(u*x*i-v*d*i+v*r*p-t*x*p-u*r*y+t*d*y)*R,e[14]=(v*a*i-o*x*i-v*r*l+t*x*l+o*r*y-t*a*y)*R,e[15]=(o*d*i-u*a*i+u*r*l-t*d*l-o*r*p+t*a*p)*R,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,u=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+r,u*l-i*o,0,c*l-i*a,u*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,u=o+o,d=a+a,p=s*c,m=s*u,v=s*d,x=o*u,y=o*d,g=a*d,_=l*c,E=l*u,A=l*d,M=r.x,T=r.y,R=r.z;return i[0]=(1-(x+g))*M,i[1]=(m+A)*M,i[2]=(v-E)*M,i[3]=0,i[4]=(m-A)*T,i[5]=(1-(p+g))*T,i[6]=(y+_)*T,i[7]=0,i[8]=(v+E)*R,i[9]=(y-_)*R,i[10]=(1-(p+x))*R,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=bu.set(i[0],i[1],i[2]).length();const o=bu.set(i[4],i[5],i[6]).length(),a=bu.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],Ns.copy(this);const c=1/s,u=1/o,d=1/a;return Ns.elements[0]*=c,Ns.elements[1]*=c,Ns.elements[2]*=c,Ns.elements[4]*=u,Ns.elements[5]*=u,Ns.elements[6]*=u,Ns.elements[8]*=d,Ns.elements[9]*=d,Ns.elements[10]*=d,t.setFromRotationMatrix(Ns),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=oo){const l=this.elements,c=2*s/(t-e),u=2*s/(r-i),d=(t+e)/(t-e),p=(r+i)/(r-i);let m,v;if(a===oo)m=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(a===Kd)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]=d,l[12]=0,l[1]=0,l[5]=u,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=oo){const l=this.elements,c=1/(t-e),u=1/(r-i),d=1/(o-s),p=(t+e)*c,m=(r+i)*u;let v,x;if(a===oo)v=(o+s)*d,x=-2*d;else if(a===Kd)v=s*d,x=-1*d;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*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=x,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,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 bu=new Q,Ns=new bt,_N=new Q(0,0,0),xN=new Q(1,1,1),$a=new Q,Dg=new Q,Wi=new Q,r2=new bt,i2=new Hr;class nh{constructor(e=0,t=0,r=0,i=nh.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],u=i[9],d=i[2],p=i[6],m=i[10];switch(t){case"XYZ":this._y=Math.asin(Kn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Kn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Kn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Kn(d,-1,1)),Math.abs(d)<.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(Kn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-Kn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,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 r2.makeRotationFromQuaternion(e),this.setFromRotationMatrix(r2,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return i2.setFromEuler(this),this.setFromQuaternion(i2,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}}nh.DEFAULT_ORDER="XYZ";class $l{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(rh,e,SN),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rh,AN,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,u=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),u.length>0&&(r.images=u),d.length>0&&(r.shapes=d),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 u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){zs.subVectors(i,t),Ho.subVectors(r,t),Lx.subVectors(e,t);const o=zs.dot(zs),a=zs.dot(Ho),l=zs.dot(Lx),c=Ho.dot(Ho),u=Ho.dot(Lx),d=o*c-a*a;if(d===0)return s.set(-2,-1,-1);const p=1/d,m=(c*l-a*u)*p,v=(o*u-a*l)*p;return s.set(1-m-v,v,m)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,Vo),Vo.x>=0&&Vo.y>=0&&Vo.x+Vo.y<=1}static getUV(e,t,r,i,s,o,a,l){return Og===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Og=!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,Vo),l.setScalar(0),l.addScaledVector(s,Vo.x),l.addScaledVector(o,Vo.y),l.addScaledVector(a,Vo.z),l}static isFrontFacing(e,t,r,i){return zs.subVectors(r,t),Ho.subVectors(e,t),zs.cross(Ho).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 zs.subVectors(this.c,this.b),Ho.subVectors(this.a,this.b),zs.cross(Ho).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ei.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ei.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return Og===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Og=!0),Ei.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}getInterpolation(e,t,r,i,s){return Ei.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Ei.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ei.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;Pu.subVectors(i,r),Bu.subVectors(s,r),Ox.subVectors(e,r);const l=Pu.dot(Ox),c=Bu.dot(Ox);if(l<=0&&c<=0)return t.copy(r);Ux.subVectors(e,i);const u=Pu.dot(Ux),d=Bu.dot(Ux);if(u>=0&&d<=u)return t.copy(i);const p=l*d-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(r).addScaledVector(Pu,o);Fx.subVectors(e,s);const m=Pu.dot(Fx),v=Bu.dot(Fx);if(v>=0&&m<=v)return t.copy(s);const x=m*c-l*v;if(x<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(r).addScaledVector(Bu,a);const y=u*v-m*d;if(y<=0&&d-u>=0&&m-v>=0)return u2.subVectors(s,i),a=(d-u)/(d-u+(m-v)),t.copy(i).addScaledVector(u2,a);const g=1/(y+x+p);return o=x*g,a=p*g,t.copy(r).addScaledVector(Pu,o).addScaledVector(Bu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let MN=0;class or extends Fo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:MN++}),this.uuid=zi(),this.name="",this.type="Material",this.blending=Ol,this.side=Us,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=U1,this.blendDst=F1,this.blendEquation=Ul,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=dg,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Vb,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=wg,this.stencilZFail=wg,this.stencilZPass=wg,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!==Ol&&(r.blending=this.blending),this.side!==Us&&(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 f2={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},Gs={h:0,s:0,l:0},Ug={h:0,s:0,l:0};function kx(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 rt=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=Ut){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ls.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=ls.workingColorSpace){return this.r=e,this.g=t,this.b=r,ls.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=ls.workingColorSpace){if(e=Ex(e,1),t=Kn(t,0,1),r=Kn(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=kx(o,s,e+1/3),this.g=kx(o,s,e),this.b=kx(o,s,e-1/3)}return ls.toWorkingColorSpace(this,i),this}setStyle(e,t=Ut){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=Ut){const r=f2[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=Eu(e.r),this.g=Eu(e.g),this.b=Eu(e.b),this}copyLinearToSRGB(e){return this.r=wx(e.r),this.g=wx(e.g),this.b=wx(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ut){return ls.fromWorkingColorSpace(Vr.copy(this),e),Math.round(Kn(Vr.r*255,0,255))*65536+Math.round(Kn(Vr.g*255,0,255))*256+Math.round(Kn(Vr.b*255,0,255))}getHexString(e=Ut){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ls.workingColorSpace){ls.fromWorkingColorSpace(Vr.copy(this),t);const r=Vr.r,i=Vr.g,s=Vr.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const d=o-a;switch(c=u<=.5?d/(o+a):d/(2-o-a),o){case r:l=(i-s)/d+(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,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}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 Ai(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Kn(n,-65504,65504),Wo.floatView[0]=n;const e=Wo.uint32View[0],t=e>>23&511;return Wo.baseTable[t]+((e&8388607)>>Wo.shiftTable[t])}function ih(n){const e=n>>10;return Wo.uint32View[0]=Wo.mantissaTable[Wo.offsetTable[e]+(n&1023)]+Wo.exponentTable[e],Wo.floatView[0]}const Xl={toHalfFloat:Ai,fromHalfFloat:ih},ar=new Q,Fg=new Ge;class un{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=Yd,this.updateRange={offset:0,count:-1},this.gpuType=zr,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],u=[];for(let d=0,p=c.length;d0&&(i[l]=u,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 u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let p=0,m=d.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))&&(d2.copy(s).invert(),jl.copy(e.ray).applyMatrix4(d2),!(r.boundingBox!==null&&jl.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,jl)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,x=p.length;vt.far?null:{distance:c,point:Wg.clone(),object:n}}function $g(n,e,t,r,i,s,o,a,l,c){n.getVertexPosition(a,Du),n.getVertexPosition(l,Lu),n.getVertexPosition(c,Ou);const u=ON(n,e,t,r,Du,Lu,Ou,Vg);if(u){i&&(zg.fromBufferAttribute(i,a),Gg.fromBufferAttribute(i,l),Hg.fromBufferAttribute(i,c),u.uv=Ei.getInterpolation(Vg,Du,Lu,Ou,zg,Gg,Hg,new Ge)),s&&(zg.fromBufferAttribute(s,a),Gg.fromBufferAttribute(s,l),Hg.fromBufferAttribute(s,c),u.uv1=Ei.getInterpolation(Vg,Du,Lu,Ou,zg,Gg,Hg,new Ge),u.uv2=u.uv1),o&&(p2.fromBufferAttribute(o,a),m2.fromBufferAttribute(o,l),g2.fromBufferAttribute(o,c),u.normal=Ei.getInterpolation(Vg,Du,Lu,Ou,p2,m2,g2,new Q),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:l,c,normal:new Q,materialIndex:0};Ei.getNormal(Du,Lu,Ou,d.normal),u.face=d}return u}class Xa extends Dt{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=[],u=[],d=[];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 mt(c,3)),this.setAttribute("normal",new mt(u,3)),this.setAttribute("uv",new mt(d,2));function v(x,y,g,_,E,A,M,T,R,B,P){const I=A/R,F=M/B,N=A/2,H=M/2,V=T/2,Y=R+1,K=B+1;let ee=0,G=0;const W=new Q;for(let J=0;J0?1:-1,u.push(W.x,W.y,W.z),d.push(X/R),d.push(1-J/B),ee+=1}}for(let J=0;J0&&(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 oh extends en{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new bt,this.projectionMatrix=new bt,this.projectionMatrixInverse=new bt,this.coordinateSystem=oo}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 pr extends oh{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=_u*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Gl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return _u*2*Math.atan(Math.tan(Gl*.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(Gl*.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 Fu=-90,ku=1;class y2 extends en{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null;const i=new pr(Fu,ku,e,t);i.layers=this.layers,this.add(i);const s=new pr(Fu,ku,e,t);s.layers=this.layers,this.add(s);const o=new pr(Fu,ku,e,t);o.layers=this.layers,this.add(o);const a=new pr(Fu,ku,e,t);a.layers=this.layers,this.add(a);const l=new pr(Fu,ku,e,t);l.layers=this.layers,this.add(l);const c=new pr(Fu,ku,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===oo)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===Kd)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,u=e.getRenderTarget(),d=e.toneMapping,p=e.xr.enabled;e.toneMapping=Fs,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(u),e.toneMapping=d,e.xr.enabled=p,r.texture.needsPMREMUpdate=!0}}class ah extends bn{constructor(e,t,r,i,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Oo,super(e,t,r,i,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Vx extends Hi{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&&(qd("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Na?Ut:Ga),this.texture=new ah(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:vn}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 Xa(5,5,5),s=new wi({name:"CubemapFromEquirect",uniforms:Uu(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Ir,blending:Lo});s.uniforms.tEquirect.value=t;const o=new Gn(i,s),a=t.minFilter;return t.minFilter===io&&(t.minFilter=vn),new y2(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 Wx=new Q,NN=new Q,zN=new kt;class ja{constructor(e=new Q(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=Wx.subVectors(r,t).cross(NN.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(Wx),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||zN.getNormalMatrix(e),i=this.coplanarPoint(Wx).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 Jl=new Vi,jg=new Q;class Jg{constructor(e=new ja,t=new ja,r=new ja,i=new ja,s=new ja,o=new ja){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=oo){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],d=i[6],p=i[7],m=i[8],v=i[9],x=i[10],y=i[11],g=i[12],_=i[13],E=i[14],A=i[15];if(r[0].setComponents(l-s,p-c,y-m,A-g).normalize(),r[1].setComponents(l+s,p+c,y+m,A+g).normalize(),r[2].setComponents(l+o,p+u,y+v,A+_).normalize(),r[3].setComponents(l-o,p-u,y-v,A-_).normalize(),r[4].setComponents(l-a,p-d,y-x,A-E).normalize(),t===oo)r[5].setComponents(l+a,p+d,y+x,A+E).normalize();else if(t===Kd)r[5].setComponents(a,d,x,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(),Jl.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Jl.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Jl)}intersectsSprite(e){return Jl.center.set(0,0,0),Jl.radius=.7071067811865476,Jl.applyMatrix4(e.matrixWorld),this.intersectsSphere(Jl)}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,jg.y=i.normal.y>0?e.max.y:e.min.y,jg.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(jg)<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 _2(){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 GN(n,e){const t=e.isWebGL2,r=new WeakMap;function i(c,u){const d=c.array,p=c.usage,m=n.createBuffer();n.bindBuffer(u,m),n.bufferData(u,d,p),c.onUploadCallback();let v;if(d instanceof Float32Array)v=n.FLOAT;else if(d 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(d instanceof Int16Array)v=n.SHORT;else if(d instanceof Uint32Array)v=n.UNSIGNED_INT;else if(d instanceof Int32Array)v=n.INT;else if(d instanceof Int8Array)v=n.BYTE;else if(d instanceof Uint8Array)v=n.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)v=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:m,type:v,bytesPerElement:d.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,d){const p=u.array,m=u.updateRange;n.bindBuffer(d,c),m.count===-1?n.bufferSubData(d,0,p):(t?n.bufferSubData(d,m.offset*p.BYTES_PER_ELEMENT,p,m.offset,m.count):n.bufferSubData(d,m.offset*p.BYTES_PER_ELEMENT,p.subarray(m.offset,m.offset+m.count)),m.count=-1),u.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),r.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=r.get(c);u&&(n.deleteBuffer(u.buffer),r.delete(c))}function l(c,u){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`,e4=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,t4=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,n4=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,r4=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,i4=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,s4=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`,o4=`#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`,a4=`#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`,l4=`#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`,c4=`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`,u4=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,f4=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,d4=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,h4=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,p4="gl_FragColor = linearToOutputTexel( gl_FragColor );",m4=`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 ); }`,g4=`#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`,v4=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,y4=`#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`,_4=`#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`,x4=`#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`,E4=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,S4=`#ifdef USE_FOG varying float vFogDepth; #endif`,A4=`#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`,w4=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,M4=`#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 }`,T4=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif`,C4=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,b4=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,R4=`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`,P4=`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`,B4=`#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`,I4=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,D4=`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`,L4=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,O4=`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`,U4=`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`,F4=`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 ); }`,k4=` 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`,N4=`#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`,z4=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`,G4=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,H4=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,V4=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,W4=`#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`,$4=`#ifdef USE_MAP diffuseColor *= texture2D( map, vMapUv ); #endif`,X4=`#ifdef USE_MAP uniform sampler2D map; #endif`,j4=`#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`,J4=`#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`,Y4=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,K4=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,Z4=`#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`,Q4=`#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`,q4=`#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`,ez=`#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`,tz=`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;`,nz=`#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`,rz=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,iz=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,sz=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,oz=`#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`,az=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`,lz=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,cz=`#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`,uz=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,fz=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,dz=`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 ); }`,hz=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,pz=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,mz=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,gz=`#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`,vz=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,yz=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,_z=`#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`,xz=`#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`,Ez=`#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`,Sz=`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; }`,Az=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,wz=`#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`,Mz=`#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`,Tz=`#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`,Cz=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,bz=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,Rz=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,Pz=`#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; }`,Bz=`#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`,Iz=`#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`,Dz=`#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`,Lz=`#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`,Oz=`#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`,Uz=`#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 Nt={alphamap_fragment:HN,alphamap_pars_fragment:VN,alphatest_fragment:WN,alphatest_pars_fragment:$N,aomap_fragment:XN,aomap_pars_fragment:jN,begin_vertex:JN,beginnormal_vertex:YN,bsdfs:KN,iridescence_fragment:ZN,bumpmap_pars_fragment:QN,clipping_planes_fragment:qN,clipping_planes_pars_fragment:e4,clipping_planes_pars_vertex:t4,clipping_planes_vertex:n4,color_fragment:r4,color_pars_fragment:i4,color_pars_vertex:s4,color_vertex:o4,common:a4,cube_uv_reflection_fragment:l4,defaultnormal_vertex:c4,displacementmap_pars_vertex:u4,displacementmap_vertex:f4,emissivemap_fragment:d4,emissivemap_pars_fragment:h4,encodings_fragment:p4,encodings_pars_fragment:m4,envmap_fragment:g4,envmap_common_pars_fragment:v4,envmap_pars_fragment:y4,envmap_pars_vertex:_4,envmap_physical_pars_fragment:B4,envmap_vertex:x4,fog_vertex:E4,fog_pars_vertex:S4,fog_fragment:A4,fog_pars_fragment:w4,gradientmap_pars_fragment:M4,lightmap_fragment:T4,lightmap_pars_fragment:C4,lights_lambert_fragment:b4,lights_lambert_pars_fragment:R4,lights_pars_begin:P4,lights_toon_fragment:I4,lights_toon_pars_fragment:D4,lights_phong_fragment:L4,lights_phong_pars_fragment:O4,lights_physical_fragment:U4,lights_physical_pars_fragment:F4,lights_fragment_begin:k4,lights_fragment_maps:N4,lights_fragment_end:z4,logdepthbuf_fragment:G4,logdepthbuf_pars_fragment:H4,logdepthbuf_pars_vertex:V4,logdepthbuf_vertex:W4,map_fragment:$4,map_pars_fragment:X4,map_particle_fragment:j4,map_particle_pars_fragment:J4,metalnessmap_fragment:Y4,metalnessmap_pars_fragment:K4,morphcolor_vertex:Z4,morphnormal_vertex:Q4,morphtarget_pars_vertex:q4,morphtarget_vertex:ez,normal_fragment_begin:tz,normal_fragment_maps:nz,normal_pars_fragment:rz,normal_pars_vertex:iz,normal_vertex:sz,normalmap_pars_fragment:oz,clearcoat_normal_fragment_begin:az,clearcoat_normal_fragment_maps:lz,clearcoat_pars_fragment:cz,iridescence_pars_fragment:uz,output_fragment:fz,packing:dz,premultiplied_alpha_fragment:hz,project_vertex:pz,dithering_fragment:mz,dithering_pars_fragment:gz,roughnessmap_fragment:vz,roughnessmap_pars_fragment:yz,shadowmap_pars_fragment:_z,shadowmap_pars_vertex:xz,shadowmap_vertex:Ez,shadowmask_pars_fragment:Sz,skinbase_vertex:Az,skinning_pars_vertex:wz,skinning_vertex:Mz,skinnormal_vertex:Tz,specularmap_fragment:Cz,specularmap_pars_fragment:bz,tonemapping_fragment:Rz,tonemapping_pars_fragment:Pz,transmission_fragment:Bz,transmission_pars_fragment:Iz,uv_pars_fragment:Dz,uv_pars_vertex:Lz,uv_vertex:Oz,worldpos_vertex:Uz,background_vert:`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,background_frag:`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,backgroundCube_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,backgroundCube_frag:`#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 }`,cube_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,cube_frag:`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 }`,depth_vert:`#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; }`,depth_frag:`#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 }`,distanceRGBA_vert:`#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; }`,distanceRGBA_frag:`#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 ); }`,equirect_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,equirect_frag:`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,linedashed_vert:`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 }`,linedashed_frag:`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 }`,meshbasic_vert:`#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 }`,meshbasic_frag:`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 }`,meshlambert_vert:`#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 }`,meshlambert_frag:`#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 }`,meshmatcap_vert:`#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; }`,meshmatcap_frag:`#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 }`,meshnormal_vert:`#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 }`,meshnormal_frag:`#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 }`,meshphong_vert:`#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 }`,meshphong_frag:`#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 }`,meshphysical_vert:`#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 }`,meshphysical_frag:`#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 }`,meshtoon_vert:`#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 }`,meshtoon_frag:`#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 }`,points_vert:`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 }`,points_frag:`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 }`,shadow_vert:`#include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include }`,shadow_frag:`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 }`,sprite_vert:`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 }`,sprite_frag:`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 }`},it={common:{diffuse:{value:new rt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new kt},alphaMap:{value:null},alphaMapTransform:{value:new kt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new kt}},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 kt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new kt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new kt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new kt},normalScale:{value:new Ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new kt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new kt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new kt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new kt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new rt(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 rt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new kt},alphaTest:{value:0},uvTransform:{value:new kt}},sprite:{diffuse:{value:new rt(16777215)},opacity:{value:1},center:{value:new Ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new kt},alphaMap:{value:null},alphaMapTransform:{value:new kt},alphaTest:{value:0}}},Hs={basic:{uniforms:ii([it.common,it.specularmap,it.envmap,it.aomap,it.lightmap,it.fog]),vertexShader:Nt.meshbasic_vert,fragmentShader:Nt.meshbasic_frag},lambert:{uniforms:ii([it.common,it.specularmap,it.envmap,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.fog,it.lights,{emissive:{value:new rt(0)}}]),vertexShader:Nt.meshlambert_vert,fragmentShader:Nt.meshlambert_frag},phong:{uniforms:ii([it.common,it.specularmap,it.envmap,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.fog,it.lights,{emissive:{value:new rt(0)},specular:{value:new rt(1118481)},shininess:{value:30}}]),vertexShader:Nt.meshphong_vert,fragmentShader:Nt.meshphong_frag},standard:{uniforms:ii([it.common,it.envmap,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.roughnessmap,it.metalnessmap,it.fog,it.lights,{emissive:{value:new rt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Nt.meshphysical_vert,fragmentShader:Nt.meshphysical_frag},toon:{uniforms:ii([it.common,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.gradientmap,it.fog,it.lights,{emissive:{value:new rt(0)}}]),vertexShader:Nt.meshtoon_vert,fragmentShader:Nt.meshtoon_frag},matcap:{uniforms:ii([it.common,it.bumpmap,it.normalmap,it.displacementmap,it.fog,{matcap:{value:null}}]),vertexShader:Nt.meshmatcap_vert,fragmentShader:Nt.meshmatcap_frag},points:{uniforms:ii([it.points,it.fog]),vertexShader:Nt.points_vert,fragmentShader:Nt.points_frag},dashed:{uniforms:ii([it.common,it.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Nt.linedashed_vert,fragmentShader:Nt.linedashed_frag},depth:{uniforms:ii([it.common,it.displacementmap]),vertexShader:Nt.depth_vert,fragmentShader:Nt.depth_frag},normal:{uniforms:ii([it.common,it.bumpmap,it.normalmap,it.displacementmap,{opacity:{value:1}}]),vertexShader:Nt.meshnormal_vert,fragmentShader:Nt.meshnormal_frag},sprite:{uniforms:ii([it.sprite,it.fog]),vertexShader:Nt.sprite_vert,fragmentShader:Nt.sprite_frag},background:{uniforms:{uvTransform:{value:new kt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Nt.background_vert,fragmentShader:Nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Nt.backgroundCube_vert,fragmentShader:Nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Nt.cube_vert,fragmentShader:Nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Nt.equirect_vert,fragmentShader:Nt.equirect_frag},distanceRGBA:{uniforms:ii([it.common,it.displacementmap,{referencePosition:{value:new Q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Nt.distanceRGBA_vert,fragmentShader:Nt.distanceRGBA_frag},shadow:{uniforms:ii([it.lights,it.fog,{color:{value:new rt(0)},opacity:{value:1}}]),vertexShader:Nt.shadow_vert,fragmentShader:Nt.shadow_frag}};Hs.physical={uniforms:ii([Hs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new kt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new kt},clearcoatNormalScale:{value:new Ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new kt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new kt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new kt},sheen:{value:0},sheenColor:{value:new rt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new kt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new kt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new kt},transmissionSamplerSize:{value:new Ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new kt},attenuationDistance:{value:0},attenuationColor:{value:new rt(0)},specularColor:{value:new rt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new kt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new kt},anisotropyVector:{value:new Ge},anisotropyMap:{value:null},anisotropyMapTransform:{value:new kt}}]),vertexShader:Nt.meshphysical_vert,fragmentShader:Nt.meshphysical_frag};const Yg={r:0,b:0,g:0};function Fz(n,e,t,r,i,s,o){const a=new rt(0);let l=s===!0?0:1,c,u,d=null,p=0,m=null;function v(y,g){let _=!1,E=g.isScene===!0?g.background:null;switch(E&&E.isTexture&&(E=(g.backgroundBlurriness>0?t:e).get(E)),E===null?x(a,l):E&&E.isColor&&(x(E,1),_=!0),n.xr.getEnvironmentBlendMode()){case"opaque":_=!0;break;case"additive":r.buffers.color.setClear(0,0,0,1,o),_=!0;break;case"alpha-blend":r.buffers.color.setClear(0,0,0,0,o),_=!0;break}(n.autoClear||_)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),E&&(E.isCubeTexture||E.mapping===mu)?(u===void 0&&(u=new Gn(new Xa(1,1,1),new wi({name:"BackgroundCubeMaterial",uniforms:Uu(Hs.backgroundCube.uniforms),vertexShader:Hs.backgroundCube.vertexShader,fragmentShader:Hs.backgroundCube.fragmentShader,side:Ir,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(T,R,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=E,u.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.toneMapped=E.colorSpace!==Ut,(d!==E||p!==E.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,d=E,p=E.version,m=n.toneMapping),u.layers.enableAll(),y.unshift(u,u.geometry,u.material,0,0,null)):E&&E.isTexture&&(c===void 0&&(c=new Gn(new ao(2,2),new wi({name:"BackgroundMaterial",uniforms:Uu(Hs.background.uniforms),vertexShader:Hs.background.vertexShader,fragmentShader:Hs.background.fragmentShader,side:Us,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=E,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=E.colorSpace!==Ut,E.matrixAutoUpdate===!0&&E.updateMatrix(),c.material.uniforms.uvTransform.value.copy(E.matrix),(d!==E||p!==E.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,d=E,p=E.version,m=n.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function x(y,g){y.getRGB(Yg,v2(n)),r.buffers.color.setClear(Yg.r,Yg.g,Yg.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(y,g=1){a.set(y),l=g,x(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,x(a,l)},render:v}}function kz(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=y(null);let c=l,u=!1;function d(V,Y,K,ee,G){let W=!1;if(o){const J=x(ee,K,Y);c!==J&&(c=J,m(c.object)),W=g(V,ee,K,G),W&&_(V,ee,K,G)}else{const J=Y.wireframe===!0;(c.geometry!==ee.id||c.program!==K.id||c.wireframe!==J)&&(c.geometry=ee.id,c.program=K.id,c.wireframe=J,W=!0)}G!==null&&t.update(G,n.ELEMENT_ARRAY_BUFFER),(W||u)&&(u=!1,B(V,Y,K,ee),G!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(G).buffer))}function p(){return r.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(V){return r.isWebGL2?n.bindVertexArray(V):s.bindVertexArrayOES(V)}function v(V){return r.isWebGL2?n.deleteVertexArray(V):s.deleteVertexArrayOES(V)}function x(V,Y,K){const ee=K.wireframe===!0;let G=a[V.id];G===void 0&&(G={},a[V.id]=G);let W=G[Y.id];W===void 0&&(W={},G[Y.id]=W);let J=W[ee];return J===void 0&&(J=y(p()),W[ee]=J),J}function y(V){const Y=[],K=[],ee=[];for(let G=0;G=0){const se=G[X];let ce=W[X];if(ce===void 0&&(X==="instanceMatrix"&&V.instanceMatrix&&(ce=V.instanceMatrix),X==="instanceColor"&&V.instanceColor&&(ce=V.instanceColor)),se===void 0||se.attribute!==ce||ce&&se.data!==ce.data)return!0;J++}return c.attributesNum!==J||c.index!==ee}function _(V,Y,K,ee){const G={},W=Y.attributes;let J=0;const j=K.getAttributes();for(const X in j)if(j[X].location>=0){let se=W[X];se===void 0&&(X==="instanceMatrix"&&V.instanceMatrix&&(se=V.instanceMatrix),X==="instanceColor"&&V.instanceColor&&(se=V.instanceColor));const ce={};ce.attribute=se,se&&se.data&&(ce.data=se.data),G[X]=ce,J++}c.attributes=G,c.attributesNum=J,c.index=ee}function E(){const V=c.newAttributes;for(let Y=0,K=V.length;Y=0){let oe=G[j];if(oe===void 0&&(j==="instanceMatrix"&&V.instanceMatrix&&(oe=V.instanceMatrix),j==="instanceColor"&&V.instanceColor&&(oe=V.instanceColor)),oe!==void 0){const se=oe.normalized,ce=oe.itemSize,le=t.get(oe);if(le===void 0)continue;const ue=le.buffer,xe=le.type,Le=le.bytesPerElement,Je=r.isWebGL2===!0&&(xe===n.INT||xe===n.UNSIGNED_INT||oe.gpuType===N1);if(oe.isInterleavedBufferAttribute){const Pe=oe.data,$=Pe.stride,Me=oe.offset;if(Pe.isInstancedInterleavedBuffer){for(let ve=0;ve0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="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"),u=t.logarithmicDepthBuffer===!0,d=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),x=n.getParameter(n.MAX_VERTEX_ATTRIBS),y=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),g=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),E=p>0,A=o||e.has("OES_texture_float"),M=E&&A,T=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:d,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:v,maxAttributes:x,maxVertexUniforms:y,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:E,floatFragmentTextures:A,floatVertexTextures:M,maxSamples:T}}function Gz(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new ja,a=new kt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,p){const m=d.length!==0||p||r!==0||i;return i=p,r=d.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,p){t=u(d,p,0)},this.setState=function(d,p,m){const v=d.clippingPlanes,x=d.clipIntersection,y=d.clipShadows,g=n.get(d);if(!i||v===null||v.length===0||s&&!y)s?u(null):c();else{const _=s?0:r,E=_*4;let A=g.clippingState||null;l.value=A,A=u(v,p,E,m);for(let M=0;M!==E;++M)A[M]=t[M];g.clippingState=A,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=_}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(d,p,m,v){const x=d!==null?d.length:0;let y=null;if(x!==0){if(y=l.value,v!==!0||y===null){const g=m+x*4,_=p.matrixWorldInverse;a.getNormalMatrix(_),(y===null||y.length0){const c=new Vx(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 Nu extends oh{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,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*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 zu=4,x2=[.125,.215,.35,.446,.526,.582],Yl=20,$x=new Nu,E2=new rt;let Xx=null;const Kl=(1+Math.sqrt(5))/2,Gu=1/Kl,S2=[new Q(1,1,1),new Q(-1,1,1),new Q(1,1,-1),new Q(-1,1,-1),new Q(0,Kl,Gu),new Q(0,Kl,-Gu),new Q(Gu,0,Kl),new Q(-Gu,0,Kl),new Q(Kl,Gu,0),new Q(-Kl,Gu,0)];class jx{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){Xx=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=M2(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=w2(),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?E:0,E,E),u.setRenderTarget(i),x&&u.render(v,a),u.render(e,a)}v.geometry.dispose(),v.material.dispose(),u.toneMapping=p,u.autoClear=d,e.background=y}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Oo||e.mapping===Oa;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=M2()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=w2());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Gn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Kg(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,$x)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;iYl&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${Yl}`);const g=[];let _=0;for(let R=0;RE-zu?i-E+zu:0),T=4*(this._cubeSize-A);Kg(t,M,T,3*A,2*A),l.setRenderTarget(t),l.render(d,$x)}}function Vz(n){const e=[],t=[],r=[];let i=n;const s=n-zu+1+x2.length;for(let o=0;on-zu?l=x2[o-n+zu-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),u=-c,d=1+c,p=[u,u,d,u,d,d,u,u,d,d,u,d],m=6,v=6,x=3,y=2,g=1,_=new Float32Array(x*v*m),E=new Float32Array(y*v*m),A=new Float32Array(g*v*m);for(let T=0;T2?0:-1,P=[R,B,0,R+2/3,B,0,R+2/3,B+1,0,R,B,0,R+2/3,B+1,0,R,B+1,0];_.set(P,x*v*T),E.set(p,y*v*T);const I=[T,T,T,T,T,T];A.set(I,g*v*T)}const M=new Dt;M.setAttribute("position",new un(_,x)),M.setAttribute("uv",new un(E,y)),M.setAttribute("faceIndex",new un(A,g)),e.push(M),i>zu&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function A2(n,e,t){const r=new Hi(n,e,t);return r.texture.mapping=mu,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Kg(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function Wz(n,e,t){const r=new Float32Array(Yl),i=new Q(0,1,0);return new wi({name:"SphericalGaussianBlur",defines:{n:Yl,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:Jx(),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:Lo,depthTest:!1,depthWrite:!1})}function w2(){return new wi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Jx(),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:Lo,depthTest:!1,depthWrite:!1})}function M2(){return new wi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Jx(),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:Lo,depthTest:!1,depthWrite:!1})}function Jx(){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 $z(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===pu||l===Xd,u=l===Oo||l===Oa;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let d=e.get(a);return t===null&&(t=new jx(n)),d=c?t.fromEquirectangular(a,d):t.fromCubemap(a,d),e.set(a,d),d.texture}else{if(e.has(a))return e.get(a).texture;{const d=a.image;if(c&&d&&d.height>0||u&&d&&i(d)){t===null&&(t=new jx(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 u=0;ue.maxTextureSize&&(I=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);const F=new Float32Array(P*I*4*v),N=new bg(F,P,I,v);N.type=zr,N.needsUpdate=!0;const H=B*4;for(let Y=0;Y0)return n;const i=e*t;let s=P2[i];if(s===void 0&&(s=new Float32Array(i),P2[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 mr(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` `)}function XG(n){switch(n){case ks:return["Linear","( value )"];case Ut:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),["Linear","( value )"]}}function F2(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+` `+$G(n.getShaderSource(e),o)}else return i}function jG(n,e){const t=XG(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function JG(n,e){let t;switch(e){case Mb:t="Linear";break;case Tb:t="Reinhard";break;case Cb:t="OptimizedCineon";break;case k1:t="ACESFilmic";break;case bb:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function YG(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(lh).join(` `)}function KG(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` `)}function ZG(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function Kx(n){return n.replace(QG,qG)}function qG(n,e){const t=Nt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Kx(t)}const eH=/#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 z2(n){return n.replace(eH,tH)}function tH(n,e,t,r){let i="";for(let s=parseInt(e);s0&&(y+=` `),g=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(lh).join(` `),g.length>0&&(g+=` `)):(y=[G2(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 "+u:"",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(lh).join(` `),g=[m,G2(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 "+u:"",t.envMap?"#define "+d:"",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!==Fs?"#define TONE_MAPPING":"",t.toneMapping!==Fs?Nt.tonemapping_pars_fragment:"",t.toneMapping!==Fs?JG("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Nt.encodings_pars_fragment,jG("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(lh).join(` `)),o=Kx(o),o=k2(o,t),o=N2(o,t),a=Kx(a),a=k2(a,t),a=N2(a,t),o=z2(o),a=z2(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(_=`#version 300 es `,y=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+y,g=["#define varying in",t.glslVersion===xx?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===xx?"":"#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 E=_+y+o,A=_+g+a,M=U2(i,i.VERTEX_SHADER,E),T=U2(i,i.FRAGMENT_SHADER,A);if(i.attachShader(x,M),i.attachShader(x,T),t.index0AttributeName!==void 0?i.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(x,0,"position"),i.linkProgram(x),n.debug.checkShaderErrors){const P=i.getProgramInfoLog(x).trim(),I=i.getShaderInfoLog(M).trim(),F=i.getShaderInfoLog(T).trim();let N=!0,H=!0;if(i.getProgramParameter(x,i.LINK_STATUS)===!1)if(N=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,x,M,T);else{const V=F2(i,M,"vertex"),Y=F2(i,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(x,i.VALIDATE_STATUS)+` Program Info Log: `+P+` `+V+` `+Y)}else P!==""?console.warn("THREE.WebGLProgram: Program Info Log:",P):(I===""||F==="")&&(H=!1);H&&(this.diagnostics={runnable:N,programLog:P,vertexShader:{log:I,prefix:y},fragmentShader:{log:F,prefix:g}})}i.deleteShader(M),i.deleteShader(T);let R;this.getUniforms=function(){return R===void 0&&(R=new Qg(i,x)),R};let B;return this.getAttributes=function(){return B===void 0&&(B=ZG(i,x)),B},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=WG++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=M,this.fragmentShader=T,this}let lH=0;class cH{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 uH(e),t.set(e,r)),r}}class uH{constructor(e){this.id=lH++,this.code=e,this.usedTimes=0}}function fH(n,e,t,r,i,s,o){const a=new $l,l=new cH,c=[],u=i.isWebGL2,d=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 x(P){return P===0?"uv":`uv${P}`}function y(P,I,F,N,H){const V=N.fog,Y=H.geometry,K=P.isMeshStandardMaterial?N.environment:null,ee=(P.isMeshStandardMaterial?t:e).get(P.envMap||K),G=ee&&ee.mapping===mu?ee.image.height:null,W=v[P.type];P.precision!==null&&(m=i.getMaxPrecision(P.precision),m!==P.precision&&console.warn("THREE.WebGLProgram.getParameters:",P.precision,"not supported, using",m,"instead."));const J=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,j=J!==void 0?J.length:0;let X=0;Y.morphAttributes.position!==void 0&&(X=1),Y.morphAttributes.normal!==void 0&&(X=2),Y.morphAttributes.color!==void 0&&(X=3);let oe,se,ce,le;if(W){const $t=Hs[W];oe=$t.vertexShader,se=$t.fragmentShader}else oe=P.vertexShader,se=P.fragmentShader,l.update(P),ce=l.getVertexShaderID(P),le=l.getFragmentShaderID(P);const ue=n.getRenderTarget(),xe=H.isInstancedMesh===!0,Le=!!P.map,Je=!!P.matcap,Pe=!!ee,$=!!P.aoMap,Me=!!P.lightMap,ve=!!P.bumpMap,me=!!P.normalMap,pe=!!P.displacementMap,$e=!!P.emissiveMap,_e=!!P.metalnessMap,Fe=!!P.roughnessMap,Ne=P.anisotropy>0,Ce=P.clearcoat>0,st=P.iridescence>0,k=P.sheen>0,U=P.transmission>0,ae=Ne&&!!P.anisotropyMap,be=Ce&&!!P.clearcoatMap,Be=Ce&&!!P.clearcoatNormalMap,Te=Ce&&!!P.clearcoatRoughnessMap,Ve=st&&!!P.iridescenceMap,He=st&&!!P.iridescenceThicknessMap,we=k&&!!P.sheenColorMap,je=k&&!!P.sheenRoughnessMap,Ze=!!P.specularMap,We=!!P.specularColorMap,ze=!!P.specularIntensityMap,Xe=U&&!!P.transmissionMap,et=U&&!!P.thicknessMap,ut=!!P.gradientMap,re=!!P.alphaMap,ge=P.alphaTest>0,ye=!!P.extensions,Ke=!!Y.attributes.uv1,nt=!!Y.attributes.uv2,Bt=!!Y.attributes.uv3;return{isWebGL2:u,shaderID:W,shaderType:P.type,shaderName:P.name,vertexShader:oe,fragmentShader:se,defines:P.defines,customVertexShaderID:ce,customFragmentShaderID:le,isRawShaderMaterial:P.isRawShaderMaterial===!0,glslVersion:P.glslVersion,precision:m,instancing:xe,instancingColor:xe&&H.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:ue===null?n.outputColorSpace:ue.isXRRenderTarget===!0?ue.texture.colorSpace:ks,map:Le,matcap:Je,envMap:Pe,envMapMode:Pe&&ee.mapping,envMapCubeUVHeight:G,aoMap:$,lightMap:Me,bumpMap:ve,normalMap:me,displacementMap:p&&pe,emissiveMap:$e,normalMapObjectSpace:me&&P.normalMapType===Hb,normalMapTangentSpace:me&&P.normalMapType===za,metalnessMap:_e,roughnessMap:Fe,anisotropy:Ne,anisotropyMap:ae,clearcoat:Ce,clearcoatMap:be,clearcoatNormalMap:Be,clearcoatRoughnessMap:Te,iridescence:st,iridescenceMap:Ve,iridescenceThicknessMap:He,sheen:k,sheenColorMap:we,sheenRoughnessMap:je,specularMap:Ze,specularColorMap:We,specularIntensityMap:ze,transmission:U,transmissionMap:Xe,thicknessMap:et,gradientMap:ut,opaque:P.transparent===!1&&P.blending===Ol,alphaMap:re,alphaTest:ge,combine:P.combine,mapUv:Le&&x(P.map.channel),aoMapUv:$&&x(P.aoMap.channel),lightMapUv:Me&&x(P.lightMap.channel),bumpMapUv:ve&&x(P.bumpMap.channel),normalMapUv:me&&x(P.normalMap.channel),displacementMapUv:pe&&x(P.displacementMap.channel),emissiveMapUv:$e&&x(P.emissiveMap.channel),metalnessMapUv:_e&&x(P.metalnessMap.channel),roughnessMapUv:Fe&&x(P.roughnessMap.channel),anisotropyMapUv:ae&&x(P.anisotropyMap.channel),clearcoatMapUv:be&&x(P.clearcoatMap.channel),clearcoatNormalMapUv:Be&&x(P.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Te&&x(P.clearcoatRoughnessMap.channel),iridescenceMapUv:Ve&&x(P.iridescenceMap.channel),iridescenceThicknessMapUv:He&&x(P.iridescenceThicknessMap.channel),sheenColorMapUv:we&&x(P.sheenColorMap.channel),sheenRoughnessMapUv:je&&x(P.sheenRoughnessMap.channel),specularMapUv:Ze&&x(P.specularMap.channel),specularColorMapUv:We&&x(P.specularColorMap.channel),specularIntensityMapUv:ze&&x(P.specularIntensityMap.channel),transmissionMapUv:Xe&&x(P.transmissionMap.channel),thicknessMapUv:et&&x(P.thicknessMap.channel),alphaMapUv:re&&x(P.alphaMap.channel),vertexTangents:!!Y.attributes.tangent&&(me||Ne),vertexColors:P.vertexColors,vertexAlphas:P.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,vertexUv1s:Ke,vertexUv2s:nt,vertexUv3s:Bt,pointsUvs:H.isPoints===!0&&!!Y.attributes.uv&&(Le||re),fog:!!V,useFog:P.fog===!0,fogExp2:V&&V.isFogExp2,flatShading:P.flatShading===!0,sizeAttenuation:P.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:H.isSkinnedMesh===!0,morphTargets:Y.morphAttributes.position!==void 0,morphNormals:Y.morphAttributes.normal!==void 0,morphColors:Y.morphAttributes.color!==void 0,morphTargetsCount:j,morphTextureStride:X,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:P.dithering,shadowMapEnabled:n.shadowMap.enabled&&F.length>0,shadowMapType:n.shadowMap.type,toneMapping:P.toneMapped?n.toneMapping:Fs,useLegacyLights:n.useLegacyLights,premultipliedAlpha:P.premultipliedAlpha,doubleSided:P.side===xi,flipSided:P.side===Ir,useDepthPacking:P.depthPacking>=0,depthPacking:P.depthPacking||0,index0AttributeName:P.index0AttributeName,extensionDerivatives:ye&&P.extensions.derivatives===!0,extensionFragDepth:ye&&P.extensions.fragDepth===!0,extensionDrawBuffers:ye&&P.extensions.drawBuffers===!0,extensionShaderTextureLOD:ye&&P.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||r.has("EXT_shader_texture_lod"),customProgramCacheKey:P.customProgramCacheKey()}}function g(P){const I=[];if(P.shaderID?I.push(P.shaderID):(I.push(P.customVertexShaderID),I.push(P.customFragmentShaderID)),P.defines!==void 0)for(const F in P.defines)I.push(F),I.push(P.defines[F]);return P.isRawShaderMaterial===!1&&(_(I,P),E(I,P),I.push(n.outputColorSpace)),I.push(P.customProgramCacheKey),I.join()}function _(P,I){P.push(I.precision),P.push(I.outputColorSpace),P.push(I.envMapMode),P.push(I.envMapCubeUVHeight),P.push(I.mapUv),P.push(I.alphaMapUv),P.push(I.lightMapUv),P.push(I.aoMapUv),P.push(I.bumpMapUv),P.push(I.normalMapUv),P.push(I.displacementMapUv),P.push(I.emissiveMapUv),P.push(I.metalnessMapUv),P.push(I.roughnessMapUv),P.push(I.anisotropyMapUv),P.push(I.clearcoatMapUv),P.push(I.clearcoatNormalMapUv),P.push(I.clearcoatRoughnessMapUv),P.push(I.iridescenceMapUv),P.push(I.iridescenceThicknessMapUv),P.push(I.sheenColorMapUv),P.push(I.sheenRoughnessMapUv),P.push(I.specularMapUv),P.push(I.specularColorMapUv),P.push(I.specularIntensityMapUv),P.push(I.transmissionMapUv),P.push(I.thicknessMapUv),P.push(I.combine),P.push(I.fogExp2),P.push(I.sizeAttenuation),P.push(I.morphTargetsCount),P.push(I.morphAttributeCount),P.push(I.numDirLights),P.push(I.numPointLights),P.push(I.numSpotLights),P.push(I.numSpotLightMaps),P.push(I.numHemiLights),P.push(I.numRectAreaLights),P.push(I.numDirLightShadows),P.push(I.numPointLightShadows),P.push(I.numSpotLightShadows),P.push(I.numSpotLightShadowsWithMaps),P.push(I.shadowMapType),P.push(I.toneMapping),P.push(I.numClippingPlanes),P.push(I.numClipIntersection),P.push(I.depthPacking)}function E(P,I){a.disableAll(),I.isWebGL2&&a.enable(0),I.supportsVertexTextures&&a.enable(1),I.instancing&&a.enable(2),I.instancingColor&&a.enable(3),I.matcap&&a.enable(4),I.envMap&&a.enable(5),I.normalMapObjectSpace&&a.enable(6),I.normalMapTangentSpace&&a.enable(7),I.clearcoat&&a.enable(8),I.iridescence&&a.enable(9),I.alphaTest&&a.enable(10),I.vertexColors&&a.enable(11),I.vertexAlphas&&a.enable(12),I.vertexUv1s&&a.enable(13),I.vertexUv2s&&a.enable(14),I.vertexUv3s&&a.enable(15),I.vertexTangents&&a.enable(16),I.anisotropy&&a.enable(17),P.push(a.mask),a.disableAll(),I.fog&&a.enable(0),I.useFog&&a.enable(1),I.flatShading&&a.enable(2),I.logarithmicDepthBuffer&&a.enable(3),I.skinning&&a.enable(4),I.morphTargets&&a.enable(5),I.morphNormals&&a.enable(6),I.morphColors&&a.enable(7),I.premultipliedAlpha&&a.enable(8),I.shadowMapEnabled&&a.enable(9),I.useLegacyLights&&a.enable(10),I.doubleSided&&a.enable(11),I.flipSided&&a.enable(12),I.useDepthPacking&&a.enable(13),I.dithering&&a.enable(14),I.transmission&&a.enable(15),I.sheen&&a.enable(16),I.opaque&&a.enable(17),I.pointsUvs&&a.enable(18),P.push(a.mask)}function A(P){const I=v[P.type];let F;if(I){const N=Hs[I];F=Xg.clone(N.uniforms)}else F=P.uniforms;return F}function M(P,I){let F;for(let N=0,H=c.length;N0?r.push(g):m.transparent===!0?i.push(g):t.push(g)}function l(d,p,m,v,x,y){const g=o(d,p,m,v,x,y);m.transmission>0?r.unshift(g):m.transparent===!0?i.unshift(g):t.unshift(g)}function c(d,p){t.length>1&&t.sort(d||hH),r.length>1&&r.sort(p||H2),i.length>1&&i.sort(p||H2)}function u(){for(let d=e,p=n.length;d=s.length?(o=new V2,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function mH(){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 Q,color:new rt};break;case"SpotLight":t={position:new Q,direction:new Q,color:new rt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Q,color:new rt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Q,skyColor:new rt,groundColor:new rt};break;case"RectAreaLight":t={color:new rt,position:new Q,halfWidth:new Q,halfHeight:new Q};break}return n[e.id]=t,t}}}function gH(){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 Ge};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let vH=0;function yH(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function _H(n,e){const t=new mH,r=gH(),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 u=0;u<9;u++)i.probe.push(new Q);const s=new Q,o=new bt,a=new bt;function l(u,d){let p=0,m=0,v=0;for(let F=0;F<9;F++)i.probe[F].set(0,0,0);let x=0,y=0,g=0,_=0,E=0,A=0,M=0,T=0,R=0,B=0;u.sort(yH);const P=d===!0?Math.PI:1;for(let F=0,N=u.length;F0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=it.LTC_FLOAT_1,i.rectAreaLTC2=it.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=it.LTC_HALF_1,i.rectAreaLTC2=it.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 I=i.hash;(I.directionalLength!==x||I.pointLength!==y||I.spotLength!==g||I.rectAreaLength!==_||I.hemiLength!==E||I.numDirectionalShadows!==A||I.numPointShadows!==M||I.numSpotShadows!==T||I.numSpotMaps!==R)&&(i.directional.length=x,i.spot.length=g,i.rectArea.length=_,i.point.length=y,i.hemi.length=E,i.directionalShadow.length=A,i.directionalShadowMap.length=A,i.pointShadow.length=M,i.pointShadowMap.length=M,i.spotShadow.length=T,i.spotShadowMap.length=T,i.directionalShadowMatrix.length=A,i.pointShadowMatrix.length=M,i.spotLightMatrix.length=T+R-B,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=B,I.directionalLength=x,I.pointLength=y,I.spotLength=g,I.rectAreaLength=_,I.hemiLength=E,I.numDirectionalShadows=A,I.numPointShadows=M,I.numSpotShadows=T,I.numSpotMaps=R,i.version=vH++)}function c(u,d){let p=0,m=0,v=0,x=0,y=0;const g=d.matrixWorldInverse;for(let _=0,E=u.length;_=a.length?(l=new W2(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class ch extends or{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Gb,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 qg extends or{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 EH=`void main() { gl_Position = vec4( position, 1.0 ); }`,SH=`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 AH(n,e,t){let r=new Jg;const i=new Ge,s=new Ge,o=new pn,a=new ch({depthPacking:yx}),l=new qg,c={},u=t.maxTextureSize,d={[Us]:Ir,[Ir]:Us,[xi]:xi},p=new wi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ge},radius:{value:4}},vertexShader:EH,fragmentShader:SH}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const v=new Dt;v.setAttribute("position",new un(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Gn(v,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=fg;let g=this.type;this.render=function(M,T,R){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||M.length===0)return;const B=n.getRenderTarget(),P=n.getActiveCubeFace(),I=n.getActiveMipmapLevel(),F=n.state;F.setBlending(Lo),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const N=g!==Os&&this.type===Os,H=g===Os&&this.type!==Os;for(let V=0,Y=M.length;Vu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/G.x),i.x=s.x*G.x,ee.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/G.y),i.y=s.y*G.y,ee.mapSize.y=s.y)),ee.map===null||N===!0||H===!0){const J=this.type!==Os?{minFilter:Yn,magFilter:Yn}:{};ee.map!==null&&ee.map.dispose(),ee.map=new Hi(i.x,i.y,J),ee.map.texture.name=K.name+".shadowMap",ee.camera.updateProjectionMatrix()}n.setRenderTarget(ee.map),n.clear();const W=ee.getViewportCount();for(let J=0;J0||T.map&&T.alphaTest>0){const F=P.uuid,N=T.uuid;let H=c[F];H===void 0&&(H={},c[F]=H);let V=H[N];V===void 0&&(V=P.clone(),H[N]=V),P=V}if(P.visible=T.visible,P.wireframe=T.wireframe,B===Os?P.side=T.shadowSide!==null?T.shadowSide:T.side:P.side=T.shadowSide!==null?T.shadowSide:d[T.side],P.alphaMap=T.alphaMap,P.alphaTest=T.alphaTest,P.map=T.map,P.clipShadows=T.clipShadows,P.clippingPlanes=T.clippingPlanes,P.clipIntersection=T.clipIntersection,P.displacementMap=T.displacementMap,P.displacementScale=T.displacementScale,P.displacementBias=T.displacementBias,P.wireframeLinewidth=T.wireframeLinewidth,P.linewidth=T.linewidth,R.isPointLight===!0&&P.isMeshDistanceMaterial===!0){const F=n.properties.get(P);F.light=R}return P}function A(M,T,R,B,P){if(M.visible===!1)return;if(M.layers.test(T.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&P===Os)&&(!M.frustumCulled||r.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,M.matrixWorld);const N=e.update(M),H=M.material;if(Array.isArray(H)){const V=N.groups;for(let Y=0,K=V.length;Y=1):G.indexOf("OpenGL ES")!==-1&&(ee=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),K=ee>=2);let W=null,J={};const j=n.getParameter(n.SCISSOR_BOX),X=n.getParameter(n.VIEWPORT),oe=new pn().fromArray(j),se=new pn().fromArray(X);function ce(re,ge,ye,Ke){const nt=new Uint8Array(4),Bt=n.createTexture();n.bindTexture(re,Bt),n.texParameteri(re,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(re,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ht=0;Ht"u"?!1:/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap;let x;const y=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(k,U){return g?new OffscreenCanvas(k,U):Qd("canvas")}function E(k,U,ae,be){let Be=1;if((k.width>be||k.height>be)&&(Be=be/Math.max(k.width,k.height)),Be<1||U===!0)if(typeof HTMLImageElement<"u"&&k instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&k instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&k instanceof ImageBitmap){const Te=U?Tg:Math.floor,Ve=Te(Be*k.width),He=Te(Be*k.height);x===void 0&&(x=_(Ve,He));const we=ae?_(Ve,He):x;return we.width=Ve,we.height=He,we.getContext("2d").drawImage(k,0,0,Ve,He),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+k.width+"x"+k.height+") to ("+Ve+"x"+He+")."),we}else return"data"in k&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+k.width+"x"+k.height+")."),k;return k}function A(k){return Sx(k.width)&&Sx(k.height)}function M(k){return a?!1:k.wrapS!==Dr||k.wrapT!==Dr||k.minFilter!==Yn&&k.minFilter!==vn}function T(k,U){return k.generateMipmaps&&U&&k.minFilter!==Yn&&k.minFilter!==vn}function R(k){n.generateMipmap(k)}function B(k,U,ae,be,Be=!1){if(a===!1)return U;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 Te=U;return U===n.RED&&(ae===n.FLOAT&&(Te=n.R32F),ae===n.HALF_FLOAT&&(Te=n.R16F),ae===n.UNSIGNED_BYTE&&(Te=n.R8)),U===n.RG&&(ae===n.FLOAT&&(Te=n.RG32F),ae===n.HALF_FLOAT&&(Te=n.RG16F),ae===n.UNSIGNED_BYTE&&(Te=n.RG8)),U===n.RGBA&&(ae===n.FLOAT&&(Te=n.RGBA32F),ae===n.HALF_FLOAT&&(Te=n.RGBA16F),ae===n.UNSIGNED_BYTE&&(Te=be===Ut&&Be===!1?n.SRGB8_ALPHA8:n.RGBA8),ae===n.UNSIGNED_SHORT_4_4_4_4&&(Te=n.RGBA4),ae===n.UNSIGNED_SHORT_5_5_5_1&&(Te=n.RGB5_A1)),(Te===n.R16F||Te===n.R32F||Te===n.RG16F||Te===n.RG32F||Te===n.RGBA16F||Te===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Te}function P(k,U,ae){return T(k,ae)===!0||k.isFramebufferTexture&&k.minFilter!==Yn&&k.minFilter!==vn?Math.log2(Math.max(U.width,U.height))+1:k.mipmaps!==void 0&&k.mipmaps.length>0?k.mipmaps.length:k.isCompressedTexture&&Array.isArray(k.image)?U.mipmaps.length:1}function I(k){return k===Yn||k===jd||k===vu?n.NEAREST:n.LINEAR}function F(k){const U=k.target;U.removeEventListener("dispose",F),H(U),U.isVideoTexture&&v.delete(U)}function N(k){const U=k.target;U.removeEventListener("dispose",N),Y(U)}function H(k){const U=r.get(k);if(U.__webglInit===void 0)return;const ae=k.source,be=y.get(ae);if(be){const Be=be[U.__cacheKey];Be.usedTimes--,Be.usedTimes===0&&V(k),Object.keys(be).length===0&&y.delete(ae)}r.remove(k)}function V(k){const U=r.get(k);n.deleteTexture(U.__webglTexture);const ae=k.source,be=y.get(ae);delete be[U.__cacheKey],o.memory.textures--}function Y(k){const U=k.texture,ae=r.get(k),be=r.get(U);if(be.__webglTexture!==void 0&&(n.deleteTexture(be.__webglTexture),o.memory.textures--),k.depthTexture&&k.depthTexture.dispose(),k.isWebGLCubeRenderTarget)for(let Be=0;Be<6;Be++)n.deleteFramebuffer(ae.__webglFramebuffer[Be]),ae.__webglDepthbuffer&&n.deleteRenderbuffer(ae.__webglDepthbuffer[Be]);else{if(n.deleteFramebuffer(ae.__webglFramebuffer),ae.__webglDepthbuffer&&n.deleteRenderbuffer(ae.__webglDepthbuffer),ae.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ae.__webglMultisampledFramebuffer),ae.__webglColorRenderbuffer)for(let Be=0;Be=l&&console.warn("THREE.WebGLTextures: Trying to use "+k+" texture units while this GPU supports only "+l),K+=1,k}function W(k){const U=[];return U.push(k.wrapS),U.push(k.wrapT),U.push(k.wrapR||0),U.push(k.magFilter),U.push(k.minFilter),U.push(k.anisotropy),U.push(k.internalFormat),U.push(k.format),U.push(k.type),U.push(k.generateMipmaps),U.push(k.premultiplyAlpha),U.push(k.flipY),U.push(k.unpackAlignment),U.push(k.colorSpace),U.join()}function J(k,U){const ae=r.get(k);if(k.isVideoTexture&&Ce(k),k.isRenderTargetTexture===!1&&k.version>0&&ae.__version!==k.version){const be=k.image;if(be===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(be.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Le(ae,k,U);return}}t.bindTexture(n.TEXTURE_2D,ae.__webglTexture,n.TEXTURE0+U)}function j(k,U){const ae=r.get(k);if(k.version>0&&ae.__version!==k.version){Le(ae,k,U);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ae.__webglTexture,n.TEXTURE0+U)}function X(k,U){const ae=r.get(k);if(k.version>0&&ae.__version!==k.version){Le(ae,k,U);return}t.bindTexture(n.TEXTURE_3D,ae.__webglTexture,n.TEXTURE0+U)}function oe(k,U){const ae=r.get(k);if(k.version>0&&ae.__version!==k.version){Je(ae,k,U);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ae.__webglTexture,n.TEXTURE0+U)}const se={[Ua]:n.REPEAT,[Dr]:n.CLAMP_TO_EDGE,[gu]:n.MIRRORED_REPEAT},ce={[Yn]:n.NEAREST,[jd]:n.NEAREST_MIPMAP_NEAREST,[vu]:n.NEAREST_MIPMAP_LINEAR,[vn]:n.LINEAR,[pg]:n.LINEAR_MIPMAP_NEAREST,[io]:n.LINEAR_MIPMAP_LINEAR},le={[Wb]:n.NEVER,[Zb]:n.ALWAYS,[$b]:n.LESS,[jb]:n.LEQUAL,[Xb]:n.EQUAL,[Kb]:n.GEQUAL,[Jb]:n.GREATER,[Yb]:n.NOTEQUAL};function ue(k,U,ae){if(ae?(n.texParameteri(k,n.TEXTURE_WRAP_S,se[U.wrapS]),n.texParameteri(k,n.TEXTURE_WRAP_T,se[U.wrapT]),(k===n.TEXTURE_3D||k===n.TEXTURE_2D_ARRAY)&&n.texParameteri(k,n.TEXTURE_WRAP_R,se[U.wrapR]),n.texParameteri(k,n.TEXTURE_MAG_FILTER,ce[U.magFilter]),n.texParameteri(k,n.TEXTURE_MIN_FILTER,ce[U.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),(U.wrapS!==Dr||U.wrapT!==Dr)&&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,I(U.magFilter)),n.texParameteri(k,n.TEXTURE_MIN_FILTER,I(U.minFilter)),U.minFilter!==Yn&&U.minFilter!==vn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),U.compareFunction&&(n.texParameteri(k,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(k,n.TEXTURE_COMPARE_FUNC,le[U.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const be=e.get("EXT_texture_filter_anisotropic");if(U.magFilter===Yn||U.minFilter!==vu&&U.minFilter!==io||U.type===zr&&e.has("OES_texture_float_linear")===!1||a===!1&&U.type===ni&&e.has("OES_texture_half_float_linear")===!1)return;(U.anisotropy>1||r.get(U).__currentAnisotropy)&&(n.texParameterf(k,be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(U.anisotropy,i.getMaxAnisotropy())),r.get(U).__currentAnisotropy=U.anisotropy)}}function xe(k,U){let ae=!1;k.__webglInit===void 0&&(k.__webglInit=!0,U.addEventListener("dispose",F));const be=U.source;let Be=y.get(be);Be===void 0&&(Be={},y.set(be,Be));const Te=W(U);if(Te!==k.__cacheKey){Be[Te]===void 0&&(Be[Te]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ae=!0),Be[Te].usedTimes++;const Ve=Be[k.__cacheKey];Ve!==void 0&&(Be[k.__cacheKey].usedTimes--,Ve.usedTimes===0&&V(U)),k.__cacheKey=Te,k.__webglTexture=Be[Te].texture}return ae}function Le(k,U,ae){let be=n.TEXTURE_2D;(U.isDataArrayTexture||U.isCompressedArrayTexture)&&(be=n.TEXTURE_2D_ARRAY),U.isData3DTexture&&(be=n.TEXTURE_3D);const Be=xe(k,U),Te=U.source;t.bindTexture(be,k.__webglTexture,n.TEXTURE0+ae);const Ve=r.get(Te);if(Te.version!==Ve.__version||Be===!0){t.activeTexture(n.TEXTURE0+ae),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,U.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,U.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const He=M(U)&&A(U.image)===!1;let we=E(U.image,He,!1,u);we=st(U,we);const je=A(we)||a,Ze=s.convert(U.format,U.colorSpace);let We=s.convert(U.type),ze=B(U.internalFormat,Ze,We,U.colorSpace);ue(be,U,je);let Xe;const et=U.mipmaps,ut=a&&U.isVideoTexture!==!0,re=Ve.__version===void 0||Be===!0,ge=P(U,we,je);if(U.isDepthTexture)ze=n.DEPTH_COMPONENT,a?U.type===zr?ze=n.DEPTH_COMPONENT32F:U.type===Uo?ze=n.DEPTH_COMPONENT24:U.type===Fa?ze=n.DEPTH24_STENCIL8:ze=n.DEPTH_COMPONENT16:U.type===zr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),U.format===ka&&ze===n.DEPTH_COMPONENT&&U.type!==mg&&U.type!==Uo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),U.type=Uo,We=s.convert(U.type)),U.format===Fl&&ze===n.DEPTH_COMPONENT&&(ze=n.DEPTH_STENCIL,U.type!==Fa&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),U.type=Fa,We=s.convert(U.type))),re&&(ut?t.texStorage2D(n.TEXTURE_2D,1,ze,we.width,we.height):t.texImage2D(n.TEXTURE_2D,0,ze,we.width,we.height,0,Ze,We,null));else if(U.isDataTexture)if(et.length>0&&je){ut&&re&&t.texStorage2D(n.TEXTURE_2D,ge,ze,et[0].width,et[0].height);for(let ye=0,Ke=et.length;ye>=1,Ke>>=1}}else if(et.length>0&&je){ut&&re&&t.texStorage2D(n.TEXTURE_2D,ge,ze,et[0].width,et[0].height);for(let ye=0,Ke=et.length;ye0&&re++,t.texStorage2D(n.TEXTURE_CUBE_MAP,re,Xe,we[0].width,we[0].height));for(let ye=0;ye<6;ye++)if(He){et?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,0,0,we[ye].width,we[ye].height,We,ze,we[ye].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,Xe,we[ye].width,we[ye].height,0,We,ze,we[ye].data);for(let Ke=0;Ke=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Be<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,be,Be,r.get(ae).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function $(k,U,ae){if(n.bindRenderbuffer(n.RENDERBUFFER,k),U.depthBuffer&&!U.stencilBuffer){let be=n.DEPTH_COMPONENT16;if(ae||Ne(U)){const Be=U.depthTexture;Be&&Be.isDepthTexture&&(Be.type===zr?be=n.DEPTH_COMPONENT32F:Be.type===Uo&&(be=n.DEPTH_COMPONENT24));const Te=Fe(U);Ne(U)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Te,be,U.width,U.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Te,be,U.width,U.height)}else n.renderbufferStorage(n.RENDERBUFFER,be,U.width,U.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,k)}else if(U.depthBuffer&&U.stencilBuffer){const be=Fe(U);ae&&Ne(U)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,be,n.DEPTH24_STENCIL8,U.width,U.height):Ne(U)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,be,n.DEPTH24_STENCIL8,U.width,U.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,U.width,U.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,k)}else{const be=U.isWebGLMultipleRenderTargets===!0?U.texture:[U.texture];for(let Be=0;Be0&&Ne(k)===!1){const He=Te?U:[U];ae.__webglMultisampledFramebuffer=n.createFramebuffer(),ae.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ae.__webglMultisampledFramebuffer);for(let we=0;we0&&Ne(k)===!1){const U=k.isWebGLMultipleRenderTargets?k.texture:[k.texture],ae=k.width,be=k.height;let Be=n.COLOR_BUFFER_BIT;const Te=[],Ve=k.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,He=r.get(k),we=k.isWebGLMultipleRenderTargets===!0;if(we)for(let je=0;je0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&U.__useRenderToTexture!==!1}function Ce(k){const U=o.render.frame;v.get(k)!==U&&(v.set(k,U),k.update())}function st(k,U){const ae=k.colorSpace,be=k.format,Be=k.type;return k.isCompressedTexture===!0||k.format===Mg||ae!==ks&&ae!==Ga&&(ae===Ut?a===!1?e.has("EXT_sRGB")===!0&&be===ri?(k.format=Mg,k.minFilter=vn,k.generateMipmaps=!1):U=Mx.sRGBToLinear(U):(be!==ri||Be!==so)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ae)),U}this.allocateTextureUnit=G,this.resetTextureUnits=ee,this.setTexture2D=J,this.setTexture2DArray=j,this.setTexture3D=X,this.setTextureCube=oe,this.rebindTextures=me,this.setupRenderTarget=pe,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=_e,this.setupDepthRenderbuffer=ve,this.setupFrameBufferTexture=Pe,this.useMultisampledRTT=Ne}function $2(n,e,t){const r=t.isWebGL2;function i(s,o=Ga){let a;if(s===so)return n.UNSIGNED_BYTE;if(s===z1)return n.UNSIGNED_SHORT_4_4_4_4;if(s===G1)return n.UNSIGNED_SHORT_5_5_5_1;if(s===Rb)return n.BYTE;if(s===Pb)return n.SHORT;if(s===mg)return n.UNSIGNED_SHORT;if(s===N1)return n.INT;if(s===Uo)return n.UNSIGNED_INT;if(s===zr)return n.FLOAT;if(s===ni)return r?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Bb)return n.ALPHA;if(s===ri)return n.RGBA;if(s===Ib)return n.LUMINANCE;if(s===Db)return n.LUMINANCE_ALPHA;if(s===ka)return n.DEPTH_COMPONENT;if(s===Fl)return n.DEPTH_STENCIL;if(s===Mg)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===H1)return n.RED;if(s===V1)return n.RED_INTEGER;if(s===Lb)return n.RG;if(s===W1)return n.RG_INTEGER;if(s===$1)return n.RGBA_INTEGER;if(s===gg||s===vg||s===yg||s===_g)if(o===Ut)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===gg)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===vg)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===yg)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===_g)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===gg)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===vg)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===yg)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===_g)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===X1||s===j1||s===J1||s===Y1)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===X1)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===j1)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===J1)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Y1)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Ob)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===K1||s===Z1)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===K1)return o===Ut?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Z1)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Q1||s===q1||s===ex||s===tx||s===nx||s===rx||s===ix||s===sx||s===ox||s===ax||s===lx||s===cx||s===ux||s===fx)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Q1)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===q1)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===ex)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===tx)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===nx)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===rx)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===ix)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===sx)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===ox)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===ax)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===lx)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===cx)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===ux)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===fx)return o===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===xg)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===xg)return o===Ut?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===Ub||s===dx||s===hx||s===px)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===xg)return a.COMPRESSED_RED_RGTC1_EXT;if(s===dx)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===hx)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===px)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Fa?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 X2 extends pr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class $o extends en{constructor(){super(),this.isGroup=!0,this.type="Group"}}const TH={type:"move"};class Zx{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new $o,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 $o,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new $o,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Q),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 x of e.hand.values()){const y=t.getJointPose(x,r),g=this._getHandJoint(c,x);y!==null&&(g.matrix.fromArray(y.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=y.radius),g.visible=y!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],p=u.position.distanceTo(d.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(TH)))}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 $o;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class j2 extends bn{constructor(e,t,r,i,s,o,a,l,c,u){if(u=u!==void 0?u:ka,u!==ka&&u!==Fl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&u===ka&&(r=Uo),r===void 0&&u===Fl&&(r=Fa),super(null,i,s,o,a,l,u,r,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Yn,this.minFilter=l!==void 0?l:Yn,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 CH extends Fo{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,d=null,p=null,m=null,v=null;const x=t.getContextAttributes();let y=null,g=null;const _=[],E=[];let A=null;const M=new pr;M.layers.enable(1),M.viewport=new pn;const T=new pr;T.layers.enable(2),T.viewport=new pn;const R=[M,T],B=new X2;B.layers.enable(1),B.layers.enable(2);let P=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getCamera=function(){},this.setUserCamera=function(X){A=X},this.getController=function(X){let oe=_[X];return oe===void 0&&(oe=new Zx,_[X]=oe),oe.getTargetRaySpace()},this.getControllerGrip=function(X){let oe=_[X];return oe===void 0&&(oe=new Zx,_[X]=oe),oe.getGripSpace()},this.getHand=function(X){let oe=_[X];return oe===void 0&&(oe=new Zx,_[X]=oe),oe.getHandSpace()};function F(X){const oe=E.indexOf(X.inputSource);if(oe===-1)return;const se=_[oe];se!==void 0&&(se.update(X.inputSource,X.frame,c||o),se.dispatchEvent({type:X.type,data:X.inputSource}))}function N(){i.removeEventListener("select",F),i.removeEventListener("selectstart",F),i.removeEventListener("selectend",F),i.removeEventListener("squeeze",F),i.removeEventListener("squeezestart",F),i.removeEventListener("squeezeend",F),i.removeEventListener("end",N),i.removeEventListener("inputsourceschange",H);for(let X=0;X<_.length;X++){const oe=E[X];oe!==null&&(E[X]=null,_[X].disconnect(oe))}P=null,I=null,e.setRenderTarget(y),m=null,p=null,d=null,i=null,g=null,j.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){a=X,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(X){c=X},this.getBaseLayer=function(){return p!==null?p:m},this.getBinding=function(){return d},this.getFrame=function(){return v},this.getSession=function(){return i},this.setSession=async function(X){if(i=X,i!==null){if(y=e.getRenderTarget(),i.addEventListener("select",F),i.addEventListener("selectstart",F),i.addEventListener("selectend",F),i.addEventListener("squeeze",F),i.addEventListener("squeezestart",F),i.addEventListener("squeezeend",F),i.addEventListener("end",N),i.addEventListener("inputsourceschange",H),x.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const oe={antialias:i.renderState.layers===void 0?x.antialias:!0,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(i,t,oe),i.updateRenderState({baseLayer:m}),g=new Hi(m.framebufferWidth,m.framebufferHeight,{format:ri,type:so,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil})}else{let oe=null,se=null,ce=null;x.depth&&(ce=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,oe=x.stencil?Fl:ka,se=x.stencil?Fa:Uo);const le={colorFormat:t.RGBA8,depthFormat:ce,scaleFactor:s};d=new XRWebGLBinding(i,t),p=d.createProjectionLayer(le),i.updateRenderState({layers:[p]}),g=new Hi(p.textureWidth,p.textureHeight,{format:ri,type:so,depthTexture:new j2(p.textureWidth,p.textureHeight,se,void 0,void 0,void 0,void 0,void 0,void 0,oe),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0});const ue=e.properties.get(g);ue.__ignoreDepthValues=p.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),j.setContext(i),j.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function H(X){for(let oe=0;oe=0&&(E[ce]=null,_[ce].disconnect(se))}for(let oe=0;oe=E.length){E.push(se),ce=ue;break}else if(E[ue]===null){E[ue]=se,ce=ue;break}if(ce===-1)break}const le=_[ce];le&&le.connect(se)}}const V=new Q,Y=new Q;function K(X,oe,se){V.setFromMatrixPosition(oe.matrixWorld),Y.setFromMatrixPosition(se.matrixWorld);const ce=V.distanceTo(Y),le=oe.projectionMatrix.elements,ue=se.projectionMatrix.elements,xe=le[14]/(le[10]-1),Le=le[14]/(le[10]+1),Je=(le[9]+1)/le[5],Pe=(le[9]-1)/le[5],$=(le[8]-1)/le[0],Me=(ue[8]+1)/ue[0],ve=xe*$,me=xe*Me,pe=ce/(-$+Me),$e=pe*-$;oe.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX($e),X.translateZ(pe),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert();const _e=xe+pe,Fe=Le+pe,Ne=ve-$e,Ce=me+(ce-$e),st=Je*Le/Fe*_e,k=Pe*Le/Fe*_e;X.projectionMatrix.makePerspective(Ne,Ce,st,k,_e,Fe),X.projectionMatrixInverse.copy(X.projectionMatrix).invert()}function ee(X,oe){oe===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(oe.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCameraXR=function(X){if(i===null)return X;A&&(X=A),B.near=T.near=M.near=X.near,B.far=T.far=M.far=X.far,(P!==B.near||I!==B.far)&&(i.updateRenderState({depthNear:B.near,depthFar:B.far}),P=B.near,I=B.far);const oe=X.parent,se=B.cameras;ee(B,oe);for(let ce=0;ce0&&(y.alphaTest.value=g.alphaTest);const _=e.get(g).envMap;if(_&&(y.envMap.value=_,y.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=g.reflectivity,y.ior.value=g.ior,y.refractionRatio.value=g.refractionRatio),g.lightMap){y.lightMap.value=g.lightMap;const E=n.useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=g.lightMapIntensity*E,t(g.lightMap,y.lightMapTransform)}g.aoMap&&(y.aoMap.value=g.aoMap,y.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,y.aoMapTransform))}function o(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,g.map&&(y.map.value=g.map,t(g.map,y.mapTransform))}function a(y,g){y.dashSize.value=g.dashSize,y.totalSize.value=g.dashSize+g.gapSize,y.scale.value=g.scale}function l(y,g,_,E){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.size.value=g.size*_,y.scale.value=E*.5,g.map&&(y.map.value=g.map,t(g.map,y.uvTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,t(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function c(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.rotation.value=g.rotation,g.map&&(y.map.value=g.map,t(g.map,y.mapTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,t(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function u(y,g){y.specular.value.copy(g.specular),y.shininess.value=Math.max(g.shininess,1e-4)}function d(y,g){g.gradientMap&&(y.gradientMap.value=g.gradientMap)}function p(y,g){y.metalness.value=g.metalness,g.metalnessMap&&(y.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,y.metalnessMapTransform)),y.roughness.value=g.roughness,g.roughnessMap&&(y.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,y.roughnessMapTransform)),e.get(g).envMap&&(y.envMapIntensity.value=g.envMapIntensity)}function m(y,g,_){y.ior.value=g.ior,g.sheen>0&&(y.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),y.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(y.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,y.sheenColorMapTransform)),g.sheenRoughnessMap&&(y.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,y.sheenRoughnessMapTransform))),g.clearcoat>0&&(y.clearcoat.value=g.clearcoat,y.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(y.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,y.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(y.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Ir&&y.clearcoatNormalScale.value.negate())),g.iridescence>0&&(y.iridescence.value=g.iridescence,y.iridescenceIOR.value=g.iridescenceIOR,y.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(y.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,y.iridescenceMapTransform)),g.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),g.transmission>0&&(y.transmission.value=g.transmission,y.transmissionSamplerMap.value=_.texture,y.transmissionSamplerSize.value.set(_.width,_.height),g.transmissionMap&&(y.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,y.transmissionMapTransform)),y.thickness.value=g.thickness,g.thicknessMap&&(y.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=g.attenuationDistance,y.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(y.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(y.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=g.specularIntensity,y.specularColor.value.copy(g.specularColor),g.specularColorMap&&(y.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,y.specularColorMapTransform)),g.specularIntensityMap&&(y.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,y.specularIntensityMapTransform))}function v(y,g){g.matcap&&(y.matcap.value=g.matcap)}function x(y,g){const _=e.get(g).light;y.referencePosition.value.setFromMatrixPosition(_.matrixWorld),y.nearDistance.value=_.shadow.camera.near,y.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function RH(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,E){const A=E.program;r.uniformBlockBinding(_,A)}function c(_,E){let A=i[_.id];A===void 0&&(v(_),A=u(_),i[_.id]=A,_.addEventListener("dispose",y));const M=E.program;r.updateUBOMapping(_,M);const T=e.render.frame;s[_.id]!==T&&(p(_),s[_.id]=T)}function u(_){const E=d();_.__bindingPointIndex=E;const A=n.createBuffer(),M=_.__size,T=_.usage;return n.bindBuffer(n.UNIFORM_BUFFER,A),n.bufferData(n.UNIFORM_BUFFER,M,T),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,E,A),A}function d(){for(let _=0;_0){T=A%M;const N=M-T;T!==0&&N-I.boundary<0&&(A+=M-T,P.__offset=A)}A+=I.storage}return T=A%M,T>0&&(A+=M-T),_.__size=A,_.__cache={},this}function x(_){const E={boundary:0,storage:0};return typeof _=="number"?(E.boundary=4,E.storage=4):_.isVector2?(E.boundary=8,E.storage=8):_.isVector3||_.isColor?(E.boundary=16,E.storage=12):_.isVector4?(E.boundary=16,E.storage=16):_.isMatrix3?(E.boundary=48,E.storage=48):_.isMatrix4?(E.boundary=64,E.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),E}function y(_){const E=_.target;E.removeEventListener("dispose",y);const A=o.indexOf(E.__bindingPointIndex);o.splice(A,1),n.deleteBuffer(i[E.id]),delete i[E.id],delete s[E.id]}function g(){for(const _ in i)n.deleteBuffer(i[_]);o=[],i={},s={}}return{bind:l,update:c,dispose:g}}function PH(){const n=Qd("canvas");return n.style.display="block",n}class Qx{constructor(e={}){const{canvas:t=PH(),context:r=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!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 x=null,y=null;const g=[],_=[];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=Ut,this.useLegacyLights=!0,this.toneMapping=Fs,this.toneMappingExposure=1;const E=this;let A=!1,M=0,T=0,R=null,B=-1,P=null;const I=new pn,F=new pn;let N=null;const H=new rt(0);let V=0,Y=t.width,K=t.height,ee=1,G=null,W=null;const J=new pn(0,0,Y,K),j=new pn(0,0,Y,K);let X=!1;const oe=new Jg;let se=!1,ce=!1,le=null;const ue=new bt,xe=new Ge,Le=new Q,Je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Pe(){return R===null?ee:1}let $=r;function Me(b,z){for(let q=0;q0?y=_[_.length-1]:y=null,g.pop(),g.length>0?x=g[g.length-1]:x=null};function wr(b,z,q,Z){if(b.visible===!1)return;if(b.layers.test(z.layers)){if(b.isGroup)q=b.renderOrder;else if(b.isLOD)b.autoUpdate===!0&&b.update(z);else if(b.isLight)y.pushLight(b),b.castShadow&&y.pushShadow(b);else if(b.isSprite){if(!b.frustumCulled||oe.intersectsSprite(b)){Z&&Le.setFromMatrixPosition(b.matrixWorld).applyMatrix4(ue);const Se=U.update(b),Ie=b.material;Ie.visible&&x.push(b,Se,Ie,q,Le.z,null)}}else if((b.isMesh||b.isLine||b.isPoints)&&(!b.frustumCulled||oe.intersectsObject(b))){b.isSkinnedMesh&&b.skeleton.frame!==$e.render.frame&&(b.skeleton.update(),b.skeleton.frame=$e.render.frame);const Se=U.update(b),Ie=b.material;if(Z&&(b.boundingSphere!==void 0?(b.boundingSphere===null&&b.computeBoundingSphere(),Le.copy(b.boundingSphere.center)):(Se.boundingSphere===null&&Se.computeBoundingSphere(),Le.copy(Se.boundingSphere.center)),Le.applyMatrix4(b.matrixWorld).applyMatrix4(ue)),Array.isArray(Ie)){const De=Se.groups;for(let ke=0,de=De.length;ke0&&Jt(ne,Ee,z,q),Z&&pe.viewport(I.copy(Z)),ne.length>0&&Sn(ne,z,q),Ee.length>0&&Sn(Ee,z,q),Se.length>0&&Sn(Se,z,q),pe.buffers.depth.setTest(!0),pe.buffers.depth.setMask(!0),pe.buffers.color.setMask(!0),pe.setPolygonOffset(!1)}function Jt(b,z,q,Z){const ne=me.isWebGL2;le===null&&(le=new Hi(1,1,{generateMipmaps:!0,type:ve.has("EXT_color_buffer_half_float")?ni:so,minFilter:io,samples:ne&&a===!0?4:0})),E.getDrawingBufferSize(xe),ne?le.setSize(xe.x,xe.y):le.setSize(Tg(xe.x),Tg(xe.y));const Ee=E.getRenderTarget();E.setRenderTarget(le),E.getClearColor(H),V=E.getClearAlpha(),V<1&&E.setClearColor(16777215,.5),E.clear();const Se=E.toneMapping;E.toneMapping=Fs,Sn(b,q,Z),Fe.updateMultisampleRenderTarget(le),Fe.updateRenderTargetMipmap(le);let Ie=!1;for(let De=0,ke=z.length;De0),ot=!!q.morphAttributes.position,Qe=!!q.morphAttributes.normal,tt=!!q.morphAttributes.color,yt=Z.toneMapped?E.toneMapping:Fs,Et=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,gt=Et!==void 0?Et.length:0,at=_e.get(Z),At=y.state.lights;if(se===!0&&(ce===!0||b!==P)){const Rt=b===P&&Z.id===B;Ve.setState(Z,b,Rt)}let dt=!1;Z.version===at.__version?(at.needsLights&&at.lightsStateVersion!==At.state.version||at.outputColorSpace!==Ie||ne.isInstancedMesh&&at.instancing===!1||!ne.isInstancedMesh&&at.instancing===!0||ne.isSkinnedMesh&&at.skinning===!1||!ne.isSkinnedMesh&&at.skinning===!0||at.envMap!==De||Z.fog===!0&&at.fog!==Ee||at.numClippingPlanes!==void 0&&(at.numClippingPlanes!==Ve.numPlanes||at.numIntersection!==Ve.numIntersection)||at.vertexAlphas!==ke||at.vertexTangents!==de||at.morphTargets!==ot||at.morphNormals!==Qe||at.morphColors!==tt||at.toneMapping!==yt||me.isWebGL2===!0&&at.morphTargetsCount!==gt)&&(dt=!0):(dt=!0,at.__version=Z.version);let It=at.currentProgram;dt===!0&&(It=cn(Z,z,ne));let on=!1,Ct=!1,Qt=!1;const qt=It.getUniforms(),rn=at.uniforms;if(pe.useProgram(It.program)&&(on=!0,Ct=!0,Qt=!0),Z.id!==B&&(B=Z.id,Ct=!0),on||P!==b){if(qt.setValue($,"projectionMatrix",b.projectionMatrix),me.logarithmicDepthBuffer&&qt.setValue($,"logDepthBufFC",2/(Math.log(b.far+1)/Math.LN2)),P!==b&&(P=b,Ct=!0,Qt=!0),Z.isShaderMaterial||Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshStandardMaterial||Z.envMap){const Rt=qt.map.cameraPosition;Rt!==void 0&&Rt.setValue($,Le.setFromMatrixPosition(b.matrixWorld))}(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial)&&qt.setValue($,"isOrthographic",b.isOrthographicCamera===!0),(Z.isMeshPhongMaterial||Z.isMeshToonMaterial||Z.isMeshLambertMaterial||Z.isMeshBasicMaterial||Z.isMeshStandardMaterial||Z.isShaderMaterial||Z.isShadowMaterial||ne.isSkinnedMesh)&&qt.setValue($,"viewMatrix",b.matrixWorldInverse)}if(ne.isSkinnedMesh){qt.setOptional($,ne,"bindMatrix"),qt.setOptional($,ne,"bindMatrixInverse");const Rt=ne.skeleton;Rt&&(me.floatVertexTextures?(Rt.boneTexture===null&&Rt.computeBoneTexture(),qt.setValue($,"boneTexture",Rt.boneTexture,Fe),qt.setValue($,"boneTextureSize",Rt.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 Ln=q.morphAttributes;if((Ln.position!==void 0||Ln.normal!==void 0||Ln.color!==void 0&&me.isWebGL2===!0)&&je.update(ne,q,It),(Ct||at.receiveShadow!==ne.receiveShadow)&&(at.receiveShadow=ne.receiveShadow,qt.setValue($,"receiveShadow",ne.receiveShadow)),Z.isMeshGouraudMaterial&&Z.envMap!==null&&(rn.envMap.value=De,rn.flipEnvMap.value=De.isCubeTexture&&De.isRenderTargetTexture===!1?-1:1),Ct&&(qt.setValue($,"toneMappingExposure",E.toneMappingExposure),at.needsLights&&bi(rn,Qt),Ee&&Z.fog===!0&&be.refreshFogUniforms(rn,Ee),be.refreshMaterialUniforms(rn,Z,ee,K,le),Qg.upload($,at.uniformsList,rn,Fe)),Z.isShaderMaterial&&Z.uniformsNeedUpdate===!0&&(Qg.upload($,at.uniformsList,rn,Fe),Z.uniformsNeedUpdate=!1),Z.isSpriteMaterial&&qt.setValue($,"center",ne.center),qt.setValue($,"modelViewMatrix",ne.modelViewMatrix),qt.setValue($,"normalMatrix",ne.normalMatrix),qt.setValue($,"modelMatrix",ne.matrixWorld),Z.isShaderMaterial||Z.isRawShaderMaterial){const Rt=Z.uniformsGroups;for(let An=0,Yt=Rt.length;An0&&Fe.useMultisampledRTT(b)===!1?ne=_e.get(b).__webglMultisampledFramebuffer:ne=de,I.copy(b.viewport),F.copy(b.scissor),N=b.scissorTest}else I.copy(J).multiplyScalar(ee).floor(),F.copy(j).multiplyScalar(ee).floor(),N=X;if(pe.bindFramebuffer($.FRAMEBUFFER,ne)&&me.drawBuffers&&Z&&pe.drawBuffers(b,ne),pe.viewport(I),pe.scissor(F),pe.setScissorTest(N),Ee){const De=_e.get(b.texture);$.framebufferTexture2D($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,$.TEXTURE_CUBE_MAP_POSITIVE_X+z,De.__webglTexture,q)}else if(Se){const De=_e.get(b.texture),ke=z||0;$.framebufferTextureLayer($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,De.__webglTexture,q||0,ke)}B=-1},this.readRenderTargetPixels=function(b,z,q,Z,ne,Ee,Se){if(!(b&&b.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ie=_e.get(b).__webglFramebuffer;if(b.isWebGLCubeRenderTarget&&Se!==void 0&&(Ie=Ie[Se]),Ie){pe.bindFramebuffer($.FRAMEBUFFER,Ie);try{const De=b.texture,ke=De.format,de=De.type;if(ke!==ri&&ze.convert(ke)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ot=de===ni&&(ve.has("EXT_color_buffer_half_float")||me.isWebGL2&&ve.has("EXT_color_buffer_float"));if(de!==so&&ze.convert(de)!==$.getParameter($.IMPLEMENTATION_COLOR_READ_TYPE)&&!(de===zr&&(me.isWebGL2||ve.has("OES_texture_float")||ve.has("WEBGL_color_buffer_float")))&&!ot){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}z>=0&&z<=b.width-Z&&q>=0&&q<=b.height-ne&&$.readPixels(z,q,Z,ne,ze.convert(ke),ze.convert(de),Ee)}finally{const De=R!==null?_e.get(R).__webglFramebuffer:null;pe.bindFramebuffer($.FRAMEBUFFER,De)}}},this.copyFramebufferToTexture=function(b,z,q=0){const Z=Math.pow(2,-q),ne=Math.floor(z.image.width*Z),Ee=Math.floor(z.image.height*Z);Fe.setTexture2D(z,0),$.copyTexSubImage2D($.TEXTURE_2D,q,0,0,b.x,b.y,ne,Ee),pe.unbindTexture()},this.copyTextureToTexture=function(b,z,q,Z=0){const ne=z.image.width,Ee=z.image.height,Se=ze.convert(q.format),Ie=ze.convert(q.type);Fe.setTexture2D(q,0),$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,q.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,q.unpackAlignment),z.isDataTexture?$.texSubImage2D($.TEXTURE_2D,Z,b.x,b.y,ne,Ee,Se,Ie,z.image.data):z.isCompressedTexture?$.compressedTexSubImage2D($.TEXTURE_2D,Z,b.x,b.y,z.mipmaps[0].width,z.mipmaps[0].height,Se,z.mipmaps[0].data):$.texSubImage2D($.TEXTURE_2D,Z,b.x,b.y,Se,Ie,z.image),Z===0&&q.generateMipmaps&&$.generateMipmap($.TEXTURE_2D),pe.unbindTexture()},this.copyTextureToTexture3D=function(b,z,q,Z,ne=0){if(E.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ee=b.max.x-b.min.x+1,Se=b.max.y-b.min.y+1,Ie=b.max.z-b.min.z+1,De=ze.convert(Z.format),ke=ze.convert(Z.type);let de;if(Z.isData3DTexture)Fe.setTexture3D(Z,0),de=$.TEXTURE_3D;else if(Z.isDataArrayTexture)Fe.setTexture2DArray(Z,0),de=$.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,Z.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,Z.unpackAlignment);const ot=$.getParameter($.UNPACK_ROW_LENGTH),Qe=$.getParameter($.UNPACK_IMAGE_HEIGHT),tt=$.getParameter($.UNPACK_SKIP_PIXELS),yt=$.getParameter($.UNPACK_SKIP_ROWS),Et=$.getParameter($.UNPACK_SKIP_IMAGES),gt=q.isCompressedTexture?q.mipmaps[0]:q.image;$.pixelStorei($.UNPACK_ROW_LENGTH,gt.width),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,gt.height),$.pixelStorei($.UNPACK_SKIP_PIXELS,b.min.x),$.pixelStorei($.UNPACK_SKIP_ROWS,b.min.y),$.pixelStorei($.UNPACK_SKIP_IMAGES,b.min.z),q.isDataTexture||q.isData3DTexture?$.texSubImage3D(de,ne,z.x,z.y,z.z,Ee,Se,Ie,De,ke,gt.data):q.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),$.compressedTexSubImage3D(de,ne,z.x,z.y,z.z,Ee,Se,Ie,De,gt.data)):$.texSubImage3D(de,ne,z.x,z.y,z.z,Ee,Se,Ie,De,ke,gt),$.pixelStorei($.UNPACK_ROW_LENGTH,ot),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,Qe),$.pixelStorei($.UNPACK_SKIP_PIXELS,tt),$.pixelStorei($.UNPACK_SKIP_ROWS,yt),$.pixelStorei($.UNPACK_SKIP_IMAGES,Et),ne===0&&Z.generateMipmaps&&$.generateMipmap(de),pe.unbindTexture()},this.initTexture=function(b){b.isCubeTexture?Fe.setTextureCube(b,0):b.isData3DTexture?Fe.setTexture3D(b,0):b.isDataArrayTexture||b.isCompressedArrayTexture?Fe.setTexture2DArray(b,0):Fe.setTexture2D(b,0),pe.unbindTexture()},this.resetState=function(){M=0,T=0,R=null,pe.reset(),Xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return oo}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===Ut?Na:vx}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Na?Ut:ks}}class J2 extends Qx{}J2.prototype.isWebGL1Renderer=!0;class e0{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new rt(e),this.density=t}clone(){return new e0(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class t0{constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new rt(e),this.near=t,this.far=r}clone(){return new t0(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class uh extends en{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 fh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Yd,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=zi()}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:dh.clone(),uv:Ei.getInterpolation(dh,n0,ph,r0,K2,eE,Z2,new Ge),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function i0(n,e,t,r,i,s){Xu.subVectors(n,t).addScalar(.5).multiply(r),i!==void 0?(hh.x=s*Xu.x-i*Xu.y,hh.y=i*Xu.x+s*Xu.y):hh.copy(Xu),n.copy(e),n.x+=hh.x,n.y+=hh.y,n.applyMatrix4(Y2)}const s0=new Q,q2=new Q;class eR extends en{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){s0.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(s0);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){s0.setFromMatrixPosition(e.matrixWorld),q2.setFromMatrixPosition(this.matrixWorld);const r=s0.distanceTo(q2)/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 B=e.ray.origin.distanceTo(p);Be.far||t.push({distance:B,point:d.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),_=Math.min(y.count,o.start+o.count);for(let E=g,A=_-1;El)continue;p.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(p);Te.far||t.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:E,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 LH extends bn{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:vn,this.magFilter=s!==void 0?s:vn,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}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 OH extends bn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Yn,this.minFilter=Yn,this.generateMipmaps=!1,this.needsUpdate=!0}}class cE extends bn{constructor(e,t,r,i,s,o,a,l,c,u,d,p){super(null,o,a,l,c,u,i,s,d,p),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class UH extends cE{constructor(e,t,r,i,s,o){super(e,t,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Dr}}class FH extends bn{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 Ws{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 u=r[i],p=r[i+1]-u,m=(o-u)/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 Ge:new Q);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 Q,i=[],s=[],o=[],a=new Q,l=new bt;for(let m=0;m<=e;m++){const v=m/e;i[m]=this.getTangentAt(v,new Q)}s[0]=new Q,o[0]=new Q;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),d=Math.abs(i[0].y),p=Math.abs(i[0].z);u<=c&&(c=u,r.set(1,0,0)),d<=c&&(c=d,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(Kn(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(Kn(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 d0 extends Ws{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 Ge,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,u;this.closed||a>0?c=i[(a-1)%s]:(h0.subVectors(i[0],i[1]).add(i[0]),c=h0);const d=i[a%s],p=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],d=i[o>i.length-3?i.length-1:o+2];return r.set(yR(a,l.x,c.x,u.x,d.x),yR(a,l.y,c.y,u.y,d.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 d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ku extends Dt{constructor(e=[new Ge(0,-.5),new Ge(.5,0),new Ge(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=Kn(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,d=new Q,p=new Ge,m=new Q,v=new Q,x=new Q;let y=0,g=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:y=e[_+1].x-e[_].x,g=e[_+1].y-e[_].y,m.x=g*1,m.y=-y,m.z=g*0,x.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:y=e[_+1].x-e[_].x,g=e[_+1].y-e[_].y,m.x=g*1,m.y=-y,m.z=g*0,v.copy(m),m.x+=x.x,m.y+=x.y,m.z+=x.z,m.normalize(),l.push(m.x,m.y,m.z),x.copy(v)}for(let _=0;_<=t;_++){const E=r+_*u*i,A=Math.sin(E),M=Math.cos(E);for(let T=0;T<=e.length-1;T++){d.x=e[T].x*A,d.y=e[T].y,d.z=e[T].x*M,o.push(d.x,d.y,d.z),p.x=_/t,p.y=T/(e.length-1),a.push(p.x,p.y);const R=l[3*T+0]*A,B=l[3*T+1],P=l[3*T+0]*M;c.push(R,B,P)}}for(let _=0;_0&&E(!0),t>0&&E(!1)),this.setIndex(u),this.setAttribute("position",new mt(d,3)),this.setAttribute("normal",new mt(p,3)),this.setAttribute("uv",new mt(m,2));function _(){const A=new Q,M=new Q;let T=0;const R=(t-e)/r;for(let B=0;B<=s;B++){const P=[],I=B/s,F=I*(t-e)+e;for(let N=0;N<=i;N++){const H=N/i,V=H*l+a,Y=Math.sin(V),K=Math.cos(V);M.x=F*Y,M.y=-I*r+y,M.z=F*K,d.push(M.x,M.y,M.z),A.set(Y,R,K).normalize(),p.push(A.x,A.y,A.z),m.push(H,1-I),P.push(v++)}x.push(P)}for(let B=0;B.9&&R<.1&&(E<.2&&(o[_+0]+=1),A<.2&&(o[_+2]+=1),M<.2&&(o[_+4]+=1))}}function p(_){s.push(_.x,_.y,_.z)}function m(_,E){const A=_*3;E.x=e[A+0],E.y=e[A+1],E.z=e[A+2]}function v(){const _=new Q,E=new Q,A=new Q,M=new Q,T=new Ge,R=new Ge,B=new Ge;for(let P=0,I=0;P80*t){a=c=n[0],l=u=n[1];for(let v=t;vc&&(c=d),p>u&&(u=p);m=Math.max(c-a,u-l),m=m!==0?32767/m:0}return Mh(s,o,t,a,l,m,0),o}};function AR(n,e,t,r,i){let s,o;if(i===a5(n,e,t,r)>0)for(s=e;s=e;s-=r)o=TR(s,n[s],n[s+1],o);return o&&y0(o,o.next)&&(Ch(o),o=o.next),o}function ec(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(y0(t,t.next)||Hn(t.prev,t,t.next)===0)){if(Ch(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Mh(n,e,t,r,i,s,o){if(!n)return;!o&&s&&t5(n,r,i,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?jH(n,r,i,s):XH(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Ch(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=JH(ec(n),e,t),Mh(n,e,t,r,i,s,2)):o===2&&YH(n,e,t,r,i,s):Mh(ec(n),e,t,r,i,s,1);break}}}function XH(n){const e=n.prev,t=n,r=n.next;if(Hn(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,u=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>=u&&v.x<=p&&v.y>=d&&v.y<=m&&Zu(i,a,s,l,o,c,v.x,v.y)&&Hn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function jH(n,e,t,r){const i=n.prev,s=n,o=n.next;if(Hn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,u=i.y,d=s.y,p=o.y,m=al?a>c?a:c:l>c?l:c,y=u>d?u>p?u:p:d>p?d:p,g=xE(m,v,e,t,r),_=xE(x,y,e,t,r);let E=n.prevZ,A=n.nextZ;for(;E&&E.z>=g&&A&&A.z<=_;){if(E.x>=m&&E.x<=x&&E.y>=v&&E.y<=y&&E!==i&&E!==o&&Zu(a,u,l,d,c,p,E.x,E.y)&&Hn(E.prev,E,E.next)>=0||(E=E.prevZ,A.x>=m&&A.x<=x&&A.y>=v&&A.y<=y&&A!==i&&A!==o&&Zu(a,u,l,d,c,p,A.x,A.y)&&Hn(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;E&&E.z>=g;){if(E.x>=m&&E.x<=x&&E.y>=v&&E.y<=y&&E!==i&&E!==o&&Zu(a,u,l,d,c,p,E.x,E.y)&&Hn(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;A&&A.z<=_;){if(A.x>=m&&A.x<=x&&A.y>=v&&A.y<=y&&A!==i&&A!==o&&Zu(a,u,l,d,c,p,A.x,A.y)&&Hn(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function JH(n,e,t){let r=n;do{const i=r.prev,s=r.next.next;!y0(i,s)&&wR(i,r,r.next,s)&&Th(i,s)&&Th(s,i)&&(e.push(i.i/t|0),e.push(r.i/t|0),e.push(s.i/t|0),Ch(r),Ch(r.next),r=n=s),r=r.next}while(r!==n);return ec(r)}function YH(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&i5(o,a)){let l=MR(o,a);o=ec(o,o.next),l=ec(l,l.next),Mh(o,e,t,r,i,s,0),Mh(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function KH(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&&Zu(oi.x||t.x===i.x&&e5(i,t)))&&(i=t,u=d)),t=t.next;while(t!==a);return i}function e5(n,e){return Hn(n.prev,n,e.prev)<0&&Hn(e.next,n,n.next)<0}function t5(n,e,t,r){let i=n;do i.z===0&&(i.z=xE(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,n5(i)}function n5(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 xE(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 r5(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 i5(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!s5(n,e)&&(Th(n,e)&&Th(e,n)&&o5(n,e)&&(Hn(n.prev,n,e.prev)||Hn(n,e.prev,e))||y0(n,e)&&Hn(n.prev,n,n.next)>0&&Hn(e.prev,e,e.next)>0)}function Hn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function y0(n,e){return n.x===e.x&&n.y===e.y}function wR(n,e,t,r){const i=x0(Hn(n,e,t)),s=x0(Hn(n,e,r)),o=x0(Hn(t,r,n)),a=x0(Hn(t,r,e));return!!(i!==s&&o!==a||i===0&&_0(n,t,e)||s===0&&_0(n,r,e)||o===0&&_0(t,n,r)||a===0&&_0(t,e,r))}function _0(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 x0(n){return n>0?1:n<0?-1:0}function s5(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&&wR(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Th(n,e){return Hn(n.prev,n,n.next)<0?Hn(n,e,n.next)>=0&&Hn(n,n.prev,e)>=0:Hn(n,e,n.prev)<0||Hn(n,n.next,e)<0}function o5(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 MR(n,e){const t=new EE(n.i,n.x,n.y),r=new EE(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 TR(n,e,t,r){const i=new EE(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 Ch(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 EE(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 a5(n,e,t,r){let i=0;for(let s=e,o=t-r;s2&&n[e-1].equals(n[0])&&n.pop()}function bR(n,e){for(let t=0;tNumber.EPSILON){const U=Math.sqrt(st),ae=Math.sqrt(Ne*Ne+Ce*Ce),be=Me.x-Fe/U,Be=Me.y+_e/U,Te=ve.x-Ce/ae,Ve=ve.y+Ne/ae,He=((Te-be)*Ce-(Ve-Be)*Ne)/(_e*Ce-Fe*Ne);me=be+_e*He-$.x,pe=Be+Fe*He-$.y;const we=me*me+pe*pe;if(we<=2)return new Ge(me,pe);$e=Math.sqrt(we/2)}else{let U=!1;_e>Number.EPSILON?Ne>Number.EPSILON&&(U=!0):_e<-Number.EPSILON?Ne<-Number.EPSILON&&(U=!0):Math.sign(Fe)===Math.sign(Ce)&&(U=!0),U?(me=-Fe,pe=_e,$e=Math.sqrt(st)):(me=_e,pe=Fe,$e=Math.sqrt(st/2))}return new Ge(me/$e,pe/$e)}const W=[];for(let $=0,Me=V.length,ve=Me-1,me=$+1;$=0;$--){const Me=$/y,ve=m*Math.cos(Me*Math.PI/2),me=v*Math.sin(Me*Math.PI/2)+x;for(let pe=0,$e=V.length;pe<$e;pe++){const _e=Y(V[pe],W[pe],me);ue(_e.x,_e.y,d+ve)}for(let pe=0,$e=F.length;pe<$e;pe++){const _e=F[pe];j=J[pe];for(let Fe=0,Ne=_e.length;Fe=0;){const me=ve;let pe=ve-1;pe<0&&(pe=$.length-1);for(let $e=0,_e=u+y*2;$e<_e;$e++){const Fe=K*$e,Ne=K*($e+1),Ce=Me+me+Fe,st=Me+pe+Fe,k=Me+pe+Ne,U=Me+me+Ne;Le(Ce,st,k,U)}}}function ue($,Me,ve){l.push($),l.push(Me),l.push(ve)}function xe($,Me,ve){Je($),Je(Me),Je(ve);const me=i.length/3,pe=_.generateTopUV(r,i,me-3,me-2,me-1);Pe(pe[0]),Pe(pe[1]),Pe(pe[2])}function Le($,Me,ve,me){Je($),Je(Me),Je(me),Je(Me),Je(ve),Je(me);const pe=i.length/3,$e=_.generateSideWallUV(r,i,pe-6,pe-3,pe-2,pe-1);Pe($e[0]),Pe($e[1]),Pe($e[3]),Pe($e[1]),Pe($e[2]),Pe($e[3])}function Je($){i.push(l[$*3+0]),i.push(l[$*3+1]),i.push(l[$*3+2])}function Pe($){s.push($.x),s.push($.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return c5(t,r,e)}static fromJSON(e,t){const r=[];for(let s=0,o=e.shapes.length;s0)&&m.push(E,A,T),(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 LR extends or{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new rt(16777215),this.specular=new rt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=za,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$d,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 OR extends or{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new rt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=za,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class UR extends or{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=za,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class FR extends or{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new rt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=za,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$d,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 kR extends or{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new rt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=za,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class NR extends Wr{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 fs(n,e,t){return SE(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function tc(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 SE(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function zR(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 AE(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 wE(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 f5(n,e,t,r,i=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l=r)){d.push(c.times[m]);for(let x=0;xs.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[v]){const g=v*d+u,_=g+d-u;x=fs(a.values,g,_)}else{const g=a.createInterpolant(),_=u,E=d-u;g.evaluate(s),x=fs(g.resultBuffer,_,E)}l==="quaternion"&&new Hr().fromArray(x).normalize().conjugate().toArray(x);const y=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=fs(r,s,o),this.values=fs(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&&SE(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=fs(this.times),t=fs(this.values),r=this.getValueSize(),i=this.getInterpolation()===Eg,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=fs(e,0,o),this.values=fs(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=fs(this.times,0),t=fs(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}$s.prototype.TimeBufferType=Float32Array,$s.prototype.ValueBufferType=Float32Array,$s.prototype.DefaultInterpolation=kl;class nc extends $s{}nc.prototype.ValueTypeName="bool",nc.prototype.ValueBufferType=Array,nc.prototype.DefaultInterpolation=yu,nc.prototype.InterpolantFactoryMethodLinear=void 0,nc.prototype.InterpolantFactoryMethodSmooth=void 0;class TE extends $s{}TE.prototype.ValueTypeName="color";class nf extends $s{}nf.prototype.ValueTypeName="number";class VR extends tf{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 u=c+a;c!==u;c+=4)Hr.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Ya extends $s{InterpolantFactoryMethodLinear(e){return new VR(this.times,this.values,this.getValueSize(),e)}}Ya.prototype.ValueTypeName="quaternion",Ya.prototype.DefaultInterpolation=kl,Ya.prototype.InterpolantFactoryMethodSmooth=void 0;class rc extends $s{}rc.prototype.ValueTypeName="string",rc.prototype.ValueBufferType=Array,rc.prototype.DefaultInterpolation=yu,rc.prototype.InterpolantFactoryMethodLinear=void 0,rc.prototype.InterpolantFactoryMethodSmooth=void 0;class rf extends $s{}rf.prototype.ValueTypeName="vector";class sf{constructor(e,t=-1,r,i=Sg){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=zi(),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(m5(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($s.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const d=u[1];let p=i[d];p||(i[d]=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(d,p,m,v,x){if(m.length!==0){const y=[],g=[];wE(m,y,g,v),y.length!==0&&x.push(new d(p,y,g))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d{t&&t(s),this.manager.itemEnd(e)},0),s;if(Jo[e]!==void 0){Jo[e].push({onLoad:t,onProgress:r,onError:i});return}Jo[e]=[],Jo[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 u=Jo[e],d=c.body.getReader(),p=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),m=p?parseInt(p):0,v=m!==0;let x=0;const y=new ReadableStream({start(g){_();function _(){d.read().then(({done:E,value:A})=>{if(E)g.close();else{x+=A.byteLength;const M=new ProgressEvent("progress",{lengthComputable:v,loaded:x,total:m});for(let T=0,R=u.length;T{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),p=d&&d[1]?d[1].toLowerCase():void 0,m=new TextDecoder(p);return c.arrayBuffer().then(v=>m.decode(v))}}}).then(c=>{ic.add(e,c);const u=Jo[e];delete Jo[e];for(let d=0,p=u.length;d{const u=Jo[e];if(u===void 0)throw this.manager.itemError(e),c;delete Jo[e];for(let d=0,p=u.length;d{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class v5 extends oi{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new Xi(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 rt().setHex(o.value);break;case"v2":i.uniforms[s].value=new Ge().fromArray(o.value);break;case"v3":i.uniforms[s].value=new Q().fromArray(o.value);break;case"v4":i.uniforms[s].value=new pn().fromArray(o.value);break;case"m3":i.uniforms[s].value=new kt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new bt().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 Ge().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 Ge().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:IR,SpriteMaterial:qx,RawShaderMaterial:DR,ShaderMaterial:wi,PointsMaterial:c0,MeshPhysicalMaterial:co,MeshStandardMaterial:Oh,MeshPhongMaterial:LR,MeshToonMaterial:OR,MeshNormalMaterial:UR,MeshLambertMaterial:FR,MeshDepthMaterial:ch,MeshDistanceMaterial:qg,MeshBasicMaterial:Si,MeshMatcapMaterial:kR,LineDashedMaterial:NR,LineBasicMaterial:Wr,Material:or};return new t[e]}}class uo{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 CE(t);s=new Uh(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){i=new Uh(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=ic.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){ic.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 A0;class UE{static getContext(){return A0===void 0&&(A0=new(window.AudioContext||window.webkitAudioContext)),A0}static setContext(e){A0=e}}class w5 extends oi{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new Xi(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);UE.getContext().decodeAudioData(c,function(d){t(d)},a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}class M5 extends E0{constructor(e,t,r=1){super(void 0,r),this.isHemisphereLightProbe=!0;const i=new rt().set(e),s=new rt().set(t),o=new Q(i.r,i.g,i.b),a=new Q(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 T5 extends E0{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const r=new rt().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const rP=new bt,iP=new bt,sc=new bt;class C5{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new pr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new pr,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,sc.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(Gl*t.fov*.5)/t.zoom;let a,l;iP.elements[12]=-i,rP.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,sc.elements[0]=2*t.near/(l-a),sc.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(sc),a=-o*t.aspect-s,l=o*t.aspect-s,sc.elements[0]=2*t.near/(l-a),sc.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(sc)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(iP),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(rP)}}class FE{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=sP(),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=sP();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function sP(){return(typeof performance>"u"?Date:performance).now()}const oc=new Q,oP=new Hr,b5=new Q,ac=new Q;class R5 extends en{constructor(){super(),this.type="AudioListener",this.context=UE.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new FE}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(oc,oP,b5),ac.set(0,0,-1).applyQuaternion(oP),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(oc.x,i),t.positionY.linearRampToValueAtTime(oc.y,i),t.positionZ.linearRampToValueAtTime(oc.z,i),t.forwardX.linearRampToValueAtTime(ac.x,i),t.forwardY.linearRampToValueAtTime(ac.y,i),t.forwardZ.linearRampToValueAtTime(ac.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(oc.x,oc.y,oc.z),t.setOrientation(ac.x,ac.y,ac.z,r.x,r.y,r.z)}}let aP=class extends en{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){Hr.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;Hr.multiplyQuaternionsFlat(e,o,e,t,e,r),Hr.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 kE="\\[\\]\\.:\\/",D5=new RegExp("["+kE+"]","g"),NE="[^"+kE+"]",L5="[^"+kE.replace("\\.","")+"]",O5=/((?:WC+[\/:])*)/.source.replace("WC",NE),U5=/(WCOD+)?/.source.replace("WCOD",L5),F5=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",NE),k5=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",NE),N5=new RegExp("^"+O5+U5+F5+k5+"$"),z5=["material","materials","bones","map"];class G5{constructor(e,t,r){const i=r||sn.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 sn{constructor(e,t,r){this.path=t,this.parsedPath=r||sn.parseTrackName(t),this.node=sn.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 sn.Composite(e,t,r):new sn(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(D5,"")}static parseTrackName(e){const t=N5.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);z5.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 d=s++,p=e[d];t[p.uuid]=u,e[u]=p,t[c]=d,e[d]=l;for(let m=0,v=i;m!==v;++m){const x=r[m],y=x[d],g=x[u];x[u]=y,x[d]=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],u=c.uuid,d=t[u];if(d!==void 0)if(delete t[u],d0&&(t[m.uuid]=d),e[d]=m,e.pop();for(let v=0,x=i;v!==x;++v){const y=r[v];y[d]=y[p],y.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,u=this.nCachedObjects_,d=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(t),s.push(d);for(let p=u,m=l.length;p!==m;++p){const v=l[p];d[p]=new sn(v,e,t)}return d}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 uP{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:Nl,endingEnd:Nl};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=kb,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 mx:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Sg:default:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].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===Nb;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===Fb){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=zl,i.endingEnd=zl):(e?i.endingStart=this.zeroSlopeAtStart?zl:Nl:i.endingStart=Jd,t?i.endingEnd=this.zeroSlopeAtEnd?zl:Nl:i.endingEnd=Jd)}_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 V5=new Float32Array(1);class fP extends Fo{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 u=c[l];u===void 0&&(u={},c[l]=u);for(let d=0;d!==s;++d){const p=i[d],m=p.name;let v=u[m];if(v!==void 0)++v.referenceCount,o[d]=v;else{if(v=o[d],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,m));continue}const x=t&&t._propertyBindings[d].binding.parsedPath;v=new cP(sn.create(r,m,x),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,m),o[d]=v}a[d].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,hP).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 pP=new Q,w0=new Q;class Z5{constructor(e=new Q,t=new Q){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){pP.subVectors(e,this.start),w0.subVectors(this.end,this.start);const r=w0.dot(w0);let s=w0.dot(pP)/r;return t&&(s=Kn(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 mP=new Q;class Q5 extends en{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const r=new Dt,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 d=0;d.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{EP.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(EP,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 f8 extends Vs{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 Dt;i.setAttribute("position",new mt(t,3)),i.setAttribute("color",new mt(r,3));const s=new Wr({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,r){const i=new rt,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 d8{constructor(){this.type="ShapePath",this.color=new rt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new xh,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 _=[];for(let E=0,A=g.length;ENumber.EPSILON){if(I<0&&(R=_[T],P=-P,B=_[M],I=-I),g.yB.y)continue;if(g.y===R.y){if(g.x===R.x)return!0}else{const F=I*(g.x-R.x)-P*(g.y-R.y);if(F===0)return!0;if(F<0)continue;A=!A}}else{if(g.y!==R.y)continue;if(B.x<=g.x&&g.x<=R.x||R.x<=g.x&&g.x<=B.x)return!0}}return A}const i=lo.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 ql,l.curves=a.curves,c.push(l),c;let u=!i(s[0].getPoints());u=e?!u:u;const d=[],p=[];let m=[],v=0,x;p[v]=void 0,m[v]=[];for(let g=0,_=s.length;g<_;g++)a=s[g],x=a.getPoints(),o=i(x),o=e?!o:o,o?(!u&&p[v]&&v++,p[v]={s:new ql,p:x},p[v].s.curves=a.curves,u&&v++,m[v]=[]):m[v].push({h:a,p:x[0]});if(!p[0])return t(s);if(p.length>1){let g=!1,_=0;for(let E=0,A=p.length;E0&&g===!1&&(m=d)}let y;for(let g=0,_=p.length;g<_;g++){l=p[g].s,c.push(l),y=m[g];for(let E=0,A=y.length;E{const d=typeof c=="function"?c(e):c;if(d!==e){const p=e;e=u?d:Object.assign({},e,d),t.forEach(m=>m(e,p))}},i=()=>e,s=(c,u=i,d=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=u(e);function m(){const v=u(e);if(!d(p,v)){const x=p;c(p=v,x)}}return t.add(m),()=>t.delete(m)},l={setState:r,getState:i,subscribe:(c,u,d)=>u||d?s(c,u,d):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return e=n(r,i,l),l}const AP=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?D.useEffect:D.useLayoutEffect;function P0(n){const e=typeof n=="function"?D8(n):n,t=(r=e.getState,i=Object.is)=>{const[,s]=D.useReducer(y=>y+1,0),o=e.getState(),a=D.useRef(o),l=D.useRef(r),c=D.useRef(i),u=D.useRef(!1),d=D.useRef();d.current===void 0&&(d.current=r(o));let p,m=!1;(a.current!==o||l.current!==r||c.current!==i||u.current)&&(p=r(o),m=!i(d.current,p)),AP(()=>{m&&(d.current=p),a.current=o,l.current=r,c.current=i,u.current=!1});const v=D.useRef(o);AP(()=>{const y=()=>{try{const _=e.getState(),E=l.current(_);c.current(d.current,E)||(a.current=_,d.current=E,s())}catch{u.current=!0,s()}},g=e.subscribe(y);return e.getState()!==v.current&&y(),g},[]);const x=m?p:d.current;return D.useDebugValue(x),x};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[t,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},t}var $E={},L8={get exports(){return $E},set exports(n){$E=n}},kh={},O8={get exports(){return kh},set exports(n){kh=n}},wP={};/** * @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(G,W){var J=G.length;G.push(W);e:for(;0>>1,X=G[j];if(0>>1;ji(ce,J))lei(ue,ce)?(G[j]=ue,G[le]=J,j=le):(G[j]=ce,G[se]=J,j=se);else if(lei(ue,J))G[j]=ue,G[le]=J,j=le;else break e}}return W}function i(G,W){var J=G.sortIndex-W.sortIndex;return J!==0?J:G.id-W.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=[],u=1,d=null,p=3,m=!1,v=!1,x=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(G){for(var W=t(c);W!==null;){if(W.callback===null)r(c);else if(W.startTime<=G)r(c),W.sortIndex=W.expirationTime,e(l,W);else break;W=t(c)}}function A(G){if(x=!1,E(G),!v)if(t(l)!==null)v=!0,K(M);else{var W=t(c);W!==null&&ee(A,W.startTime-G)}}function M(G,W){v=!1,x&&(x=!1,g(B),B=-1),m=!0;var J=p;try{for(E(W),d=t(l);d!==null&&(!(d.expirationTime>W)||G&&!F());){var j=d.callback;if(typeof j=="function"){d.callback=null,p=d.priorityLevel;var X=j(d.expirationTime<=W);W=n.unstable_now(),typeof X=="function"?d.callback=X:d===t(l)&&r(l),E(W)}else r(l);d=t(l)}if(d!==null)var oe=!0;else{var se=t(c);se!==null&&ee(A,se.startTime-W),oe=!1}return oe}finally{d=null,p=J,m=!1}}var T=!1,R=null,B=-1,P=5,I=-1;function F(){return!(n.unstable_now()-IG||125j?(G.sortIndex=J,e(c,G),t(l)===null&&G===t(c)&&(x?(g(B),B=-1):x=!0,ee(A,J-j))):(G.sortIndex=X,e(l,G),v||m||(v=!0,K(M))),G},n.unstable_shouldYield=F,n.unstable_wrapCallback=function(G){var W=p;return function(){var J=p;p=W;try{return G.apply(this,arguments)}finally{p=J}}}})(wP),function(n){n.exports=wP}(O8);/** * @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 U8=function(e){var t={},r=D,i=kh,s=Object.assign;function o(f){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+f,S=1;Sfe||C[te]!==L[fe]){var Oe=` `+C[te].replace(" at new "," at ");return f.displayName&&Oe.includes("")&&(Oe=Oe.replace("",f.displayName)),Oe}while(1<=te&&0<=fe);break}}}finally{Qe=!1,Error.prepareStackTrace=S}return(f=f?f.displayName||f.name:"")?ot(f):""}var yt=Object.prototype.hasOwnProperty,Et=[],gt=-1;function at(f){return{current:f}}function At(f){0>gt||(f.current=Et[gt],Et[gt]=null,gt--)}function dt(f,h){gt++,Et[gt]=f.current,f.current=h}var It={},on=at(It),Ct=at(!1),Qt=It;function qt(f,h){var S=f.type.contextTypes;if(!S)return It;var w=f.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===h)return w.__reactInternalMemoizedMaskedChildContext;var C={},L;for(L in S)C[L]=h[L];return w&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=h,f.__reactInternalMemoizedMaskedChildContext=C),C}function rn(f){return f=f.childContextTypes,f!=null}function Ln(){At(Ct),At(on)}function Rt(f,h,S){if(on.current!==It)throw Error(o(168));dt(on,h),dt(Ct,S)}function An(f,h,S){var w=f.stateNode;if(h=h.childContextTypes,typeof w.getChildContext!="function")return S;w=w.getChildContext();for(var C in w)if(!(C in h))throw Error(o(108,B(f)||"Unknown",C));return s({},S,w)}function Yt(f){return f=(f=f.stateNode)&&f.__reactInternalMemoizedMergedChildContext||It,Qt=on.current,dt(on,f),dt(Ct,Ct.current),!0}function Kt(f,h,S){var w=f.stateNode;if(!w)throw Error(o(169));S?(f=An(f,h,Qt),w.__reactInternalMemoizedMergedChildContext=f,At(Ct),At(on),dt(on,f)):At(Ct),dt(Ct,S)}var yn=Math.clz32?Math.clz32:Yi,Ri=Math.log,rr=Math.LN2;function Yi(f){return f>>>=0,f===0?32:31-(Ri(f)/rr|0)|0}var sa=64,oa=4194304;function aa(f){switch(f&-f){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 f&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return f&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return f}}function Ac(f,h){var S=f.pendingLanes;if(S===0)return 0;var w=0,C=f.suspendedLanes,L=f.pingedLanes,te=S&268435455;if(te!==0){var fe=te&~C;fe!==0?w=aa(fe):(L&=te,L!==0&&(w=aa(L)))}else te=S&~C,te!==0?w=aa(te):L!==0&&(w=aa(L));if(w===0)return 0;if(h!==0&&h!==w&&!(h&C)&&(C=w&-w,L=h&-h,C>=L||C===16&&(L&4194240)!==0))return h;if(w&4&&(w|=S&16),h=f.entangledLanes,h!==0)for(f=f.entanglements,h&=w;0S;S++)h.push(f);return h}function vo(f,h,S){f.pendingLanes|=h,h!==536870912&&(f.suspendedLanes=0,f.pingedLanes=0),f=f.eventTimes,h=31-yn(h),f[h]=S}function cl(f,h){var S=f.pendingLanes&~h;f.pendingLanes=h,f.suspendedLanes=0,f.pingedLanes=0,f.expiredLanes&=h,f.mutableReadLanes&=h,f.entangledLanes&=h,h=f.entanglements;var w=f.eventTimes;for(f=f.expirationTimes;0>=te,C-=te,fa=1<<32-yn(h)+C|S<dn?(br=Ot,Ot=null):br=Ot.sibling;var hn=wt(Ae,Ot,Re[dn],ct);if(hn===null){Ot===null&&(Ot=br);break}f&&Ot&&hn.alternate===null&&h(Ae,Ot),he=L(hn,he,dn),Vt===null?_t=hn:Vt.sibling=hn,Vt=hn,Ot=br}if(dn===Re.length)return S(Ae,Ot),Fn&&bc(Ae,dn),_t;if(Ot===null){for(;dndn?(br=Ot,Ot=null):br=Ot.sibling;var _l=wt(Ae,Ot,hn.value,ct);if(_l===null){Ot===null&&(Ot=br);break}f&&Ot&&_l.alternate===null&&h(Ae,Ot),he=L(_l,he,dn),Vt===null?_t=_l:Vt.sibling=_l,Vt=_l,Ot=br}if(hn.done)return S(Ae,Ot),Fn&&bc(Ae,dn),_t;if(Ot===null){for(;!hn.done;dn++,hn=Re.next())hn=Lt(Ae,hn.value,ct),hn!==null&&(he=L(hn,he,dn),Vt===null?_t=hn:Vt.sibling=hn,Vt=hn);return Fn&&bc(Ae,dn),_t}for(Ot=w(Ae,Ot);!hn.done;dn++,hn=Re.next())hn=Mn(Ot,Ae,dn,hn.value,ct),hn!==null&&(f&&hn.alternate!==null&&Ot.delete(hn.key===null?dn:hn.key),he=L(hn,he,dn),Vt===null?_t=hn:Vt.sibling=hn,Vt=hn);return f&&Ot.forEach(function(BZ){return h(Ae,BZ)}),Fn&&bc(Ae,dn),_t}function Cs(Ae,he,Re,ct){if(typeof Re=="object"&&Re!==null&&Re.type===u&&Re.key===null&&(Re=Re.props.children),typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case l:e:{for(var _t=Re.key,Vt=he;Vt!==null;){if(Vt.key===_t){if(_t=Re.type,_t===u){if(Vt.tag===7){S(Ae,Vt.sibling),he=C(Vt,Re.props.children),he.return=Ae,Ae=he;break e}}else if(Vt.elementType===_t||typeof _t=="object"&&_t!==null&&_t.$$typeof===E&&T3(_t)===Vt.type){S(Ae,Vt.sibling),he=C(Vt,Re.props),he.ref=Lp(Ae,Vt,Re),he.return=Ae,Ae=he;break e}S(Ae,Vt);break}else h(Ae,Vt);Vt=Vt.sibling}Re.type===u?(he=Oc(Re.props.children,Ae.mode,ct,Re.key),he.return=Ae,Ae=he):(ct=dy(Re.type,Re.key,Re.props,null,Ae.mode,ct),ct.ref=Lp(Ae,he,Re),ct.return=Ae,Ae=ct)}return te(Ae);case c:e:{for(Vt=Re.key;he!==null;){if(he.key===Vt)if(he.tag===4&&he.stateNode.containerInfo===Re.containerInfo&&he.stateNode.implementation===Re.implementation){S(Ae,he.sibling),he=C(he,Re.children||[]),he.return=Ae,Ae=he;break e}else{S(Ae,he);break}else h(Ae,he);he=he.sibling}he=Lw(Re,Ae.mode,ct),he.return=Ae,Ae=he}return te(Ae);case E:return Vt=Re._init,Cs(Ae,he,Vt(Re._payload),ct)}if(Y(Re))return xt(Ae,he,Re,ct);if(T(Re))return Zr(Ae,he,Re,ct);Ov(Ae,Re)}return typeof Re=="string"&&Re!==""||typeof Re=="number"?(Re=""+Re,he!==null&&he.tag===6?(S(Ae,he.sibling),he=C(he,Re),he.return=Ae,Ae=he):(S(Ae,he),he=Dw(Re,Ae.mode,ct),he.return=Ae,Ae=he),te(Ae)):S(Ae,he)}return Cs}var Xf=C3(!0),b3=C3(!1),Op={},As=at(Op),Up=at(Op),jf=at(Op);function Eo(f){if(f===Op)throw Error(o(174));return f}function ZA(f,h){dt(jf,h),dt(Up,f),dt(As,Op),f=ee(h),At(As),dt(As,f)}function Jf(){At(As),At(Up),At(jf)}function R3(f){var h=Eo(jf.current),S=Eo(As.current);h=G(S,f.type,h),S!==h&&(dt(Up,f),dt(As,h))}function QA(f){Up.current===f&&(At(As),At(Up))}var jn=at(0);function Uv(f){for(var h=f;h!==null;){if(h.tag===13){var S=h.memoizedState;if(S!==null&&(S=S.dehydrated,S===null||Jt(S)||Sn(S)))return h}else if(h.tag===19&&h.memoizedProps.revealOrder!==void 0){if(h.flags&128)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===f)break;for(;h.sibling===null;){if(h.return===null||h.return===f)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}var qA=[];function ew(){for(var f=0;fS?S:4,f(!0);var w=ws.transition;ws.transition={};try{f(!1),h()}finally{Xt=S,ws.transition=w}}function V3(){return So().memoizedState}function iZ(f,h,S){var w=gl(f);S={lane:w,action:S,hasEagerState:!1,eagerState:null,next:null},W3(f)?$3(h,S):(X3(f,h,S),S=pi(),f=Ms(f,w,S),f!==null&&j3(f,h,w))}function sZ(f,h,S){var w=gl(f),C={lane:w,action:S,hasEagerState:!1,eagerState:null,next:null};if(W3(f))$3(h,C);else{X3(f,h,C);var L=f.alternate;if(f.lanes===0&&(L===null||L.lanes===0)&&(L=h.lastRenderedReducer,L!==null))try{var te=h.lastRenderedState,fe=L(te,S);if(C.hasEagerState=!0,C.eagerState=fe,Zi(fe,te))return}catch{}finally{}S=pi(),f=Ms(f,w,S),f!==null&&j3(f,h,w)}}function W3(f){var h=f.alternate;return f===er||h!==null&&h===er}function $3(f,h){Fp=kv=!0;var S=f.pending;S===null?h.next=h:(h.next=S.next,S.next=h),f.pending=h}function X3(f,h,S){ur!==null&&f.mode&1&&!(Wt&2)?(f=h.interleaved,f===null?(S.next=S,yr===null?yr=[h]:yr.push(h)):(S.next=f.next,f.next=S),h.interleaved=S):(f=h.pending,f===null?S.next=S:(S.next=f.next,f.next=S),h.pending=S)}function j3(f,h,S){if(S&4194240){var w=h.lanes;w&=f.pendingLanes,S|=w,h.lanes=S,yo(f,S)}}var Vv={readContext:wn,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},oZ={readContext:wn,useCallback:function(f,h){return ha().memoizedState=[f,h===void 0?null:h],f},useContext:wn,useEffect:sw,useImperativeHandle:function(f,h,S){return S=S!=null?S.concat([f]):null,Gv(4194308,4,N3.bind(null,h,f),S)},useLayoutEffect:function(f,h){return Gv(4194308,4,f,h)},useInsertionEffect:function(f,h){return Gv(4,2,f,h)},useMemo:function(f,h){var S=ha();return h=h===void 0?null:h,f=f(),S.memoizedState=[f,h],f},useReducer:function(f,h,S){var w=ha();return h=S!==void 0?S(h):h,w.memoizedState=w.baseState=h,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:f,lastRenderedState:h},w.queue=f,f=f.dispatch=iZ.bind(null,er,f),[w.memoizedState,f]},useRef:function(f){var h=ha();return f={current:f},h.memoizedState=f},useState:iw,useDebugValue:ow,useDeferredValue:function(f){var h=iw(f),S=h[0],w=h[1];return sw(function(){var C=ws.transition;ws.transition={};try{w(f)}finally{ws.transition=C}},[f]),S},useTransition:function(){var f=iw(!1),h=f[0];return f=rZ.bind(null,f[1]),ha().memoizedState=f,[h,f]},useMutableSource:function(){},useSyncExternalStore:function(f,h,S){var w=er,C=ha();if(Fn){if(S===void 0)throw Error(o(407));S=S()}else{if(S=h(),ur===null)throw Error(o(349));Yf&30||I3(w,h,S)}C.memoizedState=S;var L={value:S,getSnapshot:h};return C.queue=L,sw(L3.bind(null,w,L,f),[f]),w.flags|=2048,Np(9,D3.bind(null,w,L,S,h),void 0,null),S},useId:function(){var f=ha(),h=ur.identifierPrefix;if(Fn){var S=da,w=fa;S=(w&~(1<<32-yn(w)-1)).toString(32)+S,h=":"+h+"R"+S,S=kp++,0Mw&&(h.flags|=128,w=!0,Vp(C,!1),h.lanes=4194304)}else{if(!w)if(f=Uv(L),f!==null){if(h.flags|=128,w=!0,f=f.updateQueue,f!==null&&(h.updateQueue=f,h.flags|=4),Vp(C,!0),C.tail===null&&C.tailMode==="hidden"&&!L.alternate&&!Fn)return Kr(h),null}else 2*Un()-C.renderingStartTime>Mw&&S!==1073741824&&(h.flags|=128,w=!0,Vp(C,!1),h.lanes=4194304);C.isBackwards?(L.sibling=h.child,h.child=L):(f=C.last,f!==null?f.sibling=L:h.child=L,C.last=L)}return C.tail!==null?(h=C.tail,C.rendering=h,C.tail=h.sibling,C.renderingStartTime=Un(),h.sibling=null,f=jn.current,dt(jn,w?f&1|2:f&1),h):(Kr(h),null);case 22:case 23:return Pw(),w=h.memoizedState!==null,f!==null&&f.memoizedState!==null!==w&&(h.flags|=8192),w&&h.mode&1?ts&1073741824&&(Kr(h),Pe&&h.subtreeFlags&6&&(h.flags|=8192)):Kr(h),null;case 24:return null;case 25:return null}throw Error(o(156,h.tag))}var fZ=a.ReactCurrentOwner,es=!1;function hi(f,h,S,w){h.child=f===null?b3(h,null,S,w):Xf(h,f.child,S,w)}function tO(f,h,S,w,C){S=S.render;var L=h.ref;return Tr(h,C),w=nw(f,h,S,w,L,C),S=rw(),f!==null&&!es?(h.updateQueue=f.updateQueue,h.flags&=-2053,f.lanes&=~C,pa(f,h,C)):(Fn&&S&&XA(h),h.flags|=1,hi(f,h,w,C),h.child)}function nO(f,h,S,w,C){if(f===null){var L=S.type;return typeof L=="function"&&!Iw(L)&&L.defaultProps===void 0&&S.compare===null&&S.defaultProps===void 0?(h.tag=15,h.type=L,rO(f,h,L,w,C)):(f=dy(S.type,null,w,h,h.mode,C),f.ref=h.ref,f.return=h,h.child=f)}if(L=f.child,!(f.lanes&C)){var te=L.memoizedProps;if(S=S.compare,S=S!==null?S:Mc,S(te,w)&&f.ref===h.ref)return pa(f,h,C)}return h.flags|=1,f=yl(L,w),f.ref=h.ref,f.return=h,h.child=f}function rO(f,h,S,w,C){if(f!==null&&Mc(f.memoizedProps,w)&&f.ref===h.ref)if(es=!1,(f.lanes&C)!==0)f.flags&131072&&(es=!0);else return h.lanes=f.lanes,pa(f,h,C);return cw(f,h,S,w,C)}function iO(f,h,S){var w=h.pendingProps,C=w.children,L=f!==null?f.memoizedState:null;if(w.mode==="hidden")if(!(h.mode&1))h.memoizedState={baseLanes:0,cachePool:null},dt(Kf,ts),ts|=S;else if(S&1073741824)h.memoizedState={baseLanes:0,cachePool:null},w=L!==null?L.baseLanes:S,dt(Kf,ts),ts|=w;else return f=L!==null?L.baseLanes|S:S,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:f,cachePool:null},h.updateQueue=null,dt(Kf,ts),ts|=f,null;else L!==null?(w=L.baseLanes|S,h.memoizedState=null):w=S,dt(Kf,ts),ts|=w;return hi(f,h,C,S),h.child}function sO(f,h){var S=h.ref;(f===null&&S!==null||f!==null&&f.ref!==S)&&(h.flags|=512,h.flags|=2097152)}function cw(f,h,S,w,C){var L=rn(S)?Qt:on.current;return L=qt(h,L),Tr(h,C),S=nw(f,h,S,w,L,C),w=rw(),f!==null&&!es?(h.updateQueue=f.updateQueue,h.flags&=-2053,f.lanes&=~C,pa(f,h,C)):(Fn&&w&&XA(h),h.flags|=1,hi(f,h,S,C),h.child)}function oO(f,h,S,w,C){if(rn(S)){var L=!0;Yt(h)}else L=!1;if(Tr(h,C),h.stateNode===null)f!==null&&(f.alternate=null,h.alternate=null,h.flags|=2),x3(h,S,w),$A(h,S,w,C),w=!0;else if(f===null){var te=h.stateNode,fe=h.memoizedProps;te.props=fe;var Oe=te.context,qe=S.contextType;typeof qe=="object"&&qe!==null?qe=wn(qe):(qe=rn(S)?Qt:on.current,qe=qt(h,qe));var pt=S.getDerivedStateFromProps,Lt=typeof pt=="function"||typeof te.getSnapshotBeforeUpdate=="function";Lt||typeof te.UNSAFE_componentWillReceiveProps!="function"&&typeof te.componentWillReceiveProps!="function"||(fe!==w||Oe!==qe)&&E3(h,te,w,qe),Zs=!1;var wt=h.memoizedState;te.state=wt,Bv(h,w,te,C),Oe=h.memoizedState,fe!==w||wt!==Oe||Ct.current||Zs?(typeof pt=="function"&&(WA(h,S,pt,w),Oe=h.memoizedState),(fe=Zs||_3(h,S,fe,w,wt,Oe,qe))?(Lt||typeof te.UNSAFE_componentWillMount!="function"&&typeof te.componentWillMount!="function"||(typeof te.componentWillMount=="function"&&te.componentWillMount(),typeof te.UNSAFE_componentWillMount=="function"&&te.UNSAFE_componentWillMount()),typeof te.componentDidMount=="function"&&(h.flags|=4194308)):(typeof te.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=w,h.memoizedState=Oe),te.props=w,te.state=Oe,te.context=qe,w=fe):(typeof te.componentDidMount=="function"&&(h.flags|=4194308),w=!1)}else{te=h.stateNode,m3(f,h),fe=h.memoizedProps,qe=h.type===h.elementType?fe:jr(h.type,fe),te.props=qe,Lt=h.pendingProps,wt=te.context,Oe=S.contextType,typeof Oe=="object"&&Oe!==null?Oe=wn(Oe):(Oe=rn(S)?Qt:on.current,Oe=qt(h,Oe));var Mn=S.getDerivedStateFromProps;(pt=typeof Mn=="function"||typeof te.getSnapshotBeforeUpdate=="function")||typeof te.UNSAFE_componentWillReceiveProps!="function"&&typeof te.componentWillReceiveProps!="function"||(fe!==Lt||wt!==Oe)&&E3(h,te,w,Oe),Zs=!1,wt=h.memoizedState,te.state=wt,Bv(h,w,te,C);var xt=h.memoizedState;fe!==Lt||wt!==xt||Ct.current||Zs?(typeof Mn=="function"&&(WA(h,S,Mn,w),xt=h.memoizedState),(qe=Zs||_3(h,S,qe,w,wt,xt,Oe)||!1)?(pt||typeof te.UNSAFE_componentWillUpdate!="function"&&typeof te.componentWillUpdate!="function"||(typeof te.componentWillUpdate=="function"&&te.componentWillUpdate(w,xt,Oe),typeof te.UNSAFE_componentWillUpdate=="function"&&te.UNSAFE_componentWillUpdate(w,xt,Oe)),typeof te.componentDidUpdate=="function"&&(h.flags|=4),typeof te.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof te.componentDidUpdate!="function"||fe===f.memoizedProps&&wt===f.memoizedState||(h.flags|=4),typeof te.getSnapshotBeforeUpdate!="function"||fe===f.memoizedProps&&wt===f.memoizedState||(h.flags|=1024),h.memoizedProps=w,h.memoizedState=xt),te.props=w,te.state=xt,te.context=Oe,w=qe):(typeof te.componentDidUpdate!="function"||fe===f.memoizedProps&&wt===f.memoizedState||(h.flags|=4),typeof te.getSnapshotBeforeUpdate!="function"||fe===f.memoizedProps&&wt===f.memoizedState||(h.flags|=1024),w=!1)}return uw(f,h,S,w,L,C)}function uw(f,h,S,w,C,L){sO(f,h);var te=(h.flags&128)!==0;if(!w&&!te)return C&&Kt(h,S,!1),pa(f,h,L);w=h.stateNode,fZ.current=h;var fe=te&&typeof S.getDerivedStateFromError!="function"?null:w.render();return h.flags|=1,f!==null&&te?(h.child=Xf(h,f.child,null,L),h.child=Xf(h,null,fe,L)):hi(f,h,fe,L),h.memoizedState=w.state,C&&Kt(h,S,!0),h.child}function aO(f){var h=f.stateNode;h.pendingContext?Rt(f,h.pendingContext,h.pendingContext!==h.context):h.context&&Rt(f,h.context,!1),ZA(f,h.containerInfo)}function lO(f,h,S,w,C){return $f(),KA(C),h.flags|=256,hi(f,h,S,w),h.child}var Xv={dehydrated:null,treeContext:null,retryLane:0};function jv(f){return{baseLanes:f,cachePool:null}}function cO(f,h,S){var w=h.pendingProps,C=jn.current,L=!1,te=(h.flags&128)!==0,fe;if((fe=te)||(fe=f!==null&&f.memoizedState===null?!1:(C&2)!==0),fe?(L=!0,h.flags&=-129):(f===null||f.memoizedState!==null)&&(C|=1),dt(jn,C&1),f===null)return YA(h),f=h.memoizedState,f!==null&&(f=f.dehydrated,f!==null)?(h.mode&1?Sn(f)?h.lanes=8:h.lanes=1073741824:h.lanes=1,null):(C=w.children,f=w.fallback,L?(w=h.mode,L=h.child,C={mode:"hidden",children:C},!(w&1)&&L!==null?(L.childLanes=0,L.pendingProps=C):L=hy(C,w,0,null),f=Oc(f,w,S,null),L.return=h,f.return=h,L.sibling=f,h.child=L,h.child.memoizedState=jv(S),h.memoizedState=Xv,f):fw(h,C));if(C=f.memoizedState,C!==null){if(fe=C.dehydrated,fe!==null){if(te)return h.flags&256?(h.flags&=-257,Jv(f,h,S,Error(o(422)))):h.memoizedState!==null?(h.child=f.child,h.flags|=128,null):(L=w.fallback,C=h.mode,w=hy({mode:"visible",children:w.children},C,0,null),L=Oc(L,C,S,null),L.flags|=2,w.return=h,L.return=h,w.sibling=L,h.child=w,h.mode&1&&Xf(h,f.child,null,S),h.child.memoizedState=jv(S),h.memoizedState=Xv,L);if(!(h.mode&1))h=Jv(f,h,S,null);else if(Sn(fe))h=Jv(f,h,S,Error(o(419)));else if(w=(S&f.childLanes)!==0,es||w){if(w=ur,w!==null){switch(S&-S){case 4:L=2;break;case 16:L=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:L=32;break;case 536870912:L=268435456;break;default:L=0}w=L&(w.suspendedLanes|S)?0:L,w!==0&&w!==C.retryLane&&(C.retryLane=w,Ms(f,w,-1))}Bw(),h=Jv(f,h,S,Error(o(421)))}else Jt(fe)?(h.flags|=128,h.child=f.child,h=wZ.bind(null,f),Xn(fe,h),h=null):(S=C.treeContext,Me&&(qi=bi(fe),Qi=h,Fn=!0,Qs=null,Ip=!1,S!==null&&(Es[Ss++]=fa,Es[Ss++]=da,Es[Ss++]=Cc,fa=S.id,da=S.overflow,Cc=h)),h=fw(h,h.pendingProps.children),h.flags|=4096);return h}return L?(w=fO(f,h,w.children,w.fallback,S),L=h.child,C=f.child.memoizedState,L.memoizedState=C===null?jv(S):{baseLanes:C.baseLanes|S,cachePool:null},L.childLanes=f.childLanes&~S,h.memoizedState=Xv,w):(S=uO(f,h,w.children,S),h.memoizedState=null,S)}return L?(w=fO(f,h,w.children,w.fallback,S),L=h.child,C=f.child.memoizedState,L.memoizedState=C===null?jv(S):{baseLanes:C.baseLanes|S,cachePool:null},L.childLanes=f.childLanes&~S,h.memoizedState=Xv,w):(S=uO(f,h,w.children,S),h.memoizedState=null,S)}function fw(f,h){return h=hy({mode:"visible",children:h},f.mode,0,null),h.return=f,f.child=h}function uO(f,h,S,w){var C=f.child;return f=C.sibling,S=yl(C,{mode:"visible",children:S}),!(h.mode&1)&&(S.lanes=w),S.return=h,S.sibling=null,f!==null&&(w=h.deletions,w===null?(h.deletions=[f],h.flags|=16):w.push(f)),h.child=S}function fO(f,h,S,w,C){var L=h.mode;f=f.child;var te=f.sibling,fe={mode:"hidden",children:S};return!(L&1)&&h.child!==f?(S=h.child,S.childLanes=0,S.pendingProps=fe,h.deletions=null):(S=yl(f,fe),S.subtreeFlags=f.subtreeFlags&14680064),te!==null?w=yl(te,w):(w=Oc(w,L,C,null),w.flags|=2),w.return=h,S.return=h,S.sibling=w,h.child=S,w}function Jv(f,h,S,w){return w!==null&&KA(w),Xf(h,f.child,null,S),f=fw(h,h.pendingProps.children),f.flags|=2,h.memoizedState=null,f}function dO(f,h,S){f.lanes|=h;var w=f.alternate;w!==null&&(w.lanes|=h),cr(f.return,h,S)}function dw(f,h,S,w,C){var L=f.memoizedState;L===null?f.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:w,tail:S,tailMode:C}:(L.isBackwards=h,L.rendering=null,L.renderingStartTime=0,L.last=w,L.tail=S,L.tailMode=C)}function hO(f,h,S){var w=h.pendingProps,C=w.revealOrder,L=w.tail;if(hi(f,h,w.children,S),w=jn.current,w&2)w=w&1|2,h.flags|=128;else{if(f!==null&&f.flags&128)e:for(f=h.child;f!==null;){if(f.tag===13)f.memoizedState!==null&&dO(f,S,h);else if(f.tag===19)dO(f,S,h);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===h)break e;for(;f.sibling===null;){if(f.return===null||f.return===h)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}w&=1}if(dt(jn,w),!(h.mode&1))h.memoizedState=null;else switch(C){case"forwards":for(S=h.child,C=null;S!==null;)f=S.alternate,f!==null&&Uv(f)===null&&(C=S),S=S.sibling;S=C,S===null?(C=h.child,h.child=null):(C=S.sibling,S.sibling=null),dw(h,!1,C,S,L);break;case"backwards":for(S=null,C=h.child,h.child=null;C!==null;){if(f=C.alternate,f!==null&&Uv(f)===null){h.child=C;break}f=C.sibling,C.sibling=S,S=C,C=f}dw(h,!0,S,null,L);break;case"together":dw(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function pa(f,h,S){if(f!==null&&(h.dependencies=f.dependencies),Zf|=h.lanes,!(S&h.childLanes))return null;if(f!==null&&h.child!==f.child)throw Error(o(153));if(h.child!==null){for(f=h.child,S=yl(f,f.pendingProps),h.child=S,S.return=h;f.sibling!==null;)f=f.sibling,S=S.sibling=yl(f,f.pendingProps),S.return=h;S.sibling=null}return h.child}function dZ(f,h,S){switch(h.tag){case 3:aO(h),$f();break;case 5:R3(h);break;case 1:rn(h.type)&&Yt(h);break;case 4:ZA(h,h.stateNode.containerInfo);break;case 10:Rv(h,h.type._context,h.memoizedProps.value);break;case 13:var w=h.memoizedState;if(w!==null)return w.dehydrated!==null?(dt(jn,jn.current&1),h.flags|=128,null):S&h.child.childLanes?cO(f,h,S):(dt(jn,jn.current&1),f=pa(f,h,S),f!==null?f.sibling:null);dt(jn,jn.current&1);break;case 19:if(w=(S&h.childLanes)!==0,f.flags&128){if(w)return hO(f,h,S);h.flags|=128}var C=h.memoizedState;if(C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),dt(jn,jn.current),w)break;return null;case 22:case 23:return h.lanes=0,iO(f,h,S)}return pa(f,h,S)}function hZ(f,h){switch(jA(h),h.tag){case 1:return rn(h.type)&&Ln(),f=h.flags,f&65536?(h.flags=f&-65537|128,h):null;case 3:return Jf(),At(Ct),At(on),ew(),f=h.flags,f&65536&&!(f&128)?(h.flags=f&-65537|128,h):null;case 5:return QA(h),null;case 13:if(At(jn),f=h.memoizedState,f!==null&&f.dehydrated!==null){if(h.alternate===null)throw Error(o(340));$f()}return f=h.flags,f&65536?(h.flags=f&-65537|128,h):null;case 19:return At(jn),null;case 4:return Jf(),null;case 10:return xo(h.type._context),null;case 22:case 23:return Pw(),null;case 24:return null;default:return null}}var Yv=!1,Pc=!1,pZ=typeof WeakSet=="function"?WeakSet:Set,lt=null;function Kv(f,h){var S=f.ref;if(S!==null)if(typeof S=="function")try{S(null)}catch(w){Di(f,h,w)}else S.current=null}function hw(f,h,S){try{S()}catch(w){Di(f,h,w)}}var pO=!1;function mZ(f,h){for(W(f.containerInfo),lt=h;lt!==null;)if(f=lt,h=f.child,(f.subtreeFlags&1028)!==0&&h!==null)h.return=f,lt=h;else for(;lt!==null;){f=lt;try{var S=f.alternate;if(f.flags&1024)switch(f.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var w=S.memoizedProps,C=S.memoizedState,L=f.stateNode,te=L.getSnapshotBeforeUpdate(f.elementType===f.type?w:jr(f.type,w),C);L.__reactInternalSnapshotBeforeUpdate=te}break;case 3:Pe&&Ke(f.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(fe){Di(f,f.return,fe)}if(h=f.sibling,h!==null){h.return=f.return,lt=h;break}lt=f.return}return S=pO,pO=!1,S}function Bc(f,h,S){var w=h.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var C=w=w.next;do{if((C.tag&f)===f){var L=C.destroy;C.destroy=void 0,L!==void 0&&hw(h,S,L)}C=C.next}while(C!==w)}}function Wp(f,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var S=h=h.next;do{if((S.tag&f)===f){var w=S.create;S.destroy=w()}S=S.next}while(S!==h)}}function pw(f){var h=f.ref;if(h!==null){var S=f.stateNode;switch(f.tag){case 5:f=K(S);break;default:f=S}typeof h=="function"?h(f):h.current=f}}function mO(f,h,S){if(Ki&&typeof Ki.onCommitFiberUnmount=="function")try{Ki.onCommitFiberUnmount(fl,h)}catch{}switch(h.tag){case 0:case 11:case 14:case 15:if(f=h.updateQueue,f!==null&&(f=f.lastEffect,f!==null)){var w=f=f.next;do{var C=w,L=C.destroy;C=C.tag,L!==void 0&&(C&2||C&4)&&hw(h,S,L),w=w.next}while(w!==f)}break;case 1:if(Kv(h,S),f=h.stateNode,typeof f.componentWillUnmount=="function")try{f.props=h.memoizedProps,f.state=h.memoizedState,f.componentWillUnmount()}catch(te){Di(h,S,te)}break;case 5:Kv(h,S);break;case 4:Pe?EO(f,h,S):$&&$&&(h=h.stateNode.containerInfo,S=Bt(h),nn(h,S))}}function gO(f,h,S){for(var w=h;;)if(mO(f,w,S),w.child===null||Pe&&w.tag===4){if(w===h)break;for(;w.sibling===null;){if(w.return===null||w.return===h)return;w=w.return}w.sibling.return=w.return,w=w.sibling}else w.child.return=w,w=w.child}function vO(f){var h=f.alternate;h!==null&&(f.alternate=null,vO(h)),f.child=null,f.deletions=null,f.sibling=null,f.tag===5&&(h=f.stateNode,h!==null&&$e(h)),f.stateNode=null,f.return=null,f.dependencies=null,f.memoizedProps=null,f.memoizedState=null,f.pendingProps=null,f.stateNode=null,f.updateQueue=null}function yO(f){return f.tag===5||f.tag===3||f.tag===4}function _O(f){e:for(;;){for(;f.sibling===null;){if(f.return===null||yO(f.return))return null;f=f.return}for(f.sibling.return=f.return,f=f.sibling;f.tag!==5&&f.tag!==6&&f.tag!==18;){if(f.flags&2||f.child===null||f.tag===4)continue e;f.child.return=f,f=f.child}if(!(f.flags&2))return f.stateNode}}function xO(f){if(Pe){e:{for(var h=f.return;h!==null;){if(yO(h))break e;h=h.return}throw Error(o(160))}var S=h;switch(S.tag){case 5:h=S.stateNode,S.flags&32&&(et(h),S.flags&=-33),S=_O(f),gw(f,S,h);break;case 3:case 4:h=S.stateNode.containerInfo,S=_O(f),mw(f,S,h);break;default:throw Error(o(161))}}}function mw(f,h,S){var w=f.tag;if(w===5||w===6)f=f.stateNode,h?We(S,f,h):Ve(S,f);else if(w!==4&&(f=f.child,f!==null))for(mw(f,h,S),f=f.sibling;f!==null;)mw(f,h,S),f=f.sibling}function gw(f,h,S){var w=f.tag;if(w===5||w===6)f=f.stateNode,h?Ze(S,f,h):Te(S,f);else if(w!==4&&(f=f.child,f!==null))for(gw(f,h,S),f=f.sibling;f!==null;)gw(f,h,S),f=f.sibling}function EO(f,h,S){for(var w=h,C=!1,L,te;;){if(!C){C=w.return;e:for(;;){if(C===null)throw Error(o(160));switch(L=C.stateNode,C.tag){case 5:te=!1;break e;case 3:L=L.containerInfo,te=!0;break e;case 4:L=L.containerInfo,te=!0;break e}C=C.return}C=!0}if(w.tag===5||w.tag===6)gO(f,w,S),te?Xe(L,w.stateNode):ze(L,w.stateNode);else if(w.tag===18)te?Se(L,w.stateNode):Ee(L,w.stateNode);else if(w.tag===4){if(w.child!==null){L=w.stateNode.containerInfo,te=!0,w.child.return=w,w=w.child;continue}}else if(mO(f,w,S),w.child!==null){w.child.return=w,w=w.child;continue}if(w===h)break;for(;w.sibling===null;){if(w.return===null||w.return===h)return;w=w.return,w.tag===4&&(C=!1)}w.sibling.return=w.return,w=w.sibling}}function vw(f,h){if(Pe){switch(h.tag){case 0:case 11:case 14:case 15:Bc(3,h,h.return),Wp(3,h),Bc(5,h,h.return);return;case 1:return;case 5:var S=h.stateNode;if(S!=null){var w=h.memoizedProps;f=f!==null?f.memoizedProps:w;var C=h.type,L=h.updateQueue;h.updateQueue=null,L!==null&&je(S,L,C,f,w,h)}return;case 6:if(h.stateNode===null)throw Error(o(162));S=h.memoizedProps,He(h.stateNode,f!==null?f.memoizedProps:S,S);return;case 3:Me&&f!==null&&f.memoizedState.isDehydrated&&Z(h.stateNode.containerInfo);return;case 12:return;case 13:Zv(h);return;case 19:Zv(h);return;case 17:return}throw Error(o(163))}switch(h.tag){case 0:case 11:case 14:case 15:Bc(3,h,h.return),Wp(3,h),Bc(5,h,h.return);return;case 12:return;case 13:Zv(h);return;case 19:Zv(h);return;case 3:Me&&f!==null&&f.memoizedState.isDehydrated&&Z(h.stateNode.containerInfo);break;case 22:case 23:return}e:if($){switch(h.tag){case 1:case 5:case 6:break e;case 3:case 4:h=h.stateNode,nn(h.containerInfo,h.pendingChildren);break e}throw Error(o(163))}}function Zv(f){var h=f.updateQueue;if(h!==null){f.updateQueue=null;var S=f.stateNode;S===null&&(S=f.stateNode=new pZ),h.forEach(function(w){var C=MZ.bind(null,f,w);S.has(w)||(S.add(w),w.then(C,C))})}}function gZ(f,h){for(lt=h;lt!==null;){h=lt;var S=h.deletions;if(S!==null)for(var w=0;w";case qv:return":has("+(xw(f)||"")+")";case ey:return'[role="'+f.value+'"]';case ny:return'"'+f.value+'"';case ty:return'[data-testname="'+f.value+'"]';default:throw Error(o(365))}}function TO(f,h){var S=[];f=[f,0];for(var w=0;wC&&(C=te),w&=~L}if(w=C,w=Un()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*yZ(w/1960))-w,10f?16:f,ml===null)var w=!1;else{if(f=ml,ml=null,ay=0,Wt&6)throw Error(o(331));var C=Wt;for(Wt|=4,lt=f.current;lt!==null;){var L=lt,te=L.child;if(lt.flags&16){var fe=L.deletions;if(fe!==null){for(var Oe=0;OeUn()-ww?Ic(f,0):Aw|=S),Ii(f,h)}function OO(f,h){h===0&&(f.mode&1?(h=oa,oa<<=1,!(oa&130023424)&&(oa=4194304)):h=1);var S=pi();f=uy(f,h),f!==null&&(vo(f,h,S),Ii(f,S))}function wZ(f){var h=f.memoizedState,S=0;h!==null&&(S=h.retryLane),OO(f,S)}function MZ(f,h){var S=0;switch(f.tag){case 13:var w=f.stateNode,C=f.memoizedState;C!==null&&(S=C.retryLane);break;case 19:w=f.stateNode;break;default:throw Error(o(314))}w!==null&&w.delete(h),OO(f,S)}var UO;UO=function(f,h,S){if(f!==null)if(f.memoizedProps!==h.pendingProps||Ct.current)es=!0;else{if(!(f.lanes&S)&&!(h.flags&128))return es=!1,dZ(f,h,S);es=!!(f.flags&131072)}else es=!1,Fn&&h.flags&1048576&&S3(h,Lv,h.index);switch(h.lanes=0,h.tag){case 2:var w=h.type;f!==null&&(f.alternate=null,h.alternate=null,h.flags|=2),f=h.pendingProps;var C=qt(h,on.current);Tr(h,S),C=nw(null,h,w,f,C,S);var L=rw();return h.flags|=1,typeof C=="object"&&C!==null&&typeof C.render=="function"&&C.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,rn(w)?(L=!0,Yt(h)):L=!1,h.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,VA(h),C.updater=Iv,h.stateNode=C,C._reactInternals=h,$A(h,w,f,S),h=uw(null,h,w,!0,L,S)):(h.tag=0,Fn&&L&&XA(h),hi(null,h,C,S),h=h.child),h;case 16:w=h.elementType;e:{switch(f!==null&&(f.alternate=null,h.alternate=null,h.flags|=2),f=h.pendingProps,C=w._init,w=C(w._payload),h.type=w,C=h.tag=CZ(w),f=jr(w,f),C){case 0:h=cw(null,h,w,f,S);break e;case 1:h=oO(null,h,w,f,S);break e;case 11:h=tO(null,h,w,f,S);break e;case 14:h=nO(null,h,w,jr(w.type,f),S);break e}throw Error(o(306,w,""))}return h;case 0:return w=h.type,C=h.pendingProps,C=h.elementType===w?C:jr(w,C),cw(f,h,w,C,S);case 1:return w=h.type,C=h.pendingProps,C=h.elementType===w?C:jr(w,C),oO(f,h,w,C,S);case 3:e:{if(aO(h),f===null)throw Error(o(387));w=h.pendingProps,L=h.memoizedState,C=L.element,m3(f,h),Bv(h,w,null,S);var te=h.memoizedState;if(w=te.element,Me&&L.isDehydrated)if(L={element:w,isDehydrated:!1,cache:te.cache,transitions:te.transitions},h.updateQueue.baseState=L,h.memoizedState=L,h.flags&256){C=Error(o(423)),h=lO(f,h,w,S,C);break e}else if(w!==C){C=Error(o(424)),h=lO(f,h,w,S,C);break e}else for(Me&&(qi=qn(h.stateNode.containerInfo),Qi=h,Fn=!0,Qs=null,Ip=!1),S=b3(h,null,w,S),h.child=S;S;)S.flags=S.flags&-3|4096,S=S.sibling;else{if($f(),w===C){h=pa(f,h,S);break e}hi(f,h,w,S)}h=h.child}return h;case 5:return R3(h),f===null&&YA(h),w=h.type,C=h.pendingProps,L=f!==null?f.memoizedProps:null,te=C.children,ce(w,C)?te=null:L!==null&&ce(w,L)&&(h.flags|=32),sO(f,h),hi(f,h,te,S),h.child;case 6:return f===null&&YA(h),null;case 13:return cO(f,h,S);case 4:return ZA(h,h.stateNode.containerInfo),w=h.pendingProps,f===null?h.child=Xf(h,null,w,S):hi(f,h,w,S),h.child;case 11:return w=h.type,C=h.pendingProps,C=h.elementType===w?C:jr(w,C),tO(f,h,w,C,S);case 7:return hi(f,h,h.pendingProps,S),h.child;case 8:return hi(f,h,h.pendingProps.children,S),h.child;case 12:return hi(f,h,h.pendingProps.children,S),h.child;case 10:e:{if(w=h.type._context,C=h.pendingProps,L=h.memoizedProps,te=C.value,Rv(h,w,te),L!==null)if(Zi(L.value,te)){if(L.children===C.children&&!Ct.current){h=pa(f,h,S);break e}}else for(L=h.child,L!==null&&(L.return=h);L!==null;){var fe=L.dependencies;if(fe!==null){te=L.child;for(var Oe=fe.firstContext;Oe!==null;){if(Oe.context===w){if(L.tag===1){Oe=ua(-1,S&-S),Oe.tag=2;var qe=L.updateQueue;if(qe!==null){qe=qe.shared;var pt=qe.pending;pt===null?Oe.next=Oe:(Oe.next=pt.next,pt.next=Oe),qe.pending=Oe}}L.lanes|=S,Oe=L.alternate,Oe!==null&&(Oe.lanes|=S),cr(L.return,S,h),fe.lanes|=S;break}Oe=Oe.next}}else if(L.tag===10)te=L.type===h.type?null:L.child;else if(L.tag===18){if(te=L.return,te===null)throw Error(o(341));te.lanes|=S,fe=te.alternate,fe!==null&&(fe.lanes|=S),cr(te,S,h),te=L.sibling}else te=L.child;if(te!==null)te.return=L;else for(te=L;te!==null;){if(te===h){te=null;break}if(L=te.sibling,L!==null){L.return=te.return,te=L;break}te=te.return}L=te}hi(f,h,C.children,S),h=h.child}return h;case 9:return C=h.type,w=h.pendingProps.children,Tr(h,S),C=wn(C),w=w(C),h.flags|=1,hi(f,h,w,S),h.child;case 14:return w=h.type,C=jr(w,h.pendingProps),C=jr(w.type,C),nO(f,h,w,C,S);case 15:return rO(f,h,h.type,h.pendingProps,S);case 17:return w=h.type,C=h.pendingProps,C=h.elementType===w?C:jr(w,C),f!==null&&(f.alternate=null,h.alternate=null,h.flags|=2),h.tag=1,rn(w)?(f=!0,Yt(h)):f=!1,Tr(h,S),x3(h,w,C),$A(h,w,C,S),uw(null,h,w,!0,f,S);case 19:return hO(f,h,S);case 22:return iO(f,h,S)}throw Error(o(156,h.tag))};function FO(f,h){return ca(f,h)}function TZ(f,h,S,w){this.tag=f,this.key=S,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ts(f,h,S,w){return new TZ(f,h,S,w)}function Iw(f){return f=f.prototype,!(!f||!f.isReactComponent)}function CZ(f){if(typeof f=="function")return Iw(f)?1:0;if(f!=null){if(f=f.$$typeof,f===x)return 11;if(f===_)return 14}return 2}function yl(f,h){var S=f.alternate;return S===null?(S=Ts(f.tag,h,f.key,f.mode),S.elementType=f.elementType,S.type=f.type,S.stateNode=f.stateNode,S.alternate=f,f.alternate=S):(S.pendingProps=h,S.type=f.type,S.flags=0,S.subtreeFlags=0,S.deletions=null),S.flags=f.flags&14680064,S.childLanes=f.childLanes,S.lanes=f.lanes,S.child=f.child,S.memoizedProps=f.memoizedProps,S.memoizedState=f.memoizedState,S.updateQueue=f.updateQueue,h=f.dependencies,S.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},S.sibling=f.sibling,S.index=f.index,S.ref=f.ref,S}function dy(f,h,S,w,C,L){var te=2;if(w=f,typeof f=="function")Iw(f)&&(te=1);else if(typeof f=="string")te=5;else e:switch(f){case u:return Oc(S.children,C,L,h);case d:te=8,C|=8;break;case p:return f=Ts(12,S,h,C|2),f.elementType=p,f.lanes=L,f;case y:return f=Ts(13,S,h,C),f.elementType=y,f.lanes=L,f;case g:return f=Ts(19,S,h,C),f.elementType=g,f.lanes=L,f;case A:return hy(S,C,L,h);default:if(typeof f=="object"&&f!==null)switch(f.$$typeof){case m:te=10;break e;case v:te=9;break e;case x:te=11;break e;case _:te=14;break e;case E:te=16,w=null;break e}throw Error(o(130,f==null?f:typeof f,""))}return h=Ts(te,S,h,C),h.elementType=f,h.type=w,h.lanes=L,h}function Oc(f,h,S,w){return f=Ts(7,f,w,h),f.lanes=S,f}function hy(f,h,S,w){return f=Ts(22,f,w,h),f.elementType=A,f.lanes=S,f.stateNode={},f}function Dw(f,h,S){return f=Ts(6,f,null,h),f.lanes=S,f}function Lw(f,h,S){return h=Ts(4,f.children!==null?f.children:[],f.key,h),h.lanes=S,h.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},h}function bZ(f,h,S,w,C){this.tag=h,this.containerInfo=f,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Le,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=kf(0),this.expirationTimes=kf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kf(0),this.identifierPrefix=w,this.onRecoverableError=C,Me&&(this.mutableSourceEagerHydrationData=null)}function kO(f,h,S,w,C,L,te,fe,Oe){return f=new bZ(f,h,S,fe,Oe),h===1?(h=1,L===!0&&(h|=8)):h=0,L=Ts(3,null,null,h),f.current=L,L.stateNode=f,L.memoizedState={element:w,isDehydrated:S,cache:null,transitions:null},VA(L),f}function NO(f){if(!f)return It;f=f._reactInternals;e:{if(P(f)!==f||f.tag!==1)throw Error(o(170));var h=f;do{switch(h.tag){case 3:h=h.stateNode.context;break e;case 1:if(rn(h.type)){h=h.stateNode.__reactInternalMemoizedMergedChildContext;break e}}h=h.return}while(h!==null);throw Error(o(171))}if(f.tag===1){var S=f.type;if(rn(S))return An(f,S,h)}return h}function zO(f){var h=f._reactInternals;if(h===void 0)throw typeof f.render=="function"?Error(o(188)):(f=Object.keys(f).join(","),Error(o(268,f)));return f=N(h),f===null?null:f.stateNode}function GO(f,h){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var S=f.retryLane;f.retryLane=S!==0&&S=qe&&L>=Lt&&C<=pt&&te<=wt){f.splice(h,1);break}else if(w!==qe||S.width!==Oe.width||wtte){if(!(L!==Lt||S.height!==Oe.height||ptC)){qe>w&&(Oe.width+=qe-w,Oe.x=w),ptL&&(Oe.height+=Lt-L,Oe.y=L),wtS&&(S=te)),te ")+` No matching component was found for: `)+f.join(" > ")}return null},t.getPublicRootInstance=function(f){if(f=f.current,!f.child)return null;switch(f.child.tag){case 5:return K(f.child.stateNode);default:return f.child.stateNode}},t.injectIntoDevTools=function(f){if(f={bundleType:f.bundleType,version:f.version,rendererPackageName:f.rendererPackageName,rendererConfig:f.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:RZ,findFiberByHostInstance:f.findFiberByHostInstance||PZ,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")f=!1;else{var h=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(h.isDisabled||!h.supportsFiber)f=!0;else{try{fl=h.inject(f),Ki=h}catch{}f=!!h.checkDCE}}return f},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(f,h,S,w){if(!Ne)throw Error(o(363));f=Ew(f,h);var C=Be(f,S,w).disconnect;return{disconnect:function(){C()}}},t.registerMutableSourceForHydration=function(f,h){var S=h._getVersion;S=S(h._source),f.mutableSourceEagerHydrationData==null?f.mutableSourceEagerHydrationData=[h,S]:f.mutableSourceEagerHydrationData.push(h,S)},t.runWithPriority=function(f,h){var S=Xt;try{return Xt=f,h()}finally{Xt=S}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(f,h,S,w){var C=h.current,L=pi(),te=gl(C);return S=NO(S),h.context===null?h.context=S:h.pendingContext=S,h=ua(L,te),h.payload={element:f},w=w===void 0?null:w,w!==null&&(h.callback=w),hl(C,h),f=Ms(C,te,L),f!==null&&Pv(f,C,te),te},t};(function(n){n.exports=U8})(L8);const F8=py($E),k8=n=>typeof n=="object"&&typeof n.then=="function",fc=[];function MP(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=fc.indexOf(i);s!==-1&&fc.splice(s,1)},promise:(k8(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(fc.push(i),!t)throw i.promise}const CP=(n,e,t)=>TP(n,e,!1,t),N8=(n,e,t)=>void TP(n,e,!0,t),z8=n=>{if(n===void 0||n.length===0)fc.splice(0,fc.length);else{const e=fc.find(t=>MP(n,t.keys,t.equal));e&&e.remove()}},XE={},jE=n=>void Object.assign(XE,n);function G8(n,e){function t(u,{args:d=[],attach:p,...m},v){let x=`${u[0].toUpperCase()}${u.slice(1)}`,y;if(u==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=m.object;y=af(g,{type:u,root:v,attach:p,primitive:!0})}else{const g=XE[x];if(!g)throw new Error(`R3F: ${x} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(d))throw new Error("R3F: The args prop must be an array!");y=af(new g(...d),{type:u,root:v,attach:p,memoizedProps:{args:d}})}return y.__r3f.attach===void 0&&(y instanceof Dt?y.__r3f.attach="geometry":y instanceof or&&(y.__r3f.attach="material")),x!=="inject"&&ZE(y,m),y}function r(u,d){let p=!1;if(d){var m,v;(m=d.__r3f)!=null&&m.attach?KE(u,d,d.__r3f.attach):d.isObject3D&&u.isObject3D&&(u.add(d),p=!0),p||(v=u.__r3f)==null||v.objects.push(d),d.__r3f||af(d,{}),d.__r3f.parent=u,QE(d),lf(d)}}function i(u,d,p){let m=!1;if(d){var v,x;if((v=d.__r3f)!=null&&v.attach)KE(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){d.parent=u,d.dispatchEvent({type:"added"});const y=u.children.filter(_=>_!==d),g=y.indexOf(p);u.children=[...y.slice(0,g),d,...y.slice(g)],m=!0}m||(x=u.__r3f)==null||x.objects.push(d),d.__r3f||af(d,{}),d.__r3f.parent=u,QE(d),lf(d)}}function s(u,d,p=!1){u&&[...u].forEach(m=>o(d,m,p))}function o(u,d,p){if(d){var m,v,x;if(d.__r3f&&(d.__r3f.parent=null),(m=u.__r3f)!=null&&m.objects&&(u.__r3f.objects=u.__r3f.objects.filter(A=>A!==d)),(v=d.__r3f)!=null&&v.attach)kP(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){var y;u.remove(d),(y=d.__r3f)!=null&&y.root&&J8(d.__r3f.root,d)}const _=(x=d.__r3f)==null?void 0:x.primitive,E=p===void 0?d.dispose!==null&&!_:p;if(!_){var g;s((g=d.__r3f)==null?void 0:g.objects,d,E),s(d.children,d,E)}delete d.__r3f,E&&d.dispose&&d.type!=="Scene"&&kh.unstable_scheduleCallback(kh.unstable_IdlePriority,()=>{try{d.dispose()}catch{}}),lf(u)}}function a(u,d,p,m){var v;const x=(v=u.__r3f)==null?void 0:v.parent;if(!x)return;const y=t(d,p,u.__r3f.root);if(u.children){for(const g of u.children)g.__r3f&&r(y,g);u.children=u.children.filter(g=>!g.__r3f)}u.__r3f.objects.forEach(g=>r(y,g)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(x,u),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),r(x,y),y.raycast&&y.__r3f.eventCount&&y.__r3f.root.getState().internal.interaction.push(y),[m,m.alternate].forEach(g=>{g!==null&&(g.stateNode=y,g.ref&&(typeof g.ref=="function"?g.ref(y):g.ref.current=y))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:F8({createInstance:t,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,d)=>{if(!d)return;const p=u.getState().scene;p.__r3f&&(p.__r3f.root=u,r(p,d))},removeChildFromContainer:(u,d)=>{d&&o(u.getState().scene,d)},insertInContainerBefore:(u,d,p)=>{if(!d||!p)return;const m=u.getState().scene;m.__r3f&&i(m,d,p)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var d;const p=(d=u==null?void 0:u.__r3f)!=null?d:{};return Boolean(p.handlers)},prepareUpdate(u,d,p,m){if(u.__r3f.primitive&&m.object&&m.object!==u)return[!0];{const{args:v=[],children:x,...y}=m,{args:g=[],children:_,...E}=p;if(!Array.isArray(v))throw new Error("R3F: the args prop must be an array!");if(v.some((M,T)=>M!==g[T]))return[!0];const A=NP(u,y,E,!0);return A.changes.length?[!1,A]:null}},commitUpdate(u,[d,p],m,v,x,y){d?a(u,m,x,y):ZE(u,p)},commitMount(u,d,p,m){var v;const x=(v=u.__r3f)!=null?v:{};u.raycast&&x.handlers&&x.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>af(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var d;const{attach:p,parent:m}=(d=u.__r3f)!=null?d:{};p&&m&&kP(m,u,p),u.isObject3D&&(u.visible=!1),lf(u)},unhideInstance(u,d){var p;const{attach:m,parent:v}=(p=u.__r3f)!=null?p:{};m&&v&&KE(v,u,m),(u.isObject3D&&d.visible==null||d.visible)&&(u.visible=!0),lf(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Qa.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&In.fun(performance.now)?performance.now:In.fun(Date.now)?Date.now:()=>0,scheduleTimeout:In.fun(setTimeout)?setTimeout:void 0,cancelTimeout:In.fun(clearTimeout)?clearTimeout:void 0}),applyProps:ZE}}var bP,RP;const JE=n=>"colorSpace"in n||"outputColorSpace"in n,PP=()=>{var n;return(n=XE.ColorManagement)!=null?n:null},BP=n=>n&&n.isOrthographicCamera,H8=n=>n&&n.hasOwnProperty("current"),Nh=typeof window<"u"&&((bP=window.document)!=null&&bP.createElement||((RP=window.navigator)==null?void 0:RP.product)==="ReactNative")?D.useLayoutEffect:D.useEffect;function IP(n){const e=D.useRef(n);return Nh(()=>void(e.current=n),[n]),e}function V8({set:n}){return Nh(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class DP 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}}DP.getDerivedStateFromError=()=>({error:!0});const LP="__default",OP=new Map,W8=n=>n&&!!n.memoized&&!!n.changes;function UP(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 zh=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},In={obj:n=>n===Object(n)&&!In.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(In.str(n)||In.num(n))return n===e;const s=In.obj(n);if(s&&r==="reference")return n===e;const o=In.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(!In.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(In.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 $8(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 X8(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function af(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 YE(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 FP=/-\d+$/;function KE(n,e,t){if(In.str(t)){if(FP.test(t)){const s=t.replace(FP,""),{target:o,key:a}=YE(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=YE(n,t);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=t(n,e)}function kP(n,e,t){var r,i;if(In.str(t)){const{target:s,key:o}=YE(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 NP(n,{children:e,key:t,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){var u;const d=(u=n==null?void 0:n.__r3f)!=null?u:{},p=Object.entries(i),m=[];if(c){const x=Object.keys(l);for(let y=0;y{var g;if((g=n.__r3f)!=null&&g.primitive&&x==="object"||In.equ(y,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,y,!0,[]]);let _=[];x.includes("-")&&(_=x.split("-")),m.push([x,y,!1,_]);for(const E in i){const A=i[E];E.startsWith(`${x}-`)&&m.push([E,A,!1,E.split("-")])}});const v={...i};return d.memoizedProps&&d.memoizedProps.args&&(v.args=d.memoizedProps.args),d.memoizedProps&&d.memoizedProps.attach&&(v.attach=d.memoizedProps.attach),{memoized:v,changes:m}}function ZE(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}=W8(e)?e:NP(n,e),u=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let p=0;pE[A],n),!(_&&_.set))){const[E,...A]=y.reverse();g=A.reverse().reduce((M,T)=>M[T],n),m=E}if(v===LP+"remove")if(g.constructor){let E=OP.get(g.constructor);E||(E=new g.constructor,OP.set(g.constructor,E)),v=E[m]}else v=0;if(x)v?s.handlers[m]=v:delete s.handlers[m],s.eventCount=Object.keys(s.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof $l)){if(Array.isArray(v))_.fromArray?_.fromArray(v):_.set(...v);else if(_.copy&&v&&v.constructor&&_.constructor===v.constructor)_.copy(v);else if(v!==void 0){const E=_ instanceof rt;!E&&_.setScalar?_.setScalar(v):_ instanceof $l&&v instanceof $l?_.mask=v.mask:_.set(v),!PP()&&!a.linear&&E&&_.convertSRGBToLinear()}}else if(g[m]=v,g[m]instanceof bn&&g[m].format===ri&&g[m].type===so){const E=g[m];JE(E)&&JE(a.gl)?E.colorSpace=a.gl.outputColorSpace:E.encoding=a.gl.outputEncoding}lf(n)}if(s.parent&&a.internal&&n.raycast&&u!==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&&QE(n),n}function lf(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 QE(n){n.onUpdate==null||n.onUpdate(n)}function zP(n,e){n.manual||(BP(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 B0(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function j8(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Qa.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Qa.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Qa.ContinuousEventPriority;default:return Qa.DefaultEventPriority}}function GP(n,e,t,r){const i=t.get(e);i&&(t.delete(e),t.size===0&&(n.delete(r),i.target.releasePointerCapture(r)))}function J8(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)=>{GP(t.capturedMap,e,r,i)})}function Y8(n){function e(l){const{internal:c}=n.getState(),u=l.offsetX-c.initialClick[0],d=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+d*d))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var d;return(d=c.__r3f)==null?void 0:d.handlers["onPointer"+u]}))}function r(l,c){const u=n.getState(),d=new Set,p=[],m=c?c(u.internal.interaction):u.internal.interaction;for(let g=0;g{const E=zh(g.object),A=zh(_.object);return!E||!A?g.distance-_.distance:A.events.priority-E.events.priority||g.distance-_.distance}).filter(g=>{const _=B0(g);return d.has(_)?!1:(d.add(_),!0)});u.events.filter&&(x=u.events.filter(x,u));for(const g of x){let _=g.object;for(;_;){var y;(y=_.__r3f)!=null&&y.eventCount&&p.push({...g,eventObject:_}),_=_.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let g of u.internal.capturedMap.get(l.pointerId).values())d.has(B0(g.intersection))||p.push(g.intersection);return p}function i(l,c,u,d){const p=n.getState();if(l.length){const m={stopped:!1};for(const v of l){const x=zh(v.object)||p,{raycaster:y,pointer:g,camera:_,internal:E}=x,A=new Q(g.x,g.y,0).unproject(_),M=I=>{var F,N;return(F=(N=E.capturedMap.get(I))==null?void 0:N.has(v.eventObject))!=null?F:!1},T=I=>{const F={intersection:v,target:c.target};E.capturedMap.has(I)?E.capturedMap.get(I).set(v.eventObject,F):E.capturedMap.set(I,new Map([[v.eventObject,F]])),c.target.setPointerCapture(I)},R=I=>{const F=E.capturedMap.get(I);F&&GP(E.capturedMap,v.eventObject,F,I)};let B={};for(let I in c){let F=c[I];typeof F!="function"&&(B[I]=F)}let P={...v,...B,pointer:g,intersections:l,stopped:m.stopped,delta:u,unprojectedPoint:A,ray:y.ray,camera:_,stopPropagation(){const I="pointerId"in c&&E.capturedMap.get(c.pointerId);if((!I||I.has(v.eventObject))&&(P.stopped=m.stopped=!0,E.hovered.size&&Array.from(E.hovered.values()).find(F=>F.eventObject===v.eventObject))){const F=l.slice(0,l.indexOf(v));s([...F,v])}},target:{hasPointerCapture:M,setPointerCapture:T,releasePointerCapture:R},currentTarget:{hasPointerCapture:M,setPointerCapture:T,releasePointerCapture:R},nativeEvent:c};if(d(P),m.stopped===!0)break}}return l}function s(l){const{internal:c}=n.getState();for(const u of c.hovered.values())if(!l.length||!l.find(d=>d.object===u.object&&d.index===u.index&&d.instanceId===u.instanceId)){const p=u.eventObject.__r3f,m=p==null?void 0:p.handlers;if(c.hovered.delete(B0(u)),p!=null&&p.eventCount){const v={...u,intersections:l};m.onPointerOut==null||m.onPointerOut(v),m.onPointerLeave==null||m.onPointerLeave(v)}}}function o(l,c){for(let u=0;us([]);case"onLostPointerCapture":return c=>{const{internal:u}=n.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),s([]))})}}return function(u){const{onPointerMissed:d,internal:p}=n.getState();p.lastEvent.current=u;const m=l==="onPointerMove",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",y=r(u,m?t:void 0),g=v?e(u):0;l==="onPointerDown"&&(p.initialClick=[u.offsetX,u.offsetY],p.initialHits=y.map(E=>E.eventObject)),v&&!y.length&&g<=2&&(o(u,p.interaction),d&&d(u)),m&&s(y);function _(E){const A=E.eventObject,M=A.__r3f,T=M==null?void 0:M.handlers;if(M!=null&&M.eventCount)if(m){if(T.onPointerOver||T.onPointerEnter||T.onPointerOut||T.onPointerLeave){const R=B0(E),B=p.hovered.get(R);B?B.stopped&&E.stopPropagation():(p.hovered.set(R,E),T.onPointerOver==null||T.onPointerOver(E),T.onPointerEnter==null||T.onPointerEnter(E))}T.onPointerMove==null||T.onPointerMove(E)}else{const R=T[l];R?(!v||p.initialHits.includes(A))&&(o(u,p.interaction.filter(B=>!p.initialHits.includes(B))),R(E)):v&&p.initialHits.includes(A)&&o(u,p.interaction.filter(B=>!p.initialHits.includes(B)))}}i(y,u,g,_)}}return{handlePointer:a}}const K8=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],HP=n=>!!(n!=null&&n.render),qE=D.createContext(null),Z8=(n,e)=>{const t=P0((a,l)=>{const c=new Q,u=new Q,d=new Q;function p(g=l().camera,_=u,E=l().size){const{width:A,height:M,top:T,left:R}=E,B=A/M;_ instanceof Q?d.copy(_):d.set(..._);const P=g.getWorldPosition(c).distanceTo(d);if(BP(g))return{width:A/g.zoom,height:M/g.zoom,top:T,left:R,factor:1,distance:P,aspect:B};{const I=g.fov*Math.PI/180,F=2*Math.tan(I/2)*P,N=F*(A/M);return{width:N,height:F,top:T,left:R,factor:A/N,distance:P,aspect:B}}}let m;const v=g=>a(_=>({performance:{..._.performance,current:g}})),x=new Ge;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,_)=>e(g,_,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new FE,pointer:x,mouse:x,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=l();m&&clearTimeout(m),g.performance.current!==g.performance.min&&v(g.performance.min),m=setTimeout(()=>v(l().performance.max),g.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:g=>a(_=>({..._,events:{..._.events,...g}})),setSize:(g,_,E,A,M)=>{const T=l().camera,R={width:g,height:_,top:A||0,left:M||0,updateStyle:E};a(B=>({size:R,viewport:{...B.viewport,...p(T,u,R)}}))},setDpr:g=>a(_=>{const E=UP(g);return{viewport:{..._.viewport,dpr:E,initialDpr:_.viewport.initialDpr||E}}}),setFrameloop:(g="always")=>{const _=l().clock;_.stop(),_.elapsedTime=0,g!=="never"&&(_.start(),_.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,_,E)=>{const A=l().internal;return A.priority=A.priority+(_>0?1:0),A.subscribers.push({ref:g,priority:_,store:E}),A.subscribers=A.subscribers.sort((M,T)=>M.priority-T.priority),()=>{const M=l().internal;M!=null&&M.subscribers&&(M.priority=M.priority-(_>0?1:0),M.subscribers=M.subscribers.filter(T=>T.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:u,set:d}=t.getState();if(l!==i||c.dpr!==s){var p;i=l,s=c.dpr,zP(a,l),u.setPixelRatio(c.dpr);const m=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,m)}a!==o&&(o=a,d(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let I0,Q8=new Set,q8=new Set,e6=new Set;function eS(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function Gh(n,e){switch(n){case"before":return eS(Q8,e);case"after":return eS(q8,e);case"tail":return eS(e6,e)}}let tS,nS;function rS(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),tS=e.internal.subscribers,I0=0;I00)&&!((c=i.gl.xr)!=null&&c.isPresenting)&&(t+=rS(l,i))}if(Gh("after",l),t===0)return Gh("tail",l),e=!1,cancelAnimationFrame(r)}function o(l,c=1){var u;if(!l)return n.forEach(d=>o(d.store.getState()),c);(u=l.gl.xr)!=null&&u.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+c),e||(e=!0,requestAnimationFrame(s)))}function a(l,c=!0,u,d){if(c&&Gh("before",l),u)rS(l,u,d);else for(const p of n.values())rS(l,p.store.getState());c&&Gh("after",l)}return{loop:s,invalidate:o,advance:a}}function iS(){const n=D.useContext(qE);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function ai(n=t=>t,e){return iS()(n,e)}function Hh(n,e=0){const t=iS(),r=t.getState().internal.subscribe,i=IP(n);return Nh(()=>r(i,e,t),[e,r,t]),null}function VP(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,$8(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l.message})`))))))}}function cf(n,e,t,r){const i=Array.isArray(e)?e:[e],s=CP(VP(t,r),[n,...i],{equal:In.equ});return Array.isArray(e)?s:s[0]}cf.preload=function(n,e,t){const r=Array.isArray(e)?e:[e];return N8(VP(t),[n,...r])},cf.clear=function(n,e){const t=Array.isArray(e)?e:[e];return z8([n,...t])};const uf=new Map,{invalidate:WP,advance:$P}=t6(uf),{reconciler:Vh,applyProps:ff}=G8(uf,j8),df={objects:"shallow",strict:!1},n6=(n,e)=>{const t=typeof n=="function"?n(e):n;return HP(t)?t:new Qx({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function r6(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 i6(n){const e=uf.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(WP,$P),o=t||Vh.createContainer(s,Qa.ConcurrentRoot,null,!1,null,"",i,null);e||uf.set(n,{fiber:o,store:s});let a,l=!1,c;return{configure(u={}){let{gl:d,size:p,scene:m,events:v,onCreated:x,shadows:y=!1,linear:g=!1,flat:_=!1,legacy:E=!1,orthographic:A=!1,frameloop:M="always",dpr:T=[1,2],performance:R,raycaster:B,camera:P,onPointerMissed:I}=u,F=s.getState(),N=F.gl;F.gl||F.set({gl:N=n6(d,n)});let H=F.raycaster;H||F.set({raycaster:H=new GE});const{params:V,...Y}=B||{};if(In.equ(Y,H,df)||ff(H,{...Y}),In.equ(V,H.params,df)||ff(H,{params:{...H.params,...V}}),!F.camera||F.camera===c&&!In.equ(c,P,df)){c=P;const j=P instanceof oh,X=j?P:A?new Nu(0,0,0,0,.1,1e3):new pr(75,0,.1,1e3);j||(X.position.z=5,P&&ff(X,P),!F.camera&&!(P!=null&&P.rotation)&&X.lookAt(0,0,0)),F.set({camera:X})}if(!F.scene){let j;m instanceof uh?j=m:(j=new uh,m&&ff(j,m)),F.set({scene:af(j)})}if(!F.xr){const j=(se,ce)=>{const le=s.getState();le.frameloop!=="never"&&$P(se,!0,le,ce)},X=()=>{const se=s.getState();se.gl.xr.enabled=se.gl.xr.isPresenting,se.gl.xr.setAnimationLoop(se.gl.xr.isPresenting?j:null),se.gl.xr.isPresenting||WP(se)},oe={connect(){const se=s.getState().gl;se.xr.addEventListener("sessionstart",X),se.xr.addEventListener("sessionend",X)},disconnect(){const se=s.getState().gl;se.xr.removeEventListener("sessionstart",X),se.xr.removeEventListener("sessionend",X)}};N.xr&&oe.connect(),F.set({xr:oe})}if(N.shadowMap){const j=N.shadowMap.enabled,X=N.shadowMap.type;if(N.shadowMap.enabled=!!y,In.boo(y))N.shadowMap.type=Wd;else if(In.str(y)){var K;const oe={basic:rb,percentage:fg,soft:Wd,variance:Os};N.shadowMap.type=(K=oe[y])!=null?K:Wd}else In.obj(y)&&Object.assign(N.shadowMap,y);(j!==N.shadowMap.enabled||X!==N.shadowMap.type)&&(N.shadowMap.needsUpdate=!0)}const ee=PP();ee&&("enabled"in ee?ee.enabled=!E:"legacyMode"in ee&&(ee.legacyMode=E)),ff(N,{outputEncoding:g?3e3:3001,toneMapping:_?Fs:k1}),F.legacy!==E&&F.set(()=>({legacy:E})),F.linear!==g&&F.set(()=>({linear:g})),F.flat!==_&&F.set(()=>({flat:_})),d&&!In.fun(d)&&!HP(d)&&!In.equ(d,N,df)&&ff(N,d),v&&!F.events.handlers&&F.set({events:v(s)});const J=r6(n,p);return In.equ(J,F.size,df)||F.setSize(J.width,J.height,J.updateStyle,J.top,J.left),T&&F.viewport.dpr!==UP(T)&&F.setDpr(T),F.frameloop!==M&&F.setFrameloop(M),F.onPointerMissed||F.set({onPointerMissed:I}),R&&!In.equ(R,F.performance,df)&&F.set(j=>({performance:{...j.performance,...R}})),a=x,l=!0,this},render(u){return l||this.configure(),Vh.updateContainer(D.createElement(s6,{store:s,children:u,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){XP(n)}}}function s6({store:n,children:e,onCreated:t,rootElement:r}){return Nh(()=>{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(qE.Provider,{value:n},e)}function XP(n,e){const t=uf.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),Vh.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(),X8(i),uf.delete(n),e&&e(n)}catch{}},500)})}}function o6(n,e,t){return D.createElement(a6,{key:e.uuid,children:n,container:e,state:t})}function a6({state:n={},children:e,container:t}){const{events:r,size:i,...s}=n,o=iS(),[a]=D.useState(()=>new GE),[l]=D.useState(()=>new Ge),c=D.useCallback((d,p)=>{const m={...d};Object.keys(d).forEach(x=>{(K8.includes(x)||d[x]!==p[x]&&p[x])&&delete m[x]});let v;if(p&&i){const x=p.camera;v=d.viewport.getCurrentViewport(x,new Q,i),x!==d.camera&&zP(x,i)}return{...m,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...d.events,...p==null?void 0:p.events,...r},size:{...d.size,...i},viewport:{...d.viewport,...v},...s}},[n]),[u]=D.useState(()=>{const d=o.getState();return P0((m,v)=>({...d,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...d.events,...r},size:{...d.size,...i},...s,set:m,get:v,setEvents:x=>m(y=>({...y,events:{...y.events,...x}}))}))});return D.useEffect(()=>{const d=o.subscribe(p=>u.setState(m=>c(p,m)));return()=>{d(),u.destroy()}},[]),D.useEffect(()=>{u.setState(d=>c(o.getState(),d))},[c]),D.createElement(D.Fragment,null,Vh.createPortal(D.createElement(qE.Provider,{value:u},e),u,null))}Vh.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:D.version});function D0(){return D0=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?r=setTimeout(l,e-u):(r=null,t||(a=n.apply(s,i),s=i=null))}var c=function(){s=this,i=arguments,o=Date.now();var u=t&&!r;return r||(r=setTimeout(l,e)),u&&(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}sS.debounce=sS;var jP=sS;function l6(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,u=e?typeof e=="number"?e:e.resize:null,d=D.useRef(!1);D.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[p,m,v]=D.useMemo(()=>{const _=()=>{if(!l.current.element)return;const{left:E,top:A,width:M,height:T,bottom:R,right:B,x:P,y:I}=l.current.element.getBoundingClientRect(),F={left:E,top:A,width:M,height:T,bottom:R,right:B,x:P,y:I};l.current.element instanceof HTMLElement&&i&&(F.height=l.current.element.offsetHeight,F.width=l.current.element.offsetWidth),Object.freeze(F),d.current&&!d6(l.current.lastBounds,F)&&a(l.current.lastBounds=F)};return[_,u?jP(_,u):_,c?jP(_,c):_]},[a,i,c,u]);function x(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",v,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function y(){l.current.element&&(l.current.resizeObserver=new s(v),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(_=>_.addEventListener("scroll",v,{capture:!0,passive:!0})))}const g=_=>{!_||_===l.current.element||(x(),l.current.element=_,l.current.scrollContainers=JP(_),y())};return u6(v,Boolean(t)),c6(m),D.useEffect(()=>{x(),y()},[t,v,m]),D.useEffect(()=>x,[]),[g,o,p]}function c6(n){D.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function u6(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 JP(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,...JP(n.parentElement)]}const f6=["x","y","top","bottom","left","right","width","height"],d6=(n,e)=>f6.every(t=>n[t]===e[t]);var h6=Object.defineProperty,p6=Object.defineProperties,m6=Object.getOwnPropertyDescriptors,YP=Object.getOwnPropertySymbols,g6=Object.prototype.hasOwnProperty,v6=Object.prototype.propertyIsEnumerable,KP=(n,e,t)=>e in n?h6(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ZP=(n,e)=>{for(var t in e||(e={}))g6.call(e,t)&&KP(n,t,e[t]);if(YP)for(var t of YP(e))v6.call(e,t)&&KP(n,t,e[t]);return n},y6=(n,e)=>p6(n,m6(e));function QP(n,e,t){if(!n)return;if(t(n)===!0)return n;let r=e?n.return:n.child;for(;r;){const i=QP(r,e,t);if(i)return i;r=e?null:r.sibling}}function qP(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const oS=qP(D.createContext(null));class eB extends D.Component{render(){return D.createElement(oS.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:tB,ReactCurrentDispatcher:nB}=D.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _6(){const n=D.useContext(oS);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[tB==null?void 0:tB.current,n,n==null?void 0:n.alternate]){if(!r)continue;const i=QP(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 x6(){var n,e;const t=_6(),[r]=D.useState(()=>new Map);r.clear();let i=t;for(;i;){const s=(n=i.type)==null?void 0:n._context;s&&s!==oS&&!r.has(s)&&r.set(s,(e=nB==null?void 0:nB.current)==null?void 0:e.readContext(qP(s))),i=i.return}return r}function E6(){const n=x6();return D.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>r=>D.createElement(e,null,D.createElement(t.Provider,y6(ZP({},r),{value:n.get(t)}))),e=>D.createElement(eB,ZP({},e))),[n])}const aS={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 S6(n){const{handlePointer:e}=Y8(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(aS).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]=aS[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]=aS[s];r.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const A6=D.forwardRef(function({children:e,fallback:t,resize:r,style:i,gl:s,events:o=S6,eventSource:a,eventPrefix:l,shadows:c,linear:u,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:x,performance:y,raycaster:g,camera:_,onPointerMissed:E,onCreated:A,...M},T){D.useMemo(()=>jE(SP),[]);const R=E6(),[B,P]=l6({scroll:!0,debounce:{scroll:50,resize:0},...r}),I=D.useRef(null),F=D.useRef(null);D.useImperativeHandle(T,()=>I.current);const N=IP(E),[H,V]=D.useState(!1),[Y,K]=D.useState(!1);if(H)throw H;if(Y)throw Y;const ee=D.useRef(null);Nh(()=>{const W=I.current;P.width>0&&P.height>0&&W&&(ee.current||(ee.current=i6(W)),ee.current.configure({gl:s,events:o,shadows:c,linear:u,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:x,performance:y,raycaster:g,camera:_,size:P,onPointerMissed:(...J)=>N.current==null?void 0:N.current(...J),onCreated:J=>{J.events.connect==null||J.events.connect(a?H8(a)?a.current:a:F.current),l&&J.setEvents({compute:(j,X)=>{const oe=j[l+"X"],se=j[l+"Y"];X.pointer.set(oe/X.size.width*2-1,-(se/X.size.height)*2+1),X.raycaster.setFromCamera(X.pointer,X.camera)}}),A==null||A(J)}}),ee.current.render(D.createElement(R,null,D.createElement(DP,{set:K},D.createElement(D.Suspense,{fallback:D.createElement(V8,{set:V})},e)))))}),D.useEffect(()=>{const W=I.current;if(W)return()=>XP(W)},[]);const G=a?"none":"auto";return D.createElement("div",D0({ref:F,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:G,...i}},M),D.createElement("div",{ref:B,style:{width:"100%",height:"100%"}},D.createElement("canvas",{ref:I,style:{display:"block"}},t)))}),w6=D.forwardRef(function(e,t){return D.createElement(eB,null,D.createElement(A6,D0({},e,{ref:t})))});let Wh=0;const M6=P0(n=>(of.onStart=(e,t,r)=>{n({active:!0,item:e,loaded:t,total:r,progress:(t-Wh)/(r-Wh)*100})},of.onLoad=()=>{n({active:!1})},of.onError=e=>n(t=>({errors:[...t.errors,e]})),of.onProgress=(e,t,r)=>{t===r&&(Wh=r),n({active:!0,item:e,loaded:t,total:r,progress:(t-Wh)/(r-Wh)*100||100})},{errors:[],active:!1,progress:0,item:"",loaded:0,total:0})),T6=n=>`Loading ${n.toFixed(2)}%`;function C6({containerStyles:n,innerStyles:e,barStyles:t,dataStyles:r,dataInterpolation:i=T6,initialState:s=o=>o}){const{active:o,progress:a}=M6(),l=D.useRef(0),c=D.useRef(0),u=D.useRef(null),[d,p]=D.useState(s(o));D.useEffect(()=>{let v;return o!==d&&(v=setTimeout(()=>p(o),300)),()=>clearTimeout(v)},[d,o]);const m=D.useCallback(()=>{u.current&&(l.current+=(a-l.current)/2,(l.current>.95*a||a===100)&&(l.current=a),u.current.innerText=i(l.current),l.current(m(),()=>cancelAnimationFrame(c.current)),[m]),d?D.createElement("div",{style:{...L0.container,opacity:o?1:0,...n}},D.createElement("div",null,D.createElement("div",{style:{...L0.inner,...e}},D.createElement("div",{style:{...L0.bar,transform:`scaleX(${a/100})`,...t}}),D.createElement("span",{ref:u,style:{...L0.data,...r}})))):null}const L0={container:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"#171717",display:"flex",alignItems:"center",justifyContent:"center",transition:"opacity 300ms ease",zIndex:1e3},inner:{width:100,height:3,background:"#272727",textAlign:"center"},bar:{height:3,width:"100%",background:"white",transition:"transform 200ms",transformOrigin:"left center"},data:{display:"inline-block",position:"relative",fontVariantNumeric:"tabular-nums",marginTop:"0.8em",color:"#f0f0f0",fontSize:"0.6em",fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Helvetica, Arial, Roboto, Ubuntu, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',whiteSpace:"nowrap"}},b6=n=>(e,t,r)=>{const i=r.subscribe;return r.subscribe=(o,a,l)=>{let c=o;if(a){const u=(l==null?void 0:l.equalityFn)||Object.is;let d=o(r.getState());c=p=>{const m=o(p);if(!u(d,m)){const v=d;a(d=m,v)}},l!=null&&l.fireImmediately&&a(d,d)}return i(c)},n(e,t,r)};var ds=Uint8Array,qa=Uint16Array,lS=Uint32Array,rB=new ds([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),iB=new ds([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),R6=new ds([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sB=function(n,e){for(var t=new qa(31),r=0;r<31;++r)t[r]=e+=1<>>1|(Dn&21845)<<1;el=(el&52428)>>>2|(el&13107)<<2,el=(el&61680)>>>4|(el&3855)<<4,cS[Dn]=((el&65280)>>>8|(el&255)<<8)>>>1}for(var $h=function(n,e,t){for(var r=n.length,i=0,s=new qa(e);i>>l]=c}else for(a=new qa(r),i=0;i>>15-n[i]);return a},Xh=new ds(288),Dn=0;Dn<144;++Dn)Xh[Dn]=8;for(var Dn=144;Dn<256;++Dn)Xh[Dn]=9;for(var Dn=256;Dn<280;++Dn)Xh[Dn]=7;for(var Dn=280;Dn<288;++Dn)Xh[Dn]=8;for(var lB=new ds(32),Dn=0;Dn<32;++Dn)lB[Dn]=5;var D6=$h(Xh,9,1),L6=$h(lB,5,1),uS=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Xs=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},fS=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},O6=function(n){return(n/8|0)+(n&7&&1)},U6=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof qa?qa:n instanceof lS?lS:ds)(t-e);return r.set(n.subarray(e,t)),r},F6=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new ds(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new ds(r*3));var o=function(le){var ue=e.length;if(le>ue){var xe=new ds(Math.max(ue*2,le));xe.set(e),e=xe}},a=t.f||0,l=t.p||0,c=t.b||0,u=t.l,d=t.d,p=t.m,m=t.n,v=r*8;do{if(!u){t.f=a=Xs(n,l,1);var x=Xs(n,l+1,3);if(l+=3,x)if(x==1)u=D6,d=L6,p=9,m=5;else if(x==2){var E=Xs(n,l,31)+257,A=Xs(n,l+10,15)+4,M=E+Xs(n,l+5,31)+1;l+=14;for(var T=new ds(M),R=new ds(19),B=0;B>>4;if(y<16)T[B++]=y;else{var H=0,V=0;for(y==16?(V=3+Xs(n,l,3),l+=2,H=T[B-1]):y==17?(V=3+Xs(n,l,7),l+=3):y==18&&(V=11+Xs(n,l,127),l+=7);V--;)T[B++]=H}}var Y=T.subarray(0,E),K=T.subarray(E);p=uS(Y),m=uS(K),u=$h(Y,p,1),d=$h(K,m,1)}else throw"invalid block type";else{var y=O6(l)+4,g=n[y-4]|n[y-3]<<8,_=y+g;if(_>r){if(s)throw"unexpected EOF";break}i&&o(c+g),e.set(n.subarray(y,_),c),t.b=c+=g,t.p=l=_*8;continue}if(l>v){if(s)throw"unexpected EOF";break}}i&&o(c+131072);for(var ee=(1<>>4;if(l+=H&15,l>v){if(s)throw"unexpected EOF";break}if(!H)throw"invalid length/literal";if(J<256)e[c++]=J;else if(J==256){W=l,u=null;break}else{var j=J-254;if(J>264){var B=J-257,X=rB[B];j=Xs(n,l,(1<>>4;if(!oe)throw"invalid distance";l+=oe&15;var K=I6[se];if(se>3){var X=iB[se];K+=fS(n,l)&(1<v){if(s)throw"unexpected EOF";break}i&&o(c+131072);for(var ce=c+j;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 O0(n,e){return F6((N6(n),n.subarray(2,-4)),e)}var z6=typeof TextDecoder<"u"&&new TextDecoder,G6=0;try{z6.decode(k6,{stream:!0}),G6=1}catch{}function cB(n,e){if(e===zb)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===Ag||e===gx){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let l=0;l degrees, and the cosine of that const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; // 3.0 / ( 16.0 * pi ) const float THREE_OVER_SIXTEENPI = 0.05968310365946075; // 1.0 / ( 4.0 * pi ) const float ONE_OVER_FOURPI = 0.07957747154594767; float rayleighPhase( float cosTheta ) { return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); } float hgPhase( float cosTheta, float g ) { float g2 = pow( g, 2.0 ); float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); } void main() { vec3 direction = normalize( vWorldPosition - cameraPos ); // optical length // cutoff angle at 90 to avoid singularity in next formula. float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); float sR = rayleighZenithLength * inverse; float sM = mieZenithLength * inverse; // combined extinction factor vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); // in scattering float cosTheta = dot( direction, vSunDirection ); float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); vec3 betaRTheta = vBetaR * rPhase; float mPhase = hgPhase( cosTheta, mieDirectionalG ); vec3 betaMTheta = vBetaM * mPhase; vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); // nightsky float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); vec3 L0 = vec3( 0.1 ) * Fex; // composition + solar disc float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); L0 += ( vSunE * 19000.0 * Fex ) * sundisk; vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); gl_FragColor = vec4( retColor, 1.0 ); #include #include <${uB>=154?"colorspace_fragment":"encodings_fragment"}> } `};dS.fragmentShader,dS.vertexShader,dS.uniforms;const H6=n=>n&&n.isCubeTexture;class V6 extends Gn{constructor(e,t){var r,i;const s=H6(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),u=3*Math.max(c,16*7),d=4*c,p=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/u}`,`#define CUBEUV_TEXEL_HEIGHT ${1/d}`,`#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 <${parseInt(hu.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}> } `,x={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},y=new Qu(1,16),g=new wi({uniforms:x,fragmentShader:v,vertexShader:m,side:xi});super(y,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}}class hS extends oi{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new J6(t)}),this.register(function(t){return new n9(t)}),this.register(function(t){return new r9(t)}),this.register(function(t){return new i9(t)}),this.register(function(t){return new K6(t)}),this.register(function(t){return new Z6(t)}),this.register(function(t){return new Q6(t)}),this.register(function(t){return new q6(t)}),this.register(function(t){return new j6(t)}),this.register(function(t){return new e9(t)}),this.register(function(t){return new Y6(t)}),this.register(function(t){return new t9(t)}),this.register(function(t){return new $6(t)}),this.register(function(t){return new s9(t)}),this.register(function(t){return new o9(t)})}load(e,t,r,i){const s=this;let o;this.resourcePath!==""?o=this.resourcePath:this.path!==""?o=this.path:o=uo.extractUrlBase(e),this.manager.itemStart(e);const a=function(c){i?i(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Xi(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,o,function(u){t(u),s.manager.itemEnd(e)},a)}catch(u){a(u)}},r,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,i){let s;const o={},a={};if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(uo.decodeText(new Uint8Array(e.slice(0,4)))===fB){try{o[tn.KHR_BINARY_GLTF]=new a9(e)}catch(u){i&&i(u);return}s=JSON.parse(o[tn.KHR_BINARY_GLTF].content)}else s=JSON.parse(uo.decodeText(new Uint8Array(e)));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new x9(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[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}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 W6(){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 tn={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 $6{constructor(e){this.parser=e,this.name=tn.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 r9{constructor(e){this.parser=e,this.name=tn.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 i9{constructor(e){this.parser=e,this.name=tn.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 s9{constructor(e){this.name=tn.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,u=i.count,d=i.byteStride,p=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,d,p,i.mode,i.filter).then(function(m){return m.buffer}):o.ready.then(function(){const m=new ArrayBuffer(u*d);return o.decodeGltfBuffer(new Uint8Array(m),u,d,p,i.mode,i.filter),m})})}else return null}}class o9{constructor(e){this.name=tn.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!==hs.TRIANGLES&&c.mode!==hs.TRIANGLE_STRIP&&c.mode!==hs.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(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),d=u.isGroup?u.children:[u],p=c[0].count,m=[];for(const v of d){const x=new bt,y=new Q,g=new Hr,_=new Q(1,1,1),E=new iE(v.geometry,v.material,p);for(let A=0;A=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"},tl={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},h9={CUBICSPLINE:void 0,LINEAR:kl,STEP:yu},gS={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function p9(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new Oh({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Us})),n.DefaultMaterial}function dc(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 nl(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 m9(n,e,t){let r=!1,i=!1,s=!1;for(let c=0,u=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 _9=new bt;class x9{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new W6,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 $R(this.options.manager):this.textureLoader=new nP(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Xi(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:{}};dc(s,a,i),nl(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,u]of o.children.entries())s(u,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&&y.setY(P,T[R*l+1]),l>=3&&y.setZ(P,T[R*l+2]),l>=4&&y.setW(P,T[R*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return y})}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(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const p=(s.samplers||{})[o.sampler]||{};return u.magFilter=pB[p.magFilter]||vn,u.minFilter=pB[p.minFilter]||io,u.wrapS=mB[p.wrapS]||Ua,u.wrapT=mB[p.wrapT]||Ua,i.associations.set(u,{textures:e}),u}).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(d=>d.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(d){c=!0;const p=new Blob([d],{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 u=Promise.resolve(l).then(function(d){return new Promise(function(p,m){let v=p;t.isImageBitmapLoader===!0&&(v=function(x){const y=new bn(x);y.needsUpdate=!0,p(y)}),t.load(uo.resolveURL(d,s.path),v,void 0,m)})}).then(function(d){return c===!0&&a.revokeObjectURL(l),d.userData.mimeType=o.mimeType||y9(o.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),d});return this.sourceCache[e]=u,u}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[tn.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[tn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[tn.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 c0,or.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 Wr,or.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 Oh}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[tn.KHR_MATERIALS_UNLIT]){const d=i[tn.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),c.push(d.extendParams(a,s,t))}else{const d=s.pbrMetallicRoughness||{};if(a.color=new rt(1,1,1),a.opacity=1,Array.isArray(d.baseColorFactor)){const p=d.baseColorFactor;a.color.fromArray(p),a.opacity=p[3]}d.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",d.baseColorTexture,3001)),a.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,a.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",d.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",d.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=xi);const u=s.alphaMode||gS.OPAQUE;if(u===gS.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===gS.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Si&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ge(1,1),s.normalTexture.scale!==void 0)){const d=s.normalTexture.scale;a.normalScale.set(d,d)}return s.occlusionTexture!==void 0&&o!==Si&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Si&&(a.emissive=new rt().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==Si&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,3001)),Promise.all(c).then(function(){const d=new o(a);return s.name&&(d.name=s.name),nl(d,s),t.associations.set(d,{materials:e}),s.extensions&&dc(i,d,s),d})}createUniqueName(e){const t=sn.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[tn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return gB(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&g9(g,s),g.name=t.createUniqueName(s.name||"mesh_"+e),nl(g,s),y.extensions&&dc(i,g,y),t.assignFinalMaterial(g),d.push(g)}for(let m=0,v=d.length;m1?u=new $o:c.length===1?u=c[0]:u=new en,u!==c[0])for(let d=0,p=c.length;d{const d=new Map;for(const[p,m]of i.associations)(p instanceof or||p instanceof bn)&&d.set(p,m);return u.traverse(p=>{const m=i.associations.get(p);m!=null&&d.set(p,m)}),d};return i.associations=c(s),s})}}function E9(n,e,t){const r=e.attributes,i=new cs;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 Q(l[0],l[1],l[2]),new Q(c[0],c[1],c[2])),a.normalized){const u=yS(hf[a.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}}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 Q,l=new Q;for(let c=0,u=s.length;c(B=F.indexOf(d))&&P=E.byteLength||!(I=p(E)))return a(1,"no header found");if(!(F=I.match(A)))return a(3,"bad initial token");for(P.valid|=1,P.programtype=F[1],P.string+=I+` `;I=p(E),I!==!1;){if(P.string+=I+` `,I.charAt(0)==="#"){P.comments+=I+` `;continue}if((F=I.match(M))&&(P.gamma=parseFloat(F[1])),(F=I.match(T))&&(P.exposure=parseFloat(F[1])),(F=I.match(R))&&(P.valid|=2,P.format=F[1]),(F=I.match(B))&&(P.valid|=4,P.height=parseInt(F[1],10),P.width=parseInt(F[2],10)),P.valid&2&&P.valid&4)break}return P.valid&2?P.valid&4?P:a(3,"missing image size specifier"):a(3,"missing format specifier")},v=function(E,A,M){const T=A;if(T<8||T>32767||E[0]!==2||E[1]!==2||E[2]&128)return new Uint8Array(E);if(T!==(E[2]<<8|E[3]))return a(3,"wrong scanline width");const R=new Uint8Array(4*A*M);if(!R.length)return a(4,"unable to allocate buffer space");let B=0,P=0;const I=4*T,F=new Uint8Array(4),N=new Uint8Array(I);let H=M;for(;H>0&&PE.byteLength)return a(1);if(F[0]=E[P++],F[1]=E[P++],F[2]=E[P++],F[3]=E[P++],F[0]!=2||F[1]!=2||(F[2]<<8|F[3])!=T)return a(3,"bad rgbe scanline format");let V=0,Y;for(;V128;if(ee&&(Y-=128),Y===0||V+Y>I)return a(3,"bad scanline data");if(ee){const G=E[P++];for(let W=0;W>3]&1<<(q&7))&&(b[z++]=q);for(var Z=z-1;z<65536;)b[z++]=0;return Z}function F(O){for(var b=0;b<16384;b++)O[b]={},O[b].len=0,O[b].lit=0,O[b].p=null}const N={l:0,c:0,lc:0};function H(O,b,z,q,Z){for(;z>z&(1<0;--b){var q=z+V[b]>>1;V[b]=z,z=q}for(var b=0;b<65537;++b){var Z=O[b];Z>0&&(O[b]=Z|V[Z]++<<6)}}function K(O,b,z,q,Z,ne,Ee){for(var Se=z,Ie=0,De=0;Z<=ne;Z++){if(Se.value-z.value>q)return!1;H(6,Ie,De,O,Se);var ke=N.l;if(Ie=N.c,De=N.lc,Ee[Z]=ke,ke==63){if(Se.value-z.value>q)throw"Something wrong with hufUnpackEncTable";H(8,Ie,De,O,Se);var de=N.l+6;if(Ie=N.c,De=N.lc,Z+de>ne+1)throw"Something wrong with hufUnpackEncTable";for(;de--;)Ee[Z++]=0;Z--}else if(ke>=59){var de=ke-59+2;if(Z+de>ne+1)throw"Something wrong with hufUnpackEncTable";for(;de--;)Ee[Z++]=0;Z--}}Y(Ee)}function ee(O){return O&63}function G(O){return O>>6}function W(O,b,z,q){for(;b<=z;b++){var Z=G(O[b]),ne=ee(O[b]);if(Z>>ne)throw"Invalid table entry";if(ne>14){var Ee=q[Z>>ne-14];if(Ee.len)throw"Invalid table entry";if(Ee.lit++,Ee.p){var Se=Ee.p;Ee.p=new Array(Ee.lit);for(var Ie=0;Ie0;Ie--){var Ee=q[(Z<<14-ne)+De];if(Ee.len||Ee.p)throw"Invalid table entry";Ee.len=ne,Ee.lit=b,De++}}return!0}const J={c:0,lc:0};function j(O,b,z,q){O=O<<8|ze(z,q),b+=8,J.c=O,J.lc=b}const X={c:0,lc:0};function oe(O,b,z,q,Z,ne,Ee,Se,Ie,De){if(O==b){q<8&&(j(z,q,Z,Ee),z=J.c,q=J.lc),q-=8;var ke=z>>q,ke=new Uint8Array([ke])[0];if(Ie.value+ke>De)return!1;for(var de=Se[Ie.value-1];ke-- >0;)Se[Ie.value++]=de}else if(Ie.value32767?b-65536:b}const le={a:0,b:0};function ue(O,b){var z=ce(O),q=ce(b),Z=q,ne=z+(Z&1)+(Z>>1),Ee=ne,Se=ne-Z;le.a=Ee,le.b=Se}function xe(O,b){var z=se(O),q=se(b),Z=z-(q>>1)&65535,ne=q+Z-32768&65535;le.a=ne,le.b=Z}function Le(O,b,z,q,Z,ne,Ee){for(var Se=Ee<16384,Ie=z>Z?Z:z,De=1,ke;De<=Ie;)De<<=1;for(De>>=1,ke=De,De>>=1;De>=1;){for(var de=0,ot=de+ne*(Z-ke),Qe=ne*De,tt=ne*ke,yt=q*De,Et=q*ke,gt,at,At,dt;de<=ot;de+=tt){for(var It=de,on=de+q*(z-ke);It<=on;It+=Et){var Ct=It+yt,Qt=It+Qe,qt=Qt+yt;Se?(ue(O[It+b],O[Qt+b]),gt=le.a,At=le.b,ue(O[Ct+b],O[qt+b]),at=le.a,dt=le.b,ue(gt,at),O[It+b]=le.a,O[Ct+b]=le.b,ue(At,dt),O[Qt+b]=le.a,O[qt+b]=le.b):(xe(O[It+b],O[Qt+b]),gt=le.a,At=le.b,xe(O[Ct+b],O[qt+b]),at=le.a,dt=le.b,xe(gt,at),O[It+b]=le.a,O[Ct+b]=le.b,xe(At,dt),O[Qt+b]=le.a,O[qt+b]=le.b)}if(z&De){var Qt=It+Qe;Se?ue(O[It+b],O[Qt+b]):xe(O[It+b],O[Qt+b]),gt=le.a,O[Qt+b]=le.b,O[It+b]=gt}}if(Z&De)for(var It=de,on=de+q*(z-ke);It<=on;It+=Et){var Ct=It+yt;Se?ue(O[It+b],O[Ct+b]):xe(O[It+b],O[Ct+b]),gt=le.a,O[Ct+b]=le.b,O[It+b]=gt}ke=De,De>>=1}return de}function Je(O,b,z,q,Z,ne,Ee,Se,Ie,De){for(var ke=0,de=0,ot=Se,Qe=Math.trunc(Z.value+(ne+7)/8);Z.value=14;){var tt=ke>>de-14&16383,yt=b[tt];if(yt.len)de-=yt.len,oe(yt.lit,Ee,ke,de,z,q,Z,Ie,De,ot),ke=X.c,de=X.lc;else{if(!yt.p)throw"hufDecode issues";var Et;for(Et=0;Et=gt&&G(O[yt.p[Et]])==(ke>>de-gt&(1<>=at,de-=at;de>0;){var yt=b[ke<<14-de&16383];if(yt.len)de-=yt.len,oe(yt.lit,Ee,ke,de,z,q,Z,Ie,De,ot),ke=X.c,de=X.lc;else throw"hufDecode issues"}return!0}function Pe(O,b,z,q,Z,ne){var Ee={value:0},Se=z.value,Ie=We(b,z),De=We(b,z);z.value+=4;var ke=We(b,z);if(z.value+=4,Ie<0||Ie>=65537||De<0||De>=65537)throw"Something wrong with HUF_ENCSIZE";var de=new Array(65537),ot=new Array(16384);F(ot);var Qe=q-(z.value-Se);if(K(O,b,z,Qe,Ie,De,de),ke>8*(q-(z.value-Se)))throw"Something wrong with hufUncompress";W(de,Ie,De,ot),Je(de,ot,O,b,z,ke,De,ne,Z,Ee)}function $(O,b,z){for(var q=0;qne||(b[Z++]=O[z++],Z>ne));)b[Z++]=O[q++]}function me(O){for(var b=O.byteLength,z=new Array,q=0,Z=new DataView(O);b>0;){var ne=Z.getInt8(q++);if(ne<0){var Ee=-ne;b-=Ee+1;for(var Se=0;Se>8==255?Z+=q&255:(z[Z]=q,Z++),O.value++}function _e(O,b){b[0]=ge(O[0]),b[1]=ge(O[1]),b[2]=ge(O[5]),b[3]=ge(O[6]),b[4]=ge(O[14]),b[5]=ge(O[15]),b[6]=ge(O[27]),b[7]=ge(O[28]),b[8]=ge(O[2]),b[9]=ge(O[4]),b[10]=ge(O[7]),b[11]=ge(O[13]),b[12]=ge(O[16]),b[13]=ge(O[26]),b[14]=ge(O[29]),b[15]=ge(O[42]),b[16]=ge(O[3]),b[17]=ge(O[8]),b[18]=ge(O[12]),b[19]=ge(O[17]),b[20]=ge(O[25]),b[21]=ge(O[30]),b[22]=ge(O[41]),b[23]=ge(O[43]),b[24]=ge(O[9]),b[25]=ge(O[11]),b[26]=ge(O[18]),b[27]=ge(O[24]),b[28]=ge(O[31]),b[29]=ge(O[40]),b[30]=ge(O[44]),b[31]=ge(O[53]),b[32]=ge(O[10]),b[33]=ge(O[19]),b[34]=ge(O[23]),b[35]=ge(O[32]),b[36]=ge(O[39]),b[37]=ge(O[45]),b[38]=ge(O[52]),b[39]=ge(O[54]),b[40]=ge(O[20]),b[41]=ge(O[22]),b[42]=ge(O[33]),b[43]=ge(O[38]),b[44]=ge(O[46]),b[45]=ge(O[51]),b[46]=ge(O[55]),b[47]=ge(O[60]),b[48]=ge(O[21]),b[49]=ge(O[34]),b[50]=ge(O[37]),b[51]=ge(O[47]),b[52]=ge(O[50]),b[53]=ge(O[56]),b[54]=ge(O[59]),b[55]=ge(O[61]),b[56]=ge(O[35]),b[57]=ge(O[36]),b[58]=ge(O[48]),b[59]=ge(O[49]),b[60]=ge(O[57]),b[61]=ge(O[58]),b[62]=ge(O[62]),b[63]=ge(O[63])}function Fe(O){const b=.5*Math.cos(.7853975),z=.5*Math.cos(3.14159/16),q=.5*Math.cos(3.14159/8),Z=.5*Math.cos(3*3.14159/16),ne=.5*Math.cos(5*3.14159/16),Ee=.5*Math.cos(3*3.14159/8),Se=.5*Math.cos(7*3.14159/16);for(var Ie=new Array(4),De=new Array(4),ke=new Array(4),de=new Array(4),ot=0;ot<8;++ot){var Qe=ot*8;Ie[0]=q*O[Qe+2],Ie[1]=Ee*O[Qe+2],Ie[2]=q*O[Qe+6],Ie[3]=Ee*O[Qe+6],De[0]=z*O[Qe+1]+Z*O[Qe+3]+ne*O[Qe+5]+Se*O[Qe+7],De[1]=Z*O[Qe+1]-Se*O[Qe+3]-z*O[Qe+5]-ne*O[Qe+7],De[2]=ne*O[Qe+1]-z*O[Qe+3]+Se*O[Qe+5]+Z*O[Qe+7],De[3]=Se*O[Qe+1]-ne*O[Qe+3]+Z*O[Qe+5]-z*O[Qe+7],ke[0]=b*(O[Qe+0]+O[Qe+4]),ke[3]=b*(O[Qe+0]-O[Qe+4]),ke[1]=Ie[0]+Ie[3],ke[2]=Ie[1]-Ie[2],de[0]=ke[0]+ke[1],de[1]=ke[3]+ke[2],de[2]=ke[3]-ke[2],de[3]=ke[0]-ke[1],O[Qe+0]=de[0]+De[0],O[Qe+1]=de[1]+De[1],O[Qe+2]=de[2]+De[2],O[Qe+3]=de[3]+De[3],O[Qe+4]=de[3]-De[3],O[Qe+5]=de[2]-De[2],O[Qe+6]=de[1]-De[1],O[Qe+7]=de[0]-De[0]}for(var tt=0;tt<8;++tt)Ie[0]=q*O[16+tt],Ie[1]=Ee*O[16+tt],Ie[2]=q*O[48+tt],Ie[3]=Ee*O[48+tt],De[0]=z*O[8+tt]+Z*O[24+tt]+ne*O[40+tt]+Se*O[56+tt],De[1]=Z*O[8+tt]-Se*O[24+tt]-z*O[40+tt]-ne*O[56+tt],De[2]=ne*O[8+tt]-z*O[24+tt]+Se*O[40+tt]+Z*O[56+tt],De[3]=Se*O[8+tt]-ne*O[24+tt]+Z*O[40+tt]-z*O[56+tt],ke[0]=b*(O[tt]+O[32+tt]),ke[3]=b*(O[tt]-O[32+tt]),ke[1]=Ie[0]+Ie[3],ke[2]=Ie[1]-Ie[2],de[0]=ke[0]+ke[1],de[1]=ke[3]+ke[2],de[2]=ke[3]-ke[2],de[3]=ke[0]-ke[1],O[0+tt]=de[0]+De[0],O[8+tt]=de[1]+De[1],O[16+tt]=de[2]+De[2],O[24+tt]=de[3]+De[3],O[32+tt]=de[3]-De[3],O[40+tt]=de[2]-De[2],O[48+tt]=de[1]-De[1],O[56+tt]=de[0]-De[0]}function Ne(O){for(var b=0;b<64;++b){var z=O[0][b],q=O[1][b],Z=O[2][b];O[0][b]=z+1.5747*Z,O[1][b]=z-.1873*q-.4682*Z,O[2][b]=z+1.8556*q}}function Ce(O,b,z){for(var q=0;q<64;++q)b[z+q]=Xl.toHalfFloat(st(O[q]))}function st(O){return O<=1?Math.sign(O)*Math.pow(Math.abs(O),2.2):Math.sign(O)*Math.pow(P,Math.abs(O)-1)}function k(O){return new DataView(O.array.buffer,O.offset.value,O.size)}function U(O){var b=O.viewer.buffer.slice(O.offset.value,O.offset.value+O.size),z=new Uint8Array(me(b)),q=new Uint8Array(z.length);return Me(z),ve(z,q),new DataView(q.buffer)}function ae(O){var b=O.array.slice(O.offset.value,O.offset.value+O.size),z=O0(b),q=new Uint8Array(z.length);return Me(z),ve(z,q),new DataView(q.buffer)}function be(O){for(var b=O.viewer,z={value:O.offset.value},q=new Uint16Array(O.width*O.scanlineBlockSize*(O.channels*O.type)),Z=new Uint8Array(8192),ne=0,Ee=new Array(O.channels),Se=0;Se=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(Ie<=De)for(var Se=0;Se0;){var Se=Ve(b.buffer,z),Ie=Xe(b,z),De=Ie>>2&3,ke=(Ie>>4)-1,de=new Int8Array([ke])[0],ot=Xe(b,z);ne.push({name:Se,index:de,type:ot,compression:De}),Ee-=Se.length+3}for(var Qe=cn.channels,tt=new Array(O.channels),yt=0;yt=0&&(at.idx[dt.index]=At),Et.offset=At)}if(Z.acCompressedSize>0)switch(Z.acCompression){case 0:var Ct=new Uint16Array(Z.totalAcUncompressedCount);Pe(O.array,b,z,Z.acCompressedSize,Ct,Z.totalAcUncompressedCount);break;case 1:var It=O.array.slice(z.value,z.value+Z.totalAcUncompressedCount),on=O0(It),Ct=new Uint16Array(on.buffer);z.value+=Z.totalAcUncompressedCount;break}if(Z.dcCompressedSize>0){var Qt={array:O.array,offset:z,size:Z.dcCompressedSize},qt=new Uint16Array(ae(Qt).buffer);z.value+=Z.dcCompressedSize}if(Z.rleRawSize>0){var It=O.array.slice(z.value,z.value+Z.rleCompressedSize),on=O0(It),rn=me(on.buffer);z.value+=Z.rleCompressedSize}for(var Ln=0,Rt=new Array(tt.length),yt=0;yt>10,z=O&1023;return(O>>15?-1:1)*(b?b===31?z?NaN:1/0:Math.pow(2,b-15)*(1+z/1024):6103515625e-14*(z/1024))}function ye(O,b){var z=O.getUint16(b.value,!0);return b.value+=2,z}function Ke(O,b){return ge(ye(O,b))}function nt(O,b,z,q){for(var Z=z.value,ne=[];z.valuevt.height?vt.height-b:vt.scanlineBlockSize;const q=vt.size=vt.height)break;for(let Ee=0;Ee{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(_S.has(e)){const l=_S.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,u)=>{i._callbacks[s]={resolve:c,reject:u},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)}),_S.set(e,{key:r,promise:a}),a}_createGeometry(e){const t=new Dt;e.index&&t.setIndex(new un(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=C9.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 d=u.draco,p=new d.Decoder,m=new d.DecoderBuffer;m.Init(new Int8Array(l),l.byteLength);try{const v=t(d,p,m,c),x=v.attributes.map(y=>y.array.buffer);v.index&&x.push(v.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:v},x)}catch(v){console.error(v),self.postMessage({type:"error",id:a.id,error:v.message})}finally{d.destroy(m),d.destroy(p)}});break}};function t(o,a,l,c){const u=c.attributeIDs,d=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 x={index:null,attributes:[]};for(const y in u){const g=self[d[y]];let _,E;if(c.useUniqueIDs)E=u[y],_=a.GetAttributeByUniqueId(p,E);else{if(E=a.GetAttributeId(p,o[u[y]]),E===-1)continue;_=a.GetAttribute(p,E)}x.attributes.push(i(o,a,p,y,g,_))}return v===o.TRIANGULAR_MESH&&(x.index=r(o,a,p)),o.destroy(p),x}function r(o,a,l){const u=l.num_faces()*3,d=u*4,p=o._malloc(d);a.GetTrianglesUInt32Array(l,d,p);const m=new Uint32Array(o.HEAPF32.buffer,p,u).slice();return o._free(p),{array:m,itemSize:1}}function i(o,a,l,c,u,d){const p=d.num_components(),v=l.num_points()*p,x=v*u.BYTES_PER_ELEMENT,y=s(o,u),g=o._malloc(x);a.GetAttributeDataArrayForAllPoints(l,d,y,x,g);const _=new u(o.HEAPF32.buffer,g,v).slice();return o._free(g),{name:c,array:_,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 U0;const xS=()=>{if(U0)return U0;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(d=>{s=d.instance,s.exports.__wasm_call_ctors()});function a(d){const p=new Uint8Array(d.length);for(let v=0;v96?x-71:x>64?x-65:x>47?x+4:x>46?63:62}let m=0;for(let v=0;v.init",c),u&&(u=r("<"+a+">.getTransferables",u));var d=null;typeof c=="function"?d=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),n[o]={id:o,value:d,getTransferables:u},s(d)}catch(p){p&&p.noLog||console.error(p),s(p)}}function t(i,s){var o,a=i.id,l=i.args;(!n[a]||typeof n[a].value!="function")&&s(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var c=(o=n[a]).value.apply(o,l);c&&typeof c.then=="function"?c.then(u,function(d){return s(d instanceof Error?d:new Error(""+d))}):u(c)}catch(d){s(d)}function u(d){try{var p=n[a].getTransferables&&n[a].getTransferables(d);(!p||!Array.isArray(p)||!p.length)&&(p=void 0),s(d,p)}catch(m){console.error(m),s(m)}}}function r(i,s){var o=void 0;self.troikaDefine=function(l){return o=l};var a=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/ troikaDefine( `+s+` )`],{type:"application/javascript"}));try{importScripts(a)}catch(l){console.error(l)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(i){var s=i.data,o=s.messageId,a=s.action,l=s.data;try{a==="registerModule"&&e(l,function(c){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof c=="function"}})}),a==="callModule"&&t(l,function(c,u){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:c},u||void 0)})}catch(c){postMessage({messageId:o,success:!1,error:c.stack})}})}function R9(n){var e=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=n.dependencies,r=n.init;t=Array.isArray(t)?t.map(function(s){return s&&s._getInitResult?s._getInitResult():s}):[];var i=Promise.all(t).then(function(s){return r.apply(null,s)});return e._getInitResult=function(){return i},i},e}var vB=function(){var n=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),n=!0}catch(t){typeof process<"u",console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return vB=function(){return n},n},P9=0,B9=0,ES=!1,Kh=Object.create(null),Zh=Object.create(null),SS=Object.create(null);function Qh(n){if((!n||typeof n.init!="function")&&!ES)throw new Error("requires `options.init` function");var e=n.dependencies,t=n.init,r=n.getTransferables,i=n.workerId;if(!vB())return R9(n);i==null&&(i="#default");var s="workerModule"+ ++P9,o=n.name||s,a=null;e=e&&e.map(function(c){return typeof c=="function"&&!c.workerModuleData&&(ES=!0,c=Qh({workerId:i,name:"<"+o+"> function dependency: "+c.name,init:`function(){return ( `+F0(c)+` )}`}),ES=!1),c&&c.workerModuleData&&(c=c.workerModuleData),c});function l(){for(var c=[],u=arguments.length;u--;)c[u]=arguments[u];if(!a){a=yB(i,"registerModule",l.workerModuleData);var d=function(){a=null,Zh[i].delete(d)};(Zh[i]||(Zh[i]=new Set)).add(d)}return a.then(function(p){var m=p.isCallable;if(m)return yB(i,"callModule",{id:s,args:c});throw new Error("Worker module function was called but `init` did not return a callable function")})}return l.workerModuleData={isWorkerModule:!0,id:s,name:o,dependencies:e,init:F0(t),getTransferables:r&&F0(r)},l}function I9(n){Zh[n]&&Zh[n].forEach(function(e){e()}),Kh[n]&&(Kh[n].terminate(),delete Kh[n])}function F0(n){var e=n.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function D9(n){var e=Kh[n];if(!e){var t=F0(b9);e=Kh[n]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+n.replace(/\*/g,"")+` **/ ;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(r){var i=r.data,s=i.messageId,o=SS[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete SS[s],o(i)}}return e}function yB(n,e,t){return new Promise(function(r,i){var s=++B9;SS[s]=function(o){o.success?r(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},D9(n).postMessage({messageId:s,action:e,data:t})})}function _B(){var n=function(e){function t(W,J,j,X,oe,se,ce,le){var ue=1-ce;le.x=ue*ue*W+2*ue*ce*j+ce*ce*oe,le.y=ue*ue*J+2*ue*ce*X+ce*ce*se}function r(W,J,j,X,oe,se,ce,le,ue,xe){var Le=1-ue;xe.x=Le*Le*Le*W+3*Le*Le*ue*j+3*Le*ue*ue*oe+ue*ue*ue*ce,xe.y=Le*Le*Le*J+3*Le*Le*ue*X+3*Le*ue*ue*se+ue*ue*ue*le}function i(W,J){for(var j=/([MLQCZ])([^MLQCZ]*)/g,X,oe,se,ce,le;X=j.exec(W);){var ue=X[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(xe){return parseFloat(xe)});switch(X[1]){case"M":ce=oe=ue[0],le=se=ue[1];break;case"L":(ue[0]!==ce||ue[1]!==le)&&J("L",ce,le,ce=ue[0],le=ue[1]);break;case"Q":{J("Q",ce,le,ce=ue[2],le=ue[3],ue[0],ue[1]);break}case"C":{J("C",ce,le,ce=ue[4],le=ue[5],ue[0],ue[1],ue[2],ue[3]);break}case"Z":(ce!==oe||le!==se)&&J("L",ce,le,oe,se);break}}}function s(W,J,j){j===void 0&&(j=16);var X={x:0,y:0};i(W,function(oe,se,ce,le,ue,xe,Le,Je,Pe){switch(oe){case"L":J(se,ce,le,ue);break;case"Q":{for(var $=se,Me=ce,ve=1;ve0;)Be[Te]=arguments[Te+2];var Ve=Ne[be]||(Ne[be]=j.getUniformLocation(Ce,be));j["uniform"+ae].apply(j,[Ve].concat(Be))},setAttribute:function(ae,be,Be,Te,Ve){var He=Fe[ae];He||(He=Fe[ae]={buf:j.createBuffer(),loc:j.getAttribLocation(Ce,ae),data:null}),j.bindBuffer(j.ARRAY_BUFFER,He.buf),j.vertexAttribPointer(He.loc,be,j.FLOAT,!1,0,0),j.enableVertexAttribArray(He.loc),oe?j.vertexAttribDivisor(He.loc,Te):Le("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(He.loc,Te),Ve!==He.data&&(j.bufferData(j.ARRAY_BUFFER,Ve,Be),He.data=Ve)}})}}}ce[me].transaction(_e)},$=function(me,pe){ue++;try{j.activeTexture(j.TEXTURE0+ue);var $e=le[me];$e||($e=le[me]=j.createTexture(),j.bindTexture(j.TEXTURE_2D,$e),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST)),j.bindTexture(j.TEXTURE_2D,$e),pe($e,ue)}finally{ue--}},Me=function(me,pe,$e){var _e=j.createFramebuffer();xe.push(_e),j.bindFramebuffer(j.FRAMEBUFFER,_e),j.activeTexture(j.TEXTURE0+pe),j.bindTexture(j.TEXTURE_2D,me),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,me,0);try{$e(_e)}finally{j.deleteFramebuffer(_e),j.bindFramebuffer(j.FRAMEBUFFER,xe[--xe.length-1]||null)}},ve=function(){se={},ce={},le={},ue=-1,xe.length=0};var oe=typeof WebGL2RenderingContext<"u"&&j instanceof WebGL2RenderingContext,se={},ce={},le={},ue=-1,xe=[];j.canvas.addEventListener("webglcontextlost",function(me){ve(),me.preventDefault()},!1),l.set(j,X={gl:j,isWebGL2:oe,getExtension:Le,withProgram:Pe,withTexture:$,withTextureFramebuffer:Me,handleContextLoss:ve})}J(X)}function d(W,J,j,X,oe,se,ce,le){ce===void 0&&(ce=15),le===void 0&&(le=null),u(W,function(ue){var xe=ue.gl,Le=ue.withProgram,Je=ue.withTexture;Je("copy",function(Pe,$){xe.texImage2D(xe.TEXTURE_2D,0,xe.RGBA,oe,se,0,xe.RGBA,xe.UNSIGNED_BYTE,J),Le("copy",o,a,function(Me){var ve=Me.setUniform,me=Me.setAttribute;me("aUV",2,xe.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),ve("1i","image",$),xe.bindFramebuffer(xe.FRAMEBUFFER,le||null),xe.disable(xe.BLEND),xe.colorMask(ce&8,ce&4,ce&2,ce&1),xe.viewport(j,X,oe,se),xe.scissor(j,X,oe,se),xe.drawArrays(xe.TRIANGLES,0,3)})})})}function p(W,J,j){var X=W.width,oe=W.height;u(W,function(se){var ce=se.gl,le=new Uint8Array(X*oe*4);ce.readPixels(0,0,X,oe,ce.RGBA,ce.UNSIGNED_BYTE,le),W.width=J,W.height=j,d(ce,le,0,0,X,oe)})}var m=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:d,resizeWebGLCanvasWithoutClearing:p});function v(W,J,j,X,oe,se){se===void 0&&(se=1);var ce=new Uint8Array(W*J),le=X[2]-X[0],ue=X[3]-X[1],xe=[];s(j,function(me,pe,$e,_e){xe.push({x1:me,y1:pe,x2:$e,y2:_e,minX:Math.min(me,$e),minY:Math.min(pe,_e),maxX:Math.max(me,$e),maxY:Math.max(pe,_e)})}),xe.sort(function(me,pe){return me.maxX-pe.maxX});for(var Le=0;LeNe.minX&&pe-_eNe.minY){var Ce=g(me,pe,Ne.x1,Ne.y1,Ne.x2,Ne.y2);Ce<$e&&($e=Ce,_e=Math.sqrt($e))}}return ve(me,pe)&&(_e=-_e),_e}function ve(me,pe){for(var $e=0,_e=xe.length;_e--;){var Fe=xe[_e];if(Fe.maxX<=me)break;var Ne=Fe.y1>pe!=Fe.y2>pe&&me<(Fe.x2-Fe.x1)*(pe-Fe.y1)/(Fe.y2-Fe.y1)+Fe.x1;Ne&&($e+=Fe.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function x(_e,Fe){var Ne=36,Ce=0,st=new Map,k=Fe&&new Map,U;return _e.split(",").forEach(function ae(be){if(be.indexOf("+")!==-1)for(var Be=+be;Be--;)ae(U);else{U=be;var Te=be.split(">"),Ve=Te[0],He=Te[1];Ve=String.fromCodePoint(Ce+=parseInt(Ve,Ne)),He=String.fromCodePoint(Ce+=parseInt(He,Ne)),st.set(Ve,He),Fe&&k.set(He,Ve)}}),{map:st,reverseMap:k}}var y,g,_;function E(){if(!y){var _e=x(v.pairs,!0),Fe=_e.map,Ne=_e.reverseMap;y=Fe,g=Ne,_=x(v.canonical,!1).map}}function A(_e){return E(),y.get(_e)||null}function M(_e){return E(),g.get(_e)||null}function T(_e){return E(),_.get(_e)||null}var R=r.L,B=r.R,P=r.EN,I=r.ES,F=r.ET,N=r.AN,H=r.CS,V=r.B,Y=r.S,K=r.ON,ee=r.BN,G=r.NSM,W=r.AL,J=r.LRO,j=r.RLO,X=r.LRE,oe=r.RLE,se=r.PDF,ce=r.LRI,le=r.RLI,ue=r.FSI,xe=r.PDI;function Le(_e,Fe){for(var Ne=125,Ce=new Uint32Array(_e.length),st=0;st<_e.length;st++)Ce[st]=p(_e[st]);var k=new Map;function U(cr,Tr){var wn=Ce[cr];Ce[cr]=Tr,k.set(wn,k.get(wn)-1),wn&a&&k.set(a,k.get(a)-1),k.set(Tr,(k.get(Tr)||0)+1),Tr&a&&k.set(a,(k.get(a)||0)+1)}for(var ae=new Uint8Array(_e.length),be=new Map,Be=[],Te=null,Ve=0;Ve<_e.length;Ve++)Te||Be.push(Te={start:Ve,end:_e.length-1,level:Fe==="rtl"?1:Fe==="ltr"?0:Hf(Ve,!1)}),Ce[Ve]&V&&(Te.end=Ve,Te=null);for(var He=oe|X|j|J|s|xe|se|V,we=function(cr){return cr+(cr&1?1:2)},je=function(cr){return cr+(cr&1?2:1)},Ze=0;Ze0)Xe--;else if(ut>0){for(et=0;!We[We.length-1]._isolate;)We.pop();var Bt=We[We.length-1]._isolInitIndex;Bt!=null&&(be.set(Bt,re),be.set(re,Bt)),We.pop(),ut--}ze=We[We.length-1],ae[re]=ze._level,ze._override&&U(re,ze._override)}else ge&se?(Xe===0&&(et>0?et--:!ze._isolate&&We.length>1&&(We.pop(),ze=We[We.length-1])),ae[re]=ze._level):ge&V&&(ae[re]=Te.level);else ae[re]=ze._level,ze._override&&ge!==ee&&U(re,ze._override)}for(var Ht=[],$t=null,nn=Te.start;nn<=Te.end;nn++){var ln=Ce[nn];if(!(ln&l)){var jt=ae[nn],Ft=ln&s,wr=ln===xe;$t&&jt===$t._level?($t._end=nn,$t._endsWithIsolInit=Ft):Ht.push($t={_start:nn,_end:nn,_level:jt,_startsWithPDI:wr,_endsWithIsolInit:Ft})}}for(var lr=[],Jt=0;Jt=0;Z--)if(!(Ce[Z]&l)){q=ae[Z];break}var ne=qn[qn.length-1],Ee=ae[ne],Se=Te.level;if(!(Ce[ne]&s)){for(var Ie=ne+1;Ie<=Te.end;Ie++)if(!(Ce[Ie]&l)){Se=ae[Ie];break}}lr.push({_seqIndices:qn,_sosType:Math.max(q,z)%2?B:R,_eosType:Math.max(Se,Ee)%2?B:R})}}for(var De=0;De=0;gt--)if(!(Ce[de[gt]]&l)){Et=Ce[de[gt]];break}U(yt,Et&(s|xe)?K:Et)}}if(k.get(P))for(var at=0;at=-1;dt--){var It=dt===-1?ot:Ce[de[dt]];if(It&o){It===W&&U(At,N);break}}}if(k.get(W))for(var on=0;on=0&&(rn=Ce[de[Rt]],!!(rn&l));Rt--);for(var An=Qt+1;An=0&&Ce[de[yn]]&(F|l);yn--)U(de[yn],P);for(var Ri=Yt+1;Ri=0&&Ce[de[sa]]&l;sa--)U(de[sa],K);for(var oa=rr+1;oa=0;ca--){var Nf=cl[ca].char;if(Nf===Tp||Nf===M(T(Xt))||A(T(Nf))===Xt){vo.push([cl[ca].seqIndex,yo]),cl.length=ca;break}}}vo.sort(function(cr,Tr){return cr[0]-Tr[0]})}for(var Cp=0;Cp=0;Rp--){var zf=de[Rp];if(Ce[zf]&kf){var Zi=Ce[zf]&la?B:R;Zi!==xo(zf)?fi=Zi:fi=xo(zf);break}}}if(fi){if(Ce[de[Un]]=Ce[de[ul]]=fi,fi!==xo(de[Un])){for(var di=Un+1;di=0;wc--)if(Ce[de[wc]]&l)Pp=wc;else{Pi=Ce[de[wc]]&la?B:R;break}for(var Mc=Qe,Tc=xs+1;Tc=0&&p(_e[dl])&c;dl--)ae[dl]=Te.level}}return{levels:ae,paragraphs:Be};function Hf(cr,Tr){for(var wn=cr;wn<_e.length;wn++){var yr=Ce[wn];if(yr&(B|W))return 1;if(yr&(V|R)||Tr&&yr===xe)return 0;if(yr&s){var Zs=Rv(wn);wn=Zs===-1?_e.length:Zs}}return 0}function Rv(cr){for(var Tr=1,wn=cr+1;wn<_e.length;wn++){var yr=Ce[wn];if(yr&V)break;if(yr&xe){if(--Tr===0)return wn}else yr&s&&Tr++}return-1}function xo(cr){return ae[cr]&1?B:R}}var Je="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",Pe;function $(){if(!Pe){var _e=x(Je,!0),Fe=_e.map,Ne=_e.reverseMap;Ne.forEach(function(Ce,st){Fe.set(st,Ce)}),Pe=Fe}}function Me(_e){return $(),Pe.get(_e)||null}function ve(_e,Fe,Ne,Ce){var st=_e.length;Ne=Math.max(0,Ne==null?0:+Ne),Ce=Math.min(st-1,Ce==null?st-1:+Ce);for(var k=new Map,U=Ne;U<=Ce;U++)if(Fe[U]&1){var ae=Me(_e[U]);ae!==null&&k.set(U,ae)}return k}function me(_e,Fe,Ne,Ce){var st=_e.length;Ne=Math.max(0,Ne==null?0:+Ne),Ce=Math.min(st-1,Ce==null?st-1:+Ce);var k=[];return Fe.paragraphs.forEach(function(U){var ae=Math.max(Ne,U.start),be=Math.min(Ce,U.end);if(ae=ae&&p(_e[Te])&c;Te--)Be[Te]=U.level;for(var Ve=U.level,He=1/0,we=0;weVe&&(Ve=je),je=He;Ze--)for(var We=0;We=Ze){for(var ze=We;We+1=Ze;)We++;We>ze&&k.push([ze+Ne,We+Ne])}}}),k}function pe(_e,Fe,Ne,Ce){var st=$e(_e,Fe,Ne,Ce),k=[].concat(_e);return st.forEach(function(U,ae){k[ae]=(Fe.levels[U]&1?Me(_e[U]):null)||_e[U]}),k.join("")}function $e(_e,Fe,Ne,Ce){for(var st=me(_e,Fe,Ne,Ce),k=[],U=0;U<_e.length;U++)k[U]=U;return st.forEach(function(ae){for(var be=ae[0],Be=ae[1],Te=k.slice(be,Be+1),Ve=Te.length;Ve--;)k[Be-Ve]=Te[Ve]}),k}return e.closingToOpeningBracket=M,e.getBidiCharType=p,e.getBidiCharTypeName=m,e.getCanonicalBracket=T,e.getEmbeddingLevels=Le,e.getMirroredCharacter=Me,e.getMirroredCharactersMap=ve,e.getReorderSegments=me,e.getReorderedIndices=$e,e.getReorderedString=pe,e.openingToClosingBracket=A,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return n}const xB=/\bvoid\s+main\s*\(\s*\)\s*{/g;function AS(n){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function t(r,i){let s=Nt[i];return s?AS(s):r}return n.replace(e,t)}const Lr=[];for(let n=0;n<256;n++)Lr[n]=(n<16?"0":"")+n.toString(16);function O9(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Lr[n&255]+Lr[n>>8&255]+Lr[n>>16&255]+Lr[n>>24&255]+"-"+Lr[e&255]+Lr[e>>8&255]+"-"+Lr[e>>16&15|64]+Lr[e>>24&255]+"-"+Lr[t&63|128]+Lr[t>>8&255]+"-"+Lr[t>>16&255]+Lr[t>>24&255]+Lr[r&255]+Lr[r>>8&255]+Lr[r>>16&255]+Lr[r>>24&255]).toUpperCase()}const hc=Object.assign||function(){let n=arguments[0];for(let e=1,t=arguments.length;e/gm,` //!BEGIN_POST_CHUNK $1 $& //!END_POST_CHUNK `),t=AS(t)),m){let x=m({vertexShader:e,fragmentShader:t});e=x.vertexShader,t=x.fragmentShader}if(p){let x=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,y=>(x.push(y),"")),d=`${p} ${x.join(` `)} ${d}`}if(v){const x=` uniform float ${v}; `;s=x+s,c=x+c}return l&&(e=`vec3 troika_position_${i}; vec3 troika_normal_${i}; vec2 troika_uv_${i}; ${e} `,s=`${s} void troikaVertexTransform${i}(inout vec3 position, inout vec3 normal, inout vec2 uv) { ${l} } `,o=` troika_position_${i} = vec3(position); troika_normal_${i} = vec3(normal); troika_uv_${i} = vec2(uv); troikaVertexTransform${i}(troika_position_${i}, troika_normal_${i}, troika_uv_${i}); ${o} `,e=e.replace(/\b(position|normal|uv)\b/g,(x,y,g,_)=>/\battribute\s+vec[23]\s+$/.test(_.substr(0,g))?y:`troika_${y}_${i}`),n.map&&n.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=AB(e,i,s,o,a),t=AB(t,i,c,u,d),{vertexShader:e,fragmentShader:t}}function AB(n,e,t,r,i){return(r||i||t)&&(n=n.replace(xB,` ${t} void troikaOrigMain${e}() {`),n+=` void main() { ${r} troikaOrigMain${e}(); ${i} }`),n}function N9(n,e){return n==="uniforms"?void 0:typeof e=="function"?e.toString():e}let z9=0;const wB=new Map;function G9(n){const e=JSON.stringify(n,N9);let t=wB.get(e);return t==null&&wB.set(e,t=++z9),t}function H9(n,e,t){const{defaultFontURL:r}=t,i=Object.create(null),s=1/0,o=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,a="[^\\S\\u00A0]",l=new RegExp(`${a}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function c(_,E){function A(){const M=T=>{console.error(`Failure loading font ${_}${_===r?"":"; trying fallback"}`,T),_!==r&&(_=r,A())};try{const T=new XMLHttpRequest;T.open("get",_,!0),T.responseType="arraybuffer",T.onload=function(){if(T.status>=400)M(new Error(T.statusText));else if(T.status>0)try{const R=n(T.response);E(R)}catch(R){M(R)}},T.onerror=M,T.send()}catch(T){M(T)}}A()}function u(_,E){_||(_=r);let A=i[_];A?A.pending?A.pending.push(E):E(A):(i[_]={pending:[E]},c(_,M=>{let T=i[_].pending;i[_]=M,T.forEach(R=>R(M))}))}function d({text:_="",font:E=r,sdfGlyphSize:A=64,fontSize:M=1,letterSpacing:T=0,lineHeight:R="normal",maxWidth:B=s,direction:P,textAlign:I="left",textIndent:F=0,whiteSpace:N="normal",overflowWrap:H="normal",anchorX:V=0,anchorY:Y=0,includeCaretPositions:K=!1,chunkedBoundsSize:ee=8192,colorRanges:G=null},W,J=!1){const j=x(),X={fontLoad:0,typesetting:0};_.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),_=_.replace(/\r\n/g,` `).replace(/\r/g,` `)),M=+M,T=+T,B=+B,R=R||"normal",F=+F,u(E,oe=>{const se=isFinite(B);let ce=null,le=null,ue=null,xe=null,Le=null,Je=null,Pe=null,$=0,Me=0,ve=N!=="nowrap";const{ascender:me,descender:pe,unitsPerEm:$e,lineGap:_e,capHeight:Fe,xHeight:Ne}=oe;X.fontLoad=x()-j;const Ce=x(),st=M/$e;R==="normal"&&(R=(me-pe+_e)/$e),R=R*M;const k=(R-(me-pe)*st)/2,U=-(me*st+k),ae=Math.min(R,(me-pe)*st),be=(me+pe)/2*st-ae/2;let Be=F,Te=new y;const Ve=[Te];oe.forEachGlyph(_,M,T,(je,Ze,We)=>{const ze=_.charAt(We),Xe=je.advanceWidth*st,et=Te.count;let ut;if("isEmpty"in je||(je.isWhitespace=!!ze&&new RegExp(a).test(ze),je.canBreakAfter=!!ze&&l.test(ze),je.isEmpty=je.xMin===je.xMax||je.yMin===je.yMax||o.test(ze)),!je.isWhitespace&&!je.isEmpty&&Me++,ve&&se&&!je.isWhitespace&&Ze+Xe+Be>B&&et){if(Te.glyphAt(et-1).glyphObj.canBreakAfter)ut=new y,Be=-Ze;else for(let ge=et;ge--;)if(ge===0&&H==="break-word"){ut=new y,Be=-Ze;break}else if(Te.glyphAt(ge).glyphObj.canBreakAfter){ut=Te.splitAt(ge+1);const ye=ut.glyphAt(0).x;Be-=ye;for(let Ke=ut.count;Ke--;)ut.glyphAt(Ke).x-=ye;break}ut&&(Te.isSoftWrapped=!0,Te=ut,Ve.push(Te),$=B)}let re=Te.glyphAt(Te.count);re.glyphObj=je,re.x=Ze+Be,re.width=Xe,re.charIndex=We,ze===` `&&(Te=new y,Ve.push(Te),Be=-(Ze+Xe+T*M)+F)}),Ve.forEach(je=>{for(let Ze=je.count;Ze--;){let{glyphObj:We,x:ze,width:Xe}=je.glyphAt(Ze);if(!We.isWhitespace){je.width=ze+Xe,je.width>$&&($=je.width);return}}});let He=0,we=0;if(V&&(typeof V=="number"?He=-V:typeof V=="string"&&(He=-$*(V==="left"?0:V==="center"?.5:V==="right"?1:m(V)))),Y){if(typeof Y=="number")we=-Y;else if(typeof Y=="string"){let je=Ve.length*R;we=Y==="top"?0:Y==="top-baseline"?-U:Y==="top-cap"?-U-Fe*st:Y==="top-ex"?-U-Ne*st:Y==="middle"?je/2:Y==="bottom"?je:Y==="bottom-baseline"?je-k+pe*st:m(Y)*je}}if(!J){const je=e.getEmbeddingLevels(_,P);ce=new Uint16Array(Me),le=new Float32Array(Me*2),ue={},Je=[s,s,-s,-s],Pe=[];let Ze=U;K&&(Le=new Float32Array(_.length*3)),G&&(xe=new Uint8Array(Me*3));let We=0,ze=-1,Xe=-1,et,ut;if(Ve.forEach((re,ge)=>{let{count:ye,width:Ke}=re;if(ye>0){let nt=0;for(let jt=ye;jt--&&re.glyphAt(jt).glyphObj.isWhitespace;)nt++;let Bt=0,Ht=0;if(I==="center")Bt=($-Ke)/2;else if(I==="right")Bt=$-Ke;else if(I==="justify"&&re.isSoftWrapped){let jt=0;for(let Ft=ye-nt;Ft--;)re.glyphAt(Ft).glyphObj.isWhitespace&&jt++;Ht=($-Ke)/jt}if(Ht||Bt){let jt=0;for(let Ft=0;Ft=Ft){let Xn=Sn,cn=Sn;for(;cnwr)break;cnnn=jt;for(let jt=0;jt1&&v(Le,ze,cn),ze=Jt}if(G){const{charIndex:Jt}=Ft;for(;Jt>Xe;)Xe++,G.hasOwnProperty(Xe)&&(ut=G[Xe])}if(!nn.isWhitespace&&!nn.isEmpty){const Jt=We++;ue[wr]||(ue[wr]={path:nn.path,pathBounds:[nn.xMin,nn.yMin,nn.xMax,nn.yMax]});const Sn=Ft.x+He,Xn=Ze+we;le[Jt*2]=Sn,le[Jt*2+1]=Xn;const cn=Sn+nn.xMin*st,vt=Xn+nn.yMin*st,qn=Sn+nn.xMax*st,bi=Xn+nn.yMax*st;cnJe[2]&&(Je[2]=qn),bi>Je[3]&&(Je[3]=bi),Jt%ee===0&&(et={start:Jt,end:Jt,rect:[s,s,-s,-s]},Pe.push(et)),et.end++;const O=et.rect;if(cnO[2]&&(O[2]=qn),bi>O[3]&&(O[3]=bi),ce[Jt]=wr,G){const b=Jt*3;xe[b]=ut>>16&255,xe[b+1]=ut>>8&255,xe[b+2]=ut&255}}}}Ze-=R}),Le){const re=_.length-ze;re>1&&v(Le,ze,re)}}X.typesetting=x()-Ce,W({glyphIds:ce,glyphPositions:le,glyphData:ue,caretPositions:Le,caretHeight:ae,glyphColors:xe,chunkedBounds:Pe,fontSize:M,unitsPerEm:$e,ascender:me*st,descender:pe*st,capHeight:Fe*st,xHeight:Ne*st,lineHeight:R,topBaseline:U,blockBounds:[He,we-Ve.length*R,He+$,we],visibleBounds:Je,timings:X})})}function p(_,E){d(_,A=>{const[M,T,R,B]=A.blockBounds;E({width:R-M,height:B-T})},{metricsOnly:!0})}function m(_){let E=_.match(/^([\d.]+)%$/),A=E?parseFloat(E[1]):NaN;return isNaN(A)?0:A/100}function v(_,E,A){const M=_[E*3],T=_[E*3+1],R=_[E*3+2],B=(T-M)/A;for(let P=0;P(Object.defineProperty(_,E,{get(){return this.data[this.index*g.length+A]},set(T){this.data[this.index*g.length+A]=T}}),_),{data:null,index:0}),{typeset:d,measure:p,loadFont:u}}const pc=()=>(self.performance||Date).now(),k0=_B();let MB;function V9(n,e,t,r,i,s,o,a,l,c,u=!0){return u?$9(n,e,t,r,i,s,o,a,l,c).then(null,d=>(MB||(console.warn("WebGL SDF generation failed, falling back to JS",d),MB=!0),bB(n,e,t,r,i,s,o,a,l,c))):bB(n,e,t,r,i,s,o,a,l,c)}const N0=[],W9=5;let MS=0;function TB(){const n=pc();for(;N0.length&&pc()-nnew Promise((e,t)=>{N0.push(()=>{const r=pc();try{k0.webgl.generateIntoCanvas(...n),e({timing:pc()-r})}catch(i){t(i)}}),MS||(MS=setTimeout(TB,0))}),X9=4,j9=2e3,CB={};let J9=0;function bB(n,e,t,r,i,s,o,a,l,c){const u="TroikaTextSDFGenerator_JS_"+J9++%X9;let d=CB[u];return d||(d=CB[u]={workerModule:Qh({name:u,workerId:u,dependencies:[_B,pc],init(p,m){const v=p().javascript.generate;return function(...x){const y=m();return{textureData:v(...x),timing:m()-y}}},getTransferables(p){return[p.textureData.buffer]}}),requests:0,idleTimer:null}),d.requests++,clearTimeout(d.idleTimer),d.workerModule(n,e,t,r,i,s).then(({textureData:p,timing:m})=>{const v=pc(),x=new Uint8Array(p.length*4);for(let y=0;y{I9(u)},j9)),{timing:m}})}function Y9(n){n._warm||(k0.webgl.isSupported(n),n._warm=!0)}const K9=k0.webglUtils.resizeWebGLCanvasWithoutClearing;/*! Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering. Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE */function Z9(){return typeof window>"u"&&(self.window=self),function(n){var e={parse:function(i){var s=e._bin,o=new Uint8Array(i);if(s.readASCII(o,0,4)=="ttcf"){var a=4;s.readUshort(o,a),a+=2,s.readUshort(o,a),a+=2;var l=s.readUint(o,a);a+=4;for(var c=[],u=0;u>>o&1&&s++;return s},e._lctf.readClassDef=function(i,s){var o=e._bin,a=[],l=o.readUshort(i,s);if(s+=2,l==1){var c=o.readUshort(i,s);s+=2;var u=o.readUshort(i,s);s+=2;for(var d=0;d0&&(l.featureParams=a+c);var u=o.readUshort(i,s);s+=2,l.tab=[];for(var d=0;d255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[s])},e.CFF.readEncoding=function(i,s,o){e._bin;var a=[".notdef"],l=i[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=i[s];s++;for(var u=0;u>4,_=15&y;if(g!=15&&x.push(g),_!=15&&x.push(_),_==15)break}for(var E="",A=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],M=0;M=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var u=0;u=1&&u.fmt<=2){p=l.readUshort(i,o),o+=2;var v=l.readUshort(i,o);o+=2,m=e._lctf.numOfOnes(p);var x=e._lctf.numOfOnes(v);if(u.fmt==1){u.pairsets=[];var y=l.readUshort(i,o);o+=2;for(var g=0;g=1&&u.fmt<=2){if(u.fmt==1)u.delta=l.readShort(i,o),o+=2;else if(u.fmt==2){var p=l.readUshort(i,o);o+=2,u.newg=l.readUshorts(i,o,p),o+=2*u.newg.length}}else if(s==4){u.vals=[],p=l.readUshort(i,o),o+=2;for(var m=0;m>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;s=e.kern.readFormat0(i,s,d)}return d},e.kern.parseV1=function(i,s,o,a){var l=e._bin;l.readFixed(i,s),s+=4;var c=l.readUint(i,s);s+=4;for(var u={glyph1:[],rval:[]},d=0;d>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;s=e.kern.readFormat0(i,s,u)}return u},e.kern.readFormat0=function(i,s,o){var a=e._bin,l=-1,c=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2;for(var u=0;u=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,u=0;us?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(u=0;u-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,s,o))},e.U._simpleGlyph=function(i,s){for(var o=0;ol)){for(var y=!0,g=0,_=0;_l)){for(y=!0,_=0;_>1,c.length=0,d=!0;else if(N=="o3"||N=="o23")c.length%2!=0&&!d&&(p=c.shift()+a.nominalWidthX),u+=c.length>>1,c.length=0,d=!0;else if(N=="o4")c.length>1&&!d&&(p=c.shift()+a.nominalWidthX,d=!0),m&&e.U.P.closePath(l),y+=c.pop(),e.U.P.moveTo(l,x,y),m=!0;else if(N=="o5")for(;c.length>0;)x+=c.shift(),y+=c.shift(),e.U.P.lineTo(l,x,y);else if(N=="o6"||N=="o7")for(var H=c.length,V=N=="o6",Y=0;YMath.abs(B-y)?x=R+c.shift():y=B+c.shift(),e.U.P.curveTo(l,g,_,E,A,P,I),e.U.P.curveTo(l,M,T,R,B,x,y));else if(N=="o14"){if(c.length>0&&!d&&(p=c.shift()+o.nominalWidthX,d=!0),c.length==4){var G=c.shift(),W=c.shift(),J=c.shift(),j=c.shift(),X=e.CFF.glyphBySE(o,J),oe=e.CFF.glyphBySE(o,j);e.U._drawCFF(o.CharStrings[X],s,o,a,l),s.x=G,s.y=W,e.U._drawCFF(o.CharStrings[oe],s,o,a,l)}m&&(e.U.P.closePath(l),m=!1)}else if(N=="o19"||N=="o20")c.length%2!=0&&!d&&(p=c.shift()+a.nominalWidthX),u+=c.length>>1,c.length=0,d=!0,v+=u+7>>3;else if(N=="o21")c.length>2&&!d&&(p=c.shift()+a.nominalWidthX,d=!0),y+=c.pop(),x+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,x,y),m=!0;else if(N=="o22")c.length>1&&!d&&(p=c.shift()+a.nominalWidthX,d=!0),x+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,x,y),m=!0;else if(N=="o25"){for(;c.length>6;)x+=c.shift(),y+=c.shift(),e.U.P.lineTo(l,x,y);g=x+c.shift(),_=y+c.shift(),E=g+c.shift(),A=_+c.shift(),x=E+c.shift(),y=A+c.shift(),e.U.P.curveTo(l,g,_,E,A,x,y)}else if(N=="o26")for(c.length%2&&(x+=c.shift());c.length>0;)g=x,_=y+c.shift(),x=E=g+c.shift(),y=(A=_+c.shift())+c.shift(),e.U.P.curveTo(l,g,_,E,A,x,y);else if(N=="o27")for(c.length%2&&(y+=c.shift());c.length>0;)_=y,E=(g=x+c.shift())+c.shift(),A=_+c.shift(),x=E+c.shift(),y=A,e.U.P.curveTo(l,g,_,E,A,x,y);else if(N=="o10"||N=="o29"){var se=N=="o10"?a:o;if(c.length==0)console.debug("error: empty stack");else{var ce=c.pop(),le=se.Subrs[ce+se.Bias];s.x=x,s.y=y,s.nStems=u,s.haveWidth=d,s.width=p,s.open=m,e.U._drawCFF(le,s,o,a,l),x=s.x,y=s.y,u=s.nStems,d=s.haveWidth,p=s.width,m=s.open}}else if(N=="o30"||N=="o31"){var ue=c.length,xe=(ee=0,N=="o31");for(ee+=ue-(H=-3&ue);ee>>1|(21845&m)<<1;v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4,p[m]=((65280&v)>>>8|(255&v)<<8)>>>1}var x=function(N,H,V){for(var Y=N.length,K=0,ee=new t(H);K>>J]=j}else for(G=new t(Y),K=0;K>>15-N[K]);return G},y=new e(288);for(m=0;m<144;++m)y[m]=8;for(m=144;m<256;++m)y[m]=9;for(m=256;m<280;++m)y[m]=7;for(m=280;m<288;++m)y[m]=8;var g=new e(32);for(m=0;m<32;++m)g[m]=5;var _=x(y,9,1),E=x(g,5,1),A=function(N){for(var H=N[0],V=1;VH&&(H=N[V]);return H},M=function(N,H,V){var Y=H/8|0;return(N[Y]|N[Y+1]<<8)>>(7&H)&V},T=function(N,H){var V=H/8|0;return(N[V]|N[V+1]<<8|N[V+2]<<16)>>(7&H)},R=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],B=function(N,H,V){var Y=new Error(H||R[N]);if(Y.code=N,Error.captureStackTrace&&Error.captureStackTrace(Y,B),!V)throw Y;return Y},P=function(N,H,V){var Y=N.length;if(!Y||V&&!V.l&&Y<5)return H||new e(0);var K=!H||V,ee=!V||V.i;V||(V={}),H||(H=new e(3*Y));var G,W=function(ze){var Xe=H.length;if(ze>Xe){var et=new e(Math.max(2*Xe,ze));et.set(H),H=et}},J=V.f||0,j=V.p||0,X=V.b||0,oe=V.l,se=V.d,ce=V.m,le=V.n,ue=8*Y;do{if(!oe){V.f=J=M(N,j,1);var xe=M(N,j+1,3);if(j+=3,!xe){var Le=N[(Ne=((G=j)/8|0)+(7&G&&1)+4)-4]|N[Ne-3]<<8,Je=Ne+Le;if(Je>Y){ee&&B(0);break}K&&W(X+Le),H.set(N.subarray(Ne,Je),X),V.b=X+=Le,V.p=j=8*Je;continue}if(xe==1)oe=_,se=E,ce=9,le=5;else if(xe==2){var Pe=M(N,j,31)+257,$=M(N,j+10,15)+4,Me=Pe+M(N,j+5,31)+1;j+=14;for(var ve=new e(Me),me=new e(19),pe=0;pe<$;++pe)me[o[pe]]=M(N,j+3*pe,7);j+=3*$;var $e=A(me),_e=(1<<$e)-1,Fe=x(me,$e,1);for(pe=0;pe>>4)<16)ve[pe++]=Ne;else{var st=0,k=0;for(Ne==16?(k=3+M(N,j,3),j+=2,st=ve[pe-1]):Ne==17?(k=3+M(N,j,7),j+=3):Ne==18&&(k=11+M(N,j,127),j+=7);k--;)ve[pe++]=st}}var U=ve.subarray(0,Pe),ae=ve.subarray(Pe);ce=A(U),le=A(ae),oe=x(U,ce,1),se=x(ae,le,1)}else B(1);if(j>ue){ee&&B(0);break}}K&&W(X+131072);for(var be=(1<>>4;if((j+=15&st)>ue){ee&&B(0);break}if(st||B(2),Ve<256)H[X++]=Ve;else{if(Ve==256){Te=j,oe=null;break}var He=Ve-254;if(Ve>264){var we=i[pe=Ve-257];He=M(N,j,(1<>>4;if(je||B(3),j+=15&je,ae=d[Ze],Ze>3&&(we=s[Ze],ae+=T(N,j)&(1<ue){ee&&B(0);break}K&&W(X+131072);for(var We=X+He;Xze.length)&&(et=ze.length);var ut=new(ze instanceof t?t:ze instanceof r?r:e)(et-Xe);return ut.set(ze.subarray(Xe,et)),ut}(H,0,X)},I=new e(0),F=typeof TextDecoder<"u"&&new TextDecoder;try{F.decode(I,{stream:!0})}catch{}return n.convert_streams=function(N){var H=new DataView(N),V=0;function Y(){var Pe=H.getUint16(V);return V+=2,Pe}function K(){var Pe=H.getUint32(V);return V+=4,Pe}function ee(Pe){Le.setUint16(Je,Pe),Je+=2}function G(Pe){Le.setUint32(Je,Pe),Je+=4}for(var W={signature:K(),flavor:K(),length:K(),numTables:Y(),reserved:Y(),totalSfntSize:K(),majorVersion:Y(),minorVersion:Y(),metaOffset:K(),metaLength:K(),metaOrigLength:K(),privOffset:K(),privLength:K()},J=0;Math.pow(2,J)<=W.numTables;)J++;J--;for(var j=16*Math.pow(2,J),X=16*W.numTables-j,oe=12,se=[],ce=0;ce{let[I,F]=P.split("+");I=parseInt(I,36),F=F?parseInt(F,36):0,u.set(B+=I,T[R]);for(let N=F;N--;)u.set(++B,T[R])})}}return u.get(M)||c}const p=1,m=2,v=3,x=4,y=[null,"isol","init","fina","medi"];function g(M){const T=new Uint8Array(M.length);let R=c,B=p,P=-1;for(let I=0;I65535&&I++)}return T}function _(M,T){const R=[];for(let P=0;P65535&&P++,R.push(n.U.codeToGlyph(M,I))}const B=M.GSUB;if(B){const{lookupList:P,featureList:I}=B;let F;const N=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,H=[];I.forEach(V=>{if(N.test(V.tag))for(let Y=0;Y{if(j!==-1){let oe=T[j];if(!oe){const{cmds:se,crds:ce}=n.U.glyphToPath(M,j);let le="",ue=0;for(let $=0,Me=se.length;$1?",":"")+ce[ue++]}let xe,Le,Je,Pe;if(ce.length){xe=Le=1/0,Je=Pe=-1/0;for(let $=0,Me=ce.length;$Je&&(Je=ve),me>Pe&&(Pe=me)}}else xe=Je=Le=Pe=0;oe=T[j]={index:j,advanceWidth:M.hmtx.aWidth[j],xMin:xe,yMin:Le,xMax:Je,yMax:Pe,path:le,pathCommandCount:se.length}}J!==-1&&(K+=n.U.getPairAdjustment(M,J,j)*ee),Y.call(null,oe,K,W),oe.advanceWidth&&(K+=oe.advanceWidth*ee),V&&(K+=V*H),J=j}W+=N.codePointAt(W)>65535?2:1}),K}};return F}return function(T){const R=new Uint8Array(T,0,4),B=n._bin.readASCII(R,0,4);if(B==="wOFF")T=e(T);else if(B==="wOF2")throw new Error("woff2 fonts not supported");return A(n.parse(T)[0])}}const eV=Qh({name:"Typr Font Parser",dependencies:[Z9,Q9,q9],init(n,e,t){const r=n(),i=e();return t(r,i)}}),pf={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},tV=new rt;function mf(){return(self.performance||Date).now()}const RB=Object.create(null);function PB(n,e){n=iV({},n);const t=mf();if(n.font=sV(n.font||pf.defaultFontURL),n.text=""+n.text,n.sdfGlyphSize=n.sdfGlyphSize||pf.sdfGlyphSize,n.colorRanges!=null){let d={};for(let p in n.colorRanges)if(n.colorRanges.hasOwnProperty(p)){let m=n.colorRanges[p];typeof m!="number"&&(m=tV.set(m).getHex()),d[p]=m}n.colorRanges=d}Object.freeze(n);const{textureWidth:r,sdfExponent:i}=pf,{sdfGlyphSize:s}=n,o=r/s*4;let a=RB[s];if(!a){const d=document.createElement("canvas");d.width=r,d.height=s*256/o,a=RB[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:d,sdfTexture:new bn(d,void 0,void 0,void 0,vn,vn),contextLost:!1,glyphsByFont:new Map},a.sdfTexture.generateMipmaps=!1,nV(a)}const{sdfTexture:l,sdfCanvas:c}=a;let u=a.glyphsByFont.get(n.font);u||a.glyphsByFont.set(n.font,u=new Map),oV(n).then(d=>{const{glyphIds:p,glyphPositions:m,fontSize:v,unitsPerEm:x,timings:y}=d,g=[],_=new Float32Array(p.length*4),E=v/x;let A=0,M=0;const T=mf();p.forEach((F,N)=>{let H=u.get(F);if(!H){const{path:ee,pathBounds:G}=d.glyphData[F],W=Math.max(G[2]-G[0],G[3]-G[1])/s*(pf.sdfMargin*s+.5),J=a.glyphCount++,j=[G[0]-W,G[1]-W,G[2]+W,G[3]+W];u.set(F,H={path:ee,atlasIndex:J,sdfViewBox:j}),g.push(H)}const{sdfViewBox:V}=H,Y=m[M++],K=m[M++];_[A++]=Y+V[0]*E,_[A++]=K+V[1]*E,_[A++]=Y+V[2]*E,_[A++]=K+V[3]*E,p[N]=H.atlasIndex}),y.quads=(y.quads||0)+(mf()-T);const R=mf();y.sdf={};const B=c.height,P=Math.ceil(a.glyphCount/o),I=Math.pow(2,Math.ceil(Math.log2(P*s)));I>B&&(console.info(`Increasing SDF texture size ${B}->${I}`),K9(c,r,I),l.dispose()),Promise.all(g.map(F=>BB(F,a,n.gpuAccelerateSDF).then(({timing:N})=>{y.sdf[F.atlasIndex]=N}))).then(()=>{g.length&&!a.contextLost&&(IB(a),l.needsUpdate=!0),y.sdfTotal=mf()-R,y.total=mf()-t,e(Object.freeze({parameters:n,sdfTexture:l,sdfGlyphSize:s,sdfExponent:i,glyphBounds:_,glyphAtlasIndices:p,glyphColors:d.glyphColors,caretPositions:d.caretPositions,caretHeight:d.caretHeight,chunkedBounds:d.chunkedBounds,ascender:d.ascender,descender:d.descender,lineHeight:d.lineHeight,capHeight:d.capHeight,xHeight:d.xHeight,topBaseline:d.topBaseline,blockBounds:d.blockBounds,visibleBounds:d.visibleBounds,timings:d.timings}))})}),Promise.resolve().then(()=>{a.contextLost||Y9(c)})}function BB({path:n,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:r,sdfCanvas:i,contextLost:s},o){if(s)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:l}=pf,c=Math.max(t[2]-t[0],t[3]-t[1]),u=Math.floor(e/4),d=u%(a/r)*r,p=Math.floor(u/(a/r))*r,m=e%4;return V9(r,r,n,t,c,l,i,d,p,m,o)}function nV(n){const e=n.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),n.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),n.contextLost=!1;const r=[];n.glyphsByFont.forEach(i=>{i.forEach(s=>{r.push(BB(s,n,!0))})}),Promise.all(r).then(()=>{IB(n),n.sdfTexture.needsUpdate=!0})})}function rV({font:n,characters:e,sdfGlyphSize:t},r){let i=Array.isArray(e)?e.join(` `):""+e;PB({font:n,sdfGlyphSize:t,text:i},r)}function iV(n,e){for(let t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}let z0;function sV(n){return z0||(z0=typeof document>"u"?{}:document.createElement("a")),z0.href=n,z0.href}function IB(n){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=n,{width:r,height:i}=e,s=n.sdfCanvas.getContext("webgl");let o=t.image.data;(!o||o.length!==r*i*4)&&(o=new Uint8Array(r*i*4),t.image={width:r,height:i,data:o},t.flipY=!1,t.isDataTexture=!0),s.readPixels(0,0,r,i,s.RGBA,s.UNSIGNED_BYTE,o)}}const oV=Qh({name:"Typesetter",dependencies:[Qh({name:"Typesetter",dependencies:[pf,eV,H9,L9],init(n,e,t,r){const{defaultFontURL:i}=n;return t(e,r(),{defaultFontURL:i})}})],init(n){return function(e){return new Promise(t=>{n.typeset(e,t)})}},getTransferables(n){const e=[n.glyphPositions.buffer,n.glyphIds.buffer];return n.caretPositions&&e.push(n.caretPositions.buffer),n.glyphColors&&e.push(n.glyphColors.buffer),e}}),DB={};function aV(n){let e=DB[n];if(!e){const t=new ao(1,1,n,n),r=t.clone(),i=t.attributes,s=r.attributes,o=new Dt,a=i.uv.count;for(let l=0;l{o.setAttribute(l,new mt([...i[l].array,...s[l].array],i[l].itemSize))}),o.setIndex([...t.index.array,...r.index.array.map(l=>l+a)]),o.translate(.5,.5,0),e=DB[n]=o}return e}const lV="aTroikaGlyphBounds",LB="aTroikaGlyphIndex",cV="aTroikaGlyphColor";class uV extends OE{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Vi,this.boundingBox=new cs}computeBoundingSphere(){}computeBoundingBox(){}setSide(e){const t=this.getIndex().count;this.setDrawRange(e===Ir?t/2:0,e===xi?t:t/2)}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=aV(e);["position","normal","uv"].forEach(r=>{this.attributes[r]=t.attributes[r].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,r,i,s){TS(this,lV,e,4),TS(this,LB,t,1),TS(this,cV,s,3),this._blockBounds=r,this._chunkedBounds=i,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:r}=this;if(t){const{PI:i,floor:s,min:o,max:a,sin:l,cos:c}=Math,u=i/2,d=i*2,p=Math.abs(t),m=e[0]/p,v=e[2]/p,x=s((m+u)/d)!==s((v+u)/d)?-p:o(l(m)*p,l(v)*p),y=s((m-u)/d)!==s((v-u)/d)?p:a(l(m)*p,l(v)*p),g=s((m+i)/d)!==s((v+i)/d)?p*2:a(p-c(m)*p,p-c(v)*p);r.min.set(x,e[1],t<0?-g:0),r.max.set(y,e[3],t<0?0:g)}else r.min.set(e[0],e[1],0),r.max.set(e[2],e[3],0);r.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(LB).count,r=this._chunkedBounds;if(r)for(let i=r.length;i--;){t=r[i].end;let s=r[i].rect;if(s[1]e.y&&s[0]e.x)break}this.instanceCount=t}}function TS(n,e,t,r){const i=n.getAttribute(e);t?i&&i.array.length===t.length?(i.array.set(t),i.needsUpdate=!0):(n.setAttribute(e,new Zl(t,r)),delete n._maxInstanceCount,n.dispose()):i&&n.deleteAttribute(e)}const fV=` uniform vec2 uTroikaSDFTextureSize; uniform float uTroikaSDFGlyphSize; uniform vec4 uTroikaTotalBounds; uniform vec4 uTroikaClipRect; uniform mat3 uTroikaOrient; uniform bool uTroikaUseGlyphColors; uniform float uTroikaDistanceOffset; uniform float uTroikaBlurRadius; uniform vec2 uTroikaPositionOffset; uniform float uTroikaCurveRadius; attribute vec4 aTroikaGlyphBounds; attribute float aTroikaGlyphIndex; attribute vec3 aTroikaGlyphColor; varying vec2 vTroikaGlyphUV; varying vec4 vTroikaTextureUVBounds; varying float vTroikaTextureChannel; varying vec3 vTroikaGlyphColor; varying vec2 vTroikaGlyphDimensions; `,dV=` vec4 bounds = aTroikaGlyphBounds; bounds.xz += uTroikaPositionOffset.x; bounds.yw -= uTroikaPositionOffset.y; vec4 outlineBounds = vec4( bounds.xy - uTroikaDistanceOffset - uTroikaBlurRadius, bounds.zw + uTroikaDistanceOffset + uTroikaBlurRadius ); vec4 clippedBounds = vec4( clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw), clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw) ); vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy); position.xy = mix(bounds.xy, bounds.zw, clippedXY); uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy); float rad = uTroikaCurveRadius; if (rad != 0.0) { float angle = position.x / rad; position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad); normal.xz = vec2(sin(angle), cos(angle)); } position = uTroikaOrient * position; normal = uTroikaOrient * normal; vTroikaGlyphUV = clippedXY.xy; vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]); float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize; vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize; vec2 txStartUV = txUvPerSquare * vec2( mod(floor(aTroikaGlyphIndex / 4.0), txCols), floor(floor(aTroikaGlyphIndex / 4.0) / txCols) ); vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare); vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0); `,hV=` uniform sampler2D uTroikaSDFTexture; uniform vec2 uTroikaSDFTextureSize; uniform float uTroikaSDFGlyphSize; uniform float uTroikaSDFExponent; uniform float uTroikaDistanceOffset; uniform float uTroikaFillOpacity; uniform float uTroikaOutlineOpacity; uniform float uTroikaBlurRadius; uniform vec3 uTroikaStrokeColor; uniform float uTroikaStrokeWidth; uniform float uTroikaStrokeOpacity; uniform bool uTroikaSDFDebug; varying vec2 vTroikaGlyphUV; varying vec4 vTroikaTextureUVBounds; varying float vTroikaTextureChannel; varying vec2 vTroikaGlyphDimensions; float troikaSdfValueToSignedDistance(float alpha) { // Inverse of exponential encoding in webgl-sdf-generator float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y); float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension; float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0); return signedDist; } float troikaGlyphUvToSdfValue(vec2 glyphUV) { vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV); vec4 rgba = texture2D(uTroikaSDFTexture, textureUV); float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1 return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a; } float troikaGlyphUvToDistance(vec2 uv) { return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv)); } float troikaGetAADist() { #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300 return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5; #else return vTroikaGlyphDimensions.x / 64.0; #endif } float troikaGetFragDistValue() { vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize); float distance = troikaGlyphUvToDistance(clampedGlyphUV); // Extrapolate distance when outside bounds: distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions); return distance; } float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) { #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL) float alpha = step(-distanceOffset, -distance); #else float alpha = smoothstep( distanceOffset + aaDist, distanceOffset - aaDist, distance ); #endif return alpha; } `,pV=` float aaDist = troikaGetAADist(); float fragDistance = troikaGetFragDistValue(); float edgeAlpha = uTroikaSDFDebug ? troikaGlyphUvToSdfValue(vTroikaGlyphUV) : troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius)); #if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL) vec4 fillRGBA = gl_FragColor; fillRGBA.a *= uTroikaFillOpacity; vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity); if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb; gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep( -uTroikaStrokeWidth - aaDist, -uTroikaStrokeWidth + aaDist, fragDistance )); gl_FragColor.a *= edgeAlpha; #endif if (edgeAlpha == 0.0) { discard; } `;function mV(n){const e=wS(n,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Ge},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new pn(0,0,0,0)},uTroikaClipRect:{value:new pn(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Ge},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new rt},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new kt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:fV,vertexTransform:dV,fragmentDefs:hV,fragmentColorTransform:pV,customRewriter({vertexShader:t,fragmentShader:r}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(r)&&(r=r.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(t)||(t=t.replace(xB,`uniform vec3 diffuse; $& vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; `))),{vertexShader:t,fragmentShader:r}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const CS=new Si({color:16777215,side:xi,transparent:!0}),OB=8421504,UB=new bt,G0=new Q,bS=new Q,qh=[],gV=new Q,RS="+x+y";function FB(n){return Array.isArray(n)?n[0]:n}let kB=()=>{const n=new Gn(new ao(1,1),CS);return kB=()=>n,n},NB=()=>{const n=new Gn(new ao(1,1,32,1),CS);return NB=()=>n,n};const vV={type:"syncstart"},yV={type:"synccomplete"},zB=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],_V=zB.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let GB=class extends Gn{constructor(){const e=new uV;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=OB,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=RS,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(vV),PB({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const r=this._queuedSyncs;r&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{r.forEach(i=>i&&i())})),this.dispatchEvent(yV),e&&e()})))}onBeforeRender(e,t,r,i,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s),s._hadOwnSide=s.hasOwnProperty("side"),this.geometry.setSide(s._actualSide=s.side),s.side=Us}onAfterRender(e,t,r,i,s,o){s._hadOwnSide?s.side=s._actualSide:delete s.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=CS.clone());if((!e||e.baseMaterial!==t)&&(e=this._derivedMaterial=mV(t),t.addEventListener("dispose",function r(){t.removeEventListener("dispose",r),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let r=e._outlineMtl;return r||(r=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),r.isTextOutlineMaterial=!0,r.depthWrite=!1,r.map=null,e.addEventListener("dispose",function i(){e.removeEventListener("dispose",i),r.dispose()})),[r,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return FB(this.material).getDepthMaterial()}get customDistanceMaterial(){return FB(this.material).getDistanceMaterial()}_prepareForRender(e){const t=e.isTextOutlineMaterial,r=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:a,blockBounds:l}=i;r.uTroikaSDFTexture.value=a,r.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),r.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,r.uTroikaSDFExponent.value=i.sdfExponent,r.uTroikaTotalBounds.value.fromArray(l),r.uTroikaUseGlyphColors.value=!t&&!!i.glyphColors;let c=0,u=0,d=0,p,m,v,x=0,y=0;if(t){let{outlineWidth:_,outlineOffsetX:E,outlineOffsetY:A,outlineBlur:M,outlineOpacity:T}=this;c=this._parsePercent(_)||0,u=Math.max(0,this._parsePercent(M)||0),p=T,x=this._parsePercent(E)||0,y=this._parsePercent(A)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(v=this.strokeColor,r.uTroikaStrokeColor.value.set(v??OB),m=this.strokeOpacity,m==null&&(m=1)),p=this.fillOpacity;r.uTroikaDistanceOffset.value=c,r.uTroikaPositionOffset.value.set(x,y),r.uTroikaBlurRadius.value=u,r.uTroikaStrokeWidth.value=d,r.uTroikaStrokeOpacity.value=m,r.uTroikaFillOpacity.value=p??1,r.uTroikaCurveRadius.value=this.curveRadius||0;let g=this.clipRect;if(g&&Array.isArray(g)&&g.length===4)r.uTroikaClipRect.value.fromArray(g);else{const _=(this.fontSize||.1)*100;r.uTroikaClipRect.value.set(l[0]-_,l[1]-_,l[2]+_,l[3]+_)}this.geometry.applyClipRect(r.uTroikaClipRect.value)}r.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new rt;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||RS;if(o!==e._orientation){let a=r.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let l=o!==RS&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,u,d,p]=l;G0.set(0,0,0)[u]=c==="-"?1:-1,bS.set(0,0,0)[p]=d==="-"?-1:1,UB.lookAt(gV,G0.cross(bS),bS),a.setFromMatrix4(UB)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),r=t?parseFloat(t[1]):NaN;e=(isNaN(r)?0:r/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new Ge){t.copy(e);const r=this.curveRadius;return r&&(t.x=Math.atan2(e.x,Math.abs(r)-Math.abs(e.z))*Math.abs(r)),t}worldPositionToTextCoords(e,t=new Ge){return G0.copy(e),this.localPositionToTextCoords(this.worldToLocal(G0),t)}raycast(e,t){const{textRenderInfo:r,curveRadius:i}=this;if(r){const s=r.blockBounds,o=i?NB():kB(),a=o.geometry,{position:l,uv:c}=a.attributes;for(let u=0;u{this[r]=e[r]}),this}clone(){return new this.constructor().copy(this)}};zB.forEach(n=>{const e="_private_"+n;Object.defineProperty(GB.prototype,n,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});const xV=D.forwardRef(({sdfGlyphSize:n=64,anchorX:e="center",anchorY:t="middle",font:r,fontSize:i=1,children:s,characters:o,onSync:a,...l},c)=>{const u=ai(({invalidate:v})=>v),[d]=D.useState(()=>new GB),[p,m]=D.useMemo(()=>{const v=[];let x="";return D.Children.forEach(s,y=>{typeof y=="string"||typeof y=="number"?x+=y:v.push(y)}),[v,x]},[s]);return CP(()=>new Promise(v=>rV({font:r,characters:o},v)),["troika-text",r,o]),D.useLayoutEffect(()=>void d.sync(()=>{u(),a&&a(d)})),D.useEffect(()=>()=>d.dispose(),[d]),D.createElement("primitive",du({object:d,ref:c,font:r,text:m,anchorX:e,anchorY:t,fontSize:i,sdfGlyphSize:n},l),p)});let H0=null;function HB(n,e,t){return r=>{t&&t(r),n&&(H0||(H0=new T9),H0.setDecoderPath(typeof n=="string"?n:"https://www.gstatic.com/draco/versioned/decoders/1.5.5/"),r.setDRACOLoader(H0)),e&&r.setMeshoptDecoder(typeof xS=="function"?xS():xS)}}function ep(n,e=!0,t=!0,r){return cf(hS,n,HB(e,t,r))}ep.preload=(n,e=!0,t=!0,r)=>cf.preload(hS,n,HB(e,t,r)),ep.clear=n=>cf.clear(hS,n);/*! * camera-controls * https://github.com/yomotsu/camera-controls * (c) 2017 @yomotsu * Released under the MIT License. */const Pt={LEFT:1,RIGHT:2,MIDDLE:4},Ue=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),gf={NONE:0,IN:1,OUT:-1};function mc(n){return n.isPerspectiveCamera}function rl(n){return n.isOrthographicCamera}const vf=Math.PI*2,VB=Math.PI/2,WB=1e-5,tp=Math.PI/180;function js(n,e,t){return Math.max(e,Math.min(t,n))}function Rn(n,e=WB){return Math.abs(n)0==m>u&&(m=u,t.value=(m-u)/s),m}function XB(n,e,t,r,i=1/0,s,o){r=Math.max(1e-4,r);const a=2/r,l=a*s,c=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,d=e.y,p=e.z,m=n.x-u,v=n.y-d,x=n.z-p;const y=u,g=d,_=p,E=i*r,A=E*E,M=m*m+v*v+x*x;if(M>A){const Y=Math.sqrt(M);m=m/Y*E,v=v/Y*E,x=x/Y*E}u=n.x-m,d=n.y-v,p=n.z-x;const T=(t.x+a*m)*s,R=(t.y+a*v)*s,B=(t.z+a*x)*s;t.x=(t.x-a*T)*c,t.y=(t.y-a*R)*c,t.z=(t.z-a*B)*c,o.x=u+(m+T)*c,o.y=d+(v+R)*c,o.z=p+(x+B)*c;const P=y-n.x,I=g-n.y,F=_-n.z,N=o.x-y,H=o.y-g,V=o.z-_;return P*N+I*H+F*V>0&&(o.x=y,o.y=g,o.z=_,t.x=(o.x-y)/s,t.y=(o.y-g)/s,t.z=(o.z-_)/s),o}function PS(n,e){e.set(0,0),n.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=n.length,e.y/=n.length}function BS(n,e){return rl(n)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class EV{constructor(){this._listeners={}}addEventListener(e,t){const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){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{},this._enabled=!0,this._state=Ue.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=gf.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new Tt.Vector3,this._focalOffsetVelocity=new Tt.Vector3,this._zoomVelocity={value:0},this._truckInternal=(A,M,T)=>{let R,B;if(mc(this._camera)){const P=zt.copy(this._camera.position).sub(this._target),I=this._camera.getEffectiveFOV()*tp,F=P.length()*Math.tan(I*.5);R=this.truckSpeed*A*F/this._elementRect.height,B=this.truckSpeed*M*F/this._elementRect.height}else if(rl(this._camera)){const P=this._camera;R=A*(P.right-P.left)/P.zoom/this._elementRect.width,B=M*(P.top-P.bottom)/P.zoom/this._elementRect.height}else return;this.verticalDragToForward?(T?this.setFocalOffset(this._focalOffsetEnd.x+R,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(R,0,!0),this.forward(-B,!0)):T?this.setFocalOffset(this._focalOffsetEnd.x+R,this._focalOffsetEnd.y+B,this._focalOffsetEnd.z,!0):this.truck(R,B,!0)},this._rotateInternal=(A,M)=>{const T=vf*this.azimuthRotateSpeed*A/this._elementRect.height,R=vf*this.polarRotateSpeed*M/this._elementRect.height;this.rotate(T,R,!0)},this._dollyInternal=(A,M,T)=>{const R=Math.pow(.95,-A*this.dollySpeed),B=this._sphericalEnd.radius,P=this._sphericalEnd.radius*R,I=js(P,this.minDistance,this.maxDistance),F=I-P;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(P,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(F,!0),this._dollyToNoClamp(I,!0)):this._dollyToNoClamp(I,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?P:I)-B,this._dollyControlCoord.set(M,T)),this._lastDollyDirection=Math.sign(-A)},this._zoomInternal=(A,M,T)=>{const R=Math.pow(.95,A*this.dollySpeed),B=this._zoom,P=this._zoom*R;this.zoomTo(P,!0),this.dollyToCursor&&(this._changedZoom+=P-B,this._dollyControlCoord.set(M,T))},typeof Tt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new Tt.Quaternion().setFromUnitVectors(this._camera.up,$0),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=Ue.NONE,this._target=new Tt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new Tt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new Tt.Spherical().setFromVector3(zt.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new Tt.Vector3,new Tt.Vector3,new Tt.Vector3,new Tt.Vector3],this._updateNearPlaneCorners(),this._boundary=new Tt.Box3(new Tt.Vector3(-1/0,-1/0,-1/0),new Tt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new Tt.Vector2,this.mouseButtons={left:Ue.ROTATE,middle:Ue.DOLLY,right:Ue.TRUCK,wheel:mc(this._camera)?Ue.DOLLY:rl(this._camera)?Ue.ZOOM:Ue.NONE},this.touches={one:Ue.TOUCH_ROTATE,two:mc(this._camera)?Ue.TOUCH_DOLLY_TRUCK:rl(this._camera)?Ue.TOUCH_ZOOM_TRUCK:Ue.NONE,three:Ue.TOUCH_TRUCK};const r=new Tt.Vector2,i=new Tt.Vector2,s=new Tt.Vector2,o=A=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const R=this._domElement.getBoundingClientRect(),B=A.clientX/R.width,P=A.clientY/R.height;if(Bthis._interactiveArea.right||Pthis._interactiveArea.bottom)return}const M=A.pointerType!=="mouse"?null:(A.buttons&Pt.LEFT)===Pt.LEFT?Pt.LEFT:(A.buttons&Pt.MIDDLE)===Pt.MIDDLE?Pt.MIDDLE:(A.buttons&Pt.RIGHT)===Pt.RIGHT?Pt.RIGHT:null;if(M!==null){const R=this._findPointerByMouseButton(M);R&&this._disposePointer(R)}if((A.buttons&Pt.LEFT)===Pt.LEFT&&this._lockedPointer)return;const T={pointerId:A.pointerId,clientX:A.clientX,clientY:A.clientY,deltaX:0,deltaY:0,mouseButton:M};this._activePointers.push(T),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),this._isDragging=!0,x(A)},a=A=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const R=this._domElement.getBoundingClientRect(),B=A.clientX/R.width,P=A.clientY/R.height;if(Bthis._interactiveArea.right||Pthis._interactiveArea.bottom)return}const M=(A.buttons&Pt.LEFT)===Pt.LEFT?Pt.LEFT:(A.buttons&Pt.MIDDLE)===Pt.MIDDLE?Pt.MIDDLE:(A.buttons&Pt.RIGHT)===Pt.RIGHT?Pt.RIGHT:null;if(M!==null){const R=this._findPointerByMouseButton(M);R&&this._disposePointer(R)}const T={pointerId:1,clientX:A.clientX,clientY:A.clientY,deltaX:0,deltaY:0,mouseButton:(A.buttons&Pt.LEFT)===Pt.LEFT?Pt.LEFT:(A.buttons&Pt.MIDDLE)===Pt.LEFT?Pt.MIDDLE:(A.buttons&Pt.RIGHT)===Pt.LEFT?Pt.RIGHT:null};this._activePointers.push(T),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,x(A)},l=A=>{A.cancelable&&A.preventDefault();const M=A.pointerId,T=this._lockedPointer||this._findPointerById(M);if(T){if(T.clientX=A.clientX,T.clientY=A.clientY,T.deltaX=A.movementX,T.deltaY=A.movementY,this._state=0,A.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(A.buttons&Pt.LEFT)===Pt.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(A.buttons&Pt.MIDDLE)===Pt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(A.buttons&Pt.RIGHT)===Pt.RIGHT&&(this._state=this._state|this.mouseButtons.right);y()}},c=A=>{const M=this._lockedPointer||this._findPointerById(1);M&&(M.clientX=A.clientX,M.clientY=A.clientY,M.deltaX=A.movementX,M.deltaY=A.movementY,this._state=0,(this._lockedPointer||(A.buttons&Pt.LEFT)===Pt.LEFT)&&(this._state=this._state|this.mouseButtons.left),(A.buttons&Pt.MIDDLE)===Pt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(A.buttons&Pt.RIGHT)===Pt.RIGHT&&(this._state=this._state|this.mouseButtons.right),y())},u=A=>{const M=this._findPointerById(A.pointerId);if(!(M&&M===this._lockedPointer)){if(M&&this._disposePointer(M),A.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=Ue.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=Ue.NONE;g()}},d=()=>{const A=this._findPointerById(1);A&&A===this._lockedPointer||(A&&this._disposePointer(A),this._state=Ue.NONE,g())};let p=-1;const m=A=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===Ue.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const P=this._domElement.getBoundingClientRect(),I=A.clientX/P.width,F=A.clientY/P.height;if(Ithis._interactiveArea.right||Fthis._interactiveArea.bottom)return}if(A.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===Ue.ROTATE||this.mouseButtons.wheel===Ue.TRUCK){const P=performance.now();p-P<1e3&&this._getClientRect(this._elementRect),p=P}const M=AV?-1:-3,T=A.deltaMode===1?A.deltaY/M:A.deltaY/(M*10),R=this.dollyToCursor?(A.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,B=this.dollyToCursor?(A.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case Ue.ROTATE:{this._rotateInternal(A.deltaX,A.deltaY),this._isUserControllingRotate=!0;break}case Ue.TRUCK:{this._truckInternal(A.deltaX,A.deltaY,!1),this._isUserControllingTruck=!0;break}case Ue.OFFSET:{this._truckInternal(A.deltaX,A.deltaY,!0),this._isUserControllingOffset=!0;break}case Ue.DOLLY:{this._dollyInternal(-T,R,B),this._isUserControllingDolly=!0;break}case Ue.ZOOM:{this._zoomInternal(-T,R,B),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},v=A=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Uw.ACTION.NONE){const M=A instanceof PointerEvent?A.pointerId:(A instanceof MouseEvent,0),T=this._findPointerById(M);T&&this._disposePointer(T),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}A.preventDefault()}},x=A=>{if(!this._enabled)return;if(PS(this._activePointers,Mi),this._getClientRect(this._elementRect),r.copy(Mi),i.copy(Mi),this._activePointers.length>=2){const T=Mi.x-this._activePointers[1].clientX,R=Mi.y-this._activePointers[1].clientY,B=Math.sqrt(T*T+R*R);s.set(0,B);const P=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,I=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(P,I)}if(this._state=0,!A)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in A&&A.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(A.buttons&Pt.LEFT)===Pt.LEFT&&(this._state=this._state|this.mouseButtons.left),(A.buttons&Pt.MIDDLE)===Pt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(A.buttons&Pt.RIGHT)===Pt.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&Ue.ROTATE)===Ue.ROTATE||(this._state&Ue.TOUCH_ROTATE)===Ue.TOUCH_ROTATE||(this._state&Ue.TOUCH_DOLLY_ROTATE)===Ue.TOUCH_DOLLY_ROTATE||(this._state&Ue.TOUCH_ZOOM_ROTATE)===Ue.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&Ue.TRUCK)===Ue.TRUCK||(this._state&Ue.TOUCH_TRUCK)===Ue.TOUCH_TRUCK||(this._state&Ue.TOUCH_DOLLY_TRUCK)===Ue.TOUCH_DOLLY_TRUCK||(this._state&Ue.TOUCH_ZOOM_TRUCK)===Ue.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&Ue.DOLLY)===Ue.DOLLY||(this._state&Ue.TOUCH_DOLLY)===Ue.TOUCH_DOLLY||(this._state&Ue.TOUCH_DOLLY_TRUCK)===Ue.TOUCH_DOLLY_TRUCK||(this._state&Ue.TOUCH_DOLLY_OFFSET)===Ue.TOUCH_DOLLY_OFFSET||(this._state&Ue.TOUCH_DOLLY_ROTATE)===Ue.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&Ue.ZOOM)===Ue.ZOOM||(this._state&Ue.TOUCH_ZOOM)===Ue.TOUCH_ZOOM||(this._state&Ue.TOUCH_ZOOM_TRUCK)===Ue.TOUCH_ZOOM_TRUCK||(this._state&Ue.TOUCH_ZOOM_OFFSET)===Ue.TOUCH_ZOOM_OFFSET||(this._state&Ue.TOUCH_ZOOM_ROTATE)===Ue.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&Ue.OFFSET)===Ue.OFFSET||(this._state&Ue.TOUCH_OFFSET)===Ue.TOUCH_OFFSET||(this._state&Ue.TOUCH_DOLLY_OFFSET)===Ue.TOUCH_DOLLY_OFFSET||(this._state&Ue.TOUCH_ZOOM_OFFSET)===Ue.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},y=()=>{if(!this._enabled)return;PS(this._activePointers,Mi);const M=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,T=M?-M.deltaX:i.x-Mi.x,R=M?-M.deltaY:i.y-Mi.y;if(i.copy(Mi),((this._state&Ue.ROTATE)===Ue.ROTATE||(this._state&Ue.TOUCH_ROTATE)===Ue.TOUCH_ROTATE||(this._state&Ue.TOUCH_DOLLY_ROTATE)===Ue.TOUCH_DOLLY_ROTATE||(this._state&Ue.TOUCH_ZOOM_ROTATE)===Ue.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(T,R),this._isUserControllingRotate=!0),(this._state&Ue.DOLLY)===Ue.DOLLY||(this._state&Ue.ZOOM)===Ue.ZOOM){const B=this.dollyToCursor?(r.x-this._elementRect.x)/this._elementRect.width*2-1:0,P=this.dollyToCursor?(r.y-this._elementRect.y)/this._elementRect.height*-2+1:0,I=this.dollyDragInverted?-1:1;(this._state&Ue.DOLLY)===Ue.DOLLY?(this._dollyInternal(I*R*W0,B,P),this._isUserControllingDolly=!0):(this._zoomInternal(I*R*W0,B,P),this._isUserControllingZoom=!0)}if((this._state&Ue.TOUCH_DOLLY)===Ue.TOUCH_DOLLY||(this._state&Ue.TOUCH_ZOOM)===Ue.TOUCH_ZOOM||(this._state&Ue.TOUCH_DOLLY_TRUCK)===Ue.TOUCH_DOLLY_TRUCK||(this._state&Ue.TOUCH_ZOOM_TRUCK)===Ue.TOUCH_ZOOM_TRUCK||(this._state&Ue.TOUCH_DOLLY_OFFSET)===Ue.TOUCH_DOLLY_OFFSET||(this._state&Ue.TOUCH_ZOOM_OFFSET)===Ue.TOUCH_ZOOM_OFFSET||(this._state&Ue.TOUCH_DOLLY_ROTATE)===Ue.TOUCH_DOLLY_ROTATE||(this._state&Ue.TOUCH_ZOOM_ROTATE)===Ue.TOUCH_ZOOM_ROTATE){const B=Mi.x-this._activePointers[1].clientX,P=Mi.y-this._activePointers[1].clientY,I=Math.sqrt(B*B+P*P),F=s.y-I;s.set(0,I);const N=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,H=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&Ue.TOUCH_DOLLY)===Ue.TOUCH_DOLLY||(this._state&Ue.TOUCH_DOLLY_ROTATE)===Ue.TOUCH_DOLLY_ROTATE||(this._state&Ue.TOUCH_DOLLY_TRUCK)===Ue.TOUCH_DOLLY_TRUCK||(this._state&Ue.TOUCH_DOLLY_OFFSET)===Ue.TOUCH_DOLLY_OFFSET?(this._dollyInternal(F*W0,N,H),this._isUserControllingDolly=!0):(this._zoomInternal(F*W0,N,H),this._isUserControllingZoom=!0)}((this._state&Ue.TRUCK)===Ue.TRUCK||(this._state&Ue.TOUCH_TRUCK)===Ue.TOUCH_TRUCK||(this._state&Ue.TOUCH_DOLLY_TRUCK)===Ue.TOUCH_DOLLY_TRUCK||(this._state&Ue.TOUCH_ZOOM_TRUCK)===Ue.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(T,R,!1),this._isUserControllingTruck=!0),((this._state&Ue.OFFSET)===Ue.OFFSET||(this._state&Ue.TOUCH_OFFSET)===Ue.TOUCH_OFFSET||(this._state&Ue.TOUCH_DOLLY_OFFSET)===Ue.TOUCH_DOLLY_OFFSET||(this._state&Ue.TOUCH_ZOOM_OFFSET)===Ue.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(T,R,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},g=()=>{PS(this._activePointers,Mi),i.copy(Mi),(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",d),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",_),this._domElement.ownerDocument.addEventListener("pointerlockerror",E),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),x())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",_),this._domElement.ownerDocument.removeEventListener("pointerlockerror",E))};const _=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},E=()=>{this.unlockPointer()};this._addAllEventListeners=A=>{this._domElement=A,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),wV&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",u),this._domElement.addEventListener("wheel",m,{passive:!1}),this._domElement.addEventListener("contextmenu",v)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",u),this._domElement.removeEventListener("wheel",m,{passive:!1}),this._domElement.removeEventListener("contextmenu",v),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",_),this._domElement.ownerDocument.removeEventListener("pointerlockerror",E))},this.cancel=()=>{this._state!==Ue.NONE&&(this._state=Ue.NONE,this._activePointers.length=0,g())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=js(e.width,0,1),this._interactiveArea.height=js(e.height,0,1),this._interactiveArea.x=js(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=js(e.x,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,r=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,r)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,r=!1){this._isUserControllingRotate=!1;const i=js(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=js(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,r||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!r||mn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&mn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=gf.NONE,this._changedDolly=0,this._dollyToNoClamp(js(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const r=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=mn(o,this._spherical.radius);if(!(r>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||mn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(ip).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const r=!t||mn(this._target.x,this._targetEnd.x,this.restThreshold)&&mn(this._target.y,this._targetEnd.y,this.restThreshold)&&mn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=js(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const r=!t||mn(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(r)}pan(e,t,r=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,r)}truck(e,t,r=!1){this._camera.updateMatrix(),fo.setFromMatrixColumn(this._camera.matrix,0),ho.setFromMatrixColumn(this._camera.matrix,1),fo.multiplyScalar(e),ho.multiplyScalar(-t);const i=zt.copy(fo).add(ho),s=fn.copy(this._targetEnd).add(i);return this.moveTo(s.x,s.y,s.z,r)}forward(e,t=!1){zt.setFromMatrixColumn(this._camera.matrix,0),zt.crossVectors(this._camera.up,zt),zt.multiplyScalar(e);const r=fn.copy(this._targetEnd).add(zt);return this.moveTo(r.x,r.y,r.z,t)}elevate(e,t=!1){return zt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+zt.x,this._targetEnd.y+zt.y,this._targetEnd.z+zt.z,t)}moveTo(e,t,r,i=!1){this._isUserControllingTruck=!1;const s=zt.set(e,t,r).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const o=!i||mn(this._target.x,this._targetEnd.x,this.restThreshold)&&mn(this._target.y,this._targetEnd.y,this.restThreshold)&&mn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,r,i=!1){const a=zt.set(e,t,r).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(a.x,a.y,a.z,i)}fitToBox(e,t,{cover:r=!1,paddingLeft:i=0,paddingRight:s=0,paddingBottom:o=0,paddingTop:a=0}={}){const l=[],c=e.isBox3?_f.copy(e):_f.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=$B(this._sphericalEnd.theta,VB),d=$B(this._sphericalEnd.phi,VB);l.push(this.rotateTo(u,d,t));const p=zt.setFromSpherical(this._sphericalEnd).normalize(),m=QB.setFromUnitVectors(p,IS),v=mn(Math.abs(p.y),1);v&&m.multiply(LS.setFromAxisAngle($0,u)),m.multiply(this._yAxisUpSpaceInverse);const x=ZB.makeEmpty();fn.copy(c.min).applyQuaternion(m),x.expandByPoint(fn),fn.copy(c.min).setX(c.max.x).applyQuaternion(m),x.expandByPoint(fn),fn.copy(c.min).setY(c.max.y).applyQuaternion(m),x.expandByPoint(fn),fn.copy(c.max).setZ(c.min.z).applyQuaternion(m),x.expandByPoint(fn),fn.copy(c.min).setZ(c.max.z).applyQuaternion(m),x.expandByPoint(fn),fn.copy(c.max).setY(c.min.y).applyQuaternion(m),x.expandByPoint(fn),fn.copy(c.max).setX(c.min.x).applyQuaternion(m),x.expandByPoint(fn),fn.copy(c.max).applyQuaternion(m),x.expandByPoint(fn),x.min.x-=i,x.min.y-=o,x.max.x+=s,x.max.y+=a,m.setFromUnitVectors(IS,p),v&&m.premultiply(LS.invert()),m.premultiply(this._yAxisUpSpace);const y=x.getSize(zt),g=x.getCenter(fn).applyQuaternion(m);if(mc(this._camera)){const _=this.getDistanceToFitBox(y.x,y.y,y.z,r);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.dollyTo(_,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(rl(this._camera)){const _=this._camera,E=_.right-_.left,A=_.top-_.bottom,M=r?Math.max(E/y.x,A/y.y):Math.min(E/y.x,A/y.y);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.zoomTo(M,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const r=[],s=e instanceof Tt.Sphere?DS.copy(e):Uw.createBoundingSphere(e,DS);if(r.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),mc(this._camera)){const o=this.getDistanceToFitSphere(s.radius);r.push(this.dollyTo(o,t))}else if(rl(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,l=2*s.radius,c=Math.min(o/l,a/l);r.push(this.zoomTo(c,t))}return r.push(this.setFocalOffset(0,0,0,t)),Promise.all(r)}setLookAt(e,t,r,i,s,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=gf.NONE,this._changedDolly=0;const l=fn.set(i,s,o),c=zt.set(e,t,r);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!a||mn(this._target.x,this._targetEnd.x,this.restThreshold)&&mn(this._target.y,this._targetEnd.y,this.restThreshold)&&mn(this._target.z,this._targetEnd.z,this.restThreshold)&&mn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&mn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&mn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,r,i,s,o,a,l,c,u,d,p,m,v=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=gf.NONE,this._changedDolly=0;const x=zt.set(i,s,o),y=fn.set(e,t,r);ps.setFromVector3(y.sub(x).applyQuaternion(this._yAxisUpSpace));const g=yf.set(u,d,p),_=fn.set(a,l,c);sp.setFromVector3(_.sub(g).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(x.lerp(g,m));const E=sp.theta-ps.theta,A=sp.phi-ps.phi,M=sp.radius-ps.radius;this._sphericalEnd.set(ps.radius+M*m,ps.phi+A*m,ps.theta+E*m),this.normalizeRotations(),this._needsUpdate=!0,v||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const T=!v||mn(this._target.x,this._targetEnd.x,this.restThreshold)&&mn(this._target.y,this._targetEnd.y,this.restThreshold)&&mn(this._target.z,this._targetEnd.z,this.restThreshold)&&mn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&mn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&mn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(T)}setPosition(e,t,r,i=!1){return this.setLookAt(e,t,r,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,r,i=!1){const s=this.getPosition(zt),o=this.setLookAt(s.x,s.y,s.z,e,t,r,i);return this._sphericalEnd.phi=js(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,r,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,r),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const s=!i||mn(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&mn(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&mn(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,r){this._camera.updateMatrixWorld(),fo.setFromMatrixColumn(this._camera.matrixWorldInverse,0),ho.setFromMatrixColumn(this._camera.matrixWorldInverse,1),gc.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=zt.set(e,t,r),s=i.distanceTo(this._camera.position),o=i.sub(this._camera.position);fo.multiplyScalar(o.x),ho.multiplyScalar(o.y),gc.multiplyScalar(o.z),zt.copy(fo).add(ho).add(gc),zt.z=zt.z+s,this.dollyTo(s,!1),this.setFocalOffset(-zt.x,zt.y,-zt.z,!1),this.moveTo(e,t,r,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,r,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new Tt.Vector4,typeof e=="number"?this._viewport.set(e,t,r,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,r,i=!1){if(BS(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,o=this._camera.getEffectiveFOV()*tp,a=this._camera.aspect;return((i?s>a:st.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,r){const i=t.lengthSq();if(i===0)return e;const s=fn.copy(t).add(e),a=this._boundary.clampPoint(s,yf).sub(s),l=a.lengthSq();if(l===0)return e.add(t);if(l===i)return e;if(r===0)return e.add(t).add(a);{const c=1+r*l/t.dot(a);return e.add(fn.copy(t).multiplyScalar(c)).add(a.multiplyScalar(1-r))}}_updateNearPlaneCorners(){if(mc(this._camera)){const e=this._camera,t=e.near,r=e.getEffectiveFOV()*tp,i=Math.tan(r*.5)*t,s=i*e.aspect;this._nearPlaneCorners[0].set(-s,-i,0),this._nearPlaneCorners[1].set(s,-i,0),this._nearPlaneCorners[2].set(s,i,0),this._nearPlaneCorners[3].set(-s,i,0)}else if(rl(this._camera)){const e=this._camera,t=1/e.zoom,r=e.left*t,i=e.right*t,s=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(r,s,0),this._nearPlaneCorners[1].set(i,s,0),this._nearPlaneCorners[2].set(i,o,0),this._nearPlaneCorners[3].set(r,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||BS(this._camera,"_collisionTest"))return e;const r=this._getTargetDirection(ip);OS.lookAt(JB,r,this._camera.up);for(let i=0;i<4;i++){const s=fn.copy(this._nearPlaneCorners[i]);s.applyMatrix4(OS);const o=yf.addVectors(this._target,s);X0.set(o,r),X0.far=this._spherical.radius+1;const a=X0.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance{const r=()=>{this.removeEventListener("rest",r),t()};this.addEventListener("rest",r)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new Tt.Sphere){const r=t,i=r.center;_f.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&_f.expandByObject(o)}),_f.getCenter(i);let s=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const u=l.attributes.position;for(let d=0,p=u.count;d{D.useMemo(()=>{US.install({THREE:SP}),jE({CameraControlsImpl:US})},[]);const{camera:t,domElement:r,makeDefault:i,onStart:s,onEnd:o,onChange:a,regress:l,...c}=n,u=ai(M=>M.camera),d=ai(M=>M.gl),p=ai(M=>M.invalidate),m=ai(M=>M.events),v=ai(M=>M.setEvents),x=ai(M=>M.set),y=ai(M=>M.get),g=ai(M=>M.performance),_=t||u,E=r||m.connected||d.domElement,A=D.useMemo(()=>new US(_),[_]);return Hh((M,T)=>{A.enabled&&A.update(T)},-1),D.useEffect(()=>(A.connect(E),()=>void A.disconnect()),[E,A]),D.useEffect(()=>{const M=B=>{p(),l&&g.regress(),a&&a(B)},T=B=>{s&&s(B)},R=B=>{o&&o(B)};return A.addEventListener("update",M),A.addEventListener("controlstart",T),A.addEventListener("controlend",R),A.addEventListener("control",M),A.addEventListener("transitionstart",M),A.addEventListener("wake",M),()=>{A.removeEventListener("update",M),A.removeEventListener("controlstart",T),A.removeEventListener("controlend",R),A.removeEventListener("control",M),A.removeEventListener("transitionstart",M),A.removeEventListener("wake",M)}},[A,s,o,p,v,l,a]),D.useEffect(()=>{if(i){const M=y().controls;return x({controls:A}),()=>x({controls:M})}},[i,A]),D.createElement("primitive",du({ref:e,object:A},c))});function TV(n,e){const t=D.useRef(),[r]=D.useState(()=>e?e instanceof en?{current:e}:e:t),[i]=D.useState(()=>new fP(void 0));D.useLayoutEffect(()=>void(i._root=r.current),[i,e]);const s=D.useRef({}),[o]=D.useState(()=>{const a={};return n.forEach(l=>Object.defineProperty(a,l.name,{enumerable:!0,get(){if(r.current)return s.current[l.name]||(s.current[l.name]=i.clipAction(l,r.current))},configurable:!0})),{ref:r,clips:n,actions:a,names:n.map(l=>l.name),mixer:i}});return Hh((a,l)=>i.update(l)),D.useEffect(()=>{const a=r.current;return()=>{s.current={},Object.values(o.actions).forEach(l=>{a&&i.uncacheAction(l,a)})}},[n]),D.useEffect(()=>()=>{i.stopAllAction()},[i]),o}const FS={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"},CV="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",qB=n=>Array.isArray(n);function eI({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 FS))throw new Error("Preset must be one of: "+Object.keys(FS).join(", "));n=FS[t],e=CV}if(a=qB(n),l=qB(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?WR:l==="hdr"?w9:l==="exr"?M9:null,!o)throw new Error("useEnvironment: Unrecognized file extension: "+n);const c=cf(o,a?[n]:n,m=>{m.setPath==null||m.setPath(e),i&&i(m)}),u=a?c[0]:c;u.mapping=a?Oo:pu;const d=3001,p=3e3;return"colorSpace"in u?u.colorSpace=r??a?"srgb":"srgb-linear":u.encoding=r??a?d:p,u}const bV=n=>n.current&&n.current.isScene,RV=n=>bV(n)?n.current:n;function kS(n,e,t,r,i=0){const s=RV(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 NS({scene:n,background:e=!1,blur:t,map:r}){const i=ai(s=>s.scene);return D.useLayoutEffect(()=>{if(r)return kS(e,n,i,r,t)},[i,n,r,e,t]),null}function tI({background:n=!1,scene:e,blur:t,...r}){const i=eI(r),s=ai(o=>o.scene);return D.useLayoutEffect(()=>kS(n,e,s,i,t),[i,n,e,s,t]),null}function PV({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:u,preset:d=void 0,extensions:p}){const m=ai(E=>E.gl),v=ai(E=>E.scene),x=D.useRef(null),[y]=D.useState(()=>new uh),g=D.useMemo(()=>{const E=new Vx(r);return E.texture.type=ni,E},[r]);D.useLayoutEffect(()=>(i===1&&x.current.update(m,y),kS(o,l,v,g.texture,a)),[n,y,g.texture,l,v,o,i,m]);let _=1;return Hh(()=>{(i===1/0||_jE({GroundProjectedEnvImpl:V6}),[]);const a=D.useMemo(()=>[o],[o]),l=(e=n.ground)==null?void 0:e.height,c=(t=n.ground)==null?void 0:t.radius,u=(r=(i=n.ground)==null?void 0:i.scale)!==null&&r!==void 0?r:1e3;return D.createElement(D.Fragment,null,D.createElement(NS,du({},n,{map:o})),D.createElement("groundProjectedEnvImpl",{args:a,scale:u,height:l,radius:c}))}function IV(n){return n.ground?D.createElement(BV,n):n.map?D.createElement(NS,n):n.children?D.createElement(PV,n):D.createElement(tI,n)}const DV=D.forwardRef(({scale:n=10,frames:e=1/0,opacity:t=1,width:r=1,height:i=1,blur:s=1,far:o=10,resolution:a=512,smooth:l=!0,color:c="#000000",depthWrite:u=!1,renderOrder:d,...p},m)=>{const v=D.useRef(null),x=ai(H=>H.scene),y=ai(H=>H.gl),g=D.useRef(null);r=r*(Array.isArray(n)?n[0]:n||1),i=i*(Array.isArray(n)?n[1]:n||1);const[_,E,A,M,T,R,B]=D.useMemo(()=>{const H=new Hi(a,a),V=new Hi(a,a);V.texture.generateMipmaps=H.texture.generateMipmaps=!1;const Y=new ao(r,i).rotateX(Math.PI/2),K=new Gn(Y),ee=new ch;ee.depthTest=ee.depthWrite=!1,ee.onBeforeCompile=J=>{J.uniforms={...J.uniforms,ucolor:{value:new rt(c)}},J.fragmentShader=J.fragmentShader.replace("void main() {",`uniform vec3 ucolor; void main() { `),J.fragmentShader=J.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const G=new wi(S9),W=new wi(A9);return W.depthTest=G.depthTest=!1,[H,Y,ee,K,G,W,V]},[a,r,i,n,c]),P=H=>{M.visible=!0,M.material=T,T.uniforms.tDiffuse.value=_.texture,T.uniforms.h.value=H*1/256,y.setRenderTarget(B),y.render(M,g.current),M.material=R,R.uniforms.tDiffuse.value=B.texture,R.uniforms.v.value=H*1/256,y.setRenderTarget(_),y.render(M,g.current),M.visible=!1};let I=0,F,N;return Hh(()=>{g.current&&(e===1/0||Iv.current,[]),D.createElement("group",du({"rotation-x":Math.PI/2},p,{ref:v}),D.createElement("mesh",{renderOrder:d,geometry:E,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},D.createElement("meshBasicMaterial",{transparent:!0,map:_.texture,opacity:t,depthWrite:u})),D.createElement("orthographicCamera",{ref:g,args:[-r/2,r/2,i/2,-i/2,0,o]}))});var _n={},LV={get exports(){return _n},set exports(n){_n=n}},OV="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",UV=OV,FV=UV;function nI(){}function rI(){}rI.resetWarningCache=nI;var kV=function(){function n(r,i,s,o,a,l){if(l!==FV){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:rI,resetWarningCache:nI};return t.PropTypes=t,t};LV.exports=kV();function vr(){return vr=Object.assign?Object.assign.bind():function(n){for(var e=1;en.forEach(t=>NV(t,e))}function xf(...n){return D.useCallback(iI(...n),n)}const sI=D.forwardRef((n,e)=>{const{children:t,...r}=n,i=D.Children.toArray(t),s=i.find(zV);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(zS,vr({},r,{ref:e}),D.isValidElement(o)?D.cloneElement(o,void 0,a):null)}return D.createElement(zS,vr({},r,{ref:e}),t)});sI.displayName="Slot";const zS=D.forwardRef((n,e)=>{const{children:t,...r}=n;return D.isValidElement(t)?D.cloneElement(t,{...GV(r,t.props),ref:e?iI(e,t.ref):t.ref}):D.Children.count(t)>1?D.Children.only(null):null});zS.displayName="SlotClone";const oI=({children:n})=>D.createElement(D.Fragment,null,n);function zV(n){return D.isValidElement(n)&&n.type===oI}function GV(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 vc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((n,e)=>{const t=D.forwardRef((r,i)=>{const{asChild:s,...o}=r,a=s?sI:e;return D.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),D.createElement(a,vr({},o,{ref:i}))});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function HV(n,e){n&&xl.flushSync(()=>n.dispatchEvent(e))}const VV=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?QC.createPortal(D.createElement(vc.div,vr({},i,{ref:e})),r):null});var aI=Object.prototype.hasOwnProperty;function op(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--&&op(n[r],e[r]););return r===-1}if(!t||typeof n=="object"){r=0;for(t in n)if(aI.call(n,t)&&++r&&!aI.call(e,t)||!(t in e)||!op(n[t],e[t]))return!1;return Object.keys(e).length===r}}return n!==n&&e!==e}var j0=function(e,t,r,i){this.name=e,this.fn=t,this.args=r,this.modifiers=i};j0.prototype._test=function(e){var t=this.fn;try{Ef(this.modifiers.slice(),t,this)(e)}catch{t=function(){return!1}}try{return Ef(this.modifiers.slice(),t,this)(e)}catch{return!1}},j0.prototype._check=function(e){try{Ef(this.modifiers.slice(),this.fn,this)(e)}catch{if(Ef(this.modifiers.slice(),function(r){return r},this)(!1))return}if(!Ef(this.modifiers.slice(),this.fn,this)(e))throw null},j0.prototype._testAsync=function(e){var t=this;return new Promise(function(r,i){cI(t.modifiers.slice(),t.fn,t)(e).then(function(s){s?r(e):i(null)}).catch(function(s){return i(s)})})};function lI(n,e){return e===void 0&&(e="simple"),typeof n=="object"?n[e]:n}function Ef(n,e,t){if(n.length){var r=n.shift(),i=Ef(n,e,t);return r.perform(i,t)}else return lI(e)}function cI(n,e,t){if(n.length){var r=n.shift(),i=cI(n,e,t);return r.performAsync(i,t)}else return function(s){return Promise.resolve(lI(e,"async")(s))}}var WV=function(e,t,r){this.name=e,this.perform=t,this.performAsync=r},GS=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),po=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=[]),this.chain=e,this.nextRuleModifiers=t};po.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 j0(t,e.apply(r,i),i,r.nextRuleModifiers)),r.nextRuleModifiers=[],r}},po.prototype._applyModifier=function(e,t){return this.nextRuleModifiers.push(new WV(t,e.simple,e.async)),this},po.prototype._clone=function(){return new po(this.chain.slice(),this.nextRuleModifiers.slice())},po.prototype.test=function(e){return this.chain.every(function(t){return t._test(e)})},po.prototype.testAll=function(e){var t=[];return this.chain.forEach(function(r){try{r._check(e)}catch(i){t.push(new GS(r,e,i))}}),t},po.prototype.check=function(e){this.chain.forEach(function(t){try{t._check(e)}catch(r){throw new GS(t,e,r)}})},po.prototype.testAsync=function(e){var t=this;return new Promise(function(r,i){uI(e,t.chain.slice(),r,i)})};function uI(n,e,t,r){if(e.length){var i=e.shift();i._testAsync(n).then(function(){uI(n,e,t,r)},function(s){r(new GS(i,n,s))})}else t(n)}var fI=function(n,e){return e&&typeof n=="string"&&n.trim().length===0?!0:n==null};function $V(n,e){return e===void 0&&(e=!1),{simple:function(t){return fI(t,e)||n.check(t)===void 0},async:function(t){return fI(t,e)||n.testAsync(t)}}}function Ti(){return typeof Proxy<"u"?dI(new po):HS(new po)}var ap={};Ti.extend=function(n){Object.assign(ap,n)},Ti.clearCustomRules=function(){ap={}};function dI(n){return new Proxy(n,{get:function(t,r){if(r in t)return t[r];var i=dI(n._clone());if(r in J0)return i._applyModifier(J0[r],r);if(r in ap)return i._applyRule(ap[r],r);if(r in VS)return i._applyRule(VS[r],r)}})}function HS(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=HS(s._clone()),u=c._applyRule(i[o],o).apply(void 0,a);return u}}),s},t=e(VS,n),r=e(ap,t);return Object.keys(J0).forEach(function(i){Object.defineProperty(r,i,{get:function(){var s=HS(r._clone());return s._applyModifier(J0[i],i)}})}),r}var J0={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 Y0(e).some(function(t){try{return n(t)}catch{return!1}})}},async:function(n){return function(e){return Promise.all(Y0(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&&Y0(e).every(n)}},async:function(n){return function(e){return Promise.all(Y0(e).map(n)).then(function(t){return t.every(Boolean)})}}},strict:{simple:function(n,e){return function(t){return hI(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 hI(e)&&t&&typeof t=="object"?Object.keys(e.args[0]).length===Object.keys(t).length&&r:r}).catch(function(){return!1})}}}};function hI(n){return n&&n.name==="schema"&&n.args.length>0&&typeof n.args[0]=="object"}function Y0(n){return typeof n=="string"?n.split(""):n}var VS={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||XV;return e(n)}},numeric:function(){return function(n){return!isNaN(parseFloat(n))&&isFinite(n)}},string:function(){return Sf("string")},boolean:function(){return Sf("boolean")},undefined:function(){return Sf("undefined")},null:function(){return Sf("null")},array:function(){return Sf("array")},object:function(){return Sf("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 jV(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:$V};function Sf(n){return function(e){return Array.isArray(e)&&n==="array"||e===null&&n==="null"||typeof e===n}}function XV(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n}function jV(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 xn="colors",li="sizes",ht="space",JV={gap:ht,gridGap:ht,columnGap:ht,gridColumnGap:ht,rowGap:ht,gridRowGap:ht,inset:ht,insetBlock:ht,insetBlockEnd:ht,insetBlockStart:ht,insetInline:ht,insetInlineEnd:ht,insetInlineStart:ht,margin:ht,marginTop:ht,marginRight:ht,marginBottom:ht,marginLeft:ht,marginBlock:ht,marginBlockEnd:ht,marginBlockStart:ht,marginInline:ht,marginInlineEnd:ht,marginInlineStart:ht,padding:ht,paddingTop:ht,paddingRight:ht,paddingBottom:ht,paddingLeft:ht,paddingBlock:ht,paddingBlockEnd:ht,paddingBlockStart:ht,paddingInline:ht,paddingInlineEnd:ht,paddingInlineStart:ht,top:ht,right:ht,bottom:ht,left:ht,scrollMargin:ht,scrollMarginTop:ht,scrollMarginRight:ht,scrollMarginBottom:ht,scrollMarginLeft:ht,scrollMarginX:ht,scrollMarginY:ht,scrollMarginBlock:ht,scrollMarginBlockEnd:ht,scrollMarginBlockStart:ht,scrollMarginInline:ht,scrollMarginInlineEnd:ht,scrollMarginInlineStart:ht,scrollPadding:ht,scrollPaddingTop:ht,scrollPaddingRight:ht,scrollPaddingBottom:ht,scrollPaddingLeft:ht,scrollPaddingX:ht,scrollPaddingY:ht,scrollPaddingBlock:ht,scrollPaddingBlockEnd:ht,scrollPaddingBlockStart:ht,scrollPaddingInline:ht,scrollPaddingInlineEnd:ht,scrollPaddingInlineStart:ht,fontSize:"fontSizes",background:xn,backgroundColor:xn,backgroundImage:xn,borderImage:xn,border:xn,borderBlock:xn,borderBlockEnd:xn,borderBlockStart:xn,borderBottom:xn,borderBottomColor:xn,borderColor:xn,borderInline:xn,borderInlineEnd:xn,borderInlineStart:xn,borderLeft:xn,borderLeftColor:xn,borderRight:xn,borderRightColor:xn,borderTop:xn,borderTopColor:xn,caretColor:xn,color:xn,columnRuleColor:xn,fill:xn,outline:xn,outlineColor:xn,stroke:xn,textDecorationColor:xn,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:li,minBlockSize:li,maxBlockSize:li,inlineSize:li,minInlineSize:li,maxInlineSize:li,width:li,minWidth:li,maxWidth:li,height:li,minHeight:li,maxHeight:li,flexBasis:li,gridTemplateColumns:li,gridTemplateRows:li,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"},YV=(n,e)=>typeof e=="function"?{"()":Function.prototype.toString.call(e)}:e,Af=()=>{const n=Object.create(null);return(e,t,...r)=>{const i=(s=>JSON.stringify(s,YV))(e);return i in n?n[i]:n[i]=t(e,...r)}},yc=Symbol.for("sxs.internal"),WS=(n,e)=>Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)),pI=n=>{for(const e in n)return!0;return!1},{hasOwnProperty:KV}=Object.prototype,$S=n=>n.includes("-")?n:n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()),ZV=/\s+(?![^()]*\))/,wf=n=>e=>n(...typeof e=="string"?String(e).split(ZV):[e]),mI={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:wf((n,e)=>({marginBlockStart:n,marginBlockEnd:e||n})),marginInline:wf((n,e)=>({marginInlineStart:n,marginInlineEnd:e||n})),maxSize:wf((n,e)=>({maxBlockSize:n,maxInlineSize:e||n})),minSize:wf((n,e)=>({minBlockSize:n,minInlineSize:e||n})),paddingBlock:wf((n,e)=>({paddingBlockStart:n,paddingBlockEnd:e||n})),paddingInline:wf((n,e)=>({paddingInlineStart:n,paddingInlineEnd:e||n}))},XS=/([\d.]+)([^]*)/,QV=(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,qV=(n,e)=>n in eW&&typeof e=="string"?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,(t,r,i,s)=>r+(i==="stretch"?`-moz-available${s};${$S(n)}:${r}-webkit-fill-available`:`-moz-fit-content${s};${$S(n)}:${r}fit-content`)+s):String(e),eW={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},Yo=n=>n?n+"-":"",gI=(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==="$"?Yo(e)+(a.includes("$")?"":Yo(t))+a.replace(/\$/g,"-"):a)+")"+(i||o=="--"?"*"+(i||"")+(s||"1")+")":"")),tW=/\s*,\s*(?![^()]*\))/,nW=Object.prototype.toString,Mf=(n,e,t,r,i)=>{let s,o,a;const l=(c,u,d)=>{let p,m;const v=x=>{for(p in x){const _=p.charCodeAt(0)===64,E=_&&Array.isArray(x[p])?x[p]:[x[p]];for(m of E){const A=/[A-Z]/.test(g=p)?g:g.replace(/-[^]/g,T=>T[1].toUpperCase()),M=typeof m=="object"&&m&&m.toString===nW&&(!r.utils[A]||!u.length);if(A in r.utils&&!M){const T=r.utils[A];if(T!==o){o=T,v(T(m)),o=null;continue}}else if(A in mI){const T=mI[A];if(T!==a){a=T,v(T(m)),a=null;continue}}if(_&&(y=p.slice(1)in r.media?"@media "+r.media[p.slice(1)]:p,p=y.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,(T,R,B,P,I,F)=>{const N=XS.test(R),H=.0625*(N?-1:1),[V,Y]=N?[P,R]:[R,P];return"("+(B[0]==="="?"":B[0]===">"===N?"max-":"min-")+V+":"+(B[0]!=="="&&B.length===1?Y.replace(XS,(K,ee,G)=>Number(ee)+H*(B===">"?1:-1)+G):Y)+(I?") and ("+(I[0]===">"?"min-":"max-")+V+":"+(I.length===1?F.replace(XS,(K,ee,G)=>Number(ee)+H*(I===">"?-1:1)+G):F):"")+")"})),M){const T=_?d.concat(p):[...d],R=_?[...u]:QV(u,p.split(tW));s!==void 0&&i(vI(...s)),s=void 0,l(m,R,T)}else s===void 0&&(s=[[],u,d]),p=_||p.charCodeAt(0)!==36?p:`--${Yo(r.prefix)}${p.slice(1).replace(/\$/g,"-")}`,m=M?m:typeof m=="number"?m&&A in rW?String(m)+"px":String(m):gI(qV(A,m??""),r.prefix,r.themeMap[A]),s[0].push(`${_?`${p} `:`${$S(p)}:`}${m}`)}}var y,g};v(c),s!==void 0&&i(vI(...s)),s=void 0};l(n,e,t)},vI=(n,e,t)=>`${t.map(r=>`${r}{`).join("")}${e.length?`${e.join(",")}{`:""}${n.join(";")}${e.length?"}":""}${Array(t.length?t.length+1:0).join("}")}`,rW={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},yI=n=>String.fromCharCode(n+(n>25?39:97)),_c=n=>(e=>{let t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=yI(t%52)+r;return yI(t%52)+r})(((e,t)=>{let r=t.length;for(;r;)e=33*e^t.charCodeAt(--r);return e})(5381,JSON.stringify(n))>>>0),lp=["themed","global","styled","onevar","resonevar","allvar","inline"],iW=n=>{if(n.href&&!n.href.startsWith(location.origin))return!1;try{return!!n.cssRules}catch{return!1}},sW=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(iW(a)){for(let l=0,c=a.cssRules;c[l];++l){const u=Object(c[l]);if(u.type!==1)continue;const d=Object(c[l+1]);if(d.type!==4)continue;++l;const{cssText:p}=u;if(!p.startsWith("--sxs"))continue;const m=p.slice(14,-3).trim().split(/\s+/),v=lp[m[0]];v&&(e||(e={sheet:a,reset:r,rules:{},toString:t}),e.rules[v]={group:d,index:l,cache:new Set(m)})}if(e)break}if(!e){const a=(l,c)=>({type:c,cssRules:[],insertRule(u,d){this.cssRules.splice(d,0,a(u,{import:3,undefined:1}[(u.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return l==="@media{}"?`@media{${[].map.call(this.cssRules,u=>u.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=lp.length-1;a>=0;--a){const l=lp[a];if(!o[l]){const c=lp[a+1],u=o[c]?o[c].index:s.cssRules.length;s.insertRule("@media{}",u),s.insertRule(`--sxs{--sxs:${a}}`,u),o[l]={group:s.cssRules[u+1],index:u,cache:new Set([a])}}oW(o[l])}};return r(),e},oW=n=>{const e=n.group;let t=e.cssRules.length;n.apply=r=>{try{e.insertRule(r,t),++t}catch{}}},cp=Symbol(),aW=Af(),_I=(n,e)=>aW(n,()=>(...t)=>{let r={type:null,composers:new Set};for(const i of t)if(i!=null)if(i[yc]){r.type==null&&(r.type=i[yc].type);for(const s of i[yc].composers)r.composers.add(s)}else i.constructor!==Object||i.$$typeof?r.type==null&&(r.type=i):r.composers.add(lW(i,n));return r.type==null&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),cW(n,r,e)}),lW=({variants:n,compoundVariants:e,defaultVariants:t,...r},i)=>{const s=`${Yo(i.prefix)}c-${_c(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){u=l,d=p,KV.call(u,d)||(l[p]="undefined");const m=n[p];for(const v in m){const x={[p]:String(v)};String(v)==="undefined"&&c.push(p);const y=m[v],g=[x,y,!pI(y)];o.push(g)}}var u,d;if(typeof e=="object"&&e)for(const p of e){let{css:m,...v}=p;m=typeof m=="object"&&m||{};for(const y in v)v[y]=String(v[y]);const x=[v,m,!pI(m)];a.push(x)}return[s,r,o,a,l,c]},cW=(n,e,t)=>{const[r,i,s,o]=uW(e.composers),a=typeof e.type=="function"||e.type.$$typeof?(d=>{function p(){for(let m=0;mp.rules[m]={apply:v=>p[cp].push([m,v])}),p})(t):null,l=(a||t).rules,c=`.${r}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,u=d=>{d=typeof d=="object"&&d||fW;const{css:p,...m}=d,v={};for(const g in s)if(delete m[g],g in d){let _=d[g];typeof _=="object"&&_?v[g]={"@initial":s[g],..._}:(_=String(_),v[g]=_!=="undefined"||o.has(g)?_:s[g])}else v[g]=s[g];const x=new Set([...i]);for(const[g,_,E,A]of e.composers){t.rules.styled.cache.has(g)||(t.rules.styled.cache.add(g),Mf(_,[`.${g}`],[],n,R=>{l.styled.apply(R)}));const M=xI(E,v,n.media),T=xI(A,v,n.media,!0);for(const R of M)if(R!==void 0)for(const[B,P,I]of R){const F=`${g}-${_c(P)}-${B}`;x.add(F);const N=(I?t.rules.resonevar:t.rules.onevar).cache,H=I?l.resonevar:l.onevar;N.has(F)||(N.add(F),Mf(P,[`.${F}`],[],n,V=>{H.apply(V)}))}for(const R of T)if(R!==void 0)for(const[B,P]of R){const I=`${g}-${_c(P)}-${B}`;x.add(I),t.rules.allvar.cache.has(I)||(t.rules.allvar.cache.add(I),Mf(P,[`.${I}`],[],n,F=>{l.allvar.apply(F)}))}}if(typeof p=="object"&&p){const g=`${r}-i${_c(p)}-css`;x.add(g),t.rules.inline.cache.has(g)||(t.rules.inline.cache.add(g),Mf(p,[`.${g}`],[],n,_=>{l.inline.apply(_)}))}for(const g of String(d.className||"").trim().split(/\s+/))g&&x.add(g);const y=m.className=[...x].join(" ");return{type:e.type,className:y,selector:c,props:m,toString:()=>y,deferredInjector:a}};return WS(u,{className:r,selector:c,[yc]:e,toString:()=>(t.rules.styled.cache.has(r)||u(),r)})},uW=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)]},xI=(n,e,t,r)=>{const i=[];e:for(let[s,o,a]of n){if(a)continue;let l,c=0,u=!1;for(l in s){const d=s[l];let p=e[l];if(p!==d){if(typeof p!="object"||!p)continue e;{let m,v,x=0;for(const y in p){if(d===String(p[y])){if(y!=="@initial"){const g=y.slice(1);(v=v||[]).push(g in t?t[g]:y.replace(/^@media ?/,"")),u=!0}c+=x,m=!0}++x}if(v&&v.length&&(o={["@media "+v.join(", ")]:o}),!m)continue e}}}(i[c]=i[c]||[]).push([r?"cv":`${l}-${s[l]}`,o,u])}return i},fW={},dW=Af(),hW=(n,e)=>dW(n,()=>(...t)=>{const r=()=>{for(let i of t){i=typeof i=="object"&&i||{};let s=_c(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"]}Mf(i,[],[],n,o=>{e.rules.global.apply(o)})}}return""};return WS(r,{toString:r})}),pW=Af(),mW=(n,e)=>pW(n,()=>t=>{const r=`${Yo(n.prefix)}k-${_c(t)}`,i=()=>{if(!e.rules.global.cache.has(r)){e.rules.global.cache.add(r);const s=[];Mf(t,[],[],n,a=>s.push(a));const o=`@keyframes ${r}{${s.join("")}}`;e.rules.global.apply(o)}return r};return WS(i,{get name(){return i()},toString:i})}),gW=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"--"+Yo(this.prefix)+Yo(this.scale)+this.token}toString(){return this.computedValue}},vW=Af(),yW=(n,e)=>vW(n,()=>(t,r)=>{r=typeof t=="object"&&t||Object(r);const i=`.${t=(t=typeof t=="string"?t:"")||`${Yo(n.prefix)}t-${_c(r)}`}`,s={},o=[];for(const l in r){s[l]={};for(const c in r[l]){const u=`--${Yo(n.prefix)}${l}-${c}`,d=gI(String(r[l][c]),n.prefix,l);s[l][c]=new gW(c,d,l,n.prefix),o.push(`${u}:${d}`)}}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}}),_W=Af(),xW=Af(),EW=n=>{const e=(t=>{let r=!1;const i=_W(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||{},u={prefix:o,media:a,theme:c,themeMap:typeof s.themeMap=="object"&&s.themeMap||{...JV},utils:typeof s.utils=="object"&&s.utils||{}},d=sW(l),p={css:_I(u,d),globalCss:hW(u,d),keyframes:mW(u,d),createTheme:yW(u,d),reset(){d.reset(),p.theme.toString()},theme:{},sheet:d,config:u,prefix:o,getCssText:d.toString,toString:d.toString};return String(p.theme=p.createTheme(c)),p});return r||i.reset(),i})(n);return e.styled=(({config:t,sheet:r})=>xW(t,()=>{const i=_I(t,r);return(...s)=>{const o=i(...s),a=o[yc].type,l=ie.forwardRef((c,u)=>{const d=c&&c.as||a,{props:p,deferredInjector:m}=o(c);return delete p.as,p.ref=u,m?ie.createElement(ie.Fragment,null,ie.createElement(d,p),ie.createElement(m,null)):ie.createElement(d,p)});return l.className=o.className,l.displayName=`Styled.${a.displayName||a.name||a}`,l.selector=o.selector,l.toString=()=>o.selector,l[yc]=o[yc],l}}))(e),e};function SW(n,e,t){return Math.max(e,Math.min(n,t))}const $r={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 EI(n,e,t){return e===0||Math.abs(e)===1/0?Math.pow(n,t*5):n*e*t/(e+t*n)}function SI(n,e,t,r=.15){return r===0?SW(n,e,t):nt?+EI(n-t,t-e,r)+t:n}function AW(n,[e,t],[r,i]){const[[s,o],[a,l]]=n;return[SI(e,s,o,r),SI(t,a,l,i)]}function wW(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 MW(n){var e=wW(n,"string");return typeof e=="symbol"?e:String(e)}function Ci(n,e,t){return e=MW(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function AI(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 Vn(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 DW(n){return n.type==="touchend"||n.type==="touchcancel"?n.changedTouches:n.targetTouches}function CI(n){return K0(n)?DW(n)[0]:n}function LW(n){return IW(n).map(e=>e.identifier)}function jS(n){const e=CI(n);return K0(n)?e.identifier:e.pointerId}function bI(n){const e=CI(n);return[e.clientX,e.clientY]}function OW(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 Z0(n,...e){return typeof n=="function"?n(...e):n}function UW(){}function FW(...n){return n.length===0?UW:n.length===1?n[0]:function(){let e;for(const t of n)e=t.apply(this,arguments)||e;return e}}function RI(n,e){return Object.assign({},e,n||{})}const kW=32;class NW{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?Z0(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,OW(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 T=t._delta.map(Math.abs);$r.addTo(t._distance,T)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[l,c]=r.threshold,{_step:u,values:d}=t;if(r.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=l&&d[0]),u[1]===!1&&(u[1]=Math.abs(a)>=c&&d[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=l&&Math.sign(o)*l),u[1]===!1&&(u[1]=Math.abs(a)>=c&&Math.sign(a)*c)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const p=[0,0];if(r.hasCustomTransform){const[T,R]=d;p[0]=u[0]!==!1?T-u[0]:0,p[1]=u[1]!==!1?R-u[1]:0}else p[0]=u[0]!==!1?o-u[0]:0,p[1]=u[1]!==!1?a-u[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=Z0(r.bounds,t)),this.setup&&this.setup()),t.movement=p,this.computeOffset()));const[x,y]=t.offset,[[g,_],[E,A]]=t._bounds;t.overflow=[x_?1:0,yA?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 M=t._active?r.rubberband||[0,0]:[0,0];if(t.offset=AW(t._bounds,t.offset,M),t.delta=$r.sub(t.offset,m),this.computeMovement(),v&&(!t.last||s>kW)){t.delta=$r.sub(t.offset,m);const T=t.delta.map(Math.abs);$r.addTo(t.distance,T),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[T[0]/s,T[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(Vn(Vn(Vn({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function zW([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 GW extends NW{constructor(...e){super(...e),Ci(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=$r.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=$r.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[TI(e)]:r.axisThreshold;t.axis=zW(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 HW=n=>n,PI=.15,BI={enabled(n=!0){return n},eventOptions(n,e,t){return Vn(Vn({},t.shared.eventOptions),n)},preventDefault(n=!1){return n},triggerAllEvents(n=!1){return n},rubberband(n=0){switch(n){case!0:return[PI,PI];case!1:return[0,0];default:return $r.toVector(n)}},from(n){if(typeof n=="function")return n;if(n!=null)return $r.toVector(n)},transform(n,e,t){const r=n||t.shared.transform;return this.hasCustomTransform=!!r,r||HW},threshold(n){return $r.toVector(n,0)}},VW=0,up=Vn(Vn({},BI),{},{axis(n,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(n=VW){return n},bounds(n={}){if(typeof n=="function")return s=>up.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]]}}),II={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 WW extends GW{constructor(...e){super(...e),Ci(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=up.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=jS(e),r._pointerActive=!0,this.computeValues(bI(e)),this.computeInitial(),t.preventScrollAxis&&TI(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=jS(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=bI(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=$r.sub(s,t._values),this.computeValues(s)),$r.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=jS(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,u]=t._movement,[d,p]=r.swipe.velocity,[m,v]=r.swipe.distance,x=r.swipe.duration;if(t.elapsedTimed&&Math.abs(c)>m&&(t.swipe[0]=Math.sign(a)),g>p&&Math.abs(u)>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,$W(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=II[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,$r.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in II&&(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 $W(n){"persist"in n&&typeof n.persist=="function"&&n.persist()}const fp=typeof window<"u"&&window.document&&window.document.createElement;function DI(){return fp&&"ontouchstart"in window}function XW(){return DI()||fp&&window.navigator.maxTouchPoints>1}function jW(){return fp&&"onpointerdown"in window}function JW(){return fp&&"exitPointerLock"in window.document}function YW(){try{return"constructor"in GestureEvent}catch{return!1}}const ms={isBrowser:fp,gesture:YW(),touch:DI(),touchscreen:XW(),pointer:jW(),pointerLock:JW()},KW=250,ZW=180,QW=.5,qW=50,e7=250,t7=10,LI={mouse:0,touch:0,pen:8},n7=Vn(Vn({},up),{},{device(n,e,{pointer:{touch:t=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&ms.pointerLock,ms.touch&&t?"touch":this.pointerLock?"mouse":ms.pointer&&!i?"pointer":ms.touch?"touch":"mouse"},preventScrollAxis(n,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&n?KW:void 0,!(!ms.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=$r.toVector(n,t?r:i?1:0);return this.filterTaps=t,this.tapsThreshold=r,s},swipe({velocity:n=QW,distance:e=qW,duration:t=e7}={}){return{velocity:this.transform($r.toVector(n)),distance:this.transform($r.toVector(e)),duration:t}},delay(n=0){switch(n){case!0:return ZW;case!1:return 0;default:return n}},axisThreshold(n){return n?Vn(Vn({},LI),n):LI},keyboardDisplacement(n=t7){return n}});Vn(Vn({},BI),{},{device(n,e,{shared:t,pointer:{touch:r=!1}={}}){if(t.target&&!ms.touch&&ms.gesture)return"gesture";if(ms.touch&&r)return"touch";if(ms.touchscreen){if(ms.pointer)return"pointer";if(ms.touch)return"touch"}},bounds(n,e,{scaleBounds:t={},angleBounds:r={}}){const i=o=>{const a=RI(Z0(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=RI(Z0(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",$r.toVector(n,this.lockDirection?[.1,3]:0)},modifierKey(n){return n===void 0?"ctrlKey":n},pinchOnWheel(n=!0){return n}}),Vn(Vn({},up),{},{mouseOnly:(n=!0)=>n}),Vn(Vn({},up),{},{mouseOnly:(n=!0)=>n});const OI=new Map,JS=new Map;function r7(n){OI.set(n.key,n.engine),JS.set(n.key,n.resolver)}const i7={key:"drag",engine:WW,resolver:n7};function s7(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 o7(n,e){if(n==null)return{};var t=s7(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 a7={target(n){if(n)return()=>"current"in n?n.current:n},enabled(n=!0){return n},window(n=ms.isBrowser?window:void 0){return n},eventOptions({passive:n=!0,capture:e=!1}={}){return{passive:n,capture:e}},transform(n){return n}},l7=["target","eventOptions","window","enabled","transform"];function Q0(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]=Q0(n[r],i);break;case"boolean":i&&(t[r]=n[r]);break}return t}function c7(n,e,t={}){const r=n,{target:i,eventOptions:s,window:o,enabled:a,transform:l}=r,c=o7(r,l7);if(t.shared=Q0({target:i,eventOptions:s,window:o,enabled:a,transform:l},a7),e){const u=JS.get(e);t[e]=Q0(Vn({shared:t.shared},c),u)}else for(const u in c){const d=JS.get(u);d&&(t[u]=Q0(Vn({shared:t.shared},c[u]),d))}return t}class UI{constructor(e,t){Ci(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,i,s){const o=this._listeners,a=BW(t,r),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},c=Vn(Vn({},l),s);e.addEventListener(a,i,c);const u=()=>{e.removeEventListener(a,i,c),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class u7{constructor(){Ci(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 f7{constructor(e){Ci(this,"gestures",new Set),Ci(this,"_targetEventStore",new UI(this)),Ci(this,"gestureEventStores",{}),Ci(this,"gestureTimeoutStores",{}),Ci(this,"handlers",{}),Ci(this,"config",{}),Ci(this,"pointerIds",new Set),Ci(this,"touchIds",new Set),Ci(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),d7(this,e)}setEventIds(e){if(K0(e))return this.touchIds=new Set(LW(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=c7(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=FI(r,a.eventOptions,!!i);if(a.enabled){const c=OI.get(o);new c(this,e,o).bind(l)}}const s=FI(r,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](Vn(Vn({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in r)r[s]=FW(...r[s]);if(!i)return r;for(const s in r){const{device:o,capture:a,passive:l}=PW(s);this._targetEventStore.add(i,o,"",r[s],{capture:a,passive:l})}}}}function Tf(n,e){n.gestures.add(e),n.gestureEventStores[e]=new UI(n,e),n.gestureTimeoutStores[e]=new u7}function d7(n,e){e.drag&&Tf(n,"drag"),e.wheel&&Tf(n,"wheel"),e.scroll&&Tf(n,"scroll"),e.move&&Tf(n,"move"),e.pinch&&Tf(n,"pinch"),e.hover&&Tf(n,"hover")}const FI=(n,e,t)=>(r,i,s,o={},a=!1)=>{var l,c;const u=(l=o.capture)!==null&&l!==void 0?l:e.capture,d=(c=o.passive)!==null&&c!==void 0?c:e.passive;let p=a?r:bW(r,i,u);t&&d&&(p+="Passive"),n[p]=n[p]||[],n[p].push(s)};function h7(n,e={},t,r){const i=ie.useMemo(()=>new f7(n),[]);if(i.applyHandlers(n,r),i.applyConfig(e,t),ie.useEffect(i.effect.bind(i)),ie.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function p7(n,e){return r7(i7),h7({drag:n},e||{},"drag")}function Ko(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 kI(n,e=[]){let t=[];function r(s,o){const a=D.createContext(o),l=t.length;t=[...t,o];function c(d){const{scope:p,children:m,...v}=d,x=(p==null?void 0:p[n][l])||a,y=D.useMemo(()=>v,Object.values(v));return D.createElement(x.Provider,{value:y},m)}function u(d,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(`\`${d}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}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,m7(i,...e)]}function m7(...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 d=l(s)[`__scope${c}`];return{...a,...d}},{});return D.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function Cf(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 g7(n,e=globalThis==null?void 0:globalThis.document){const t=Cf(n);D.useEffect(()=>{const r=i=>{i.key==="Escape"&&t(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[t,e])}const YS="dismissableLayer.update",v7="dismissableLayer.pointerDownOutside",y7="dismissableLayer.focusOutside";let NI;const _7=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),x7=D.forwardRef((n,e)=>{var t;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=n,u=D.useContext(_7),[d,p]=D.useState(null),m=(t=d==null?void 0:d.ownerDocument)!==null&&t!==void 0?t:globalThis==null?void 0:globalThis.document,[,v]=D.useState({}),x=xf(e,B=>p(B)),y=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),_=y.indexOf(g),E=d?y.indexOf(d):-1,A=u.layersWithOutsidePointerEventsDisabled.size>0,M=E>=_,T=E7(B=>{const P=B.target,I=[...u.branches].some(F=>F.contains(P));!M||I||(s==null||s(B),a==null||a(B),B.defaultPrevented||l==null||l())},m),R=S7(B=>{const P=B.target;[...u.branches].some(F=>F.contains(P))||(o==null||o(B),a==null||a(B),B.defaultPrevented||l==null||l())},m);return g7(B=>{E===u.layers.size-1&&(i==null||i(B),!B.defaultPrevented&&l&&(B.preventDefault(),l()))},m),D.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(NI=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),zI(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=NI)}},[d,m,r,u]),D.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),zI())},[d,u]),D.useEffect(()=>{const B=()=>v({});return document.addEventListener(YS,B),()=>document.removeEventListener(YS,B)},[]),D.createElement(vc.div,vr({},c,{ref:x,style:{pointerEvents:A?M?"auto":"none":void 0,...n.style},onFocusCapture:Ko(n.onFocusCapture,R.onFocusCapture),onBlurCapture:Ko(n.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Ko(n.onPointerDownCapture,T.onPointerDownCapture)}))});function E7(n,e=globalThis==null?void 0:globalThis.document){const t=Cf(n),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){GI(v7,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()}else e.removeEventListener("click",i.current);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 S7(n,e=globalThis==null?void 0:globalThis.document){const t=Cf(n),r=D.useRef(!1);return D.useEffect(()=>{const i=s=>{s.target&&!r.current&&GI(y7,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 zI(){const n=new CustomEvent(YS);document.dispatchEvent(n)}function GI(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?HV(i,s):i.dispatchEvent(s)}const bf=Boolean(globalThis==null?void 0:globalThis.document)?D.useLayoutEffect:()=>{},A7=iU["useId".toString()]||(()=>{});let w7=0;function M7(n){const[e,t]=D.useState(A7());return bf(()=>{n||t(r=>r??String(w7++))},[n]),n||(e?`radix-${e}`:"")}const T7=["top","right","bottom","left"],il=Math.min,ji=Math.max,q0=Math.round,ev=Math.floor,sl=n=>({x:n,y:n}),C7={left:"right",right:"left",bottom:"top",top:"bottom"},b7={start:"end",end:"start"};function KS(n,e,t){return ji(n,il(e,t))}function Zo(n,e){return typeof n=="function"?n(e):n}function Qo(n){return n.split("-")[0]}function Rf(n){return n.split("-")[1]}function ZS(n){return n==="x"?"y":"x"}function QS(n){return n==="y"?"height":"width"}function Pf(n){return["top","bottom"].includes(Qo(n))?"y":"x"}function qS(n){return ZS(Pf(n))}function R7(n,e,t){t===void 0&&(t=!1);const r=Rf(n),i=qS(n),s=QS(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=tv(o)),[o,tv(o)]}function P7(n){const e=tv(n);return[eA(n),e,eA(e)]}function eA(n){return n.replace(/start|end/g,e=>b7[e])}function B7(n,e,t){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function I7(n,e,t,r){const i=Rf(n);let s=B7(Qo(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(eA)))),s}function tv(n){return n.replace(/left|right|bottom|top/g,e=>C7[e])}function D7(n){return{top:0,right:0,bottom:0,left:0,...n}}function HI(n){return typeof n!="number"?D7(n):{top:n,right:n,bottom:n,left:n}}function nv(n){return{...n,top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height}}function VI(n,e,t){let{reference:r,floating:i}=n;const s=Pf(e),o=qS(e),a=QS(o),l=Qo(e),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,p=r[a]/2-i[a]/2;let m;switch(l){case"top":m={x:u,y:r.y-i.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-i.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Rf(e)){case"start":m[o]-=p*(t&&c?-1:1);break;case"end":m[o]+=p*(t&&c?-1:1);break}return m}const L7=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:u,y:d}=VI(c,r,l),p=r,m={},v=0;for(let x=0;x({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Zo(n,e)||{};if(c==null)return{};const d=HI(u),p={x:t,y:r},m=qS(i),v=QS(m),x=await o.getDimensions(c),y=m==="y",g=y?"top":"left",_=y?"bottom":"right",E=y?"clientHeight":"clientWidth",A=s.reference[v]+s.reference[m]-p[m]-s.floating[v],M=p[m]-s.reference[m],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let R=T?T[E]:0;(!R||!await(o.isElement==null?void 0:o.isElement(T)))&&(R=a.floating[E]||s.floating[v]);const B=A/2-M/2,P=R/2-x[v]/2-1,I=il(d[g],P),F=il(d[_],P),N=I,H=R-x[v]-F,V=R/2-x[v]/2+B,Y=KS(N,V,H),K=!l.arrow&&Rf(i)!=null&&V!=Y&&s.reference[v]/2-(VN<=0)){var P,I;const N=(((P=s.flip)==null?void 0:P.index)||0)+1,H=M[N];if(H)return{data:{index:N,overflows:B},reset:{placement:H}};let V=(I=B.filter(Y=>Y.overflows[0]<=0).sort((Y,K)=>Y.overflows[1]-K.overflows[1])[0])==null?void 0:I.placement;if(!V)switch(m){case"bestFit":{var F;const Y=(F=B.map(K=>[K.placement,K.overflows.filter(ee=>ee>0).reduce((ee,G)=>ee+G,0)]).sort((K,ee)=>K[1]-ee[1])[0])==null?void 0:F[0];Y&&(V=Y);break}case"initialPlacement":V=a;break}if(i!==V)return{reset:{placement:V}}}return{}}}};function $I(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function XI(n){return T7.some(e=>n[e]>=0)}const U7=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=Zo(n,e);switch(r){case"referenceHidden":{const s=await dp(e,{...i,elementContext:"reference"}),o=$I(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:XI(o)}}}case"escaped":{const s=await dp(e,{...i,altBoundary:!0}),o=$I(s,t.floating);return{data:{escapedOffsets:o,escaped:XI(o)}}}default:return{}}}}};async function F7(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Qo(t),a=Rf(t),l=Pf(t)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,d=Zo(e,n);let{mainAxis:p,crossAxis:m,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&typeof v=="number"&&(m=a==="end"?v*-1:v),l?{x:m*u,y:p*c}:{x:p*c,y:m*u}}const k7=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){const{x:t,y:r}=e,i=await F7(e,n);return{x:t+i.x,y:r+i.y,data:i}}}},N7=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:y=>{let{x:g,y:_}=y;return{x:g,y:_}}},...l}=Zo(n,e),c={x:t,y:r},u=await dp(e,l),d=Pf(Qo(i)),p=ZS(d);let m=c[p],v=c[d];if(s){const y=p==="y"?"top":"left",g=p==="y"?"bottom":"right",_=m+u[y],E=m-u[g];m=KS(_,m,E)}if(o){const y=d==="y"?"top":"left",g=d==="y"?"bottom":"right",_=v+u[y],E=v-u[g];v=KS(_,v,E)}const x=a.fn({...e,[p]:m,[d]:v});return{...x,data:{x:x.x-t,y:x.y-r}}}}},z7=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}=Zo(n,e),u={x:t,y:r},d=Pf(i),p=ZS(d);let m=u[p],v=u[d];const x=Zo(a,e),y=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(l){const E=p==="y"?"height":"width",A=s.reference[p]-s.floating[E]+y.mainAxis,M=s.reference[p]+s.reference[E]-y.mainAxis;mM&&(m=M)}if(c){var g,_;const E=p==="y"?"width":"height",A=["top","left"].includes(Qo(i)),M=s.reference[d]-s.floating[E]+(A&&((g=o.offset)==null?void 0:g[d])||0)+(A?0:y.crossAxis),T=s.reference[d]+s.reference[E]+(A?0:((_=o.offset)==null?void 0:_[d])||0)-(A?y.crossAxis:0);vT&&(v=T)}return{[p]:m,[d]:v}}}},G7=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}=Zo(n,e),l=await dp(e,a),c=Qo(t),u=Rf(t),d=Pf(t)==="y",{width:p,height:m}=r.floating;let v,x;c==="top"||c==="bottom"?(v=c,x=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(x=c,v=u==="end"?"top":"bottom");const y=m-l[v],g=p-l[x],_=!e.middlewareData.shift;let E=y,A=g;if(d){const T=p-l.left-l.right;A=u||_?il(g,T):T}else{const T=m-l.top-l.bottom;E=u||_?il(y,T):T}if(_&&!u){const T=ji(l.left,0),R=ji(l.right,0),B=ji(l.top,0),P=ji(l.bottom,0);d?A=p-2*(T!==0||R!==0?T+R:ji(l.left,l.right)):E=m-2*(B!==0||P!==0?B+P:ji(l.top,l.bottom))}await o({...e,availableWidth:A,availableHeight:E});const M=await i.getDimensions(s.floating);return p!==M.width||m!==M.height?{reset:{rects:!0}}:{}}}};function ol(n){return jI(n)?(n.nodeName||"").toLowerCase():"#document"}function Ji(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function qo(n){var e;return(e=(jI(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function jI(n){return n instanceof Node||n instanceof Ji(n).Node}function ea(n){return n instanceof Element||n instanceof Ji(n).Element}function mo(n){return n instanceof HTMLElement||n instanceof Ji(n).HTMLElement}function JI(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ji(n).ShadowRoot}function hp(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=gs(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(i)}function H7(n){return["table","td","th"].includes(ol(n))}function tA(n){const e=nA(),t=gs(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function V7(n){let e=Bf(n);for(;mo(e)&&!rv(e);){if(tA(e))return e;e=Bf(e)}return null}function nA(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function rv(n){return["html","body","#document"].includes(ol(n))}function gs(n){return Ji(n).getComputedStyle(n)}function iv(n){return ea(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function Bf(n){if(ol(n)==="html")return n;const e=n.assignedSlot||n.parentNode||JI(n)&&n.host||qo(n);return JI(e)?e.host:e}function YI(n){const e=Bf(n);return rv(e)?n.ownerDocument?n.ownerDocument.body:n.body:mo(e)&&hp(e)?e:YI(e)}function pp(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=YI(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=Ji(i);return s?e.concat(o,o.visualViewport||[],hp(i)?i:[],o.frameElement&&t?pp(o.frameElement):[]):e.concat(i,pp(i,[],t))}function KI(n){const e=gs(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=mo(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,a=q0(t)!==s||q0(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function rA(n){return ea(n)?n:n.contextElement}function If(n){const e=rA(n);if(!mo(e))return sl(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=KI(e);let o=(s?q0(t.width):t.width)/r,a=(s?q0(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const W7=sl(0);function ZI(n){const e=Ji(n);return!nA()||!e.visualViewport?W7:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function $7(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Ji(n)?!1:e}function xc(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=rA(n);let o=sl(1);e&&(r?ea(r)&&(o=If(r)):o=If(n));const a=$7(s,t,r)?ZI(s):sl(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const p=Ji(s),m=r&&ea(r)?Ji(r):r;let v=p.frameElement;for(;v&&r&&m!==p;){const x=If(v),y=v.getBoundingClientRect(),g=gs(v),_=y.left+(v.clientLeft+parseFloat(g.paddingLeft))*x.x,E=y.top+(v.clientTop+parseFloat(g.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,d*=x.y,l+=_,c+=E,v=Ji(v).frameElement}}return nv({width:u,height:d,x:l,y:c})}function X7(n){let{rect:e,offsetParent:t,strategy:r}=n;const i=mo(t),s=qo(t);if(t===s)return e;let o={scrollLeft:0,scrollTop:0},a=sl(1);const l=sl(0);if((i||!i&&r!=="fixed")&&((ol(t)!=="body"||hp(s))&&(o=iv(t)),mo(t))){const c=xc(t);a=If(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}}function j7(n){return Array.from(n.getClientRects())}function QI(n){return xc(qo(n)).left+iv(n).scrollLeft}function J7(n){const e=qo(n),t=iv(n),r=n.ownerDocument.body,i=ji(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=ji(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+QI(n);const a=-t.scrollTop;return gs(r).direction==="rtl"&&(o+=ji(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}function Y7(n,e){const t=Ji(n),r=qo(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=nA();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function K7(n,e){const t=xc(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=mo(n)?If(n):sl(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function qI(n,e,t){let r;if(e==="viewport")r=Y7(n,t);else if(e==="document")r=J7(qo(n));else if(ea(e))r=K7(e,t);else{const i=ZI(n);r={...e,x:e.x-i.x,y:e.y-i.y}}return nv(r)}function eD(n,e){const t=Bf(n);return t===e||!ea(t)||rv(t)?!1:gs(t).position==="fixed"||eD(t,e)}function Z7(n,e){const t=e.get(n);if(t)return t;let r=pp(n,[],!1).filter(a=>ea(a)&&ol(a)!=="body"),i=null;const s=gs(n).position==="fixed";let o=s?Bf(n):n;for(;ea(o)&&!rv(o);){const a=gs(o),l=tA(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||hp(o)&&!l&&eD(n,o))?r=r.filter(u=>u!==o):i=a,o=Bf(o)}return e.set(n,r),r}function Q7(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?Z7(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((c,u)=>{const d=qI(e,u,i);return c.top=ji(d.top,c.top),c.right=il(d.right,c.right),c.bottom=il(d.bottom,c.bottom),c.left=ji(d.left,c.left),c},qI(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function q7(n){return KI(n)}function e$(n,e,t){const r=mo(e),i=qo(e),s=t==="fixed",o=xc(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=sl(0);if(r||!r&&!s)if((ol(e)!=="body"||hp(i))&&(a=iv(e)),r){const c=xc(e,!0,s,e);l.x=c.x+e.clientLeft,l.y=c.y+e.clientTop}else i&&(l.x=QI(i));return{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function tD(n,e){return!mo(n)||gs(n).position==="fixed"?null:e?e(n):n.offsetParent}function nD(n,e){const t=Ji(n);if(!mo(n))return t;let r=tD(n,e);for(;r&&H7(r)&&gs(r).position==="static";)r=tD(r,e);return r&&(ol(r)==="html"||ol(r)==="body"&&gs(r).position==="static"&&!tA(r))?t:r||V7(n)||t}const t$=async function(n){let{reference:e,floating:t,strategy:r}=n;const i=this.getOffsetParent||nD,s=this.getDimensions;return{reference:e$(e,await i(t),r),floating:{x:0,y:0,...await s(t)}}};function n$(n){return gs(n).direction==="rtl"}const r$={convertOffsetParentRelativeRectToViewportRelativeRect:X7,getDocumentElement:qo,getClippingRect:Q7,getOffsetParent:nD,getElementRects:t$,getClientRects:j7,getDimensions:q7,getScale:If,isElement:ea,isRTL:n$};function i$(n,e){let t=null,r;const i=qo(n);function s(){clearTimeout(r),t&&t.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:c,top:u,width:d,height:p}=n.getBoundingClientRect();if(a||e(),!d||!p)return;const m=ev(u),v=ev(i.clientWidth-(c+d)),x=ev(i.clientHeight-(u+p)),y=ev(c),_={rootMargin:-m+"px "+-v+"px "+-x+"px "+-y+"px",threshold:ji(0,il(1,l))||1};let E=!0;function A(M){const T=M[0].intersectionRatio;if(T!==l){if(!E)return o();T?o(!1,T):r=setTimeout(()=>{o(!1,1e-7)},100)}E=!1}try{t=new IntersectionObserver(A,{..._,root:i.ownerDocument})}catch{t=new IntersectionObserver(A,_)}t.observe(n)}return o(!0),s}function s$(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=rA(n),u=i||s?[...c?pp(c):[],...pp(e)]:[];u.forEach(g=>{i&&g.addEventListener("scroll",t,{passive:!0}),s&&g.addEventListener("resize",t)});const d=c&&a?i$(c,t):null;let p=-1,m=null;o&&(m=new ResizeObserver(g=>{let[_]=g;_&&_.target===c&&m&&(m.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{m&&m.observe(e)})),t()}),c&&!l&&m.observe(c),m.observe(e));let v,x=l?xc(n):null;l&&y();function y(){const g=xc(n);x&&(g.x!==x.x||g.y!==x.y||g.width!==x.width||g.height!==x.height)&&t(),x=g,v=requestAnimationFrame(y)}return t(),()=>{u.forEach(g=>{i&&g.removeEventListener("scroll",t),s&&g.removeEventListener("resize",t)}),d&&d(),m&&m.disconnect(),m=null,l&&cancelAnimationFrame(v)}}const o$=(n,e,t)=>{const r=new Map,i={platform:r$,...t},s={...i.platform,_c:r};return L7(n,e,{...i,platform:s})},a$=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?WI({element:r.current,padding:i}).fn(t):{}:r?WI({element:r,padding:i}).fn(t):{}}}};var sv=typeof document<"u"?D.useLayoutEffect:D.useEffect;function ov(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(!ov(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)&&!ov(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function rD(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function iD(n,e){const t=rD(n);return Math.round(e*t)/t}function sD(n){const e=D.useRef(n);return sv(()=>{e.current=n}),e}function l$(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,[u,d]=D.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[p,m]=D.useState(r);ov(p,r)||m(r);const[v,x]=D.useState(null),[y,g]=D.useState(null),_=D.useCallback(K=>{K!=T.current&&(T.current=K,x(K))},[x]),E=D.useCallback(K=>{K!==R.current&&(R.current=K,g(K))},[g]),A=s||v,M=o||y,T=D.useRef(null),R=D.useRef(null),B=D.useRef(u),P=sD(l),I=sD(i),F=D.useCallback(()=>{if(!T.current||!R.current)return;const K={placement:e,strategy:t,middleware:p};I.current&&(K.platform=I.current),o$(T.current,R.current,K).then(ee=>{const G={...ee,isPositioned:!0};N.current&&!ov(B.current,G)&&(B.current=G,xl.flushSync(()=>{d(G)}))})},[p,e,t,I]);sv(()=>{c===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,d(K=>({...K,isPositioned:!1})))},[c]);const N=D.useRef(!1);sv(()=>(N.current=!0,()=>{N.current=!1}),[]),sv(()=>{if(A&&(T.current=A),M&&(R.current=M),A&&M){if(P.current)return P.current(A,M,F);F()}},[A,M,F,P]);const H=D.useMemo(()=>({reference:T,floating:R,setReference:_,setFloating:E}),[_,E]),V=D.useMemo(()=>({reference:A,floating:M}),[A,M]),Y=D.useMemo(()=>{const K={position:t,left:0,top:0};if(!V.floating)return K;const ee=iD(V.floating,u.x),G=iD(V.floating,u.y);return a?{...K,transform:"translate("+ee+"px, "+G+"px)",...rD(V.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ee,top:G}},[t,a,V.floating,u.x,u.y]);return D.useMemo(()=>({...u,update:F,refs:H,elements:V,floatingStyles:Y}),[u,F,H,V,Y])}const c$=D.forwardRef((n,e)=>{const{children:t,width:r=10,height:i=5,...s}=n;return D.createElement(vc.svg,vr({},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"}))});function u$(n){const[e,t]=D.useState(void 0);return bf(()=>{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 oD="Popper",[aD,lD]=kI(oD),[f$,cD]=aD(oD),d$=n=>{const{__scopePopper:e,children:t}=n,[r,i]=D.useState(null);return D.createElement(f$,{scope:e,anchor:r,onAnchorChange:i},t)},h$="PopperAnchor",p$=D.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...i}=n,s=cD(h$,t),o=D.useRef(null),a=xf(e,o);return D.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:D.createElement(vc.div,vr({},i,{ref:a}))}),uD="PopperContent",[m$,g$]=aD(uD),v$=D.forwardRef((n,e)=>{var t,r,i,s,o,a,l,c;const{__scopePopper:u,side:d="bottom",sideOffset:p=0,align:m="center",alignOffset:v=0,arrowPadding:x=0,avoidCollisions:y=!0,collisionBoundary:g=[],collisionPadding:_=0,sticky:E="partial",hideWhenDetached:A=!1,updatePositionStrategy:M="optimized",onPlaced:T,...R}=n,B=cD(uD,u),[P,I]=D.useState(null),F=xf(e,me=>I(me)),[N,H]=D.useState(null),V=u$(N),Y=(t=V==null?void 0:V.width)!==null&&t!==void 0?t:0,K=(r=V==null?void 0:V.height)!==null&&r!==void 0?r:0,ee=d+(m!=="center"?"-"+m:""),G=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},W=Array.isArray(g)?g:[g],J=W.length>0,j={padding:G,boundary:W.filter(E$),altBoundary:J},{refs:X,floatingStyles:oe,placement:se,isPositioned:ce,middlewareData:le}=l$({strategy:"fixed",placement:ee,whileElementsMounted:(...me)=>s$(...me,{animationFrame:M==="always"}),elements:{reference:B.anchor},middleware:[k7({mainAxis:p+K,alignmentAxis:v}),y&&N7({mainAxis:!0,crossAxis:!1,limiter:E==="partial"?z7():void 0,...j}),y&&O7({...j}),G7({...j,apply:({elements:me,rects:pe,availableWidth:$e,availableHeight:_e})=>{const{width:Fe,height:Ne}=pe.reference,Ce=me.floating.style;Ce.setProperty("--radix-popper-available-width",`${$e}px`),Ce.setProperty("--radix-popper-available-height",`${_e}px`),Ce.setProperty("--radix-popper-anchor-width",`${Fe}px`),Ce.setProperty("--radix-popper-anchor-height",`${Ne}px`)}}),N&&a$({element:N,padding:x}),S$({arrowWidth:Y,arrowHeight:K}),A&&U7({strategy:"referenceHidden",...j})]}),[ue,xe]=fD(se),Le=Cf(T);bf(()=>{ce&&(Le==null||Le())},[ce,Le]);const Je=(i=le.arrow)===null||i===void 0?void 0:i.x,Pe=(s=le.arrow)===null||s===void 0?void 0:s.y,$=((o=le.arrow)===null||o===void 0?void 0:o.centerOffset)!==0,[Me,ve]=D.useState();return bf(()=>{P&&ve(window.getComputedStyle(P).zIndex)},[P]),D.createElement("div",{ref:X.setFloating,"data-radix-popper-content-wrapper":"",style:{...oe,transform:ce?oe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,["--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(m$,{scope:u,placedSide:ue,onArrowChange:H,arrowX:Je,arrowY:Pe,shouldHideArrow:$},D.createElement(vc.div,vr({"data-side":ue,"data-align":xe},R,{ref:F,style:{...R.style,animation:ce?void 0:"none",opacity:(c=le.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))}),y$="PopperArrow",_$={top:"bottom",right:"left",bottom:"top",left:"right"},x$=D.forwardRef(function(e,t){const{__scopePopper:r,...i}=e,s=g$(y$,r),o=_$[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(c$,vr({},i,{ref:t,style:{...i.style,display:"block"}})))});function E$(n){return n!==null}const S$=n=>({name:"transformOrigin",options:n,fn(e){var t,r,i,s,o;const{placement:a,rects:l,middlewareData:c}=e,d=((t=c.arrow)===null||t===void 0?void 0:t.centerOffset)!==0,p=d?0:n.arrowWidth,m=d?0:n.arrowHeight,[v,x]=fD(a),y={start:"0%",center:"50%",end:"100%"}[x],g=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+p/2,_=((s=(o=c.arrow)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)+m/2;let E="",A="";return v==="bottom"?(E=d?y:`${g}px`,A=`${-m}px`):v==="top"?(E=d?y:`${g}px`,A=`${l.floating.height+m}px`):v==="right"?(E=`${-m}px`,A=d?y:`${_}px`):v==="left"&&(E=`${l.floating.width+m}px`,A=d?y:`${_}px`),{data:{x:E,y:A}}}});function fD(n){const[e,t="center"]=n.split("-");return[e,t]}const A$=d$,w$=p$,M$=v$,T$=x$;function C$(n,e){return D.useReducer((t,r)=>{const i=e[t][r];return i??t},n)}const dD=n=>{const{present:e,children:t}=n,r=b$(e),i=typeof t=="function"?t({present:r.isPresent}):D.Children.only(t),s=xf(r.ref,i.ref);return typeof t=="function"||r.isPresent?D.cloneElement(i,{ref:s}):null};dD.displayName="Presence";function b$(n){const[e,t]=D.useState(),r=D.useRef({}),i=D.useRef(n),s=D.useRef("none"),o=n?"mounted":"unmounted",[a,l]=C$(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return D.useEffect(()=>{const c=av(r.current);s.current=a==="mounted"?c:"none"},[a]),bf(()=>{const c=r.current,u=i.current;if(u!==n){const p=s.current,m=av(c);n?l("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=n}},[n,l]),bf(()=>{if(e){const c=d=>{const m=av(r.current).includes(d.animationName);d.target===e&&m&&xl.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===e&&(s.current=av(r.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",u),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 av(n){return(n==null?void 0:n.animationName)||"none"}function R$({prop:n,defaultProp:e,onChange:t=()=>{}}){const[r,i]=P$({defaultProp:e,onChange:t}),s=n!==void 0,o=s?n:r,a=Cf(t),l=D.useCallback(c=>{if(s){const d=typeof c=="function"?c(n):c;d!==n&&a(d)}else i(c)},[s,n,i,a]);return[o,l]}function P$({defaultProp:n,onChange:e}){const t=D.useState(n),[r]=t,i=D.useRef(r),s=Cf(e);return D.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),t}const B$=D.forwardRef((n,e)=>D.createElement(vc.span,vr({},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}}))),[lv,yQ]=kI("Tooltip",[lD]),cv=lD(),I$="TooltipProvider",iA="tooltip.open",[_Q,sA]=lv(I$),oA="Tooltip",[D$,uv]=lv(oA),L$=n=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:i=!1,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=n,l=sA(oA,n.__scopeTooltip),c=cv(e),[u,d]=D.useState(null),p=M7(),m=D.useRef(0),v=o??l.disableHoverableContent,x=a??l.delayDuration,y=D.useRef(!1),[g=!1,_]=R$({prop:r,defaultProp:i,onChange:R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(iA))):l.onClose(),s==null||s(R)}}),E=D.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),A=D.useCallback(()=>{window.clearTimeout(m.current),y.current=!1,_(!0)},[_]),M=D.useCallback(()=>{window.clearTimeout(m.current),_(!1)},[_]),T=D.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{y.current=!0,_(!0)},x)},[x,_]);return D.useEffect(()=>()=>window.clearTimeout(m.current),[]),D.createElement(A$,c,D.createElement(D$,{scope:e,contentId:p,open:g,stateAttribute:E,trigger:u,onTriggerChange:d,onTriggerEnter:D.useCallback(()=>{l.isOpenDelayed?T():A()},[l.isOpenDelayed,T,A]),onTriggerLeave:D.useCallback(()=>{v?M():window.clearTimeout(m.current)},[M,v]),onOpen:A,onClose:M,disableHoverableContent:v},t))},hD="TooltipTrigger",O$=D.forwardRef((n,e)=>{const{__scopeTooltip:t,...r}=n,i=uv(hD,t),s=sA(hD,t),o=cv(t),a=D.useRef(null),l=xf(e,a,i.onTriggerChange),c=D.useRef(!1),u=D.useRef(!1),d=D.useCallback(()=>c.current=!1,[]);return D.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),D.createElement(w$,vr({asChild:!0},o),D.createElement(vc.button,vr({"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute},r,{ref:l,onPointerMove:Ko(n.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ko(n.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Ko(n.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Ko(n.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ko(n.onBlur,i.onClose),onClick:Ko(n.onClick,i.onClose)})))}),U$="TooltipPortal",[xQ,F$]=lv(U$,{forceMount:void 0}),mp="TooltipContent",k$=D.forwardRef((n,e)=>{const t=F$(mp,n.__scopeTooltip),{forceMount:r=t.forceMount,side:i="top",...s}=n,o=uv(mp,n.__scopeTooltip);return D.createElement(dD,{present:r||o.open},o.disableHoverableContent?D.createElement(pD,vr({side:i},s,{ref:e})):D.createElement(N$,vr({side:i},s,{ref:e})))}),N$=D.forwardRef((n,e)=>{const t=uv(mp,n.__scopeTooltip),r=sA(mp,n.__scopeTooltip),i=D.useRef(null),s=xf(e,i),[o,a]=D.useState(null),{trigger:l,onClose:c}=t,u=i.current,{onPointerInTransitChange:d}=r,p=D.useCallback(()=>{a(null),d(!1)},[d]),m=D.useCallback((v,x)=>{const y=v.currentTarget,g={x:v.clientX,y:v.clientY},_=W$(g,y.getBoundingClientRect()),E=$$(g,_),A=X$(x.getBoundingClientRect()),M=J$([...E,...A]);a(M),d(!0)},[d]);return D.useEffect(()=>()=>p(),[p]),D.useEffect(()=>{if(l&&u){const v=y=>m(y,u),x=y=>m(y,l);return l.addEventListener("pointerleave",v),u.addEventListener("pointerleave",x),()=>{l.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",x)}}},[l,u,m,p]),D.useEffect(()=>{if(o){const v=x=>{const y=x.target,g={x:x.clientX,y:x.clientY},_=(l==null?void 0:l.contains(y))||(u==null?void 0:u.contains(y)),E=!j$(g,o);_?p():E&&(p(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,u,o,c,p]),D.createElement(pD,vr({},n,{ref:s}))}),[z$,G$]=lv(oA,{isInside:!1}),pD=D.forwardRef((n,e)=>{const{__scopeTooltip:t,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=n,l=uv(mp,t),c=cv(t),{onClose:u}=l;return D.useEffect(()=>(document.addEventListener(iA,u),()=>document.removeEventListener(iA,u)),[u]),D.useEffect(()=>{if(l.trigger){const d=p=>{const m=p.target;m!=null&&m.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),D.createElement(x7,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u},D.createElement(M$,vr({"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(oI,null,r),D.createElement(z$,{scope:t,isInside:!0},D.createElement(B$,{id:l.contentId,role:"tooltip"},i||r))))}),H$="TooltipArrow",V$=D.forwardRef((n,e)=>{const{__scopeTooltip:t,...r}=n,i=cv(t);return G$(H$,t).isInside?null:D.createElement(T$,vr({},i,r,{ref:e}))});function W$(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 $$(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 X$(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 j$(n,e){const{x:t,y:r}=n;let i=!1;for(let s=0,o=e.length-1;sr!=u>r&&t<(c-a)*(r-l)/(u-l)+a&&(i=!i)}return i}function J$(n){const e=n.slice();return e.sort((t,r)=>t.xr.x?1:t.yr.y?1:0),Y$(e)}function Y$(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 K$=L$,Z$=O$,Q$=k$,q$=V$;function eX(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 En(n,e){if(n==null)return{};var t=eX(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 tX={[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 mD(n,e,...t){const[r,...i]=tX[e](...t);console[n]("LEVA: "+r,...i)}const ta=mD.bind(null,"warn"),nX=mD.bind(null,"log"),rX=["value"],iX=["schema"],sX=["value"],gD=[],Ec={};function vD(n){let{value:e}=n,t=En(n,rX);for(let r of gD){const i=r(e,t);if(i)return i}}function na(n,e){let{schema:t}=e,r=En(e,iX);if(n in Ec){ta(Wn.ALREADY_REGISTERED_TYPE,n);return}gD.push((i,s)=>t(i,s)&&n),Ec[n]=r}function EQ(n){return n}function aA(n,e,t,r){const{normalize:i}=Ec[n];if(i)return i(e,t,r);if(typeof e!="object"||!("value"in e))return{value:e};const{value:s}=e,o=En(e,sX);return{value:s,settings:o}}function oX(n,e,t,r,i,s){const{sanitize:o}=Ec[n];return o?o(e,t,r,i,s):e}function yD(n,e,t){const{format:r}=Ec[n];return r?r(e,t):e}function aX(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _D(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 Mt(n){for(var e=1;en>t?t:n{if(n===""||typeof n=="number")return n;try{const e=ll(n);if(!isNaN(e))return e}catch{}return parseFloat(n)},cX=Math.log(10);function xD(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)/cX)+1,r=Math.floor(Math.log10(Math.abs(n))),i=Math.pow(10,r-t);return Math.max(i,.001)}const fv=(n,e,t)=>t===e?0:(al(n,e,t)-e)/(t-e),dv=(n,e,t)=>n*(t-e)+e,uX=()=>"_"+Math.random().toString(36).substr(2,9),ED=/\(([0-9+\-*/^ .]+)\)/,SD=/(\d+(?:\.\d+)?) ?\^ ?(\d+(?:\.\d+)?)/,AD=/(\d+(?:\.\d+)?) ?\* ?(\d+(?:\.\d+)?)/,wD=/(\d+(?:\.\d+)?) ?\/ ?(\d+(?:\.\d+)?)/,MD=/(\d+(?:\.\d+)?) ?\+ ?(\d+(?:\.\d+)?)/,TD=/(\d+(?:\.\d+)?) ?- ?(\d+(?:\.\d+)?)/;function ll(n){if(isNaN(Number(n)))if(ED.test(n)){const e=n.replace(ED,(t,r)=>String(ll(r)));return ll(e)}else if(SD.test(n)){const e=n.replace(SD,(t,r,i)=>String(Math.pow(Number(r),Number(i))));return ll(e)}else if(AD.test(n)){const e=n.replace(AD,(t,r,i)=>String(Number(r)*Number(i)));return ll(e)}else if(wD.test(n)){const e=n.replace(wD,(t,r,i)=>{if(i!=0)return String(Number(r)/Number(i));throw new Error("Division by zero")});return ll(e)}else if(MD.test(n)){const e=n.replace(MD,(t,r,i)=>String(Number(r)+Number(i)));return ll(e)}else if(TD.test(n)){const e=n.replace(TD,(t,r,i)=>String(Number(r)-Number(i)));return ll(e)}else return Number(n);return Number(n)}function fX(n,e){return e.reduce((t,r)=>(n&&n.hasOwnProperty(r)&&(t[r]=n[r]),t),{})}function dX(n,e){const t=Mt({},n);return e.forEach(r=>r in n&&delete t[r]),t}function hX(n,e){return n.reduce((t,r,i)=>Object.assign(t,{[e[i]]:r}),{})}function CD(n){return Object.prototype.toString.call(n)==="[object Object]"}const pX=n=>CD(n)&&Object.keys(n).length===0;let vs;(function(n){n.BUTTON="BUTTON",n.BUTTON_GROUP="BUTTON_GROUP",n.MONITOR="MONITOR",n.FOLDER="FOLDER"})(vs||(vs={}));let Js;(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"})(Js||(Js={}));const mX=["type","__customInput"],gX=["render","label","optional","order","disabled","hint","onChange","onEditStart","onEditEnd","transient"],vX=["type"];function bD(n,e,t={},r){var i,s;if(typeof n!="object"||Array.isArray(n))return{type:r,input:n,options:Mt({key:e,label:e,optional:!1,disabled:!1,order:0},t)};if("__customInput"in n){const{type:M,__customInput:T}=n,R=En(n,mX);return bD(T,e,R,M)}const{render:o,label:a,optional:l,order:c=0,disabled:u,hint:d,onChange:p,onEditStart:m,onEditEnd:v,transient:x}=n,y=En(n,gX),g=Mt({render:o,key:e,label:a??e,hint:d,transient:x??!!p,onEditStart:m,onEditEnd:v,disabled:u,optional:l,order:c},t);let{type:_}=y,E=En(y,vX);if(_=r??_,_ in vs)return{type:_,input:E,options:g};let A;return r&&CD(E)&&"value"in E?A=E.value:A=pX(E)?void 0:E,{type:_,input:A,options:Mt(Mt({},g),{},{onChange:p,optional:(i=g.optional)!==null&&i!==void 0?i:!1,disabled:(s=g.disabled)!==null&&s!==void 0?s:!1})}}function yX(n,e,t,r){const i=bD(n,e),{type:s,input:o,options:a}=i;if(s)return s in vs?i:{type:s,input:aA(s,o,t,r),options:a};let l=vD(o);return l?{type:l,input:aA(l,o,t,r),options:a}:(l=vD({value:o}),l?{type:l,input:aA(l,{value:o},t,r),options:a}:!1)}function RD(n,e,t,r,i){const{value:s,type:o,settings:a}=n;n.value=PD({type:o,value:s,settings:a},e,t,r),n.fromPanel=i}const _X=function(e,t,r){this.type="LEVA_ERROR",this.message="LEVA: "+e,this.previousValue=t,this.error=r};function PD({type:n,value:e,settings:t},r,i,s){const o=n!=="SELECT"&&typeof r=="function"?r(e):r;let a;try{a=oX(n,o,t,e,i,s)}catch(l){throw new _X(`The value \`${r}\` did not result in a correct value.`,e,l)}return op(a,e)?e:a}const BD=(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()}},ID=n=>n.shiftKey?5:n.altKey?1/5:1;function xX(n,e){const t=console.error;console.error=()=>{},QC.render(n,e),console.error=t}const EX=["value"],SX=["min","max"],AX=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},DD=(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=al(i,e,t);return r?s+r:s},wX=(n,{pad:e=0,suffix:t})=>{const r=parseFloat(n).toFixed(e);return t?r+t:r},LD=n=>{let{value:e}=n,t=En(n,EX);const{min:r=-1/0,max:i=1/0}=t,s=En(t,SX);let o=parseFloat(e);const a=typeof e=="string"?e.substring((""+o).length):void 0;o=al(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?xD(l)*10:xD(o);l=l||c/10;const u=Math.round(al(Math.log10(1/c),0,2));return{value:a?o+a:o,settings:Mt({initialValue:o,step:l,pad:u,min:r,max:i,suffix:a},s)}},OD=(n,{step:e,initialValue:t})=>{const r=Math.round((n-t)/e);return t+r*e};var UD=Object.freeze({__proto__:null,schema:AX,sanitize:DD,format:wX,normalize:LD,sanitizeStep:OD});function Qn(){return Qn=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 hv(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 vp={$inputStyle:()=>n=>hv(n,{key:"$input",borderColor:"$highlight1",inset:!0}),$focusStyle:()=>n=>hv(n,{key:"$focus",borderColor:"$accent2"}),$hoverStyle:()=>n=>hv(n,{key:"$hover",borderColor:"$accent1",inset:!0}),$activeStyle:()=>n=>hv(n,{key:"$active",borderColor:"$accent1",inset:!0})},{styled:St,css:SQ,createTheme:TX,globalCss:CX,keyframes:AQ}=EW({prefix:"leva",theme:zD(),utils:Mt(Mt({},vp),{},{$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":vp.$focusStyle()(n)}),$focusWithin:n=>({"&:focus-within":vp.$focusStyle()(n)}),$hover:n=>({"&:hover":vp.$hoverStyle()(n)}),$active:n=>({"&:active":vp.$activeStyle()(n)})})}),bX=CX({".leva__panel__dragged":{WebkitUserDrag:"none",userSelect:"none",input:{userSelect:"none"},"*":{cursor:"ew-resize !important"}}});function RX(n){const e=zD();if(!n)return{theme:e,className:""};Object.keys(n).forEach(r=>{Object.assign(e[r],n[r])});const t=TX(e);return{theme:e,className:t.className}}function ra(n,e){const{theme:t}=D.useContext(lA);if(!(n in t)||!(e in t[n]))return ta(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 GD=St("input",{$reset:"",padding:"0 $sm",width:0,minWidth:0,flex:1,height:"100%",variants:{levaType:{number:{textAlign:"right"}},as:{textarea:{padding:"$sm"}}}}),HD=St("div",{$draggable:"",height:"100%",$flexCenter:"",position:"relative",padding:"0 $xs",fontSize:"0.8em",opacity:.8,cursor:"default",touchAction:"none",[`& + ${GD}`]:{paddingLeft:0}}),PX=St(HD,{cursor:"ew-resize",marginRight:"-$xs",textTransform:"uppercase",opacity:.3,"&:hover":{opacity:1},variants:{dragging:{true:{backgroundColor:"$accent2",opacity:1}}}}),BX=St("div",{$flex:"",position:"relative",borderRadius:"$sm",overflow:"hidden",color:"inherit",height:"$rowHeight",backgroundColor:"$elevation3",$inputStyle:"$elevation1",$hover:"",$focusWithin:"",variants:{textArea:{true:{height:"auto"}}}}),IX=["innerLabel","value","onUpdate","onChange","onKeyDown","type","id","inputType","rows"],DX=["onUpdate"];function cA(n){let{innerLabel:e,value:t,onUpdate:r,onChange:i,onKeyDown:s,type:o,id:a,inputType:l="text",rows:c=0}=n,u=En(n,IX);const{id:d,emitOnEditStart:p,emitOnEditEnd:m,disabled:v}=Xr(),x=a||d,y=D.useRef(null),g=c>0,_=g?"textarea":"input",E=D.useCallback(T=>R=>{const B=R.currentTarget.value;T(B)},[]);ie.useEffect(()=>{const T=y.current,R=E(B=>{r(B),m()});return T==null||T.addEventListener("blur",R),()=>T==null?void 0:T.removeEventListener("blur",R)},[E,r,m]);const A=D.useCallback(T=>{T.key==="Enter"&&E(r)(T)},[E,r]),M=Object.assign({as:_},g?{rows:c}:{},u);return ie.createElement(BX,{textArea:g},e&&typeof e=="string"?ie.createElement(HD,null,e):e,ie.createElement(GD,Qn({levaType:o,ref:y,id:x,type:l,autoComplete:"off",spellCheck:"false",value:t,onChange:E(i),onFocus:()=>p(),onKeyPress:A,onKeyDown:s,disabled:v},M)))}function LX(n){let{onUpdate:e}=n,t=En(n,DX);const r=D.useCallback(s=>e(lX(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 ie.createElement(cA,Qn({},t,{onUpdate:r,onKeyDown:i,type:"number"}))}const pv=St("div",{}),uA=St("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"}}]}),OX=St("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 + ${uA}::after`]:{opacity:.6},[`${pv}:hover > & + ${uA}::after`]:{opacity:.6},[`${pv}:hover > & > svg`]:{opacity:1}}),VD=St("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"},[`> ${pv}:not(:first-of-type)`]:{paddingTop:"$sm",marginTop:"$md",borderTop:"$borderWidths$folder solid $colors$elevation1"}}}}}),WD=St("div",{position:"relative",zIndex:100,display:"grid",rowGap:"$rowGap",gridTemplateRows:"minmax($sizes$rowHeight, max-content)",alignItems:"center",color:"$highlight2",[`${VD} > &`]:{"&:first-of-type":{marginTop:"$rowGap"},"&:last-of-type":{marginBottom:"$rowGap"}},variants:{disabled:{true:{pointerEvents:"none"},false:{"&:hover,&:focus-within":{color:"$highlight3"}}}}}),$D=St(WD,{gridTemplateColumns:"auto $sizes$controlWidth",columnGap:"$colGap"}),UX=St("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"}}}}),FX=St("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"}}),fA=St("label",{fontWeight:"$label",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","& > svg":{display:"block"}}),kX=St("div",{opacity:1,variants:{disabled:{true:{opacity:.6,pointerEvents:"none",[`& ${fA}`]:{pointerEvents:"auto"}}}}}),XD=St("div",{position:"fixed",top:0,bottom:0,right:0,left:0,zIndex:1e3,userSelect:"none"}),NX=St("div",{background:"$toolTipBackground",fontFamily:"$sans",fontSize:"$toolTip",padding:"$xs $sm",color:"$toolTipText",borderRadius:"$xs",boxShadow:"$level2",maxWidth:260}),zX=St(q$,{fill:"$toolTipBackground"});function dA({children:n}){const{className:e}=D.useContext(lA);return ie.createElement(VV,{className:e},n)}const GX=["align"];function HX(){const{id:n,disable:e,disabled:t}=Xr();return ie.createElement(ie.Fragment,null,ie.createElement(FX,{id:n+"__disable",type:"checkbox",checked:!t,onChange:()=>e(!t)}),ie.createElement("label",{htmlFor:n+"__disable"}))}function VX(n){const{id:e,optional:t,hint:r}=Xr(),i=n.htmlFor||(e?{htmlFor:e}:null),s=!r&&typeof n.children=="string"?{title:n.children}:null;return ie.createElement(ie.Fragment,null,t&&ie.createElement(HX,null),r!==void 0?ie.createElement(K$,null,ie.createElement(Z$,{asChild:!0},ie.createElement(fA,Qn({},i,n))),ie.createElement(Q$,{side:"top",sideOffset:2},ie.createElement(NX,null,r,ie.createElement(zX,null)))):ie.createElement(fA,Qn({},i,s,n)))}function Ys(n){let{align:e}=n,t=En(n,GX);const{value:r,label:i,key:s,disabled:o}=Xr(),{hideCopyButton:a}=MX(),l=!a&&s!==void 0,[c,u]=D.useState(!1),d=async()=>{try{await navigator.clipboard.writeText(JSON.stringify({[s]:r??""})),u(!0)}catch{ta(Wn.CLIPBOARD_ERROR,{[s]:r})}};return ie.createElement(UX,{align:e,onPointerLeave:()=>u(!1)},ie.createElement(VX,t),l&&!o&&ie.createElement("div",{title:`Click to copy ${typeof i=="string"?i:s} value`},c?ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},ie.createElement("path",{d:"M9 2a1 1 0 000 2h2a1 1 0 100-2H9z"}),ie.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"})):ie.createElement("svg",{onClick:d,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},ie.createElement("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),ie.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 WX=["toggled"],$X=St("svg",{fill:"currentColor",transition:"transform 350ms ease, fill 250ms ease"});function hA(n){let{toggled:e}=n,t=En(n,WX);return ie.createElement($X,Qn({width:"9",height:"5",viewBox:"0 0 9 5",xmlns:"http://www.w3.org/2000/svg",style:{transform:`rotate(${e?0:-90}deg)`}},t),ie.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 XX=["input"];function ys(n){let{input:e}=n,t=En(n,XX);return e?ie.createElement($D,t):ie.createElement(WD,t)}function jD({value:n,type:e,settings:t,setValue:r}){const[i,s]=D.useState(yD(e,n,t)),o=D.useRef(n),a=D.useRef(t);a.current=t;const l=D.useCallback(u=>s(yD(e,u,a.current)),[e]),c=D.useCallback(u=>{try{r(u)}catch(d){const{type:p,previousValue:m}=d;if(p!=="LEVA_ERROR")throw d;l(m)}},[l,r]);return D.useEffect(()=>{op(n,o.current)||l(n),o.current=n},[n,l]),{displayValue:i,onChange:s,onUpdate:c}}function yp(n,e){const{emitOnEditStart:t,emitOnEditEnd:r}=Xr();return p7(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 jX(n){const e=D.useRef(null),t=D.useRef(null),r=D.useRef(!1);return D.useEffect(()=>{const i=BD(()=>{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 JD(){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 JX=["__refCount"],pA=(n,e)=>{if(!n[e])return null;const t=n[e];return En(t,JX)};function YX(n){const e=gp(),[t,r]=D.useState(pA(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(pA(e.getData(),n));const c=e.useStore.subscribe(u=>pA(u.data,n),r,{equalityFn:Yh});return()=>c()},[e,n]),[t,{set:i,setSettings:s,disable:o,storeId:e.storeId,emitOnEditStart:a,emitOnEditEnd:l}]}const KX=St("div",{variants:{hasRange:{true:{position:"relative",display:"grid",gridTemplateColumns:"auto $sizes$numberInputMinWidth",columnGap:"$colGap",alignItems:"center"}}}}),YD=St("div",{position:"relative",width:"100%",height:2,borderRadius:"$xs",backgroundColor:"$elevation1"}),mA=St("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)))"}}}}),KD=St("div",{position:"relative",$flex:"",height:"100%",cursor:"pointer",touchAction:"none"}),ZD=St("div",{position:"absolute",height:"100%",backgroundColor:"$accent2"});function ZX({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=ra("sizes","scrubberWidth"),u=yp(({event:p,first:m,xy:[v],movement:[x],memo:y})=>{if(m){const{width:_,left:E}=o.current.getBoundingClientRect();l.current=_-parseFloat(c),y=(p==null?void 0:p.target)===a.current?n:dv((v-E)/_,e,t)}const g=y+dv(x/l.current,0,t-e);return r(OD(g,{step:i,initialValue:s})),y}),d=fv(n,e,t);return ie.createElement(KD,Qn({ref:o},u()),ie.createElement(YD,null,ie.createElement(ZD,{style:{left:0,right:`${(1-d)*100}%`}})),ie.createElement(mA,{ref:a,style:{left:`calc(${d} * (100% - ${c}))`}}))}const QX=ie.memo(({label:n,onUpdate:e,step:t,innerLabelTrim:r})=>{const[i,s]=D.useState(!1),o=yp(({active:a,delta:[l],event:c,memo:u=0})=>(s(a),u+=l/2,Math.abs(u)>=1&&(e(d=>parseFloat(d)+Math.floor(u)*t*ID(c)),u=0),u));return ie.createElement(PX,Qn({dragging:i,title:n.length>1?n:""},o()),n.slice(0,r))});function QD({label:n,id:e,displayValue:t,onUpdate:r,onChange:i,settings:s,innerLabelTrim:o=1}){const a=o>0&&ie.createElement(QX,{label:n,step:s.step,onUpdate:r,innerLabelTrim:o});return ie.createElement(LX,{id:e,value:String(t),onUpdate:r,onChange:i,innerLabel:a})}function qX(){const n=Xr(),{label:e,value:t,onUpdate:r,settings:i,id:s}=n,{min:o,max:a}=i,l=a!==1/0&&o!==-1/0;return ie.createElement(ys,{input:!0},ie.createElement(Ys,null,e),ie.createElement(KX,{hasRange:l},l&&ie.createElement(ZX,Qn({value:parseFloat(t),onDrag:r},i)),ie.createElement(QD,Qn({},n,{id:s,label:"value",innerLabelTrim:l?0:1}))))}const{sanitizeStep:ej}=UD,tj=En(UD,["sanitizeStep"]);var nj=Mt({component:qX},tj),rj=Object.freeze({__proto__:null,schema:(n,e)=>Ti().schema({options:Ti().passesAnyOf(Ti().object(),Ti().array())}).test(e),sanitize:(n,{values:e})=>{if(e.indexOf(n)<0)throw Error("Selected value doesn't match Select options");return n},format:(n,{values:e})=>e.indexOf(n),normalize: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}}}});const ij=St("div",{$flexCenter:"",position:"relative","> svg":{pointerEvents:"none",position:"absolute",right:"$md"}}),gA=St("select",{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:0}),sj=St("div",{display:"flex",alignItems:"center",width:"100%",height:"$rowHeight",backgroundColor:"$elevation3",borderRadius:"$sm",padding:"0 $sm",cursor:"pointer",[`${gA}:focus + &`]:{$focusStyle:""},[`${gA}:hover + &`]:{$hoverStyle:""}});function oj({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]),ie.createElement(ij,null,ie.createElement(gA,{id:r,value:n,onChange:c=>t(a[Number(c.currentTarget.value)]),disabled:s},o.map((c,u)=>ie.createElement("option",{key:c,value:u},c))),ie.createElement(sj,null,l.current),ie.createElement(hA,{toggled:!0}))}function aj(){const{label:n,value:e,displayValue:t,onUpdate:r,id:i,disabled:s,settings:o}=Xr();return ie.createElement(ys,{input:!0},ie.createElement(Ys,null,n),ie.createElement(oj,{id:i,value:e,displayValue:t,onUpdate:r,settings:o,disabled:s}))}var lj=Mt({component:aj},rj),cj=Object.freeze({__proto__:null,schema:n=>Ti().string().test(n),sanitize:n=>{if(typeof n!="string")throw Error("Invalid string");return n},normalize:({value:n,editable:e=!0,rows:t=!1})=>({value:n,settings:{editable:e,rows:typeof t=="number"?t:t?5:0}})});const uj=["displayValue","onUpdate","onChange","editable"],fj=St("div",{whiteSpace:"pre-wrap"});function dj(n){let{displayValue:e,onUpdate:t,onChange:r,editable:i=!0}=n,s=En(n,uj);return i?ie.createElement(cA,Qn({value:e,onUpdate:t,onChange:r},s)):ie.createElement(fj,null,e)}function hj(){const{label:n,settings:e,displayValue:t,onUpdate:r,onChange:i}=Xr();return ie.createElement(ys,{input:!0},ie.createElement(Ys,null,n),ie.createElement(dj,Qn({displayValue:t,onUpdate:r,onChange:i},e)))}var pj=Mt({component:hj},cj),mj=Object.freeze({__proto__:null,schema:n=>Ti().boolean().test(n),sanitize:n=>{if(typeof n!="boolean")throw Error("Invalid boolean");return n}});const gj=St("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 vj({value:n,onUpdate:e,id:t,disabled:r}){return ie.createElement(gj,null,ie.createElement("input",{id:t,type:"checkbox",checked:n,onChange:i=>e(i.currentTarget.checked),disabled:r}),ie.createElement("label",{htmlFor:t},ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},ie.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))))}function yj(){const{label:n,value:e,onUpdate:t,disabled:r,id:i}=Xr();return ie.createElement(ys,{input:!0},ie.createElement(Ys,null,n),ie.createElement(vj,{value:e,onUpdate:t,id:i,disabled:r}))}var _j=Mt({component:yj},mj);const xj=["locked"];function Ej({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]:PD({type:"NUMBER",value:o.current,settings:r},c)}),[i,r,t]),l=jD({type:"NUMBER",value:n[t],settings:r,setValue:a});return ie.createElement(QD,{id:e,label:t,value:n[t],displayValue:l.displayValue,onUpdate:l.onUpdate,onChange:l.onChange,settings:r,innerLabelTrim:s})}const Sj=St("div",{display:"grid",columnGap:"$colGap",gridAutoFlow:"column dense",alignItems:"center",variants:{withLock:{true:{gridTemplateColumns:"10px auto","> svg":{cursor:"pointer"}}}}});function Aj(n){let{locked:e}=n,t=En(n,xj);return ie.createElement("svg",Qn({width:"10",height:"10",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),e?ie.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"}):ie.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 vA({value:n,onUpdate:e,settings:t,innerLabelTrim:r}){const{id:i,setSettings:s}=Xr(),{lock:o,locked:a}=t;return ie.createElement(Sj,{withLock:o},o&&ie.createElement(Aj,{locked:a,onClick:()=>s({locked:!a})}),Object.keys(n).map((l,c)=>ie.createElement(Ej,{id:c===0?i:`${i}.${l}`,key:l,valueKey:l,value:n,settings:t[l],onUpdate:e,innerLabelTrim:r})))}const qD=(n,e)=>{const t={};let r=0,i=1/0;Object.entries(n).forEach(([s,o])=>{t[s]=LD(Mt({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},wj=["lock"],Mj=["value"];function Tj(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 Cj(n){return Array.isArray(n)?"array":"object"}function _p(n,e,t){return Cj(n)===e?n:e==="array"?Object.values(n):hX(n,t)}const bj=(n,e,t)=>{const r=_p(n,"object",e.keys);for(let o in r)r[o]=DD(r[o],e[o]);const i=Object.keys(r);let s={};if(i.length===e.keys.length)s=r;else{const o=_p(t,"object",e.keys);if(i.length===1&&e.locked){const a=i[0],l=r[a],c=o[a],u=c!==0?l/c:1;for(let d in o)d===a?s[a]=l:s[d]=o[d]*u}else s=Mt(Mt({},o),r)}return _p(s,e.format,e.keys)},Rj=(n,e)=>_p(n,"object",e.keys),Pj=n=>!!n&&("step"in n||"min"in n||"max"in n);function Bj(n,e,t=[]){const{lock:r=!1}=e,i=En(e,wj),s=Array.isArray(n)?"array":"object",o=s==="object"?Object.keys(n):t,a=_p(n,"object",o),l=Pj(i)?o.reduce((u,d)=>Object.assign(u,{[d]:i}),{}):i,c=qD(a,l);return{value:s==="array"?n:a,settings:Mt(Mt({},c),{},{format:s,keys:o,lock:r,locked:!1})}}function eL(n){return{schema:Tj(n.length),normalize:e=>{let{value:t}=e,r=En(e,Mj);return Bj(t,r,n)},format:(e,t)=>Rj(e,t),sanitize:(e,t,r)=>bj(e,t,r)}}var Ij={grad:.9,turn:360,rad:360/(2*Math.PI)},ia=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},Ar=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t+0},_s=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n>e?n:e},tL=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},nL=function(n){return{r:_s(n.r,0,255),g:_s(n.g,0,255),b:_s(n.b,0,255),a:_s(n.a)}},yA=function(n){return{r:Ar(n.r),g:Ar(n.g),b:Ar(n.b),a:Ar(n.a,3)}},Dj=/^#([0-9a-f]{3,8})$/i,mv=function(n){var e=n.toString(16);return e.length<2?"0"+e:e},rL=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}},iL=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}},sL=function(n){return{h:tL(n.h),s:_s(n.s,0,100),l:_s(n.l,0,100),a:_s(n.a)}},oL=function(n){return{h:Ar(n.h),s:Ar(n.s),l:Ar(n.l),a:Ar(n.a,3)}},aL=function(n){return iL((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},xp=function(n){return{h:(e=rL(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},Lj=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Oj=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Uj=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fj=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_A={string:[[function(n){var e=Dj.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?Ar(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?Ar(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var e=Uj.exec(n)||Fj.exec(n);return e?e[2]!==e[4]||e[4]!==e[6]?null:nL({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=Lj.exec(n)||Oj.exec(n);if(!e)return null;var t,r,i=sL({h:(t=e[1],r=e[2],r===void 0&&(r="deg"),Number(t)*(Ij[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return aL(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 ia(e)&&ia(t)&&ia(r)?nL({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(!ia(e)||!ia(t)||!ia(r))return null;var o=sL({h:Number(e),s:Number(t),l:Number(r),a:Number(s)});return aL(o)},"hsl"],[function(n){var e=n.h,t=n.s,r=n.v,i=n.a,s=i===void 0?1:i;if(!ia(e)||!ia(t)||!ia(r))return null;var o=function(a){return{h:tL(a.h),s:_s(a.s,0,100),v:_s(a.v,0,100),a:_s(a.a)}}({h:Number(e),s:Number(t),v:Number(r),a:Number(s)});return iL(o)},"hsv"]]},lL=function(n,e){for(var t=0;t=.5},n.prototype.toHex=function(){return e=yA(this.rgba),t=e.r,r=e.g,i=e.b,o=(s=e.a)<1?mv(Ar(255*s)):"","#"+mv(t)+mv(r)+mv(i)+o;var e,t,r,i,s,o},n.prototype.toRgb=function(){return yA(this.rgba)},n.prototype.toRgbString=function(){return e=yA(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 oL(xp(this.rgba))},n.prototype.toHslString=function(){return e=oL(xp(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=rL(this.rgba),{h:Ar(e.h),s:Ar(e.s),v:Ar(e.v),a:Ar(e.a,3)};var e},n.prototype.invert=function(){return ci({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),ci(xA(this.rgba,e))},n.prototype.desaturate=function(e){return e===void 0&&(e=.1),ci(xA(this.rgba,-e))},n.prototype.grayscale=function(){return ci(xA(this.rgba,-1))},n.prototype.lighten=function(e){return e===void 0&&(e=.1),ci(uL(this.rgba,e))},n.prototype.darken=function(e){return e===void 0&&(e=.1),ci(uL(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"?ci({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Ar(this.rgba.a,3);var t},n.prototype.hue=function(e){var t=xp(this.rgba);return typeof e=="number"?ci({h:e,s:t.s,l:t.l,a:t.a}):Ar(t.h)},n.prototype.isEqual=function(e){return this.toHex()===ci(e).toHex()},n}(),ci=function(n){return n instanceof SA?n:new SA(n)},fL=[],Nj=function(n){n.forEach(function(e){fL.indexOf(e)<0&&(e(SA,_A),fL.push(e))})};function zj(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 u=this.toRgb(),d=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 x=(a=u,l=s[v],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));x=0||(i[t]=n[t]);return i}function wA(n){var e=D.useRef(n),t=D.useRef(function(r){e.current&&e.current(r)});return e.current=n,t.current}var Lf=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n0:y.buttons>0)&&i.current?s(dL(i.current,y,a.current)):x(!1)},v=function(){return x(!1)};function x(y){var g=l.current,_=MA(i.current),E=y?_.addEventListener:_.removeEventListener;E(g?"touchmove":"mousemove",m),E(g?"touchend":"mouseup",v)}return[function(y){var g=y.nativeEvent,_=i.current;if(_&&(hL(g),!function(A,M){return M&&!Ep(A)}(g,l.current)&&_)){if(Ep(g)){l.current=!0;var E=g.changedTouches||[];E.length&&(a.current=E[0].identifier)}_.focus(),s(dL(_,g,a.current)),x(!0)}},function(y){var g=y.which||y.keyCode;g<37||g>40||(y.preventDefault(),o({left:g===39?.05:g===37?-.05:0,top:g===40?.05:g===38?-.05:0}))},x]},[o,s]),u=c[0],d=c[1],p=c[2];return D.useEffect(function(){return p},[p]),ie.createElement("div",Df({},r,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:i,onKeyDown:d,tabIndex:0,role:"slider"}))}),Sp=function(n){return n.filter(Boolean).join(" ")},CA=function(n){var e=n.color,t=n.left,r=n.top,i=r===void 0?.5:r,s=Sp(["react-colorful__pointer",n.className]);return ie.createElement("div",{className:s,style:{top:100*i+"%",left:100*t+"%"}},ie.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},ui=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t},pL=function(n){var e=n.s,t=n.v,r=n.a,i=(200-e)*t/100;return{h:ui(n.h),s:ui(i>0&&i<200?e*t/100/(i<=100?i:200-i)*100:0),l:ui(i/2),a:ui(r,2)}},bA=function(n){var e=pL(n);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},RA=function(n){var e=pL(n);return"hsla("+e.h+", "+e.s+"%, "+e.l+"%, "+e.a+")"},mL=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:ui(255*[r,a,o,o,l,r][c]),g:ui(255*[l,r,r,a,o,o][c]),b:ui(255*[o,o,l,r,r,a][c]),a:ui(i,2)}},gL=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:ui(60*(a<0?a+6:a)),s:ui(s?o/s*100:0),v:ui(s/255*100),a:i}},vL=ie.memo(function(n){var e=n.hue,t=n.onChange,r=Sp(["react-colorful__hue",n.className]);return ie.createElement("div",{className:r},ie.createElement(TA,{onMove:function(i){t({h:360*i.left})},onKey:function(i){t({h:Lf(e+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":ui(e),"aria-valuemax":"360","aria-valuemin":"0"},ie.createElement(CA,{className:"react-colorful__hue-pointer",left:e/360,color:bA({h:e,s:100,v:100,a:1})})))}),yL=ie.memo(function(n){var e=n.hsva,t=n.onChange,r={backgroundColor:bA({h:e.h,s:100,v:100,a:1})};return ie.createElement("div",{className:"react-colorful__saturation",style:r},ie.createElement(TA,{onMove:function(i){t({s:100*i.left,v:100-100*i.top})},onKey:function(i){t({s:Lf(e.s+100*i.left,0,100),v:Lf(e.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+ui(e.s)+"%, Brightness "+ui(e.v)+"%"},ie.createElement(CA,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:bA(e)})))}),PA=function(n,e){if(n===e)return!0;for(var t in n)if(n[t]!==e[t])return!1;return!0};function _L(n,e,t){var r=wA(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;PA(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(u){return Object.assign({},u,c)})},[]);return[s,l]}var Gj=typeof window<"u"?D.useLayoutEffect:D.useEffect,Hj=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},xL=new Map,EL=function(n){Gj(function(){var e=n.current?n.current.ownerDocument:document;if(e!==void 0&&!xL.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}`,xL.set(e,t);var r=Hj();r&&t.setAttribute("nonce",r),e.head.appendChild(t)}},[])},Vj=function(n){var e=n.className,t=n.colorModel,r=n.color,i=r===void 0?t.defaultColor:r,s=n.onChange,o=AA(n,["className","colorModel","color","onChange"]),a=D.useRef(null);EL(a);var l=_L(t,i,s),c=l[0],u=l[1],d=Sp(["react-colorful",e]);return ie.createElement("div",Df({},o,{ref:a,className:d}),ie.createElement(yL,{hsva:c,onChange:u}),ie.createElement(vL,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},Wj=function(n){var e=n.className,t=n.hsva,r=n.onChange,i={backgroundImage:"linear-gradient(90deg, "+RA(Object.assign({},t,{a:0}))+", "+RA(Object.assign({},t,{a:1}))+")"},s=Sp(["react-colorful__alpha",e]),o=ui(100*t.a);return ie.createElement("div",{className:s},ie.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),ie.createElement(TA,{onMove:function(a){r({a:a.left})},onKey:function(a){r({a:Lf(t.a+a.left)})},"aria-label":"Alpha","aria-valuetext":o+"%","aria-valuenow":o,"aria-valuemin":"0","aria-valuemax":"100"},ie.createElement(CA,{className:"react-colorful__alpha-pointer",left:t.a,color:RA(t)})))},$j=function(n){var e=n.className,t=n.colorModel,r=n.color,i=r===void 0?t.defaultColor:r,s=n.onChange,o=AA(n,["className","colorModel","color","onChange"]),a=D.useRef(null);EL(a);var l=_L(t,i,s),c=l[0],u=l[1],d=Sp(["react-colorful",e]);return ie.createElement("div",Df({},o,{ref:a,className:d}),ie.createElement(yL,{hsva:c,onChange:u}),ie.createElement(vL,{hue:c.h,onChange:u}),ie.createElement(Wj,{hsva:c,onChange:u,className:"react-colorful__last-control"}))},Xj={defaultColor:{r:0,g:0,b:0,a:1},toHsva:gL,fromHsva:mL,equal:PA},jj=function(n){return ie.createElement($j,Df({},n,{colorModel:Xj}))},Jj={defaultColor:{r:0,g:0,b:0},toHsva:function(n){return gL({r:n.r,g:n.g,b:n.b,a:1})},fromHsva:function(n){return{r:(e=mL(n)).r,g:e.g,b:e.b};var e},equal:PA},Yj=function(n){return ie.createElement(Vj,Df({},n,{colorModel:Jj}))};function Of(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(n,e||[])).next())})}function Uf(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]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 Zj(){for(var n=[],e=0;e0?r:n.name,writable:!1,configurable:!1,enumerable:!0})}return t}function qj(n){var e=n.name,t=e&&e.lastIndexOf(".")!==-1;if(t&&!n.type){var r=e.split(".").pop().toLowerCase(),i=Qj.get(r);i&&Object.defineProperty(n,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return n}var eJ=[".DS_Store","Thumbs.db"];function tJ(n){return Of(this,void 0,void 0,function(){return Uf(this,function(e){return gv(n)&&nJ(n)?[2,oJ(n.dataTransfer,n.type)]:rJ(n)?[2,iJ(n)]:Array.isArray(n)&&n.every(function(t){return"getFile"in t&&typeof t.getFile=="function"})?[2,sJ(n)]:[2,[]]})})}function nJ(n){return gv(n.dataTransfer)}function rJ(n){return gv(n)&&gv(n.target)}function gv(n){return typeof n=="object"&&n!==null}function iJ(n){return BA(n.target.files).map(function(e){return Ap(e)})}function sJ(n){return Of(this,void 0,void 0,function(){var e;return Uf(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 Ap(r)})]}})})}function oJ(n,e){return Of(this,void 0,void 0,function(){var t,r;return Uf(this,function(i){switch(i.label){case 0:return n===null?[2,[]]:n.items?(t=BA(n.items).filter(function(s){return s.kind==="file"}),e!=="drop"?[2,t]:[4,Promise.all(t.map(aJ))]):[3,2];case 1:return r=i.sent(),[2,SL(AL(r))];case 2:return[2,SL(BA(n.files).map(function(s){return Ap(s)}))]}})})}function SL(n){return n.filter(function(e){return eJ.indexOf(e.name)===-1})}function BA(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,BL(t)];if(n.sizet)return[!1,BL(t)]}return[!0,null]}function wp(n){return n!=null}function EJ(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=DL(a,t),c=RL(l,1),u=c[0],d=LL(a,r,i),p=RL(d,1),m=p[0];return u&&m})}function vv(n){return typeof n.isPropagationStopped=="function"?n.isPropagationStopped():typeof n.cancelBubble<"u"?n.cancelBubble:!1}function yv(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 OL(n){n.preventDefault()}function SJ(n){return n.indexOf("MSIE")!==-1||n.indexOf("Trident/")!==-1}function AJ(n){return n.indexOf("Edge/")!==-1}function wJ(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return SJ(n)||AJ(n)}function go(){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 zJ(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 OA=D.forwardRef(function(n,e){var t=n.children,r=_v(n,RJ),i=NL(r),s=i.open,o=_v(i,PJ);return D.useImperativeHandle(e,function(){return{open:s}},[s]),ie.createElement(D.Fragment,null,t($n($n({},o),{},{open:s})))});OA.displayName="Dropzone";var kL={disabled:!1,getFilesFromEvent:tJ,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0};OA.defaultProps=kL,OA.propTypes={children:_n.func,accept:_n.oneOfType([_n.string,_n.arrayOf(_n.string)]),multiple:_n.bool,preventDropOnDocument:_n.bool,noClick:_n.bool,noKeyboard:_n.bool,noDrag:_n.bool,noDragEventsBubbling:_n.bool,minSize:_n.number,maxSize:_n.number,maxFiles:_n.number,disabled:_n.bool,getFilesFromEvent:_n.func,onFileDialogCancel:_n.func,onFileDialogOpen:_n.func,useFsAccessApi:_n.bool,onDragEnter:_n.func,onDragLeave:_n.func,onDragOver:_n.func,onDrop:_n.func,onDropAccepted:_n.func,onDropRejected:_n.func,validator:_n.func};var UA={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,draggedFiles:[],acceptedFiles:[],fileRejections:[]};function NL(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=$n($n({},kL),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,u=e.onDragLeave,d=e.onDragOver,p=e.onDrop,m=e.onDropAccepted,v=e.onDropRejected,x=e.onFileDialogCancel,y=e.onFileDialogOpen,g=e.useFsAccessApi,_=e.preventDropOnDocument,E=e.noClick,A=e.noKeyboard,M=e.noDrag,T=e.noDragEventsBubbling,R=e.validator,B=D.useMemo(function(){return typeof y=="function"?y:zL},[y]),P=D.useMemo(function(){return typeof x=="function"?x:zL},[x]),I=D.useRef(null),F=D.useRef(null),N=D.useReducer(GJ,UA),H=IA(N,2),V=H[0],Y=H[1],K=V.isFocused,ee=V.isFileDialogActive,G=V.draggedFiles,W=D.useRef(typeof window<"u"&&window.isSecureContext&&g&&MJ()),J=function(){!W.current&&ee&&setTimeout(function(){if(F.current){var U=F.current.files;U.length||(Y({type:"closeDialog"}),P())}},300)};D.useEffect(function(){return window.addEventListener("focus",J,!1),function(){window.removeEventListener("focus",J,!1)}},[F,ee,P,W]);var j=D.useRef([]),X=function(U){I.current&&I.current.contains(U.target)||(U.preventDefault(),j.current=[])};D.useEffect(function(){return _&&(document.addEventListener("dragover",OL,!1),document.addEventListener("drop",X,!1)),function(){_&&(document.removeEventListener("dragover",OL),document.removeEventListener("drop",X))}},[I,_]);var oe=D.useCallback(function(k){k.preventDefault(),k.persist(),pe(k),j.current=[].concat(DJ(j.current),[k.target]),yv(k)&&Promise.resolve(i(k)).then(function(U){vv(k)&&!T||(Y({draggedFiles:U,isDragActive:!0,type:"setDraggedFiles"}),c&&c(k))})},[i,c,T]),se=D.useCallback(function(k){k.preventDefault(),k.persist(),pe(k);var U=yv(k);if(U&&k.dataTransfer)try{k.dataTransfer.dropEffect="copy"}catch{}return U&&d&&d(k),!1},[d,T]),ce=D.useCallback(function(k){k.preventDefault(),k.persist(),pe(k);var U=j.current.filter(function(be){return I.current&&I.current.contains(be)}),ae=U.indexOf(k.target);ae!==-1&&U.splice(ae,1),j.current=U,!(U.length>0)&&(Y({isDragActive:!1,type:"setDraggedFiles",draggedFiles:[]}),yv(k)&&u&&u(k))},[I,u,T]),le=D.useCallback(function(k,U){var ae=[],be=[];k.forEach(function(Be){var Te=DL(Be,t),Ve=IA(Te,2),He=Ve[0],we=Ve[1],je=LL(Be,o,s),Ze=IA(je,2),We=Ze[0],ze=Ze[1],Xe=R?R(Be):null;if(He&&We&&!Xe)ae.push(Be);else{var et=[we,ze];Xe&&(et=et.concat(Xe)),be.push({file:Be,errors:et.filter(function(ut){return ut})})}}),(!a&&ae.length>1||a&&l>=1&&ae.length>l)&&(ae.forEach(function(Be){be.push({file:Be,errors:[xJ]})}),ae.splice(0)),Y({acceptedFiles:ae,fileRejections:be,type:"setFiles"}),p&&p(ae,be,U),be.length>0&&v&&v(be,U),ae.length>0&&m&&m(ae,U)},[Y,a,t,o,s,l,p,m,v,R]),ue=D.useCallback(function(k){k.preventDefault(),k.persist(),pe(k),j.current=[],yv(k)&&Promise.resolve(i(k)).then(function(U){vv(k)&&!T||le(U,k)}),Y({type:"reset"})},[i,le,T]),xe=D.useCallback(function(){if(W.current){Y({type:"openDialog"}),B();var k={multiple:a,types:TJ(t)};window.showOpenFilePicker(k).then(function(U){return i(U)}).then(function(U){le(U,null),Y({type:"closeDialog"})}).catch(function(U){CJ(U)?(P(U),Y({type:"closeDialog"})):bJ(U)&&(W.current=!1,F.current&&(F.current.value=null,F.current.click()))});return}F.current&&(Y({type:"openDialog"}),B(),F.current.value=null,F.current.click())},[Y,B,P,g,le,t,a]),Le=D.useCallback(function(k){!I.current||!I.current.isEqualNode(k.target)||(k.key===" "||k.key==="Enter"||k.keyCode===32||k.keyCode===13)&&(k.preventDefault(),xe())},[I,xe]),Je=D.useCallback(function(){Y({type:"focus"})},[]),Pe=D.useCallback(function(){Y({type:"blur"})},[]),$=D.useCallback(function(){E||(wJ()?setTimeout(xe,0):xe())},[E,xe]),Me=function(U){return r?null:U},ve=function(U){return A?null:Me(U)},me=function(U){return M?null:Me(U)},pe=function(U){T&&U.stopPropagation()},$e=D.useMemo(function(){return function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},U=k.refKey,ae=U===void 0?"ref":U,be=k.role,Be=k.onKeyDown,Te=k.onFocus,Ve=k.onBlur,He=k.onClick,we=k.onDragEnter,je=k.onDragOver,Ze=k.onDragLeave,We=k.onDrop,ze=_v(k,BJ);return $n($n(LA({onKeyDown:ve(go(Be,Le)),onFocus:ve(go(Te,Je)),onBlur:ve(go(Ve,Pe)),onClick:Me(go(He,$)),onDragEnter:me(go(we,oe)),onDragOver:me(go(je,se)),onDragLeave:me(go(Ze,ce)),onDrop:me(go(We,ue)),role:typeof be=="string"&&be!==""?be:"button"},ae,I),!r&&!A?{tabIndex:0}:{}),ze)}},[I,Le,Je,Pe,$,oe,se,ce,ue,A,M,r]),_e=D.useCallback(function(k){k.stopPropagation()},[]),Fe=D.useMemo(function(){return function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},U=k.refKey,ae=U===void 0?"ref":U,be=k.onChange,Be=k.onClick,Te=_v(k,IJ),Ve=LA({accept:t,multiple:a,type:"file",style:{display:"none"},onChange:Me(go(be,ue)),onClick:Me(go(Be,_e)),tabIndex:-1},ae,F);return $n($n({},Ve),Te)}},[F,t,a,ue,r]),Ne=G.length,Ce=Ne>0&&EJ({files:G,accept:t,minSize:o,maxSize:s,multiple:a,maxFiles:l}),st=Ne>0&&!Ce;return $n($n({},V),{},{isDragAccept:Ce,isDragReject:st,isFocused:K&&!r,getRootProps:$e,getInputProps:Fe,rootRef:I,inputRef:F,open:Me(xe)})}function GJ(n,e){switch(e.type){case"focus":return $n($n({},n),{},{isFocused:!0});case"blur":return $n($n({},n),{},{isFocused:!1});case"openDialog":return $n($n({},UA),{},{isFileDialogActive:!0});case"closeDialog":return $n($n({},n),{},{isFileDialogActive:!1});case"setDraggedFiles":var t=e.isDragActive,r=e.draggedFiles;return $n($n({},n),{},{draggedFiles:r,isDragActive:t});case"setFiles":return $n($n({},n),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections});case"reset":return $n({},UA);default:return n}}function zL(){}/*! * isobject * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */var HJ=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 VJ=HJ;function GL(n){return VJ(n)===!0&&Object.prototype.toString.call(n)==="[object Object]"}var HL=function(e){var t,r;return!(GL(e)===!1||(t=e.constructor,typeof t!="function")||(r=t.prototype,GL(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*! * is-extendable * * Copyright (c) 2015-2017, Jon Schlinkert. * Released under the MIT License. */var WJ=HL,FA=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 $J=function(e,t,r){for(var i in e)if(t.call(r,e[i],i,e)===!1)break},XJ=FA,jJ=$J;function VL(n,e){for(var t=arguments.length,r=0;++r * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */var ZJ=function(n,e,t,r,i){if(!QJ(n)||!e)return n;if(e=xv(e),t&&(e+="."+xv(t)),r&&(e+="."+xv(r)),i&&(e+="."+xv(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 qJ=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");WL(n)||(n={});for(var e=1;e * * Copyright (c) 2015-2017, Jon Schlinkert. * Released under the MIT License. */var aY=nY,lY=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=aY({sep:"."},e),i=r.quotes||['"',"'","`"],s;r.brackets===!0?s={"<":">","(":")","[":"]","{":"}"}:r.brackets&&(s=r.brackets);var o=[],a=[],l=[""],c=r.sep,u=n.length,d=-1,p;function m(){if(s&&a.length)return s[a[a.length-1]]}for(;++d * * Copyright (c) 2015, Jon Schlinkert. * Licensed under the MIT License. */var fY=function(e){return typeof e<"u"&&e!==null&&(typeof e=="object"||typeof e=="function")},$L=fY,dY=function(e){$L(e)||(e={});for(var t=arguments.length,r=1;r * * Copyright (c) 2015, Jon Schlinkert. * Licensed under the MIT License. */var mY=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 gY=lY,vY=dY,XL=HL,jL=mY,yY=function(n,e,t){if(!jL(n)||(Array.isArray(e)&&(e=[].concat.apply([],e).join(".")),typeof e!="string"))return n;for(var r=gY(e,{sep:".",brackets:!0}).filter(_Y),i=r.length,s=-1,o=n;++sn.filter(Boolean).join(".");function SY(n){const e=n.split(".");return[e.pop(),e.join(".")||void 0]}function AY(n,e){return Object.entries(fX(n,e)).reduce((t,[,{value:r,disabled:i,key:s}])=>(t[s]=i?void 0:r,t),{})}function wY(n,e){const t=D.useRef();return(e?op:Yh)(n,t.current)||(t.current=n),t.current}function KL(n,e){return D.useMemo(n,wY(e,!0))}function MY(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 TY=n=>{const[e,t]=D.useState(n.getVisiblePaths());return D.useEffect(()=>{t(n.getVisiblePaths());const r=n.useStore.subscribe(n.getVisiblePaths,t,{equalityFn:Yh});return()=>r()},[n]),e};function CY(n,e,t){return n.useStore(i=>{const s=Mt(Mt({},t),i.data);return AY(s,e)},Yh)}function ZL(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:u}=t.current.getBoundingClientRect(),d=a+u>window.innerHeight-40?"up":"down";t.current.style.position="fixed",t.current.style.zIndex="10000",t.current.style.left=c+"px",d==="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}}Nj([zj]);const bY={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};Ti.extend({color:()=>n=>ci(n).isValid()});const RY=n=>Ti().color().test(n);function QL(n,{format:e,hasAlpha:t,isString:r}){const i=bY[e]+(r&&e!=="hex"?"String":""),s=n[i]();return typeof s=="object"&&!t?dX(s,["a"]):s}const qL=(n,e)=>{const t=ci(n);if(!t.isValid())throw Error("Invalid color");return QL(t,e)};var PY=Object.freeze({__proto__:null,schema:RY,sanitize:qL,format:(n,e)=>QL(ci(n),Mt(Mt({},e),{},{isString:!0,format:"hex"})),normalize:({value:n})=>{const e=kj(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:qL(n,i),settings:i}}});const BY=St("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}}),IY=St("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto",columnGap:"$colGap",alignItems:"center"}),DY=St("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 e3(n,e){return e!=="rgb"?ci(n).toRgb():n}function LY({value:n,displayValue:e,settings:t,onUpdate:r}){const{emitOnEditStart:i,emitOnEditEnd:s}=Xr(),{format:o,hasAlpha:a}=t,{popinRef:l,wrapperRef:c,shown:u,show:d,hide:p}=ZL(),m=D.useRef(0),[v,x]=D.useState(()=>e3(n,o)),y=a?jj:Yj,g=()=>{x(e3(n,o)),d(),i()},_=()=>{p(),s(),window.clearTimeout(m.current)},E=()=>{m.current=window.setTimeout(_,500)};return D.useEffect(()=>()=>window.clearTimeout(m.current),[]),ie.createElement(ie.Fragment,null,ie.createElement(BY,{ref:l,active:u,onClick:()=>g(),style:{color:e}}),u&&ie.createElement(dA,null,ie.createElement(XD,{onPointerUp:_}),ie.createElement(DY,{ref:c,onMouseEnter:()=>window.clearTimeout(m.current),onMouseLeave:A=>A.buttons===0&&E()},ie.createElement(y,{color:v,onChange:r}))))}function OY(){const{value:n,displayValue:e,label:t,onChange:r,onUpdate:i,settings:s}=Xr();return ie.createElement(ys,{input:!0},ie.createElement(Ys,null,t),ie.createElement(IY,null,ie.createElement(LY,{value:n,displayValue:e,onChange:r,onUpdate:i,settings:s}),ie.createElement(cA,{value:e,onChange:r,onUpdate:i})))}var UY=Mt({component:OY},PY);function FY(){const{label:n,displayValue:e,onUpdate:t,settings:r}=Xr();return ie.createElement(ys,{input:!0},ie.createElement(Ys,null,n),ie.createElement(vA,{value:e,settings:r,onUpdate:t}))}var kY=Mt({component:FY},eL(["x","y","z"]));const NY=St("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}}),zY=St("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 GY({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,u]=D.useState(!1),[d,p]=JD(),m=D.useRef(null),v=D.useRef(null);D.useLayoutEffect(()=>{if(a){const{top:N,left:H,width:V,height:Y}=m.current.getBoundingClientRect();v.current.style.left=H+V/2+"px",v.current.style.top=N+Y/2+"px"}},[a]);const{keys:[x,y],joystick:g}=e,_=g==="invertY"?1:-1,{[x]:{step:E},[y]:{step:A}}=e,M=ra("sizes","joystickWidth"),T=ra("sizes","joystickHeight"),R=parseFloat(M)*.8/2,B=parseFloat(T)*.8/2,P=D.useCallback(()=>{r.current||(u(!0),i.current&&p({x:i.current*R}),s.current&&p({y:s.current*-B}),r.current=window.setInterval(()=>{t(N=>{const H=E*i.current*o.current,V=_*A*s.current*o.current;return Array.isArray(N)?{[x]:N[0]+H,[y]:N[1]+V}:{[x]:N[x]+H,[y]:N[y]+V}})},16))},[R,B,t,p,E,A,x,y,_]),I=D.useCallback(()=>{window.clearTimeout(r.current),r.current=void 0,u(!1)},[]);D.useEffect(()=>{function N(H){o.current=ID(H)}return window.addEventListener("keydown",N),window.addEventListener("keyup",N),()=>{window.clearTimeout(r.current),window.removeEventListener("keydown",N),window.removeEventListener("keyup",N)}},[]);const F=yp(({first:N,active:H,delta:[V,Y],movement:[K,ee]})=>{N&&l(!0);const G=al(K,-R,R),W=al(ee,-B,B);i.current=Math.abs(K)>Math.abs(G)?Math.sign(K-G):0,s.current=Math.abs(ee)>Math.abs(W)?Math.sign(W-ee):0;let J=n[x],j=n[y];H?(i.current||(J+=V*E*o.current,p({x:G})),s.current||(j-=_*Y*A*o.current,p({y:W})),i.current||s.current?P():I(),t({[x]:J,[y]:j})):(l(!1),i.current=0,s.current=0,p({x:0,y:0}),I())});return ie.createElement(NY,Qn({ref:m},F()),a&&ie.createElement(dA,null,ie.createElement(zY,{ref:v,isOutOfBounds:c},ie.createElement("div",null),ie.createElement("span",{ref:d}))))}const HY=St("div",{display:"grid",columnGap:"$colGap",variants:{withJoystick:{true:{gridTemplateColumns:"$sizes$rowHeight auto"},false:{gridTemplateColumns:"auto"}}}});function VY(){const{label:n,displayValue:e,onUpdate:t,settings:r}=Xr();return ie.createElement(ys,{input:!0},ie.createElement(Ys,null,n),ie.createElement(HY,{withJoystick:!!r.joystick},r.joystick&&ie.createElement(GY,{value:e,settings:r,onUpdate:t}),ie.createElement(vA,{value:e,settings:r,onUpdate:t})))}const WY=["joystick"],t3=eL(["x","y"]),$Y=n=>{let{joystick:e=!0}=n,t=En(n,WY);const{value:r,settings:i}=t3.normalize(t);return{value:r,settings:Mt(Mt({},i),{},{joystick:e})}};var XY=Mt(Mt({component:VY},t3),{},{normalize:$Y}),jY=Object.freeze({__proto__:null,sanitize: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].")}},schema:(n,e)=>typeof e=="object"&&"image"in e,normalize:({image:n})=>({value:n})});const JY=St("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto 20px",columnGap:"$colGap",alignItems:"center"}),YY=St("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"}}}}),KY=St("div",{boxSizing:"border-box",borderRadius:"$sm",height:"$rowHeight",width:"$rowHeight",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center",variants:{hasImage:{true:{cursor:"pointer",$hover:"",$active:""}}}}),ZY=St("div",{$flexCenter:"",width:"$imagePreviewWidth",height:"$imagePreviewHeight",borderRadius:"$sm",boxShadow:"$level2",pointerEvents:"none",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center"}),QY=St("div",{fontSize:"0.8em",height:"100%",padding:"$rowGap $md"}),qY=St("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 eK(){const{label:n,value:e,onUpdate:t,disabled:r}=Xr(),{popinRef:i,wrapperRef:s,shown:o,show:a,hide:l}=ZL(),c=D.useCallback(v=>{v.length&&t(v[0])},[t]),u=D.useCallback(v=>{v.stopPropagation(),t(void 0)},[t]),{getRootProps:d,getInputProps:p,isDragAccept:m}=NL({maxFiles:1,accept:"image/*",onDrop:c,disabled:r});return ie.createElement(ys,{input:!0},ie.createElement(Ys,null,n),ie.createElement(JY,null,ie.createElement(KY,{ref:i,hasImage:!!e,onPointerDown:()=>!!e&&a(),onPointerUp:l,style:{backgroundImage:e?`url(${e})`:"none"}}),o&&!!e&&ie.createElement(dA,null,ie.createElement(XD,{onPointerUp:l,style:{cursor:"pointer"}}),ie.createElement(ZY,{ref:s,style:{backgroundImage:`url(${e})`}})),ie.createElement(YY,d({isDragAccept:m}),ie.createElement("input",p()),ie.createElement(QY,null,m?"drop image":"click or drop")),ie.createElement(qY,{onClick:u,disabled:!e})))}var tK=Mt({component:eK},jY);const n3=Ti().number(),nK=(n,e)=>Ti().array().length(2).every.number().test(n)&&Ti().schema({min:n3,max:n3}).test(e),Ev=n=>({min:n[0],max:n[1]}),r3=(n,{bounds:[e,t]},r)=>{const i=Array.isArray(n)?Ev(n):n,s={min:r[0],max:r[1]},{min:o,max:a}=Mt(Mt({},s),i);return[al(Number(o),e,Math.max(e,a)),al(Number(a),Math.min(t,o),t)]};var rK=Object.freeze({__proto__:null,schema:nK,format:Ev,sanitize:r3,normalize:({value:n,min:e,max:t})=>{const r={min:e,max:t},i=qD(Ev(n),{min:r,max:r}),s=[e,t],o=Mt(Mt({},i),{},{bounds:s});return{value:r3(Ev(n),o,n),settings:o}}});const iK=["value","bounds","onDrag"],sK=["bounds"],oK=St("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function aK(n){let{value:e,bounds:[t,r],onDrag:i}=n,s=En(n,iK);const o=D.useRef(null),a=D.useRef(null),l=D.useRef(null),c=D.useRef(0),u=ra("sizes","scrubberWidth"),d=yp(({event:v,first:x,xy:[y],movement:[g],memo:_={}})=>{if(x){const{width:A,left:M}=o.current.getBoundingClientRect();c.current=A-parseFloat(u);const T=(v==null?void 0:v.target)===a.current||(v==null?void 0:v.target)===l.current;_.pos=dv((y-M)/A,t,r);const R=Math.abs(_.pos-e.min)-Math.abs(_.pos-e.max);_.key=R<0||R===0&&_.pos<=e.min?"min":"max",T&&(_.pos=e[_.key])}const E=_.pos+dv(g/c.current,0,r-t);return i({[_.key]:ej(E,s[_.key])}),_}),p=`calc(${fv(e.min,t,r)} * (100% - ${u} - 8px) + 4px)`,m=`calc(${1-fv(e.max,t,r)} * (100% - ${u} - 8px) + 4px)`;return ie.createElement(KD,Qn({ref:o},d()),ie.createElement(YD,null,ie.createElement(ZD,{style:{left:p,right:m}})),ie.createElement(mA,{position:"left",ref:a,style:{left:p}}),ie.createElement(mA,{position:"right",ref:l,style:{right:m}}))}function lK(){const{label:n,displayValue:e,onUpdate:t,settings:r}=Xr(),i=En(r,sK);return ie.createElement(ie.Fragment,null,ie.createElement(ys,{input:!0},ie.createElement(Ys,null,n),ie.createElement(oK,null,ie.createElement(aK,Qn({value:e},r,{onDrag:t})),ie.createElement(vA,{value:e,settings:i,onUpdate:t,innerLabelTrim:0}))))}var cK=Mt({component:lK},rK);const uK=()=>{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)}}},fK=["type","value"],dK=["onChange","transient","onEditStart","onEditEnd"],hK=function(){const e=P0(b6(()=>({data:{}}))),t=uK();this.storeId=uX(),this.useStore=e;const r={},i=new Set;this.getVisiblePaths=()=>{const o=this.getData(),a=Object.keys(o),l=[];Object.entries(r).forEach(([u,d])=>{d.render&&a.some(p=>p.indexOf(u)===0)&&!d.render(this.get)&&l.push(u+".")});const c=[];return i.forEach(u=>{u in o&&o[u].__refCount>0&&l.every(d=>u.indexOf(d)===-1)&&(!o[u].render||o[u].render(this.get))&&c.push(u)}),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 u=l[c];u.__refCount--,u.__refCount===0&&u.type in vs&&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(([u,d])=>{let p=c[u];if(p){const{type:m,value:v}=d,x=En(d,fK);m!==p.type?ta(Wn.INPUT_TYPE_OVERRIDE,m):((p.__refCount===0||a)&&Object.assign(p,x),p.__refCount++)}else c[u]=Mt(Mt({},d),{},{__refCount:1})}),{data:c}})},this.setValueAtPath=(o,a,l)=>{e.setState(c=>{const u=c.data;return RD(u[o],a,o,this,l),{data:u}})},this.setSettingsAtPath=(o,a)=>{e.setState(l=>{const c=l.data;return c[o].settings=Mt(Mt({},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(([u,d])=>{try{RD(c[u],d,void 0,void 0,a)}catch{}}),{data:c}})},this.getInput=o=>{try{return this.getData()[o]}catch{ta(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,Mt(Mt({},this.getInput(o)),{},{get:this.get}))},this.emitOnEditEnd=o=>{t.emit(`onEditEnd:${o}`,this.get(o),o,Mt(Mt({},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(([u,d])=>{if(u==="")return ta(Wn.EMPTY_KEY);let p=GA(a,u);if(d.type===vs.FOLDER){const m=s(d.schema,p,l);Object.assign(c,m),p in r||(r[p]=d.settings)}else if(u in l)ta(Wn.DUPLICATE_KEYS,u,p,l[u].path);else{const m=yX(d,u,p,c);if(m){const{type:v,options:x,input:y}=m,{onChange:g,transient:_,onEditStart:E,onEditEnd:A}=x,M=En(x,dK);c[p]=Mt(Mt(Mt({type:v},M),y),{},{fromPanel:!0}),l[u]={path:p,onChange:g,transient:_,onEditStart:E,onEditEnd:A}}else ta(Wn.UNKNOWN_INPUT,p,d)}}),c};this.getDataFromSchema=o=>{const a={};return[s(o,"",a),a]}},i3=new hK,pK={collapsed:!1};function mK(n,e){return{type:vs.FOLDER,schema:n,settings:Mt(Mt({},pK),e)}}const gK={disabled:!1};function Ff(n,e){return{type:vs.BUTTON,onClick:n,settings:Mt(Mt({},gK),e)}}const s3=n=>"__levaInput"in n,vK=(n,e)=>{const t={},r=e?e.toLowerCase():null;return n.forEach(i=>{const[s,o]=SY(i);(!r||s.toLowerCase().indexOf(r)>-1)&&EY(t,o,{[s]:{__levaInput:!0,path:i}})}),t},yK=["type","label","path","valueKey","value","settings","setValue","disabled"];function _K(n){let{type:e,label:t,path:r,valueKey:i,value:s,settings:o,setValue:a,disabled:l}=n,c=En(n,yK);const{displayValue:u,onChange:d,onUpdate:p}=jD({type:e,value:s,settings:o,setValue:a}),m=Ec[e].component;return m?ie.createElement(FD.Provider,{value:Mt({key:i,path:r,id:""+r,label:t,displayValue:u,value:s,onChange:d,onUpdate:p,settings:o,setValue:a,disabled:l},c)},ie.createElement(kX,{disabled:l},ie.createElement(m,null))):(ta(Wn.NO_COMPONENT_FOR_TYPE,e,r),null)}const xK=St("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 EK({onClick:n,settings:e,label:t}){const r=gp();return ie.createElement(ys,null,ie.createElement(xK,{disabled:e.disabled,onClick:()=>n(r.get)},t))}const SK=St("div",{$flex:"",justifyContent:"flex-end",gap:"$colGap"}),AK=St("button",{$reset:"",cursor:"pointer",borderRadius:"$xs","&:hover":{backgroundColor:"$elevation3"}}),wK=({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 MK(n){const{label:e,opts:t}=wK(n),r=gp();return ie.createElement(ys,{input:!!e},e&&ie.createElement(Ys,null,e),ie.createElement(SK,null,Object.entries(t).map(([i,s])=>ie.createElement(AK,{key:i,onClick:()=>s(r.get)},i))))}const TK=St("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),o3=100;function CK(n,e){n.push(e),n.length>o3&&n.shift()}const bK=D.forwardRef(function({initialValue:n},e){const t=ra("colors","highlight3"),r=ra("colors","elevation2"),i=ra("colors","highlight1"),[s,o]=D.useMemo(()=>[ci(i).alpha(.4).toRgbString(),ci(i).alpha(.1).toRgbString()],[i]),a=D.useRef([n]),l=D.useRef(n),c=D.useRef(n),u=D.useRef(),d=D.useCallback((v,x)=>{if(!v)return;const{width:y,height:g}=v,_=new Path2D,E=y/o3,A=g*.05;for(let R=0;R({frame:v=>{(l.current===void 0||vc.current)&&(c.current=v),CK(a.current,v),u.current=requestAnimationFrame(()=>d(p.current,m.current))}}),[p,m,d]),D.useEffect(()=>()=>cancelAnimationFrame(u.current),[]),ie.createElement(TK,{ref:p})}),a3=n=>Number.isFinite(n)?n.toPrecision(2):n.toString(),RK=D.forwardRef(function({initialValue:n},e){const[t,r]=D.useState(a3(n));return D.useImperativeHandle(e,()=>({frame:i=>r(a3(i))}),[]),ie.createElement("div",null,t)});function l3(n){return typeof n=="function"?n():n.current}function PK({label:n,objectOrFn:e,settings:t}){const r=D.useRef(),i=D.useRef(l3(e));return D.useEffect(()=>{const s=window.setInterval(()=>{var o;document.hidden||(o=r.current)===null||o===void 0||o.frame(l3(e))},t.interval);return()=>window.clearInterval(s)},[e,t.interval]),ie.createElement(ys,{input:!0},ie.createElement(Ys,{align:"top"},n),t.graph?ie.createElement(bK,{ref:r,initialValue:i.current}):ie.createElement(RK,{ref:r,initialValue:i.current}))}const BK=["type","label","key"],IK={[vs.BUTTON]:EK,[vs.BUTTON_GROUP]:MK,[vs.MONITOR]:PK},DK=ie.memo(({path:n})=>{const[e,{set:t,setSettings:r,disable:i,storeId:s,emitOnEditStart:o,emitOnEditEnd:a}]=YX(n);if(!e)return null;const{type:l,label:c,key:u}=e,d=En(e,BK);if(l in vs){const p=IK[l];return ie.createElement(p,Qn({label:c,path:n},d))}return l in Ec?ie.createElement(_K,Qn({key:s+n,type:l,label:c,storeId:s,path:n,valueKey:u,setValue:t,setSettings:r,disable:i,emitOnEditStart:o,emitOnEditEnd:a},d)):(nX(Wn.UNSUPPORTED_INPUT,l,n),null)});function LK({toggle:n,toggled:e,name:t}){return ie.createElement(OX,{onClick:()=>n()},ie.createElement(hA,{toggled:e}),ie.createElement("div",null,t))}const OK=({name:n,path:e,tree:t})=>{const r=gp(),i=GA(e,n),{collapsed:s,color:o}=r.getFolderSettings(i),[a,l]=D.useState(!s),c=D.useRef(null),u=ra("colors","folderWidgetColor"),d=ra("colors","folderTextColor");return D.useLayoutEffect(()=>{c.current.style.setProperty("--leva-colors-folderWidgetColor",o||u),c.current.style.setProperty("--leva-colors-folderTextColor",o||d)},[o,u,d]),ie.createElement(pv,{ref:c},ie.createElement(LK,{name:n,toggled:a,toggle:()=>l(p=>!p)}),ie.createElement(c3,{parent:i,tree:t,toggled:a}))},c3=ie.memo(({isRoot:n=!1,fill:e=!1,flat:t=!1,parent:r,tree:i,toggled:s})=>{const{wrapperRef:o,contentRef:a}=MY(s),l=gp(),c=([d,p])=>{var m;return(s3(p)?(m=l.getInput(p.path))===null||m===void 0?void 0:m.order:l.getFolderSettings(GA(r,d)).order)||0},u=Object.entries(i).sort((d,p)=>c(d)-c(p));return ie.createElement(uA,{ref:o,isRoot:n,fill:e,flat:t},ie.createElement(VD,{ref:a,isRoot:n,toggled:s},u.map(([d,p])=>s3(p)?ie.createElement(DK,{key:p.path,valueKey:p.valueKey,path:p.path}):ie.createElement(OK,{key:d,name:d,path:r,tree:p}))))}),UK=St("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:{[`${$D}`]:{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"}}),u3=40,Sv=St("i",{$flexCenter:"",width:u3,userSelect:"none",cursor:"pointer","> svg":{fill:"$highlight1",transition:"transform 350ms ease, fill 250ms ease"},"&:hover > svg":{fill:"$highlight3"},variants:{active:{true:{"> svg":{fill:"$highlight2"}}}}}),FK=St("div",{display:"flex",alignItems:"stretch",justifyContent:"space-between",height:"$titleBarHeight",variants:{mode:{drag:{cursor:"grab"}}}}),kK=St("div",{$flex:"",position:"relative",width:"100%",overflow:"hidden",transition:"height 250ms ease",color:"$highlight3",paddingLeft:"$md",[`> ${Sv}`]:{height:30},variants:{toggled:{true:{height:30},false:{height:0}}}}),NK=St("input",{$reset:"",flex:1,position:"relative",height:30,width:"100%",backgroundColor:"transparent",fontSize:"10px",borderRadius:"$root","&:focus":{},"&::placeholder":{color:"$highlight2"}}),zK=St("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:u3}}}}),GK=ie.forwardRef(({setFilter:n,toggle:e},t)=>{const[r,i]=D.useState(""),s=D.useMemo(()=>BD(n,250),[n]),o=()=>{n(""),i("")},a=l=>{const c=l.currentTarget.value;e(!0),i(c)};return D.useEffect(()=>{s(r)},[r,s]),ie.createElement(ie.Fragment,null,ie.createElement(NK,{ref:t,value:r,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:l=>l.stopPropagation(),onChange:a}),ie.createElement(Sv,{onClick:()=>o(),style:{visibility:r?"visible":"hidden"}},ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"14",width:"14",viewBox:"0 0 20 20",fill:"currentColor"},ie.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 HK({setFilter:n,onDrag:e,onDragStart:t,onDragEnd:r,toggle:i,toggled:s,title:o,drag:a,filterEnabled:l,from:c}){const[u,d]=D.useState(!1),p=D.useRef(null);D.useEffect(()=>{var v,x;u?(v=p.current)===null||v===void 0||v.focus():(x=p.current)===null||x===void 0||x.blur()},[u]);const m=yp(({offset:[v,x],first:y,last:g})=>{e({x:v,y:x}),y&&t({x:v,y:x}),g&&r({x:v,y:x})},{filterTaps:!0,from:({offset:[v,x]})=>[(c==null?void 0:c.x)||v,(c==null?void 0:c.y)||x]});return D.useEffect(()=>{const v=x=>{x.key==="L"&&x.shiftKey&&x.metaKey&&d(y=>!y)};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[]),ie.createElement(ie.Fragment,null,ie.createElement(FK,{mode:a?"drag":void 0},ie.createElement(Sv,{active:!s,onClick:()=>i()},ie.createElement(hA,{toggled:s,width:12,height:8})),ie.createElement(zK,Qn({},a?m():{},{drag:a,filterEnabled:l}),o===void 0&&a?ie.createElement("svg",{width:"20",height:"10",viewBox:"0 0 28 14",xmlns:"http://www.w3.org/2000/svg"},ie.createElement("circle",{cx:"2",cy:"2",r:"2"}),ie.createElement("circle",{cx:"14",cy:"2",r:"2"}),ie.createElement("circle",{cx:"26",cy:"2",r:"2"}),ie.createElement("circle",{cx:"2",cy:"12",r:"2"}),ie.createElement("circle",{cx:"14",cy:"12",r:"2"}),ie.createElement("circle",{cx:"26",cy:"12",r:"2"})):o),l&&ie.createElement(Sv,{active:u,onClick:()=>d(v=>!v)},ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20",viewBox:"0 0 20 20"},ie.createElement("path",{d:"M9 9a2 2 0 114 0 2 2 0 01-4 0z"}),ie.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"})))),ie.createElement(kK,{toggled:u},ie.createElement(GK,{ref:p,setFilter:n,toggle:i})))}const VK=["store","hidden","theme","collapsed"];function WK(n){let{store:e,hidden:t=!1,theme:r,collapsed:i=!1}=n,s=En(n,VK);const o=KL(()=>RX(r),[r]),[a,l]=D.useState(!i),c=typeof i=="object"?!i.collapsed:a,u=D.useMemo(()=>typeof i=="object"?d=>{typeof d=="function"?i.onChange(!d(!i.collapsed)):i.onChange(!d)}:l,[i]);return!e||t?null:ie.createElement(lA.Provider,{value:o},ie.createElement($K,Qn({store:e},s,{toggled:c,setToggle:u,rootClass:o.className})))}const $K=ie.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 u,d;const p=TY(n),[m,v]=D.useState(""),x=D.useMemo(()=>vK(p,m),[p,m]),[y,g]=JD(),_=i||p.length>0,E=typeof o=="object"&&o.title||void 0,A=typeof o=="object"&&(u=o.drag)!==null&&u!==void 0?u:!0,M=typeof o=="object"&&(d=o.filter)!==null&&d!==void 0?d:!0,T=typeof o=="object"&&o.position||void 0,R=typeof o=="object"&&o.onDrag||void 0,B=typeof o=="object"&&o.onDragStart||void 0,P=typeof o=="object"&&o.onDragEnd||void 0;return ie.useEffect(()=>{g({x:T==null?void 0:T.x,y:T==null?void 0:T.y})},[T,g]),bX(),ie.createElement(ND.Provider,{value:{hideCopyButton:a}},ie.createElement(UK,{ref:y,className:e,fill:t,flat:r,oneLineLabels:s,hideTitleBar:!o,style:{display:_?"block":"none"}},o&&ie.createElement(HK,{onDrag:I=>{g(I),R==null||R(I)},onDragStart:I=>B==null?void 0:B(I),onDragEnd:I=>P==null?void 0:P(I),setFilter:v,toggle:I=>c(F=>I??!F),toggled:l,title:E,drag:A,filterEnabled:M,from:T}),_&&ie.createElement(kD.Provider,{value:n},ie.createElement(c3,{isRoot:!0,fill:t,flat:r,tree:x,toggled:l}))))}),XK=["isRoot"];let Av=!1,Sc=null;function f3(n){let{isRoot:e=!1}=n,t=En(n,XK);return D.useEffect(()=>(Av=!0,!e&&Sc&&(Sc.remove(),Sc=null),()=>{e||(Av=!1)}),[e]),ie.createElement(WK,Qn({store:i3},t))}function jK(n){D.useEffect(()=>{n&&!Av&&(Sc||(Sc=document.getElementById("leva__root")||Object.assign(document.createElement("div"),{id:"leva__root"}),document.body&&(document.body.appendChild(Sc),xX(ie.createElement(f3,{isRoot:!0}),Sc))),Av=!0)},[n])}function JK(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 d3(n,e,t,r,i){const{folderName:s,schema:o,folderSettings:a,hookSettings:l,deps:c}=JK(n,e,t,r,i),u=typeof o=="function",d=D.useRef(!1),p=D.useRef(!0),m=KL(()=>{d.current=!0;const F=typeof o=="function"?o():o;return s?{[s]:mK(F,a)}:F},c),v=!(l!=null&&l.store);jK(v);const[x]=D.useState(()=>(l==null?void 0:l.store)||i3),[y,g]=D.useMemo(()=>x.getDataFromSchema(m),[x,m]),[_,E,A,M,T]=D.useMemo(()=>{const F=[],N=[],H={},V={},Y={};return Object.values(g).forEach(({path:K,onChange:ee,onEditStart:G,onEditEnd:W,transient:J})=>{F.push(K),ee?(H[K]=ee,J||N.push(K)):N.push(K),G&&(V[K]=G),W&&(Y[K]=W)}),[F,N,H,V,Y]},[g]),R=D.useMemo(()=>x.orderPaths(_),[_,x]),B=CY(x,E,y),P=D.useCallback(F=>{const N=Object.entries(F).reduce((H,[V,Y])=>Object.assign(H,{[g[V].path]:Y}),{});x.set(N,!1)},[x,g]),I=D.useCallback(F=>x.get(g[F].path),[x,g]);return D.useEffect(()=>{const F=!p.current&&d.current;return x.addData(y,F),p.current=!1,d.current=!1,()=>x.disposePaths(R)},[x,R,y]),D.useEffect(()=>{const F=[];return Object.entries(A).forEach(([N,H])=>{H(x.get(N),N,Mt({initial:!0,get:x.get},x.getInput(N)));const V=x.useStore.subscribe(Y=>{const K=Y.data[N];return[K.disabled?void 0:K.value,K]},([Y,K])=>H(Y,N,Mt({initial:!1,get:x.get},K)),{equalityFn:Yh});F.push(V)}),()=>F.forEach(N=>N())},[x,A]),D.useEffect(()=>{const F=[];return Object.entries(M).forEach(([N,H])=>F.push(x.subscribeToEditStart(N,H))),Object.entries(T).forEach(([N,H])=>F.push(x.subscribeToEditEnd(N,H))),()=>F.forEach(N=>N())},[M,T,x]),u?[B,P,I]:B}na(Js.SELECT,lj),na(Js.IMAGE,tK),na(Js.NUMBER,nj),na(Js.COLOR,UY),na(Js.STRING,pj),na(Js.BOOLEAN,_j),na(Js.INTERVAL,cK),na(Js.VECTOR3D,kY),na(Js.VECTOR2D,XY);const YK="http://localhost:3000",h3=D.createContext(),KK=({children:n})=>{const e=async d=>{a(!0);const m=(await(await fetch(`${YK}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:d})})).json()).messages;r(v=>[...v,...m]),a(!1)},[t,r]=D.useState([]),[i,s]=D.useState(),[o,a]=D.useState(!1),[l,c]=D.useState(!0),u=()=>{r(d=>d.slice(1))};return D.useEffect(()=>{t.length>0?s(t[0]):s(null)},[t]),Cn(h3.Provider,{value:{chat:e,message:i,onMessagePlayed:u,loading:o,cameraZoomed:l,setCameraZoomed:c},children:n})},wv=()=>{const n=D.useContext(h3);if(!n)throw new Error("useChat must be used within a ChatProvider");return n},p3={},HA={A:"viseme_PP",B:"viseme_kk",C:"viseme_I",D:"viseme_AA",E:"viseme_O",F:"viseme_U",G:"viseme_FF",H:"viseme_TH",X:"viseme_PP"};function ZK(n){const e=D.useRef(!1),{nodes:t,materials:r,scene:i}=ep("/models/mona68471bad1761c643027ebb46.glb"),{message:s,onMessagePlayed:o,chat:a}=wv(),[l,c]=D.useState();D.useEffect(()=>{console.log("--- Huesos del Modelo ---"),t.Hips.traverse(K=>{K.isBone&&console.log(K.name)}),console.log("-----------------------")},[t.Hips]);const u=D.useRef(),{animations:d}=ep("/models/animations.glb"),{actions:p,mixer:m}=TV(d,u),[v,x]=D.useState("idle");D.useEffect(()=>{if(console.log("Animations loaded:",d),console.log("Actions available:",p),console.log("Mixer:",m),d&&d.length>0){const K=d.find(ee=>ee.name==="idle")?"idle":d[0].name;x(K)}},[d,p,m]),D.useEffect(()=>{if(p&&p[v])return p[v].reset().fadeIn(m.stats.actions.inUse===0?0:.5).play(),()=>{p[v]&&p[v].fadeOut(.5)}},[v,p,m]),D.useEffect(()=>{if(console.log(s),!s){x("idle");return}x(s.animation),B(s.facialExpression),c(s.lipsync);const K=new Audio("data:audio/mp3;base64,"+s.audio);K.play(),I(K),K.onended=o},[s]);const y=(K,ee,G=.1)=>{u.current&&u.current.traverse(W=>{if(W.isSkinnedMesh&&W.morphTargetDictionary){const J=W.morphTargetDictionary[K];if(J===void 0||W.morphTargetInfluences[J]===void 0)return;if(W.morphTargetInfluences[J]=Cg.lerp(W.morphTargetInfluences[J],ee,G),!e.current)try{Y({[K]:ee})}catch{}}})},[g,_]=D.useState(!1),[E,A]=D.useState(!1),[M,T]=D.useState(!1),[R,B]=D.useState(""),[P,I]=D.useState(),[F,N]=D.useState(null),[H,V]=D.useState(null);D.useEffect(()=>{const K=ee=>{const{viseme:G}=ee.detail;N(G),H&&clearTimeout(H);const W=setTimeout(()=>{N(null)},200);V(W)};return window.addEventListener("randomViseme",K),()=>{window.removeEventListener("randomViseme",K),H&&clearTimeout(H)}},[H]),D.useEffect(()=>{const K=ee=>{const{animationName:G}=ee.detail;p[G]?x(G):console.warn(`Animation "${G}" not found.`)};return window.addEventListener("playAnimation",K),()=>{window.removeEventListener("playAnimation",K)}},[p]),Hh(()=>{if(e.current)return;Object.keys(t.EyeLeft.morphTargetDictionary).forEach(ee=>{const G=p3[R];ee==="eyeBlinkLeft"||ee==="eyeBlinkRight"||(G&&G[ee]?y(ee,G[ee],.1):y(ee,0,.1))}),y("eyeBlinkLeft",g||E?1:0,.5),y("eyeBlinkRight",g||M?1:0,.5);const K=[];if(s&&l){const ee=P.currentTime;for(let G=0;G=W.start&&ee<=W.end){K.push(HA[W.value]),y(HA[W.value],1,.2);break}}}!s&&F&&(K.push(F),y(F,1,.3)),Object.values(HA).forEach(ee=>{K.includes(ee)||y(ee,0,.1)})}),d3("FacialExpressions",{chat:Ff(()=>a()),winkLeft:Ff(()=>{A(!0),setTimeout(()=>A(!1),300)}),winkRight:Ff(()=>{T(!0),setTimeout(()=>T(!1),300)}),animation:{value:v,options:d.map(K=>K.name),onChange:K=>x(K)},facialExpression:{options:Object.keys(p3),onChange:K=>B(K)},enableSetupMode:Ff(()=>{e.current=!0}),disableSetupMode:Ff(()=>{e.current=!1}),logMorphTargetValues:Ff(()=>{const K={};Object.keys(t.EyeLeft.morphTargetDictionary).forEach(ee=>{if(ee==="eyeBlinkLeft"||ee==="eyeBlinkRight")return;const G=t.EyeLeft.morphTargetInfluences[t.EyeLeft.morphTargetDictionary[ee]];G>.01&&(K[ee]=G)}),console.log(JSON.stringify(K,null,2))})});const[,Y]=d3("MorphTarget",()=>Object.assign({},...Object.keys(t.EyeLeft.morphTargetDictionary).map(K=>({[K]:{label:K,value:0,min:t.EyeLeft.morphTargetInfluences[t.EyeLeft.morphTargetDictionary[K]],max:1,onChange:ee=>{e.current&&y(K,ee,1)}}}))));return D.useEffect(()=>{let K;const ee=()=>{K=setTimeout(()=>{_(!0),setTimeout(()=>{_(!1),ee()},200)},Cg.randInt(1e3,5e3))};return ee(),()=>clearTimeout(K)},[]),ug("group",{ref:u,...n,dispose:null,children:[Cn("primitive",{object:t.Hips}),Cn("skinnedMesh",{name:"EyeLeft",geometry:t.EyeLeft.geometry,material:r.Wolf3D_Eye,skeleton:t.EyeLeft.skeleton,morphTargetDictionary:t.EyeLeft.morphTargetDictionary,morphTargetInfluences:t.EyeLeft.morphTargetInfluences}),Cn("skinnedMesh",{name:"EyeRight",geometry:t.EyeRight.geometry,material:r.Wolf3D_Eye,skeleton:t.EyeRight.skeleton,morphTargetDictionary:t.EyeRight.morphTargetDictionary,morphTargetInfluences:t.EyeRight.morphTargetInfluences}),Cn("skinnedMesh",{name:"Wolf3D_Head",geometry:t.Wolf3D_Head.geometry,material:r.Wolf3D_Skin,skeleton:t.Wolf3D_Head.skeleton,morphTargetDictionary:t.Wolf3D_Head.morphTargetDictionary,morphTargetInfluences:t.Wolf3D_Head.morphTargetInfluences}),Cn("skinnedMesh",{name:"Wolf3D_Teeth",geometry:t.Wolf3D_Teeth.geometry,material:r.Wolf3D_Teeth,skeleton:t.Wolf3D_Teeth.skeleton,morphTargetDictionary:t.Wolf3D_Teeth.morphTargetDictionary,morphTargetInfluences:t.Wolf3D_Teeth.morphTargetInfluences}),Cn("skinnedMesh",{geometry:t["hair-60"].geometry,material:r.M_Hair_60,skeleton:t["hair-60"].skeleton}),Cn("skinnedMesh",{geometry:t.Wolf3D_Outfit_Top.geometry,material:r.Wolf3D_Outfit_Top,skeleton:t.Wolf3D_Outfit_Top.skeleton}),Cn("skinnedMesh",{geometry:t.Wolf3D_Outfit_Bottom.geometry,material:r.Wolf3D_Outfit_Bottom,skeleton:t.Wolf3D_Outfit_Bottom.skeleton}),Cn("skinnedMesh",{geometry:t.Wolf3D_Outfit_Footwear.geometry,material:r.Wolf3D_Outfit_Footwear,skeleton:t.Wolf3D_Outfit_Footwear.skeleton}),Cn("skinnedMesh",{geometry:t.Wolf3D_Body.geometry,material:r.Wolf3D_Body,skeleton:t.Wolf3D_Body.skeleton})]})}ep.preload("/models/mona68471bad1761c643027ebb46.glb");const QK=n=>{const{loading:e}=wv(),[t,r]=D.useState("");return D.useEffect(()=>{if(e){const i=setInterval(()=>{r(s=>s.length>2?".":s+".")},800);return()=>clearInterval(i)}else r("")},[e]),e?Cn("group",{...n,children:ug(xV,{fontSize:.14,anchorX:"left",anchorY:"bottom",children:[t,Cn("meshBasicMaterial",{attach:"material",color:"white"})]})}):null},qK=()=>{const n=D.useRef(),{cameraZoomed:e}=wv();return D.useEffect(()=>{n.current.setLookAt(0,2,5,0,1.5,0)},[]),D.useEffect(()=>{e?n.current.setLookAt(0,1.5,1.5,0,1.5,0,!0):n.current.setLookAt(0,2.2,5,0,1,0,!0)},[e]),ug(R1,{children:[Cn(MV,{ref:n}),Cn(IV,{preset:"sunset"}),Cn(D.Suspense,{children:Cn(QK,{"position-y":1.75,"position-x":-.02})}),Cn(ZK,{}),Cn(DV,{opacity:.7})]})},eZ=({hidden:n,...e})=>{D.useRef();const{chat:t,loading:r,cameraZoomed:i,setCameraZoomed:s,message:o}=wv(),[a,l]=D.useState(!1),c=()=>{l(!0)},u=()=>{l(!1)};return D.useEffect(()=>{if(!a)return;const d=["viseme_PP","viseme_kk","viseme_I","viseme_AA","viseme_O","viseme_U","viseme_FF","viseme_TH"];let p;const m=()=>{if(!a)return;const v=d[Math.floor(Math.random()*d.length)],x=new CustomEvent("randomViseme",{detail:{viseme:v}});window.dispatchEvent(x);const y=Math.random()*280+70;p=setTimeout(m,y)};return m(),()=>{p&&clearTimeout(p)}},[a]),D.useEffect(()=>()=>{l(!1)},[]),D.useEffect(()=>{const d=y=>{var g;(g=y.detail)!=null&&g.message&&!r&&!o&&t(y.detail.message)},p=()=>{s(!i)},m=()=>{c()},v=()=>{u()},x=()=>{const y=document.querySelector("body");y.classList.contains("greenScreen")?y.classList.remove("greenScreen"):y.classList.add("greenScreen")};return window.addEventListener("sendMessage",d),window.addEventListener("toggleCamera",p),window.addEventListener("startRandomVisemes",m),window.addEventListener("stopRandomVisemes",v),window.addEventListener("toggleGreenScreen",x),()=>{window.removeEventListener("sendMessage",d),window.removeEventListener("toggleCamera",p),window.removeEventListener("startRandomVisemes",m),window.removeEventListener("stopRandomVisemes",v),window.removeEventListener("toggleGreenScreen",x)}},[t,r,o,i,s]),n?null:Cn(R1,{children:Cn("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-10 flex justify-between p-4 flex-col pointer-events-none"})})};function tZ(){return ug(R1,{children:[Cn(C6,{}),Cn(f3,{hidden:!0}),Cn(eZ,{}),Cn(w6,{shadows:!0,camera:{position:[0,0,1],fov:30},children:Cn(qK,{})})]})}const NQ="";class Mv extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.root=null}connectedCallback(){const e=document.createElement("div");e.style.width="100%",e.style.height="100%",e.style.position="relative",e.id="react-root";const t=document.createElement("style");t.textContent=` :host { display: block; width: 100%; height: 100%; position: relative; contain: layout style paint; } /* Import Tailwind CSS */ @import url('https://cdn.tailwindcss.com'); /* Custom styles for the component */ #react-root { width: 100%; height: 100%; position: relative; overflow: hidden; } /* Ensure canvas and 3D content renders properly */ canvas { display: block; width: 100% !important; height: 100% !important; } /* Green screen styles */ .greenScreen { background: #00ff00 !important; } `,this.shadowRoot.appendChild(t),this.shadowRoot.appendChild(e),this.root=xy.createRoot(e),this.root.render(ie.createElement(ie.StrictMode,null,ie.createElement(KK,null,ie.createElement(tZ,{...this.getAttributesAsProps()})))),this.exposePublicMethods()}disconnectedCallback(){this.root&&this.root.unmount()}getAttributesAsProps(){const e={};for(let t of this.attributes)e[t.name]=t.value;return e}exposePublicMethods(){this.sendMessage=e=>{const t=new CustomEvent("sendMessage",{detail:{message:e},bubbles:!0,composed:!0});this.dispatchEvent(t)},this.toggleCamera=()=>{const e=new CustomEvent("toggleCamera",{bubbles:!0,composed:!0});this.dispatchEvent(e)},this.startRandomVisemes=()=>{const e=new CustomEvent("startRandomVisemes",{bubbles:!0,composed:!0});this.dispatchEvent(e)},this.stopRandomVisemes=()=>{const e=new CustomEvent("stopRandomVisemes",{bubbles:!0,composed:!0});this.dispatchEvent(e)},this.playAnimation=e=>{const t=new CustomEvent("playAnimation",{detail:{animationName:e},bubbles:!0,composed:!0});this.dispatchEvent(t)},this.toggleGreenScreen=()=>{const e=new CustomEvent("toggleGreenScreen",{bubbles:!0,composed:!0});this.dispatchEvent(e)}}static register(e="wvx-virtual-avatar"){customElements.get(e)||customElements.define(e,Mv)}}Mv.register("wvx-virtual-avatar"),typeof window<"u"&&console.log("WXV Avatar Web Component loaded and registered as "),Uc.WvxVirtualAvatarWebComponent=Mv,Object.defineProperty(Uc,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=wvx-virtual-avatar-webcomponent.umd.cjs.map